UNIX Linux Commands
UNIX Linux Commands
Appendix D
UNIX/Linux Commands
UNIX will be used to mean both UNIX and Linux, since they are very
similar. In essence, Linux is another flavor of UNIX, similar to Solaris,
AIX, and others. A great benefit of Linux is that it is open-source (the
source code is open for all to see). A UNIX system command reference
will be provided since it has been widely used for decades and its
use is increasing globally.
When working on a UNIX system, you could encounter either a
GUI interface (pictures/icons/words to point and click on) or a command line (various UNIX commands must be typed to work with the
system not a point-and-click operation). Working at the command
line will be presented since the GUI is much easier to use and more
intuitive. Many skilled UNIX personnel do not have a GUI interface
on their machine because they much prefer to type commands at the
command line (more powerful and versatile and more difficult).
At the command line, there are various prompts that you could
encounter, depending on how the owner has configured the system.
The prompts you see are indicative of the type of shell (environment)
the system owner is using. The shell allows the user to use a few
commands/configurations that are peculiar to that shell. Although there
are others, the most common prompts/shells you will come across are:
Korn Shell Prompt
Bourne Shell Prompt
C Shell Prompt
$
$
%
Although there are many UNIX commands, I will cover those that are
most useful to an investigator and make extensive use of examples to
show how a command is most commonly used.
FTP commands:
? command
close, disconnect, bye, quit
UNIX commands such as cd, ls, etc.
delete filename
get file1 [file2]
help
help command
lcd /usr/cell_one/log (changes to local machine directory)
mdelete filename(s).
mget filename(S)
mkdir directory
mput filename(s)
put file1 [file2]
pwd
rmdir directory
rcv file1 [file2] (retrieve from remote).
remotehelp command
rename file1 file2
send file1 [file2]
date
sort infile
who
who am I
clear
echo whatever
I type
banner big
words
cat file1 file2
file3
df system
head file
tail file
Explanation
Example
End Result
date
sort names
who
who am i
clear
echo hey you!
banner hey!
cat cheese milk
df ~
df $HOME
head addresses
head -25
addresses
tail test.txt
tail -32 test.txt
UNIX
Command
more input
ls (-optionoptional)
Explanation
Example
End Result
more groceries
ls
ls bin
ls -l or ll
ls -a
ls -l
ll
ls -l work
ll work
ls -a
ls -a temp
UNIX
Command
ls -r
ls -r abc
ls -t
ls -t
ls -t work
ls -al
ls -l | more
ls -l > myfiles
ls -l >> allfiles
xclock &
ls -r
Explanation
Example
End Result
echo ~
Wildcards
Explanation
Example
End Result
ls * .c
ls file?
[]
ls v[6-9]file
Explanation
Example
End Result
cd bin
cd ..
cd ../..
~
<
UNIX
Command
cd directory
Important
Characters
cd ~
cd
mkdir dirname
rm file1 file2
file3
Creates a directory
mkdir junk
mkdir ~/left
rm -i file1 file2
rm -f file1 file2
rm -r directory
rm -R directory
rmdir directory
rm -fR name
rm -Rf name
*dangerous*
rm xyz
rm xyz abc
rm *
rm -i *
rm -f program
rm -r bin
rm -R bin
rmdir bin
rm -Rf c_ya
cd -
rm -Ri directory
Explanation
Example
End Result
rm -Ri rusure
rmdir -p /
home/bin/dir1
cp file1
newname
cp old new
UNIX
Command
cp -p execut1
execut2
cp -R directory
target
cp -f name
target
mv initial final
cp -R old/ junk/
pwd
pr (option)
filename
pr +k filename
none
mv temp
script_1
mv script.exe ~/
bin
mv script_1
script.exe ~/
bin
pwd
pr userlist
pr +5 userlist
cp -p name
target
Explanation
Example
End Result
pr -k filename
Prints in k columns
pr -2 userlist
pr -a filename
lpconfig -d
queue
lpstat (options)
lpstat -uuser1,
user2
lpstat s
pr -3a userlist1
pr -d userlist
pr -h users
userlist
lpconfig prntr1
bobprt
lpconfig -r
bobprt
lpconfig -d
vpprnt
lpstat
lpstat -ubob
none
UNIX
Command
lpstat -t
lpstat -d
lpstat -r
lp (-option)
file(s)
lp -ddest file(s)
lp -nnumber
file(s)
lp -ttitle file(s)
lp -ooption
file(s)
Concise Explanations
Examples
End Result
none
none
None
None
none
None
lp junkfile
lp -dbobsq
zoom
lp -n5 crash
lp -tBobs cash
lp -od output
lp -obold
output
lp -ohalf output
lp -oquarter
output
Unix
Commands
Concise Explanations
UNIX
Command
Examples
End Result
lp -olandscape
output
lp -oportrait
output
cancel 5438
cancel -a
bobsprt
Explanation
Example
End Result
cancel -u
login_id
ps
cancel -u bob
ps
ps -e
ps -e
Unix
Commands
ps -f
ps -u user_id
ps -u bob
ps -ef
kill process_id
kill -9
process_id
grep string file
kill 6969
kill -9 6969
grep -c string
file
grep -c hayes
bankletter
grep -i string
file
grep -i hi file1
ps -ef
ps -f
Explanation
Example
End Result
grep -n string
file
grep -n abc
alpha
grep -v string
file
grep -x string
file
grep -v lead
pencils
grep -x time
meetings
ps -ef | grep
bob
grep -i jan
b_days>mymo
nth
Command
Description
Example
Explanation
vuepad
filename
vi filename
none
None
none
None
none
none
None
None
emacs filename
compress
filename
UNIX
Command
none
None
none
None
Command
Description
Example
Explanation
eval `resize`
none
None
chexp
365 nr*
chexp #
filename
qstat
qstat -a
qstat -l
qstat -m
qstat -u bob
qstat -x
uncompress
filename
awk
Description
xterm
Example
Explanation
xterm
xterm -help
xterm -e
myprog.exe
xterm -sb
Command
xterm -geom
80x80+0+50
xterm -geom
10x35+300+5
00
xterm -geom
5x5+0+0
xterm -title
label
xterm -title
SCRIPTS
xterm -(areas)
color
xterm -geom
xxy+px+py
Description
xterm -iconic
Example
Explanation
xterm -bd
huntergreen
xterm -fg red
xterm -fn
courr18
xterm -iconic title xyz
Command
Description
alias dir ls
alias
unalias dir
alias h history
Command
Description
df
du
grep -i ^ftp /etc/inetd.conf
find / -name *s -print
Command
Description
ftp
Command