You are on page 1of 8

Viewing the contents of a file

Show all characters. Include control characters and


non-printing
Squeeze multiple adjacent blank lines into a
single blank line
Number lines of output


Cat
e.g cat /etc/host

cat A

cat n

cat -s

cat > /tmp/student/resolutions.txt
hjbh CTRL-D
Command that when not given a filename as an
argument will count the number of lines, words,
and characters that a user types in from the
keyboard. Use CTRL-D to end of transmission

wc

Used to update timestamps on specified files.
Create empty file

Touch


echo blondiw prince > physics.txt


Redirect the standard out stream to other
locations.


> to redirect standard out into a file

e.g ls /etc/sysconfig/rhn >lsout.txt
ls lsout.txt, cat lsout.txt
list the contents of the /etc/sysconfig/rhn direc
tory, but redirect the output into a newly created
file.

Determine who is on the system and how they
logged on


Who


1. List the contents of a directory


2. List the content as well as the size of the
contents

3. Gives a long listing, including all kinds of
details about the files, like ownership,
permission and modify times.

4. Wide

5. Reverses the sorting order. Used along with

1. Ls
e.g ls /etc/sysconfig/rhn

2. ls s


3. ls -l



4. ls w

5. ls -r
the -s and -w switches


6. Recursive




NB: -s, -l is a command line switches, use to modify
the behavior of the commands. Shot Command
Line Switches

Long Command Line Switches: Composed of words
and double hyphens instead of single letter and
hyphen. Eg --width=40


6. ls -R










list process run on a system
without commands will list all


Ps
Detailed list of all process that are currently
running on the system

Ps aux

1. Terminate the currently running /
foreground process
2. Send End of Transmission <End of File>
3. Sound an audible terminal bell
4. Backspace- erase the previous character
5. Line feed- alternative for the RETURN key
6. Form feed-causes bash to clear screen and
other screen based programs to refresh
the current screen
7. Thaw <causing it to become active again>
the terminal display (after been frozen
with CTRL-S)
8. Freeze the terminal display (thaw with
CTRL-Q)
9. Erase the current line. Helpful when mess
up while entering password
10. Suspend the foreground process.
Suspend a program, which can later be
restored with the fg (foreground)
command.

1. CTRL-C

2. CTRL-D
3. CTRL-G
4. CTRL-H
5. CTRL-J
6. CTRL-L


7. CTRL-Q : Activate


8. CTRL-S: Freeze

9. CTRL-U

10. CTRL-Z : suspend
fg: resumes

Resetting the terminal after viewing a
binary file which is supposed not to display
in terminal. E.g.image


reset
Info pages pinfo

man
man k <arg>
man -a
/usr/share/doc
The first word on any command is generally the name of
a program that lives as a file somewhere in the file
system. To know which file contains these programs,
which
Show the type of the file
file

more, less, head, tail
USER, GROUP & PERMISSONS


id [-g | -G | -u] [-n] [USERNAME]

groups
reports the current users username.
whoami
a simple list of who is currently logged in
users
Print detailed information about who is currently logged
in, or for the user USERNAME, if provided.
w [-h | -s | -f] [USERNAME]
Print summary information about the specied user,
including if they are logged in and if they have
checked their mail, or a list of all currently logged in
users if none are provided.
~/.planle, .project, .pgpkey
nger [-s | -l | -p] [USER ...] [USER@HOST ...]


finger blondie


Switch primary group
sg <group name>

newgrp <group name>


chmod

chgrp GROUP FILE

chown USER FILE
Users home directory does not follow the default
permissions for common directories (rwxrwxr-x),
instead rwx------. Because home directory are
protected
ls ld <dir name>





1. Why would users want to use a virtual console instead of GUI?
Not enough memory or hardware to support the graphical environment and the virtual
console might be all that are available
Virtual consoles are often a much quicker and more efficient interface for experienced users.
Useful in debugging systems since they are implemented by the linux kernel directly
For network servers that usually spend their lives in locked closets, administrators often
want to avoid the complexity that the graphical interface adds to the system.

2. The X server provide the graphics environment or the canvas for all of the graphical programs
that you run.
In summary, there are always two ways to refer to a file. File references relative to the root directory always
start with a leading /, and are called absolute references. File references relative to the current working
directory start with something other than a /, and are referred to as relative references

man pages
info pages--pinfo
/usr/share/doc directory
yelp: The Gnome Help Browser
Documentation selection from the System menu

Red Hat Documentation Guides www.redhat.com/docs/manuals
Linux Documentation Project www.tldp.org
Command Line Switch
Short Command Line Switch
Multiple Short Command Line Switch
Long Command Line Switches

Viewing content of a file cat (concatenates a file to the terminal output)
Trying--: cat /etc/sysconfig/network-scripts/ifcfg-eth0 > Ethernet config
File start with a dot are hidden file











Display the complete or absolute path to the
current working directory
pwd (Print Working Directory)
Change Directory
Current working directory
Parent Directory
Users home directory
Previous working directory
cd
.
..
~
-









Page40

You might also like