User Tools

Site Tools


products:ict:unix_linux_commands_list

CommandsListForAssignment

- another useful link: http://linux.about.com/od/commands/l/blcmdl_8a.htm

-for POSIX commands pl use the link below: http://www.one-serve.com/tools/unix_commands.html

A

a2p
ab
ac
access
adddefpriv
addpriv
addprivuser
addr2line
addresses
addwords
afm2tfm
aimk
ainfo
akill
allcm
allec
allneeded
amstex
analyze.pl
animate
ansi2knr
ar
arch
array
arshell
as
ascheck
asn1parse
at
atq
atrm
attr
aucat
audbin
augrep
aumix option>-][||R[ecord]|P[lay]|q[uery]] [-dhILq...
autoexpect
autofsd-probe

B

backend
bash
batch
bcfree
bibtex
bison
builtins - bash built-in commands, see bash(1)
busybox

C

c++filt
c2ph
ca
CA.pl
cal
cancel-cups
cannacheck
cannakill
cannaserver
cannastat
capinfos
captoinfo
catdic
cdda2wav
cdparanoia
cdrecord
cert2ldap
certfind
chacl
chage
chatr
chattr
checkpriv
chfn
chkhelp
chrt
chsh
chvt
ciphers
cjpeg
clear
clusterdb
clustervis
col
colcrt
colrm
column
combine_profile.pl
compile_et
composite
compress
conjure WARNING: Conjure and MSL are in very early development and the syntax is...
consoletype
cont-de
cont-en
cont-nl
convert
cpdic
cpio
cpp
cpuset
createdb
createlang
createuser
crl
crl2pkcs7
crontab
csacom
csh
cshost
ctow
curl
curl-config
cvs

D

dbiprof
dbiproxy
dbish
dbpmda
dc_client
dc_server
dc_snoop
dc_test
ddate
deallocvt
delwords
dgst
dhparam
dicar
diffpp
dig
diskstat
dislocate
display
djpeg
dkvis
dlook
dlpsh
dmp
doexec
dpbindic
dplace
dprofpp
dpromdic
dropdb
droplang
dropuser
dsa
dsaparam
dumpkeys
dvicopy
dvipdf
dvips
dvired
dvitype

E

ecpg
editcap
einitex
elatex
emacs
enc
enc2xs
enscript
eplain
eps2eps
escputil
esd
esd-config
esdcat
esdctl
esddsp
esdfilt
esdloop
esdmon
esdplay
esdrec
esdsample
esparchive
espconfig with the ESP database. The -sgmclient option specifies the client ali...
esplogger
esplognote
espnotify
espquery
espreport interacts with the ESP database
espsysid
etags
etex
ethereal
evanalyzer
eventView
evgraph
evhist
evim
evirtex
evmerge
evpp
ex
expect
expectk

F

fam
fax2ps
fax2tiff
fc-cache
fc-list
fgconsole
filter
find2perl
findsmb
finger
font2c
fontexport
fontimport
free

G

g77
gaim
gaim-remote
gamma4scanimage
gcc
gcj
gcjh
gcov
gdb
gdbserver
gdbtui
gdk-pixbuf-csource
gedit The gedit application is a simple text editor. You can use gedit to cr...
gendiff
gendsa
genhostid
genrsa
getent
getfacl
getfattr
getopt
gfdl Version 1.1, March 2000 Copyright (c) 2000 Free Software Foundation, Inc....
gftodvi
gftopk
gftype
gfxinfo
gfxtopology
ghostscript
gif2tiff
gij
gimp
gimp-1.2
gimp-remote
gimp-remote-1.2
gimpprint-config
gimptool
gimptool-1.2
gjar
gnome-panel
gnome-panel-preferences
gnuserv
gpasswd
gphoto2
gpilot-install-file
gpm-root
gprof
grep
grepjar
grmic
grmiregistry
gs
gs-pcl3
gsbj - Format and print text for DeskJet printer using ghostscript gsdj500 - ...
gsdj - Format and print text for DeskJet printer using ghostscript gsdj500 - ...
gsdj500 - Format and print text for DeskJet printer using ghostscript gsdj500 - ...
gsftopk
gslj - Format and print text for DeskJet printer using ghostscript gsdj500 - ...
gslp - Format and print text for DeskJet printer using ghostscript gsdj500 - ...
gsnd
gst-complete
gst-compprep
gst-feedback
gst-inspect
gst-launch
gst-launch-ext
gst-md5sum
gst-register
gst-visualise
gst-xmllaunch
gtk-config
gtopology
gvim
gvimdiff

H

h2ph
h2xs
hesinfo
hexdump file
hinotes
hinv
host
hostname - show the system
htdigest
htpasswd
hyperpipeinfo

I

iconv
identify
idl2eth
ietf2datebook
ijsgimpprint
ImageMagick
imlib-config
imlib_config
import
infocmp
infotocap
inimf
inimpost
iniomega
initdb
initex
initlocation
initlog
install-datebook
install-expenses time
install-hinote
install-memo
install-netsync
install-user
intro
iostat
ipcalc
ipcclean
irb
isamchk all tables on the command will be checked for errors
isamlog

J

ja
jcf-dump
jkill
jmacs
joe
jpegtran
jpico
jstar
jstat
jv-convert
jv-scan
jwait

K

kbd_mode
kernelversion
kibitz
kill
kpsestat
kpsewhich

L

lambda
lastcomm
latex
launchESPartner
lcrash
ld
ldapadd
ldapdelete
ldapmodify
ldapmodrdn
ldappasswd
ldapsearch
ldd
less
lesskey
libnetcfg
linkstat
listclients
lkcd_config
lkcd_ksyms
loaderinfo
loadkeys
locale
localedef
logger
login
logresolve
look
lp-cups
lpoptions
lppasswd
lpq-cups
lpr-cups
lprm-cups
lpstat-cups
lrelease
lsattr
lsb_release
lsdic
lupdate
lynx

M

mag
Magick++-config
Magick-config
mailq.sendmail
makeindex
makemap.pl
makempx
MakeTeXPK
man1/gpasswd
man1/hostname - mostra ou configura o nome do dom
man1/sg
mcookie
md2
md4
md5
mdc2
mergecap
mev
mf
mft
mikmod
mkaf
mkbindic
mkdic
mkpasswd
mkromdic
mktexlsr
mktexmf
mktexpk
mktextfm
moc
mogrify
montage
more
mozilla
MPI
mpimon
mpirun
mpivis
mpost
mpstat
mpto
mpvis
mtx
multixterm
mvdic
mysql
mysqlaccess
mysqladmin
mysqld
mysqldump
mysqld_multi
mysqlshow columns)
mysql_zap

N

namei
nasm
ndisasm
netreport
newaliases.sendmail
newer
newgrp
newhelp
nfsvis
nm
nmblookup
nodevis
nseq
nslookup
ntlm_auth
ntpd
ntpdate - Network Time Protocol (NTP) daemon page. After a suitable period of ...
ntpdc
ntpq
ntpstat
ntptime
ntptrace

O

objcopy
objdump
ocsp
oglsnoop
omega
omp
omprun
ompstartdmx
ompwrapwm
omshell
onsgmls
openjade
openssl
openvt
opmview
oprofile
op_visualise
osgmlnorm
ospam
ospent
osvis
osx
oview
oview4sn0
oview_layout

P

pal2rgb
parse
passmass
passwd
patgen
pcl3opts
pcp
PCPIntro
pcpintro
pcregrep
pcretest
pdf2dsc
pdf2ps
pdffonts
pdfimages
pdfinfo
pdfinitex
pdflatex
pdfopt
pdftex
pdftopbm
pdftops
pdftotext
pdfvirtex
pdl m- bers are the most effectual?" - Pliny the Elder
PDL::API
PDL::BadValues
PDL::Dataflow
PDL::Delta
PDL::FAQ
PDL::Impatient
PDL::Indexing
PDL::Internals
PDL::Objects
PDL::Philosophy
PDL::PP
PDL::PP-Inline
PDL::Tips
pdldoc
perfly
perl
perl5004delta
perl5005delta
perl561delta
perl56delta
perl570delta
perl571delta
perl572delta
perl573delta
perl58delta
perlaix
perlamiga
perlapi
perlapio
perlapollo
perlbeos
perlbook
perlboot
perlbot
perlbs2000
perlbug
perlcall
perlcc
perlce
perlclib
perlcn
perlcompile
perlcygwin
perldata
perldbmfilter
perldebguts
perldebtut
perldebug
perldelta
perldgux
perldiag
perldl
perldoc
perldos
perldsc
perlebcdic
perlembed
perlepoc
perlfaq
perlfaq1
perlfaq2
perlfaq3
perlfaq4
perlfaq5
perlfaq6
perlfaq7
perlfaq8
perlfaq9
perlfilter
perlfork
perlform
perlfreebsd
perlfunc
perlguts
perlhack
perlhist
perlhpux
perlhurd
perlintern
perlintro
perliol
perlipc
perlirix
perlivp
perljp Perl 5.8.0
perlko
perllexwarn
perllocale
perllol
perlmachten
perlmacos
perlmint
perlmod
perlmodinstall
perlmodlib
perlmodstyle
perlmpeix
perlnetware
perlnewmod
perlnumber
perlobj
perlop
perlopentut
perlos2
perlos390
perlos400
perlothrtut
perlpacktut
perlplan9
perlpod
perlpodspec
perlport
perlqnx
perlre
perlref
perlreftut
perlrequick
perlretut
perlrun
perlsec
perlsolaris
perlstyle
perlsub
perlsyn
perlthrtut
perltie
perltoc
perltodo
perltooc
perltoot
perltrap
perltru64
perltw
perlunicode
perluniintro
perlutil
perluts
perlvar
perlvmesa
perlvms
perlvos
perlwin32
perlxs
perlxstut
perror
pf2afm
pfb2pfa
pfbtopfa
pfconv
pfmon
pgrep
pgtclsh
pg_config
pg_controldata
pg_ctl
pg_dump
pg_dumpall
pg_resetxlog
pg_restore
pi-getram
pi-getrom
piconv
pilot-addresses dera, TRGPro, Sony or other Palm Compatible Handheld PDA device
pilot-xfer or other Palm Compatible Handheld PDA device
pk2bm
pkcs12
pkcs7
pkcs8
pktogf
pktype
pl2pm
play - record audio to any sound file format
pltotf
pmafm
pmap
pmcd
pmcd_wait
pmchart
pmclient
pmdacisco
pmdaespping
pmdamailq
pmdampi
pmdasample
pmdasendmail
pmdashping
pmdasimple
pmdasnia
pmdasummary
pmdate
pmdatrace
pmdatrivial
pmdatxmon
pmdaweblog
pmdbg
pmdumplog
pmdumptext
pmerr
pmgadgets
pmgcisco
pmgcluster
pmgenmap
pmgevctr
pmgirix
pmgshping
pmgsys
pmgxvm
pmhostname
pmie
pmieconf
pmie_check
pminfo
pmkstat
pmlc
pmlock
pmlogcheck
pmlogconf
pmlogextract
pmlogger
pmlogger_check
pmlogger_daily
pmlogger_merge
pmlogsummary
pmnewlog
pmnsadd
pmnscomp
pmnsdel
pmnsmerge
pmpost
pmprobe
pmshub
pmsnap
pmsocks
pmstat
pmstore
pmtime
pmtrace
pmval
pmview
pmview+
pod2html
pod2latex
pod2man
pod2text
pod2usage
podchecker
podselect
pooltype
postalias
postcat
postconf
postdrop
postfix
postgres
postkick
postlock
postlog
postmap
postmaster
postqueue
postsuper
ppm2tiff
pptemplate
printafm
probe
profile.pl
profiles
ps - report process status
ps2ascii
ps2epsi
ps2frag
ps2pdf - Convert PostScript to PDF 1.3 (Acrobat 4-and-later compati- ble) using...
ps2pdf12 - Convert PostScript to PDF 1.3 (Acrobat 4-and-later compati- ble) using...
ps2pdf13 - Convert PostScript to PDF 1.3 (Acrobat 4-and-later compati- ble) using...
ps2pdfwr
ps2pk
ps2ps
psed
psfaddtable
psfgettable
psfstriptable
psfxtable
psql
pstruct
PVM
pvm
pvmd
pvmd3
pvm_intro
pvm_shmd
python

Q

quota

R

radclient
radeapclient
radlast
radtest
radwho
radzap
ranlib
ras2tiff
rcp rcp [-px] [-r] file ... directory
rdist
rdjpgcom
read-ical
read-notepad newer devices). Alternately, if no options are given, each record
read-palmpix type is Portable Pixmap (.ppm)
readcd
readelf
readprofile
rec - record audio to any sound file format
rename
replace files or on the standard input. Uses a finite state machine to match lo...
req
reset
rev
rexec
rgb2ycbcr
ripemd160
rjoe
rlogin
rmdefpriv
rmdic
rmpriv
rmprivuser
routervis
rpcclient
rpcgen
rsa
rsautl
rsh
rsvg
rsync
ruby
runpriv
rup
rusers
rvi
rview
rvim

S

s2p
sa-learn
safe_mysqld
sane-config
sane-find-scanner
saned
sar
scanimage
scp [-i identity_file] [-l limit] [-o ssh_option] [[user@]host1:]file1 [...]...
script
scrollkeeper-config
scrollkeeper-gen-seriesid
scsitape
sendmail
sensors
sess_id
setfacl
setfattr
setleds
setmetamode
setmon
setterm
sftp [-B buffer_size] [-F ssh_config] [-P sftp_server path] [-R num_requests...
sgcmb
sgi2tiff
sgmlnorm
sh
sha
sha1
shar
showkey
shubstats
size
skill - report process status
slabtop
sliceprint
slogin ssh [-afgknqstvxACNTX1246] [-b bind_address] [-c cipher_spec] [-e escape...
smbcacls
smbclient
smbcontrol
smbcquotas
smbstatus
smbtar
smbtree
smime
snmpbulkget
snmpbulkwalk
snmpcmd
snmpdelta
snmpdf
snmpget
snmpgetnext
snmpnetstat
snmpset
snmpstatus
snmptable
snmptest
snmptranslate
snmptrap
snmpusm
snmpwalk
sox
soxexam
soxmix
spamassassin
spamc
spamd
speed
spkac
splain - standalone program to do the same thing
splitword
sprof
ssh ssh [-afgknqstvxACNTX1246] [-b bind_address] [-c cipher_spec] [-e escape...
ssh-add ssh-add -s reader ssh-add -e reader
ssh-agent ssh-agent [-c | -s] -k
ssh-keygen [-f output_keyfile] ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-...
ssh-keyscan [host | addrlist namelist] [...]
sslpasswd
sslrand
states
strace
strings
strip
sysadmd
s_client
s_server

T

tack
tangle
tapeinfo
taskset
tclsh - Simple shell containing Tcl interpreter
tcsh
telnet [-k realm] [-l user] [-n tracefile] [host [port]]
telnet-probe
testlibraw
testparm
testprns
tethereal
tex
texconfig
texhash
texi2html
text2pcap
tftopl
tftp
thumbnail
tic
tickadj
tie
tiff2bw
tiff2ps
tiff2rgba
tiffcmp
tiffcp
tiffdither
tiffdump
tiffgt
tiffinfo
tiffmedian
tiffsplit
tiffsv
time
tknewsbiff
tload
toe
top
topdisk
topology
topsys
tput
tset
txmonvis

U

ud
uic
ul
unbuffer
uncompress
unicode_start
unicode_stop
unshar
uptime
userinfo
usermount
userpasswd
usleep
uuencode - decode a file created by uuencode
uuidgen

V

vacuumdb
verify
version
vfstest
vftovp
vi
view
vim
vimdiff
vimtutor
virmf
virmpost
viromega
virtex
vizserver
vncconfig
vncpasswd
vncserver
vncviewer
vptovf
vsadmin
vscfg
vsmonitor
vsserver
vsx

W

watch
wbinfo
weave
weblogvis
webvis
wftopfa
whereis
wish - Simple windowing shell
wmxmms
write
wrjpgcom
wtoc

X

x0vncserver
x509
xaumix
xbowvis
xcftopnm
xdvi
xemacs
xkibitz
xlv_vis
xml2-config
xmlcatalog
xmllint
xmlwf
xmms
xpdf
xsltproc
xsubpp
xvcinfo
Xvnc
xxd

Y

ypcat
ypmatch
yppasswd
ypwhich

Z

zip

Total: 1056 entries

BasicCommands

This is a quick reference guide, mostly made of standard Unix commands . POSIX utilities, every Unix / Linux distribution has these.

POSIX stands for Portable Operating System Interface based on uniX).

For more information about each command, refer to a Unix manual or the man (stands for manual) command. Type man command at a consile/TelNet/SSH/xterm Client Software prompt etc… to get info about using the “man” or “info” command.

at : execute commands at a specified time/date.

awk : a scripting language, especially useful for manipulating text and automation.

bash : invokes the Bourne Again Shell (standard on most boxes).

batch : execute commands when load permits.

bc : interactive C-like calculator

  A calculator program that handles arbitrary precision (very large) numbers. It is useful for doing any kind of calculation on the command-line. Its use is left as an exercise.

Some books refer to is as an integer only calculator, but they are not aware of the scale fucntion

Use scale=5 for five decimal places.

cal : displays a calender, also lets you choose month/year using parameters.

Prints out a nicely formatted calender of the current month, a specified month, or a specified whole year. Check out cal 1752 then see the man page for Sep 1752

calender : invoke a reminder service.

cancel : cancel request to calender.

cat : concatenate files (displays a file without scrolling ability. Simply dumps it to the standard output. Can be useful when chaining multiple applications to do complicated jobs, so one application can use another's output as input). cat <filename> [<filename> …]

  Writes the contents of all the files listed to the screen. cat can join a lot of files together with cat <filename> <filename> ... > <newfile>. The file <newfile> will be an end-on-end concatenation of all the files specified.

cd : change the current working directory.

The cd command is used to take you to different directories. Create a directory new with mkdir new. You could create a directory one by doing cd new and then mkdir one, but there is a more direct way of doing this with mkdir new/one. You can then change directly to the one directory with cd new/one. And similarly you can get back to where you were with cd ../… In this way, the / is used to represent directories within directories. The directory one is called a subdirectory of new

Relative vs. Absolute Pathnames

Commands can be given file name arguments in two ways. If you are in the same directory as the file (i.e., the file is in the current directory), then you can just enter the file name on its own (e.g., cp my_file new_file). Otherwise, you can enter the full path name, like cp /home/jack/my_file /home/jack/new_file. Very often administrators use the notation ./my_file to be clear about the distinction, for instance, cp ./my_file ./new_file. The leading ./ makes it clear that both files are relative to the current directory. File names not starting with a / are called relative path names, and otherwise, absolute path names.

chgrp : change group ownership of a file.

chmod : change access patterns (permissions) to files.

chown : change user ownership of files.

clear : clear the screen. (Similar to CLS in DOS)

Erases all the text in the current terminal.

cmp : compare two files. See also diff.

cp : copy files.

  cp <file> <newfile>
  cp <file> [<file> ...] <dir> 

or

  cp file  newfile
  cp file  [file  ...]  dir 

The above lines are called a usage summary. The < and > signs mean that you don't actually type out these characters but replace <file> with a file name of your own. These are also sometimes written in italics like, cp file newfile. In rare cases they are written in capitals like, cp FILE NEWFILE. <file> and <dir> are called parameters. Sometimes they are obviously numeric, like a command that takes <ioport>. [Anyone emailing me to ask why typing in literal, <, i, o, p, o, r, t and > characters did not work will get a rude reply.] These are common conventions used to specify the usage of a command. The [ and ] brackets are also not actually typed but mean that the contents between them are optional. The ellipses … mean that <file> can be given repeatedly, and these also are never actually typed. From now on you will be expected to substitute your own parameters by interpreting the usage summary. You can see that the second of the above lines is actually just saying that one or more file names can be listed with a directory name last.

From the above usage summary it is obvious that there are two ways to use the cp command. If the last name is not a directory, then cp copies that file and renames it to the file name given. If the last name is a directory, then cp copies all the files listed into that directory.

The cp command also takes the -R option, allowing it to copy whole directories. The mv command is used to move files and directories. It really just renames a file to a different directory. Note that with cp you should use the option -p and -d with -R to preserve all attributes of a file and properly reproduce symlinks (discussed later). Hence, always use cp -dpR <dir> <newdir> instead of cp -R <dir> <newdir>

There is also cp –update

cpio : archive and extract files.

cron : clock deamon (executes “batch” and “at” commands).

crontab : schedules commands at regular intervals.

crypt : encrypt , decrypt files using altered DES, standard to Unix passwords (restricted distribution). See Also gpg

csh : invoke the C shell.

csplit : split file into several other files.

cu : call up another unix terminal. See Also minicom

cut : cut selected fields from each line of file.

date : displays the time and date (can also change it if you're root). Prints out the current date and time. Similar to DOS but time is used for calculating program execution time.

dd : convert and copy a file.

df : reports space (free, total etc') on all mounted file systems. Stands for disk free and tells you how much free space is left on your system. The available space usually has the units of kilobytes (1024 bytes) (although on some other UNIX systems this will be 512 bytes or 2048 bytes). The right-most column tells the directory (in combination with any directories below that) under which that much space is available.

diff

: compare two files.

dircmp Directory compare. This command compares directories to see if changes have been made between them. You will often want to see where two trees differ (e.g., check for missing files), possibly on different computers. Run man dircmp (that is, dircmp(1)). (This is a System 5 command and is not present on LINUX. You can, however, compare directories with the Midnight Commander, mc). This can be done by diff -r

du

: report disk usage.

Stands for disk usage and prints out the amount of space occupied by a directory. It recurses into any subdirectories and can print only a summary with du -s <directory>. Also try du –max-depth=1 /var and du -x / on a system with /usr and /home on separate partitions.

dmesg Prints a complete log of all messages printed to the screen during the bootup process. This is useful if you blinked when your machine was initializing. These messages might not yet be meaningful, however. echo Prints a message to the terminal. Try echo 'hello there', echo 10*3+2, echo `10*3+2'. The command echo -e allows interpretation of certain backslash sequences, for example echo -e “\a”, which prints a bell, or in other words, beeps the terminal. echo -n does the same without printing the trailing newline. In other words, it does not cause a wrap to the next line after the text is printed. echo -e -n “\b”, prints a back-space character only, which will erase the last character printed.

ed

: line oriented editor.

exit Logs you out. expr <expression> Calculates the numerical expression expression. Most arithmetic operations that you are accustomed to will work. Try expr 5 + 10 '*' 2. Observe how mathematical precedence is obeyed (i.e., the * is worked out before the +).

egrep

: extended version of grep (searches for extended regular expressions).

fgrep

: same as grep, only it interprets patterns as a list of fixed strings.

expr

: evaluate boolean and arithmetic expression.

false

: return nonzero (false) exit status.

file file <filename> Prints out the type of data contained in a file. file portrait.jpg will tell you that portrait.jpg is a JPEG image data, JFIF standard. The command file detects an enormous amount of file types, across every platform. file works by checking whether the first few bytes of a file match certain tell-tale byte sequences. The byte sequences are called magic numbers. Their complete list is stored in /usr/share/magic. [The word ``magic under UNIX normally refers to byte sequences or numbers that have a specific meaning or implication. So-called magic numbers are invented for source code, file formats, and file systems.] Try on mpeg files and other doc files. Change then extension and try again. free Prints out available free memory. You will notice two listings: swap space and physical memory. These are contiguous as far as the user is concerned. The swap space is a continuation of your installed memory that exists on disk. It is obviously slow to access but provides the illusion of much more available RAM and avoids the possibility of ever running out of memory (which can be quite fatal). head [-n <lines>] <filename> Prints the first <lines> lines of a file or 10 lines if the -n option is not given. (See also tail below). hostname [<new-name>] With no options, hostname prints the name of your machine, otherwise it sets the name to <new-name>. kbdrate -r <chars-per-second> -d <repeat-delay> Changes the repeat rate of your keys. Most users will like this rate set to kbdrate -r 32 -d 250 which unfortunately is the fastest the PC can go. With GUI interfaces like KDE this has no effect. You need to set the keyboard settings from the KDE control settings menus. find : find matching files and run specified programs on them (optional). finger : report user information (operates remotely only if a finger server is running on the remote host). ftp : (file transfer protocol) a client for FTP servers. grep : search files for regular expression matches. haltsys : gracefully shutdown sytem (can only be run by root. halt in Linux). head : display first 10 lines of a file. info System info Pages info pages contain some excellent reference and tutorial information in hypertext linked format. Type info on its own to go to the top-level menu of the entire info hierarchy. You can also type info <command> for help on many basic commands. Some packages will, however, not have info pages, and other UNIX systems do not support info at all. info is an interactive program with keys to navigate and search documentation. Inside info, typing H will invoke the help screen from where you can learn more commands. join : display the combination (lines with command field) of two fields. kill : send a signal to terminate a process. ksh : invoke the korn shell. line : read a specific line out of a file (shell script usage). more Displays a long file by stopping at the end of each page. Run the following: ls -l /bin > bin-ls, and then try more bin-ls. The first command creates a file with the contents of the output of ls. This will be a long file because the directory /bin has a great many entries. The second command views the file. Use the space bar to page through the file. When you get bored, just press . You can also try ls -l /bin | more which will do the same thing in one go. less The GNU version of more, but with extra features. On your system, the two commands may be the same. With less, you can use the arrow keys to page up and down through the file. ln : create a link to a file/directory. logname : gets your login name. whoami : which user you are logged in as at the moment. If you, for example, switch to a different user, logname will show the original username you logged in as, and whoami will show the current user. lpr : sends a request to printer. lprint : prints on local printer. lpstat : reports printer status. lpq : same as above. ls : lists the contents of directory. ls [-l, –format=long] [-a, –all] <file> <file> … ls -al mail : send and recieve mail. man : displays manual pages. The command man [<section>|-a] <command> displays help on a particular topic and stands for manual. Every command on the entire system is documented in so-named man pages. In the past few years a new format of documentation, called info, has evolved. This is considered the modern way to document commands, but most system documentation is still available only through man. Very few packages are not documented in man however. Now, man pages are divided into sections, numbered 1 through 9. Section 1 contains all man pages for system commands like the ones you have been using. Sections 2-7 contain information for programmers and the like, which you will probably not have to refer to just yet. Section 8 contains pages specifically for system administration commands. There are some additional sections labeled with letters; other than these, there are no manual pages besides the sections 1 through 9. The sections are … /man1 User programs … /man2 System calls … /man3 Library calls … /man4 Special files … /man5 File formats … /man6 Games … /man7 Miscellaneous … /man8 System administration … /man9 Kernel documentation xman provides a simple xwindows interface mesg : grant or deny permissions to recieve messages from other users using the write command. mkdir : create a new directory . mknod : build a special file. more : display file one page at a time. mount : mount a storage device. mv : move or rename a file. news : display news item from NNTP servers. nice : change priorities of processes. nohup : run a command after logout (ignores hangup signals). nroff : format files for printing. nslookup : retrieve information from DNS servers. od : displays a file in 8-based octals. passwd : create or change login password. passwd [<username>] paste : merge lines of files. pr : format and print file. ps : reports status of active processes. pstat : report system status. pwcheck : check /etc/passwd (default) file. pwd : display current working directory. The command pwd stands for present working directory (also called the current directory) and tells what directory you are currently in. Entering pwd gives some output like /home/<username>. rm : remove (erase) files or directories (unrecoverable). To remove (i.e., erase or delete) a file, use the command rm <filename>. To remove a directory, use the command rmdir <dir>. Practice using these two commands. Note that you cannot remove a directory unless it is empty. To remove a directory as well as any contents it might contain, use the command rm -R <dir>. The -R option specifies to dive into any subdirectories of <dir> and delete their contents. The process whereby a command dives into subdirectories of subdirectories of … is called recursion. -R stands for recursively. This is a very dangerous command. Although you may be used to ``undeleting files on other systems, on UNIX a deleted file is, at best, extremely difficult to recover.

rmdir

: remove an empty directory.

rsh

: invoke Restricted Bourne Shell.

sed

: the stream editor.

set

: assign value to variable.

setenv

: assign value to enviroment variable.

sh

: invoke Bourne shell.

sleep

: suspend execution of a command for a given period.

sort

: sort and merge files.

spell

: find spelling errors.

split

: split file to smaller files.

stty

: set options for a terminal.

su

: spawns a subshell with a different username, requires other user's password, unless you're root.

sum

: compute checksums and number of blocks for files.

tabs

: set tabs on a terminal.

tail

: display last 10 lines of file.

tar

: a simple compression tool that merges multiple files into a single one, originally made to make backing up materials on backup tapes easier.

tee

: create a tee in a pipe.

telnet

: access remote systems using the telnet protocol.

test

: test various expressions and files.

time

: display elapsed time (execution, process, and system times) for a command.

touch

: change time/date stamps of files.

tr

: substitutes sets of characters.

translate

: translates files to different format.

troff

: format files to phototypester.

true

: return zero (true) exit status.

tset

: set terminal mode.

tty

: report a name of a terminal.

umask

: set file-creation mode (permissions) mask.

umount

: unmount a device.

uname

: display the name of the current system.

uniq

: report any duplicate line in a file.

units

: convert numbers from one unit to another.

unzip

: extract files from zip archive.

uptime

: report system activity.

uucp

: copy files between two unix systems (oldie but still beautiful).

uulog

: report uucp status.

uuname

: list uucp sites known to this site.

uudecode

: decode to binary after “uuencode” transmission.

uuencode

: encode binary file for email transmission.

uustat

: report status of uucp or cancel a job.

uupick

: receive public files sent by uuto.

uuto

: send files to another public Unix system.

uux

: execute command to remote Unix system.

vi

: a screen oriented (visual) editor (cool ,but Vim is better).

wall

: sends message to all users (root only).

wait

: await completion of background process.

wc

: count lines, words, bytes etc' in one or more files.

who

: report active users.

whois

: search for user information.

write

: send a message for another user (see mesg).

zip

: archive file or files in zip format.

nohup <command> &

  Runs a command in the background, appending any output the command may produce to the file nohup.out in your home directory. nohup has the useful feature that the command will continue to run even after you have logged out. Uses for nohup will become obvious later. 

sleep <seconds>

  Pauses for <seconds> seconds. See also usleep. 

sort <filename>

  Prints a file with lines sorted in alphabetical order. Create a file called telephone with each line containing a short telephone book entry. Then type sort telephone, or sort telephone | less and see what happens. sort takes many interesting options to sort in reverse ( sort -r), to eliminate duplicate entries ( sort -u), to ignore leading whitespace ( sort -b), and so on. See the sort(1) for details. 

strings [-n <len>] <filename>

  Writes out a binary file, but strips any unreadable characters. Readable groups of characters are placed on separate lines. If you have a binary file that you think may contain something interesting but looks completely garbled when viewed normally, use strings to sift out the interesting stuff: try less /bin/cp and then try strings /bin/cp. By default strings does not print sequences smaller than 4. The -n option can alter this limit. 

split …

  Splits a file into many separate files. This might have been used when a file was too big to be copied onto a floppy disk and needed to be split into, say, 360-KB pieces. Its sister, csplit, can split files along specified lines of text within the file. The commands are seldom used on their own but are very useful within programs that manipulate text. 

tac <filename> [<filename> …]

  Writes the contents of all the files listed to the screen, reversing the order of the lines--that is, printing the last line of the file first. tac is cat backwards and behaves similarly. 

tail [-f] [-n <lines>] <filename>

  Prints the last <lines> lines of a file or 10 lines if the -n option is not given. The -f option means to watch the file for lines being appended to the end of it. (See also head above.) 

uname

  Prints the name of the UNIX operating system you are currently using. In this case, LINUX. 

uniq <filename>

  Prints a file with duplicate lines deleted. The file must first be sorted. 

usleep <microseconds>

  Pauses for <microseconds> microseconds (1/1,000,000 of a second). 

wc [-c] [-w] [-l] <filename>

  Counts the number of bytes (with -c for character), or words (with -w), or lines (with -l) in a file. 

whatis <command>

  Gives the first line of the man page corresponding to <command>, unless no such page exists, in which case it prints nothing appropriate. 

whoami

  Prints your login name.

play [-v <volume>] <filename>

  Plays linear audio formats out through your sound card. These formats are .8svx, .aiff, .au, .cdr, .cvs, .dat, .gsm, .hcom, .maud, .sf, .smp, .txw, .vms, .voc, .wav, .wve, .raw, .ub, .sb, .uw, .sw, or .ul files. In other words, it plays almost every type of ``basic'' sound file there is: most often this will be a simple Windows .wav file. Specify <volume> in percent. 

rec <filename>

  Records from your microphone into a file. ( play and rec are from the same package.) 

mpg123 <filename>

  Plays audio from MPEG files level 1, 2, or 3. Useful options are -b 1024 (for increasing the buffer size to prevent jumping) and --2to1 (down-samples by a factor of 2 for reducing CPU load). MPEG files contain sound and/or video, stored very compactly using digital signal processing techniques that the commercial software industry seems to think are very sophisticated. 

cdplay

  Plays a regular music CD. cdp is the interactive version. 

aumix

  Sets your sound card's volume, gain, recording volume, etc. You can use it interactively or just enter aumix -v <volume> to immediately set the volume in percent. Note that this is a dedicated mixer program and is considered to be an application separate from any that play music. Preferably do not set the volume from within a sound-playing application, even if it claims this feature--you have much better control with aumix. 

mikmod –interpolate -hq –renice Y <filename>

  Plays Mod files. Mod files are a special type of audio format that stores only the duration and pitch of the notes that constitute a song, along with samples of each musical instrument needed to play the song. This makes for high-quality audio with phenomenally small file size. mikmod supports 669, AMF, DSM, FAR, GDM, IMF, IT, MED, MOD, MTM, S3M, STM, STX, ULT, UNI, and XM audio formats--that is, probably every type in existence. Actually, a lot of excellent listening music is available on the Internet in Mod file format. The most common formats are .it, .mod, .s3m, and .xm. [Original .mod files are the product of Commodore-Amiga computers and had only four tracks. Today's 16 (and more) track Mod files are comparable to any recorded music.] 

Terminating Commands

Many commands can be terminated with Control C Other process control methods shall be studies in the rocess management topic.

Compressed Files

Files typically contain a lot of data that one can imagine might be represented with a smaller number of bytes. Take for example the letter you typed out. The word ``the was probably repeated many times. You were probably also using lowercase letters most of the time. The file was by far not a completely random set of bytes, and it repeatedly used spaces as well as using some letters more than others. [English text in fact contains, on average, only about 1.3 useful bits (there are eight bits in a byte) of data per byte.]Because of this the file can be compressed to take up less space. Compression involves representing the same data by using a smaller number of bytes, in such a way that the original data can be reconstructed exactly. Such usually involves finding patterns in the data. The command to compress a file is gzip <filename>, which stands for GNU zip. Run gzip on a file in your home directory and then run ls to see what happened. Now, use more to view the compressed file. To uncompress the file use gzip -d <filename>. Now, use more to view the file again. Many files on the system are stored in compressed format. For example, man pages are often stored compressed and are uncompressed automatically when you read them. You previously used the command cat to view a file. You can use the command zcat to do the same thing with a compressed file. Gzip a file and then type zcat <filename>. You will see that the contents of the file are written to the screen. Generally, when commands and files have a z in them they have something to do with compression–the letter z stands for zip. You can use zcat <filename> | less to view a compressed file proper. You can also use the command zless <filename>, which does the same as zcat <filename> | less. (Note that your less may actually have the functionality of zless combined.) A new addition to the arsenal is bzip2. This is a compression program very much like gzip, except that it is slower and compresses 20%-30% better. It is useful for compressing files that will be downloaded from the Internet (to reduce the transfer volume). Files that are compressed with bzip2 have an extension .bz2. Note that the improvement in compression depends very much on the type of data being compressed. Sometimes there will be negligible size reduction at the expense of a huge speed penalty, while occasionally it is well worth it. Files that are frequently compressed and uncompressed should never use bzip2 Searching for Files You can use the command find to search for files. Change to the root directory, and enter find. It will spew out all the files it can see by recursively descending [Goes into each subdirectory and all its subdirectories, and repeats the command find. ] into all subdirectories. In other words, find, when executed from the root directory, prints all the files on the system. find will work for a long time if you enter it as you have–press Ctrl-C to stop it. Now change back to your home directory and type find again. You will see all your personal files. You can specify a number of options to find to look for specific files. find -type d Shows only directories and not the files they contain. find -type f Shows only files and not the directories that contain them, even though it will still descend into all directories. find -name <filename> Finds only files that have the name <filename>. For instance, find -name '*.c' will find all files that end in a .c extension ( find -name *.c without the quote characters will not work. You will see why later). find -name Mary_Jones.letter will find the file with the name Mary_Jones.letter. find -size -<size> Finds only files that have a size larger (for +) or smaller (for -) than <size> kilobytes, or the same as <size> kilobytes if the sign is not specified. find <directory> [<directory> …] Starts find in each of the specified directories. There are many more options for doing just about any type of search for a file. See find(1) for more details (that is, run man 1 find). Look also at the -exec option which causes find to execute a command for each file it finds, for example: find /usr -type f -exec ls '-al' '{}' ';' find has the deficiency of actively reading directories to find files. This process is slow, especially when you start from the root directory. An alternative command is locate <filename>. This searches through a previously created database of all the files on the system and hence finds files instantaneously. Its counterpart updatedb updates the database of files used by locate. On some systems, updatedb runs automatically every day at 04h00. Try these ( updatedb will take several minutes): updatedb locate rpm locate deb locate passwd locate HOWTO locate README Searching Within Files Very often you will want to search through a number of files to find a particular word or phrase, for example, when a number of files contain lists of telephone numbers with people's names and addresses. The command grep does a line-by-line search through a file and prints only those lines that contain a word that you have specified. grep has the command summary: grep [options] <pattern> <filename> [<filename> …] [The words word, string, or pattern are used synonymously in this context, basically meaning a short length of letters and-or numbers that you are trying to find matches for. A pattern can also be a string with kinds of wildcards in it that match different characters, as we shall see later.] Run grep for the word ``the to display all lines containing it: grep 'the' Mary_Jones.letter. Now try grep 'the' *.letter.

grep -n <pattern> <filename>

  shows the line number in the file where the word was found. 

grep -<num> <pattern> <filename>

  prints out <num> of the lines that came before and after each of the lines in which the word was found. 

grep -A <num> <pattern> <filename>

  prints out <num> of the lines that came After each of the lines in which the word was found. 

grep -B <num> <pattern> <filename>

  prints out <num> of the lines that came Before each of the lines in which the word was found. 

grep -v <pattern> <filename>

  prints out only those lines that do not contain the word you are searching for. [ You may think that the -v option is no longer doing the same kind of thing that grep is advertised to do: i.e., searching for strings. In fact, UNIX commands often suffer from this--they have such versatility that their functionality often overlaps with that of other commands. One actually never stops learning new and nifty ways of doing things hidden in the dark corners of man pages.] 

grep -i <pattern> <filename>

  does the same as an ordinary grep but is case insensitive. 

Copying to MS-DOS and Windows Formatted Floppy Disks

A package, called the mtools package, enables reading and writing to MS-DOS/Windows floppy disks. These are not standard UNIX commands but are packaged with most LINUX distributions. The commands support Windows ``long file name'' floppy disks. Put an MS-DOS disk in your A: drive. Try

mdir A:

touch myfile mcopy myfile A: mdir A:

Note that there is no such thing as an A: disk under LINUX. Only the mtools package understands A: in order to retain familiarity for MS-DOS users. The complete list of commands is

floppyd mcopy mformat mmount mshowfat mattrib mdel minfo mmove mtoolstest mbadblocks mdeltree mkmanifest mpartition mtype mcat mdir mlabel mrd mzip mcd mdu mmd mren xcopy

Entering info mtools will give detailed help. In general, any MS-DOS command, put into lower case with an m prefixed to it, gives the corresponding LINUX command.

Archives and Backups

Never begin any work before you have a fail-safe method of backing it up.

One of the primary activities of a system administrator is to make backups. It is essential never to underestimate the volatility [Ability to evaporate or become chaotic. ] of information in a computer. Backups of data are therefore continually made. A backup is a duplicate of your files that can be used as a replacement should any or all of the computer be destroyed. The idea is that all of the data in a directory [As usual, meaning a directory and all its subdirectories and all the files in those subdirectories, etc. ] are stored in a separate place–often compressed–and can be retrieved in case of an emergency. When we want to store a number of files in this way, it is useful to be able to pack many files into one file so that we can perform operations on that single file only. When many files are packed together into one, this packed file is called an archive. Usually archives have the extension .tar, which stands for tape archive.

To create an archive of a directory, use the tar command:

tar -c -f <filename> <directory>

Create a directory with a few files in it, and run the tar command to back it up. A file of <filename> will be created. Take careful note of any error messages that tar reports. List the file and check that its size is appropriate for the size of the directory you are archiving. You can also use the verify option (see the man page) of the tar command to check the integrity of <filename>. Now remove the directory, and then restore it with the extract option of the tar command:

tar -x -f <filename>

You should see your directory recreated with all its files intact. A nice option to give to tar is -v. This option lists all the files that are being added to or extracted from the archive as they are processed, and is useful for monitoring the progress of archiving. It is obvious that you can call your archive anything you like, however; the common practice is to call it <directory>.tar, which makes it clear to all exactly what it is. Another important option is -p which preserves detailed attribute information of files.

Once you have your .tar file, you would probably want to compress it with gzip. This will create a file <directory>.tar.gz, which is sometimes called <directory>.tgz for brevity.

A second kind of archiving utility is cpio. cpio is actually more powerful than tar, but is considered to be more cryptic to use. The principles of cpio are quite similar and its use is left as an exercise.

The PATH Where Commands Are Searched For

When you type a command at the shell prompt, it has to be read off disk out of one or other directory. On UNIX, all such executable commands are located in one of about four directories. A file is located in the directory tree according to its type, rather than according to what software package it belongs to. For example, a word processor may have its actual executable stored in a directory with all other executables, while its font files are stored in a directory with other fonts from all other packages.

The shell has a procedure for searching for executables when you type them in. If you type in a command with slashes, like /bin/cp, then the shell tries to run the named program, cp, out of the /bin directory. If you just type cp on its own, then it tries to find the cp command in each of the subdirectories of your PATH. To see what your PATH is, just type

echo $PATH

You will see a colon separated list of four or more directories. Note that the current directory . is not listed. It is important that the current directory not be listed for reasons of security. Hence, to execute a command in the current directory, we hence always ./<command>.

To append, for example, a new directory /opt/gnome/bin to your PATH, do

PATH="$PATH:/opt/gnome/bin"

export PATH

LINUX supports the convenience of doing this in one line:

export PATH="$PATH:/opt/gnome/bin"

There is a further command, which, to check whether a command is locatable from the PATH. Sometimes there are two commands of the same name in different directories of the PATH. [This is more often true of Solaris systems than LINUX.] Typing which <command> locates the one that your shell would execute. Try:

which ls

which cp mv rm which which which cranzgots

which is also useful in shell scripts to tell if there is a command at all, and hence check whether a particular package is installed, for example, which netscape

The – Option

If a file name happens to begin with a - then it would be impossible to use that file name as an argument to a command. To overcome this circumstance, most commands take an option –. This option specifies that no more options follow on the command-line–everything else must be treated as a literal file name. For instance

touch – -stupid_file_name rm – -stupid_file_name

References

http://www.one-serve.com/tools/unix_commands.html

http://rute.2038bug.com/node7.html.gz

http://www.ctssn.com/linux/lesson1.html

http://www.ss64.com/bash/

http://www.comptechdoc.org/os/linux/usersguide/linux_ugbasics.html

http://www.justlinux.com/nhf/Command_Reference

http://www.bioafrica.net/GDElinux/linututorial1.html

http://www.userlocal.com/helpbasic.php

Man Page viewer

http://www.ctssn.com/man/man.cgi?ls

Tutorial

http://www.ctssn.com/

Full List of Commands

http://techpubs.sgi.com/library/tpl/cgi-bin/browse.cgi?db=man&coll=linux&pth=/man1

products/ict/unix_linux_commands_list.txt · Last modified: 2024/04/25 10:38 by wikiadmin