Linux Commands

There are of course thousands of Linux related commands and procedures. I will give a few of the more common ones here but I assure you there is A LOT more to Linux than just these relatively simple commands. A few tips with Linux type man command to get an extensive help file. For example type 'man ls' to get the manual page for the ls command containing information on the various switches and uses of the ls command. You can also execute multiple commands by separating each one with a ; for example cd newdir; mkdir thatdir ; ls -la will first change directories to the newdir directory, then create a directory called thatdir, then list all the files in long format. You can string together as many commands as you like but caution should be used not to inadvertently do anything harmful. Contents (Select the command to go to the relevant section select BACK TO CONTENTS to get back here) cd chmod cp df dir du find head kill less ls mkdir more mv ps pwd rm rmdir tail top tree vdir vi xload

cd
This command is used to change the directory and using this command will change your location to what ever directory you specify cd hello will change to the directory named hello located inside the current directory cd /home/games will change to the directory called games within the home directory. As you can see you can specify any directory on the Linux system and change to that directory from any other directory. There are of course a variety of switches associated with the cd command but generally it is used pretty much as it is. Type man cd for more information on the cd command. See also ls dir vdir BACK TO CONTENTS

chmod
This command is used to change the mode for files to know more about this command go to the Permissions (Setting up the mode)section. You can get there by using this link chmod you will need to use the back button (or go through the linux home page menu) on your browser to get back here).

cp
The cp command copies files. You can copy a file in within the current directory or you can copy files to another directory. cp myfile.html /home/help/mynewname.html This will copy the file called myfile.html in the current directory to the directory

/home/help/ and call it mynewname.html. Simply put the cp command has the format of cp file1 file2 With file1 being the name (including the path if needed) of the file being copied and file2 is the name (including the path if needed) of the new file being created. Remember with the cp command the original file remains in place. Type man cp to see more about the cp command. BACK TO CONTENTS

df
The disk free command shows how much memory is being used and how much is free for every partition and mounted file system (including any Windows drive/s). Type man df for more information about the df command. BACK TO CONTENTS

dir
The dir command is similar to the ls command only with less available switches (only about 50 compared to about 80 for ls). By using the dir command you will get a listing of the contents in the current directory listed in columns. Type man dir to see more about the dir command. See also cd ls vdir BACK TO CONTENTS

du
The disk usage command shows how much memory is being used by each directory below that from which the command was given. If du is run from the root directory it will show the memory used by every directory on the system, including any mounted file systems (including other drives) such as any Windows related drives. Type man du for more information about the du command. BACK TO CONTENTS

find
The find command is used to find files and or folders within a Linux system. To find a file using the find command you type find /usr/bin -name filename this will search inside the /usr/bin directory (and any sub directories within the /usr/bin directory) for the file named filename. To search the entire filing system including any mounted drives use find / -name filename and the find command will search every file system beginning in the root directory. The find command can also be used to find command to find files by date and the find command happily understand wild characters such as * and ? Type man find for more information on the find command. BACK TO CONTENTS

head
The head command list the first lines of a file. By default it will display the first ten lines of a file. For example head filename will list the first ten lines of the file named filename. You can also select how many lines to show for example head -5 filename will list the first 5 lines of the file named filename. The format for the head command is head -n filename With the number of lines to be displayed being n and the file name of the file, including the path if needed, you wish to view being in place of filename. Type man head for more information on the head command. BACK TO CONTENTS

kill
The kill command is used to kill a process by using the associated PID (Process ID) number e.g. kill 381 This will kill the process with the PID of 381. Be careful using the kill command because it is easy to accidently kill an important process. To see the current list of processes that are running use the ps command. Typing ps au will display every process that is in operation including background processes and those being conducted by other users. See also ps top BACK TO CONTENTS

less
This command allows you to scroll through a file a page at a time. The less command is very similar to the more command only it is more advanced and has more features associated with it. less filename Type man less for more information on the less command. BACK TO CONTENTS

ls
The ls command lists the contents of a directory. In its simple form typing just ls at the command prompt will give a listing for the directory you are currently in. The ls command can also give listings of other directories without having to go to those directories for example typing ls /dev/bin will display the listing for the directory /dev/bin . The ls command can also be used to list specific files by typing ls filename this will display the file filename (of course you can use any file name here). The ls command can also handle wild characters such as the * and ? . For example ls a* will list all files

starting with lower case a ls [aA]* will list files starting with either lower or upper case a (a or A remember linux is case sensitive) or ls a? will list all two character file names beginning with lower case a . There are many switches (over 70) associated with the ls command that perform specific functions. Some of the more common switches are listed here.
• • • • • •

• • •

ls -a This will list all file including those beginning with the'.' that would normally be hidden from view. ls -l This gives a long listing showing file attributes and file permissions. ls -s Will display the listing showing the size of each file rounded up to the nearest kilobyte. ls -S This will list the files according to file size. ls -C Gives the listing display in columns. ls -F Gives a symbol next to each file in the listing showing the file type. The / means it is a directory, the * means an executable file, the @ means a symbolic link. ls -r Gives the listing in reverse order. ls -R This gives a recursive listing of all directories below that where the command was issued. ls -t Lists the directory according to time stamps.

Switches can be combined to produce any output you desire. e.g. ls -la This will list all the files in long format showing full file details. Type man ls for more details about the ls command. See also cd dir vdir BACK TO CONTENTS

mkdir
The mkdir command is used to create a new directory. mkdir mydir This will make a directory (actually a sub directory) within the current directory called mydir. Type man mkdir to see more about the mkdir command. BACK TO CONTENTS

more
This command allows you too scroll through a file one screen at a time allowing you to more easily read the files contents. Some files are very big and using this command allows you to view the contents of large files more efficiently. To go forward one screen use the space bar and to go back one screen use the B key more filename

Type man more for more information about the more command. BACK TO CONTENTS

mv
The mv command moves files from one location to another. With the mv command the file will be moved an no longer exist in its former location prior to the mv. The mv command can also be used to rename files. You can move files within the current directory or another directory. cp myfile.html /home/help/mynewname.html This will move the file called myfile.html in the current directory to the directory /home/help/ and call it mynewname.html. Simply put the mv command has the format of mv file1 file2 With file1 being the name (including the path if needed) of the file being moved and file2 is the name (including the path if needed) of the new file being created. Type man mv to see more about the mv command. BACK TO CONTENTS

ps
The ps (process status) will by default only show the processes that you as a user have started. However Linux is always running background tasks so you may want to use some of the common switches associated with the ps such as ps au to display the processes running for all users and in the user format hence we get to see every process that is running on the system. When a process is started it is given among other things a PID number that is unique to it. This PID number can be seen by using the ps command or top command. By knowing a Process ID number you may opt to kill the process if you choose. See also kill top BACK TO CONTENTS

pwd
The pwd command (print working directory) will display the current directory. e.g. typing pwd will display something similar to this /home/games/help being the details of the current directory. To get help with the pwd type /bin/pwd --help and a short help file will be displayed. Type man pwd to get more information about the pwd command. BACK TO CONTENTS

rm
The rm command is used to delete files. Some very powerful switches can be used with the rm command so be sure to check the man rm file before placing extra switches on the rm command.

rm myfile This will delete the file called mydir. You can include a path to delete a file in another directory for example rm /home/hello/goodbye.htm will delete the file named goodbye.htm in the directory /home/hello/. Some of the common switches for the rm command are

• •

rm -i this operates the rm command in interactive mode meaning it will prompt you before deleting a file. This gives you a second chance to say no do not delete the file or yes delete the file. Remember Linux is merciless and once something is deleted it is gone for good so the -i flag (switch) is a good one to get into the habit of using. rm -f will force bypassing any safeguards that may be in place such as prompting. Again this command is handy to know but care should be taken with its use. rm -r will delete every file and sub directory below that in which the command was given. Be very careful with this command as no prompt will be given in most linux systems and it will mean instant good bye to your files if misused.

Type man rm to see more about the rm command. BACK TO CONTENTS

rmdir
The rmdir command is used to delete a directory. rmdir mydir This will delete the directory (actually a sub directory) called mydir. Type man rmdir to see more about the rmdir command. BACK TO CONTENTS

tail
The tail command list the last lines of a file. By default it will display the last ten lines of a file. For example tail filename will list the last ten lines of the file named filename. You can also select how many lines to show for example tail -5 filename will list the last 5 lines of the file named filename. The format for the tail command is tail -n filename With the number of lines to be displayed being n and the file name of the file you wish to view, including the path if needed, being in place of filename. Type man tail for more information on the tail command. BACK TO CONTENTS

top
Either typing top at the command prompt or selecting top from the xwindows menu will activate the top application. Top simply lists all the operations in progress showing

memory usage by each process. You have the option to kill any process if you want to but be careful if you kill a vital system you will run into trouble and may at the very least have to reboot to fix it. Typically top is run in a spare xterm or x11 window while doing other tasks. To access the help in top use the ? or H key. To kill a task use the K key or change the priority of the task by using the R key. Type man top to see more detailed information about the top command. see also xload BACK TO CONTENTS

tree
This will give a graphical display of the structure of a particular directory and all sub directories, files and links within that directory. e.g. tree /var/lib will show something similar to this /var/lib |--games |--rpm | |--conflictsindex.rpm | |--fileindex.rpm | |--groupsindex.rpm | |--packages.rpm | `--require.rpm `--text 6 directories, 6 files Type man tree for more information on the tree command. BACK TO CONTENTS

vdir
The vdir command is similar to the ls -l command. When used the command acts very much like ls -l does by displaying the directory contents showing the file attributes and permissions. The amount of switches for vdir are a lot less than for the ls command (vdir has just over half the amount of available switches as the ls command) but vdir is still used and accepted. Type man vdir to see more about the vdir command. See also cd dir ls BACK TO CONTENTS

vi
The vi command is actually a text editor that comes as standard with most Linux

packages. Type man vi for more information on vi. More information on vi is in the Using the vi Editor section. Use this link vi to get there . BACK TO CONTENTS

xload
Either typing xload or selecting xload from the xwindows menu (if it is available) will activate the xload feature in a x11 window. The xload application provides a running graph of the system load. Often it is easier to tell if a system is overloaded by having a visual aid to see the load on the system. The xload command has eight different command line options and can be customized in regards to colour, scale and background. Typically xload is run as a background task to enable visual monitoring of the system load. Type man xload to see more detailed information about the xload command. see also top BACK TO CONTENTS

Command • apropos whatis • man -t man | ps2pdf - > man.pdf which command time command • time cat • • nice info renice 19 -p $$

Description Show commands pertinent to string. See also threadsafe make a pdf of a manual page Show full path name of command See how long a command takes Start stopwatch. Ctrl-d to stop. See also sw Run a low priority command (The "info" reader in this case) Make shell (script) low priority. Use for non interactive tasks Go to previous directory Go to $HOME directory Go to dir, execute command and return to current dir Put current dir on stack so you can popd back to it

dir navigation • cd • cd (cd dir && command) • pushd .

file searching • alias l='ls -l --color=auto' • ls -lrt • ls /usr/bin | pr -T9 -W$COLUMNS find -name '*.[ch]' | xargs grep -E 'expr' find -type f -print0 | xargs -r0 grep -F 'example' find -maxdepth 1 -type f | xargs grep -F 'example' find -maxdepth 1 -type d | while read dir; do echo $dir; echo cmd2; done • find -type f ! -perm -444 • find -type d ! -perm -111 • locate -r 'file[^/]*\.txt'

• look reference • grep --color reference /usr/share/dict/words archives and compression gpg -c file Encrypt file gpg file.gpg Decrypt file tar -c dir/ | bzip2 > dir.tar.bz2 Make compressed archive of dir/ bzip2 -dc dir.tar.bz2 | tar -x Extract archive (use gzip instead of bzip2 for tar.gz files) tar -c dir/ | gzip | gpg -c | ssh user@remote 'dd Make encrypted archive of dir/ on remote machine of=dir.tar.gz.gpg' find dir/ -name '*.txt' | tar -c --files-from=- | bzip2 > Make archive of subset of dir/ and below dir_txt.tar.bz2 find dir/ -name '*.txt' | xargs cp -a --targetMake copy of subset of dir/ and below directory=dir_txt/ --parents ( tar -c /dir/to/copy ) | ( cd /where/to/ && tar -x -p ) Copy (with permissions) copy/ dir to /where/to/ dir ( cd /dir/to/copy && tar -c . ) | ( cd /where/to/ && tar -x Copy (with permissions) contents of copy/ dir to -p ) /where/to/ ( tar -c /dir/to/copy ) | ssh -C user@remote 'cd /where/to/ Copy (with permissions) copy/ dir to remote:/where/to/ && tar -x -p' dir dd bs=1M if=/dev/sda | gzip | ssh user@remote 'dd Backup harddisk to remote machine of=sda.gz' rsync (Network efficient file copier: Use the --dry-run option for testing) Only get diffs. Do multiple times for troublesome rsync -P rsync://rsync.server.com/path/to/file file downloads rsync --bwlimit=1000 fromfile tofile Locally copy with rate limit. It's like nice for I/O rsync -az -e ssh --delete ~/public_html/ Mirror web site (using compression and encryption) remote.com:'~/public_html' rsync -auz -e ssh remote:/dir/ . && rsync -auz -e ssh . Synchronize current directory with remote one remote:/dir/ ssh (Secure SHell) Run command on $HOST as $USER (default ssh $USER@$HOST command command=shell)

quick dir listing List files by date. See also newest and find_mm_yyyy Print in 9 columns to width of terminal Search 'expr' in this dir and below. See also findrepo Search all regular files for 'example' in this dir and below Search all regular files for 'example' in this dir Process each item with multiple commands (in while loop) Find files not readable by all (useful for web site) Find dirs not accessible by all (useful for web site) Search cached index for names. This re is like glob *file*.txt Quickly search (sorted) dictionary for prefix Highlight occurances of regular expression in dictionary

ssh -f -Y $USER@$HOSTNAME xeyes scp -p -r $USER@$HOST: file dir/ ssh -g -L 8080:localhost:80 root@$HOST

ssh -R 1434:imap:143 root@$HOST wget (multi purpose download tool) (cd dir/ && wget -nd -pHEKk • Store local browsable version of a page to the current dir http://www.pixelbeat.org/cmdline.html) wget -c http://www.example.com/large.file Continue downloading a partially downloaded file wget -r -nd -np -l1 -A '*.jpg' Download a set of files to the current directory http://www.example.com/dir/ wget ftp://remote/file[1-9].iso/ FTP supports globbing directly wget -q -O- http://www.pixelbeat.org/timeline.html | grep • Process output directly 'a href' | head echo 'wget url' | at 01:00 Download url at 1AM to current dir wget --limit-rate=20k url Do a low priority download (limit to 20KB/s in this case) wget -nv --spider --force-html -i bookmarks.html Check links in a file wget --mirror http://www.example.com/ Efficiently update a local copy of a site (handy from cron) networking (Note ifconfig, route, mii-tool, nslookup commands are obsolete) ethtool eth0 Show status of ethernet interface eth0 ethtool --change eth0 autoneg off speed 100 duplex full Manually set ethernet interface speed iwconfig eth1 Show status of wireless interface eth1 iwconfig eth1 rate 1Mb/s fixed Manually set wireless interface speed • iwlist scan List wireless networks in range • ip link show List network interfaces ip link set dev eth0 name wan Rename interface eth0 to wan ip link set dev eth0 up Bring interface eth0 up (or down) • ip addr show List addresses for interfaces ip addr add 1.2.3.4/24 brd + dev eth0 Add (or del) ip and mask (255.255.255.0) • ip route show List routing table ip route add default via 1.2.3.254 Set default gateway to 1.2.3.254 • tc qdisc add dev lo root handle 1:0 netem delay 20msec Add 20ms latency to loopback device (for testing) • tc qdisc del dev lo root Remove latency added above • host pixelbeat.org Lookup DNS ip address for name or vice versa • hostname -i Lookup local ip address (equivalent to host `hostname`) • whois pixelbeat.org Lookup whois info for hostname or ip address • netstat -tupl List internet services on a system • netstat -tup List active connections to/from system windows networking (Note samba is the package that provides all this windows specific networking support) • smbtree Find windows machines. See also findsmb Find the windows (netbios) name associated with ip nmblookup -A 1.2.3.4 address smbclient -L windows_box List shares on windows machine or samba server

Run GUI command on $HOSTNAME as $USER Copy with permissions to $USER's home directory on $HOST Forward connections to $HOSTNAME:8080 out to $HOST:80 Forward connections from $HOST:1434 in to imap:143

mount -t smbfs -o fmask=666,guest //windows_box/share Mount a windows share /mnt/share Send popup to windows machine (off by default in XP echo 'message' | smbclient -M windows_box sp2) text manipulation (Note sed uses stdin and stdout. Newer versions support inplace editing with the -i option) sed 's/string1/string2/g' Replace string1 with string2 sed 's/\(.*\)1/\12/g' Modify anystring1 to anystring2 sed '/ *#/d; /^ *$/d' Remove comments and blank lines sed ':a; /\\$/N; s/\\\n//; ta' Concatenate lines with trailing \ sed 's/[ \t]*$//' Remove trailing spaces from lines sed 's/\([`"$\]\)/\\\1/g' Escape shell metacharacters active within double quotes • seq 10 | sed "s/^/ /; s/ *\(.\{7,\}\)/\1/" Right align numbers sed -n '1000p;1000q' Print 1000th line sed -n '10,20p;20q' Print lines 10 to 20 sed -n 's/.*<title>\(.*\)<\/title>.*/\1/ip;T;q' Extract title from HTML web page sed -i 42d ~/.ssh/known_hosts Delete a particular line sort -t. -k1,1n -k2,2n -k3,3n -k4,4n Sort IPV4 ip addresses • echo 'Test' | tr '[:lower:]' '[:upper:]' Case conversion • tr -dc '[:print:]' < /dev/urandom Filter non printable characters • history | wc -l Count lines set operations (Note you can export LANG=C for speed. Also these assume no duplicate lines within a file) sort file1 file2 | uniq Union of unsorted files sort file1 file2 | uniq -d Intersection of unsorted files sort file1 file1 file2 | uniq -u Difference of unsorted files sort file1 file2 | uniq -u Symmetric Difference of unsorted files join -a1 -a2 file1 file2 Union of sorted files join file1 file2 Intersection of sorted files join -v2 file1 file2 Difference of sorted files join -v1 -v2 file1 file2 Symmetric Difference of sorted files math • echo '(1 + sqrt(5))/2' | bc -l Quick math (Calculate φ). See also bc • echo 'pad=20; min=64; (100*10^6)/((pad+min)*8)' | bc More complex (int) e.g. This shows max FastE packet rate echo 'pad=20; min=64; print (100E6)/((pad+min)*8)' | • Python handles scientific notation python echo 'pad=20; plot [64:1518] (100*10**6)/((pad+x)*8)' | • Plot FastE packet rate vs packet size gnuplot -persist • echo 'obase=16; ibase=10; 64206' | bc Base conversion (decimal to hexadecimal) Base conversion (hex to dec) ((shell arithmetic • echo $((0x2dec)) expansion)) • units -t '100m/9.69s' 'miles/hour' Unit conversion (metric to imperial) • units -t '500GB' 'GiB' Unit conversion (SI to IEC prefixes) • units -t '1 googol' Definition lookup • seq 100 | (tr '\n' +; echo 0) | bc Add a column of numbers. See also add and funcpy calendar

• • • • • • •

cal -3 cal 9 1752 date -d fri [ $(date -d "tomorrow" +%d) = "01" ] || exit date --date='25 Dec' +%A date --date='@2147483647' TZ=':America/Los_Angeles' date

Display a calendar Display a calendar for a particular month year What date is it this friday. See also day exit a script unless it's the last day of the month What day does xmas fall on, this year Convert seconds since the epoch (1970-01-01 UTC) to date What time is it on West coast of US (use tzselect to find TZ) Email reminder Popup reminder Print number with thousands grouping appropriate to locale get ls to do thousands grouping appropriate to locale Extract info from locale database Lookup locale info for specific country. See also ccodes List fields available in locale database Show available conversions (aliases on each line) Windows "ansi" to local charset (auto does CRLF conversion) Windows utf8 to local charset Latin9 (western europe) to utf8 Base64 encode Quoted printable decode Text to HTML Lookup table of characters Show what a code represents in latin-9 charmap Show latin-9 encoding Show utf-8 encoding Save copy of data cdrom Create cdrom image from contents of dir Mount the cdrom image at /mnt/dir (read only) Clear a CDRW Burn cdrom image (use dev=ATAPI -scanbus to confirm dev) Rip audio tracks from CD to wav files in current dir Make audio CD from all wavs in current dir (see also cdrdao) Make ogg file from wav file

echo "mail -s 'get the train' P@draigBrady.com < /dev/null" | at 17:45 echo "DISPLAY=$DISPLAY xmessage cooker" | at • "NOW + 30 minutes" locales • printf "%'d\n" 1234

• BLOCK_SIZE=\'1 ls -l • echo "I live in `locale territory`" • LANG=en_IE.utf8 locale int_prefix • locale | cut -d= -f1 | xargs locale -kc | less recode (Obsoletes iconv, dos2unix, unix2dos) • recode -l | less recode windows-1252.. file_to_change.txt recode utf-8/CRLF.. file_to_change.txt recode iso-8859-15..utf8 file_to_change.txt recode ../b64 < file.txt > file.b64 recode /qp.. < file.txt > file.qp recode ..HTML < file.txt > file.html • recode -lf windows-1252 | grep euro • echo -n 0x80 | recode latin-9/x1..dump • echo -n 0x20AC | recode ucs-2/x2..latin-9/x • echo -n 0x20AC | recode ucs-2/x2..utf-8/x CDs gzip < /dev/cdrom > cdrom.iso.gz mkisofs -V LABEL -r dir | gzip > cdrom.iso.gz mount -o loop cdrom.iso /mnt/dir cdrecord -v dev=/dev/cdrom blank=fast gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom cdparanoia -B cdrecord -v dev=/dev/cdrom -audio *.wav oggenc --tracknum='track' track.cdda.wav -o 'track.ogg'

disk space (See also FSlint) • ls -lSr • du -s * | sort -k1,1rn | head • df -h • df -i • fdisk -l • rpm -q -a --qf '%10{SIZE}\t%{NAME}\n' | sort -k1,1n dpkg-query -W -f='${Installed-Size;10}\t${Package}\n' | • sort -k1,1n • dd bs=1 seek=2TB if=/dev/null of=ext3.test • > file monitoring/debugging • tail -f /var/log/messages • strace -c ls >/dev/null • strace -f -e open ls >/dev/null • ltrace -f -e getenv ls >/dev/null • lsof -p $$ • lsof ~ • • tcpdump not port 22

Show files by size, biggest last Show top disk users in current dir. See also dutop Show free space on mounted filesystems Show free inodes on mounted filesystems Show disks partitions sizes and types (run as root) List all packages by installed size (Bytes) on rpm distros List all packages by installed size (KBytes) on deb distros Create a large test file (taking no space). See also truncate truncate data of file or create an empty file Monitor messages in a log file Summarise/profile system calls made by command List system calls made by command List library calls made by command List paths that process id has open List processes that have specified path open Show network traffic except ssh. See also tcpdump_not_me List processes in a hierarchy

ps -e -o pid,args --forest ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed • List processes by % cpu usage '/^ 0.0 /d' • ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS List processes by mem usage. See also ps_mem.py • ps -C firefox-bin -L -o pid,tid,pcpu,state List all threads for a particular process • ps -p 1,2 List info for particular process IDs • last reboot Show system reboot history • free -m Show amount of (remaining) RAM (-m displays in MB) • watch -n.1 'cat /proc/interrupts' Watch changeable data continuously system information (see also sysinfo) ('#' means root access is required) • uname -a Show kernel version and system architecture • head -n1 /etc/issue Show name and version of distribution • cat /proc/partitions Show all partitions registered on the system • grep MemTotal /proc/meminfo Show RAM total seen by the system • grep "model name" /proc/cpuinfo Show CPU(s) info • lspci -tv Show PCI info • lsusb -tv Show USB info • mount | column -t List mounted filesystems on the system (and align output) • grep -F capacity: /proc/acpi/battery/BAT0/info Show state of cells in laptop battery # dmidecode -q | less Display SMBIOS/DMI information # smartctl -A /dev/sda | grep Power_On_Hours How long has this disk (system) been powered on in total # hdparm -i /dev/sda Show info about disk sda # hdparm -tT /dev/sda Do a read speed test on disk sda

# badblocks -s /dev/sda interactive (see also linux keyboard shortcuts) • readline • screen • mc

Test for unreadable blocks on disk sda Line editor used by bash, python, bc, gnuplot, ... Virtual terminals with detach capability, ... Powerful file manager that can browse rpm, tar, ftp, ssh, ... Interactive/scriptable graphing Web browser open a file or url with the registered desktop application Handy hexdump. (usage e.g.: • hd /proc/self/cmdline | less) Canonicalize path. (usage e.g.: • realpath ~/../$USER) Search current environment Set file timestamp (YYMMDDhhmm) Serve current directory tree at http://$HOSTNAME:8000/

• gnuplot • links • xdg-open http://www.pixelbeat.org/ miscellaneous • • • • alias hd='od -Ax -tx1z -v' alias realpath='readlink -f' set | grep $USER touch -c -t 0304050607 file python -m SimpleHTTPServer

passwd nslookup quota motd finger username man or xman command xman less filename or more filename info clear ls directory cat filename rm filename pico filename or emacs filename cp sourcefile detstinationfilename lpr filename grep string filename head filename

Changes password Queries Internet domain name servers Displays disk usage and limits Message of the Day User information lookup program Displays pages of online manual Displays System Manual in X Displays the contents of a file in the terminal one page at a time Displays information and documentation on shells, utilities and programs Clears the terminal window List contents of a directory Displays the contents of a file in the terminal Removes a file Opens and edits text files Copies a file Sends file to printer looks through files for strings Displays first 10 lines of file

tail filename mv existingfilename newfilename lpq filename lprm filename sort filename diff filename1 filename2 file filename echo string date cal gzip filename compress filename gunzip filename zcat filename apropos command lynx dmesg which command whereis command who

Displays last 10 lines of file Moves or renames file

Displays files in printing queue Removes file from printing queue Displays and sorts file contents Displays differences between files Displays information about file contents Copies string to terminal Displays current date and time Displays calendar Compresses a file Compresses a file Decompresses a compressed file Displays contents of a compressed file Lists all man page titles/headers that contain the command Text based web browser Displays kernel ring buffer Displays path to command Displays paths to locations of commands Lists currently logged on users Obtains detailed information about a user currently using the finger username@hostname system w Lists currently logged on users with processing usage mesg y/n Sets options for letting other users write you messages write user Sends message to other users talk user Allows two way chat to other users chmod permissions filename Changes file access permissions mkdir directoryname Makes a directory rmdir directoryname Removes an empty directory ln existingfile new-link Creates link to an existing file (hard link) stat filename Lists information about a file ln -s existingfile new-link Creates link to an existing file (soft link) df Displays all mounted filesystems ps Reports process status Sends a job to the background (job: one or more commands connected by a pipe "|" or pipes) The operating system command & assigns a number to the job when you press return. example: [1] 3578 top Displays updating list of currently running processes

Displays the name of the terminal in which the command was issued command > filename Redirects standard output command < filename Redirects standard input cat file1 >> file2 Appends standard output from file1 to file2 cat /dev/null > filename or Redirects "bit bucket" or null string to file (only superuser filename > /dev/null has write access to this file) Pipe sends standard output of one command to the standard command1 | command2 input of another command translates each character in string1 to the corresponding tr string1 string2 < inputfile character in string2 command | tee filename | Sends the output of one command to standard output and a grep string file bg %job number Sends job to the background by job number fg %job number Brings job to the foreground by job number Aborts a process by PID (Process Identification Number) or kill PID or %job number job number jobs Displays a list of current jobs netcfg Utility to set up PPP and network configurations xev Utility used to see information flow from X server to client Environment variable that displays the ID string for a echo $DISPLAY window echo $PATH Variable that displays executable path netstat Displays network connections viewres Graphical class browser for X Game featuring Bill Gates trying to put windows on Macs xbill and NeXT workstations xevil Game similar to Loderunner? xchomp Linux's version of PacMan xcmap Strange color lookup utility xedit Text editor for X asclock Clock from AfterStep xconsole Strange console for X xmessage message Sends message to a dialog box xgal XGalaga game xg3 Image viewing program xgc Graphing calculator? xjewel Jewel game for Linux xkbvleds LEDs? xkbwatch LEDs? tty

xlogo xmixer xsnow xwininfo startx ghostview xv filename xsetroot -color xcalc xclipboard traceroute host hostname rlogin host telnet host rcp file remotemachine ftp rsh command ping host lcd directorypath

Displays X logo Opens system sound controls Snowflakes are fallin' on your desktop Displays info about a window Starts an X Window System server Starts a text preview application Image viewer Set background color in X Starts a calculator in X Starts a clipboard in X Prints the route packets take to the host Displays system identity name Utility to connect to a remote system Utility to connect to a remote system (similar to rlogin but more interactive) Used to copy from a remote computer Utility to transfer files between systems on a network Utility to run a command on a remote system without logging in Utility used to test connection to a remote system Changes local machine directory while logged on to remote machine

Shared Directories
Directory / /bin /boot /dev /etc /home /lib /mnt /proc /root /sbin /tmp Description Root - The root directory is present in all Linux system file structures. It's the parent of all files in the system. Essential common binaries - Holds files needed to boot the system and run it when it comes up in single user mode. Static files of the boot loader. Device files - All files that represent peripheral devices. Machine-local system configuration - Holds administrative, config, and other system files. Holds /etc/passwd file that contains a list of all users who have permission to the system. User home directories - Contains each user's or client's home directory Shared libraries Mount point for temporary partitions Kernel and process information (virtual filesystem) Home directory for root Essential system binaries - Contains utilities for system administration. Temporary files

/usr /var

Second major hierarchy - Includes subdirectories that contain information used by the system. Variable data - Contains files whose contents change as system runs.

vi Commands
Command vi filename :q! p P yy :r !command i :set autoindent :set showmatch :set nu :set showmode ESCAPE Control-U Control-H Control-W h, j, k, l u x dw dd ZZ o Control-L :w filename Description Starts vi and creates a new file Quits vi without saving work Pastes data in buffer below current line Pastes data in buffer above current line Copies current line Reads in output of the command Puts vi in insert mode Sets vi to indent automatically Sets vi to show matching parenthesis Sets vi to display line numbers Sets vi to display the mode you're in Sets vi to command mode Erases current line (insert mode) Erases on letter (insert mode) Erases current word (insert mode) Moves cursor left, up, down, right respectively Undoes last action Deletes a single character Deletes a single word Deletes a single line Writes work buffer to disk and exits vi inserts line after cursor position Redraws screen Save work as filename and exits

Control Characters
Key Control-H or BACKSPACE Control-U Control-W Control-C COMMAND-Tab Control-L or CONtrOL-R Control-D, logout or exit Use Erases a character on the command line Deletes an entire command line Erases a word on the command line Aborts program execution Switches Programs Refreshes the screen Logs you off the system

/etc/crontab The syntax of each line in this file is: minute, hour, day of month, Month, day of week, (user name), command /etc/fstab Columns are: device file to mount, directory to mount on, filesystem type, options, backup frequency, and fsck pass number (To specify the order in which filesystems should be checked on boot; 0 means no check.) The noauto option stops this mount from being done automatically on boot. Below is a detailed list of what is on each column. 1. The name of the device such as "/dev/hda1" 2. The mount point. Use "/" for root. Other typical mount points are "/dos" for DOS, "swap" or "none" for the swap partition, and "/mnt/floppy" for "/dev/fd0" (the floppy drive). 3. The type of filesystem. They are: mini, ext, ext2(linux native), xiafs, msdos, hpfs, ntfs, fat32, iso9660(CD-ROM), NFS, swap (for swap space). 4. The mount options for use with the filesystem. Each filesystem type has different mount options. Read the mount man page to see possible options. ro= read only, user- allows normal users to mount the device. 5. The frequency the filesystem needs to be dumped (backed up) by the dump command. For ext2, normally make it 1, for others make it 0. 0 or nothing means it is not dumped. If 1, it is backed up during a system backup.

6. A number telling the order in which the filesystems should be checked at reboot time by the fsck program. Your root should be 1, others are in ascending order or 0 to not be checked. /etc/hosts Sets up host address information for local use. The format is: IPaddress name1 name2... /etc/inetd.conf Sets the services under the inetd daemon. The fields of this file are: 1. 2. 3. 4. 5. 6. service name socket type protocol wait or nowait user server program name

7. server program command line arguments /etc/inittab Sets the init configuration. An entry in the inittab file has the following format: id:runlevels:action:process /etc/lilo.conf Tells LILO how to boot The lilo.conf file below is for a system which has a Linux root partition on /dev/hda1 and a MS-DOS partition on /dev/hda2. See the "How Linux Works" guide and the "Linux User's Guidel" for more information. boot = /dev/hda vga = normal delay = 60 # Tell LILO to install the boot loader on the /dev/hda disk boot record # Set a normal video mode # The time in tenths of seconds to press <SHIFT> to get the LILO prompt # Equivalent would be "prompt" on one line, and "timeout=60" on # another line. # Sets the default boot to DOS, Without this line, the default is the first stanza # The file containing the boot sector to use # Have LILO perform some optimization. #Specifies the map file LILO creates when installed

default=msdos install = /boot/boot.b compact map = /boot/map

image = /vmlinuz label = linux root = /dev/hda1 read-only other = /dev/hda2 table = /dev/hda label = msdos

# Section for Linux root partition on /dev/hda2. # Location of kernel # Name of the OS that is displayed in the LILO boot menu # Location of root partition, if this isn't here the kernel image must have # this set using the rdev command # Mount read only on startup, Can also be set by rdev # Section for MSDOS partition on /dev/hda1. # Location of partition # Location of partition table for /dev/hda2 # Name of OS (for boot menu)

if the command "vga= ask" is given, LILO will prompt the user for a video mode at boot time. /etc/passwd The file has one line per username, and is divided into seven colon-delimited fields: 1. 2. 3. 4. 5. 6. 7. Username. Password, in an encrypted form. Numeric user id. Numeric group id. Full name or other description of account. This is called gecos. The user's home directory. The user's login shell (program to run at login).

The format is explained in more detail on the passwd manual page. /usr/X11R6/lib/X11/XF86Config The main XFree86 configuration file. Type "man XF86Config"

• • •

• •

The first section is "Files" RgbPath Sets the path to the X11R6 RGB color database FontPath Sets the path to a directory containing X11 fonts The second section is "ServerFlags", all lines are commented out The third section is "Keyboard" The fourth section is "Pointer" Protocol Specifies the mouse protocol Device Specifies the device file by which the mouse can be accessed. The fifth section is "Monitor" which specifies the characteristics of your monitor ModeLine Specifies resolution modes for your monitor The file, VideoModes.doc describes in detail how to determine the ModeLine values for each resolution mode. Two files, modeDB.txt and Monitors,may have

ModeLine information for your monitor. They are located in /usr/X11R6/lib/X11/doc. The sixth section is "Screen" describing the video/monitor card configuration for the particular server. The Driver line specifies the X server that you will be using. Valid Driver values are: _ Accel: For the XF86 S3, XF86 Mach32, XF86 Mach8, XF86 8514, XF86 P9000, XF86 AGX,and XF86 W32 servers; _ SVGA: For the XF86 SVGA server; _ VGA16: For the XF86 VGA16 server; _ VGA2: For the XF86 Mono server; _ Mono: For the non-VGA monochrome drivers in the XF86 Mono and XF86 VGA16 servers. Be sure that /usr/X11R6/bin/X is a symbolic link to this server. The Device line specifies the Identifier of the Device section that corresponds to the video card to use for this server. Above, we created a Device section with the line Identifier "#9 GXE 64" Therefore, we use "#9 GXE 64" on the Device line here. Similarly, the Monitor line specifies the name of the Monitor section to be used with this server. Here, "CTX 5468 NI" is the Identifier used in the Monitor section described above.

Subsection "Display" defines several properties of the XFree86 server corresponding to your monitor/video card combination. The XF86Config file describes all of these options in detail. Most of them are not necessary to get the system working. The options that you should know about are: o _ Depth. Defines the number of color planes; that is, the number of bits per pixel. Usually, Depth is set to 16. For the VGA16 server, you would use a depth of 4, and for the monochrome server a depth of 1. If you use an accelerated video card with enough memory to support more bits per pixel, you can set Depth to 24, or 32. o _ Modes. This is the list of mode names that have been defined using the ModeLine directive(s) in the Monitor section. In the above section, we used ModeLines named "1024x768", "800x600",and "640x48"0. Therefore, we use a Modes line of Modes "1024x768" "800x600" "640x480" The first mode listed on this line is the default when XFree86 starts. After XFree86 is running, you can switch between the modes listed here using the keys Ctrl - Alt –Numeric + and Ctrl - Alt - Numeric - . It might be best, when you initially configure XFree86, to use lower resolution video modes like 640x480, which tend to work with most

systems. Once you have the basic configuration working, you can modify XF86Config to support higher resolutions.
o

o

_ Virtual. Set the virtual desktop size. XFree86 can use additional memory on your video card to extend the size of the desktop. When you move the mouse pointer to the edge of the display, the desktop scrolls, bringing the additional space into view. Even if you run the server at a lower video resolution like 800x600, you can set Virtual to the total resolution that your video card can support. A 1-megabyte video card can support 1024x768 at a depth of 8 bits per pixel; a 2-megabyte card 1280x1024 at depth 8, or 1024x768 at depth 16. Of course, the entire area will not be visible at once, but it can still be used. The Virtual feature is rather limited. If you want to use a true virtual desktop, fvwm and similar window managers allow you to have large, virtual desktops by hiding windows and using other techniques, instead of storing the entire desktop in video memory. See the manual pages for fvwm for more details about this. Some Linux systems use fvwm by default. _ ViewPort. If you are using the Virtual option that is described above, ViewPort sets the coordinates of the upper-left-hand corner of the virtual desktop when XFree86 starts up. Virtual 0 is often used. If this is unspecified, then the desktop is centered on the virtual desktop display, which may be undesirable to you.

badblocks cfdisk debugfs df dosfsck du dump dumpe2fs e2fsck e2label exportfs fdisk fdformat fsck hdparm

Used to search a disk or partition for badblocks. Similar to fdisk but with a nicer interface. Allows direct access to filesystems data structure. Shows the disk free space on one or more filesystems. Check and repair MS-Dos filesystems. Shows how much disk space a directory and all its files contain. Used to back up an ext2 filesystem. Complement is restore. Dump filesystem superblock and blocks group information. Ex: dumpe2fs /dev/hda2 Check a Linux second extended filesystem. Change the label on an ext2 filesystem. Used to set up filesystems to export for nfs (network file sharing). Used to fix or create partitions on a hard drive. Formats a floppy disk. Used to add new blocks to a filesystem. Must not be run on a mounted file system. Get/set hard disk geometry parameters, cylinders, heads, sectors.

mkfs mke2fs mkswap mount rdev rdump rmt restore setfdprm swapoff(8) swapon(8) sync tune2fs umount

Initializes a Linux filesystem. This is a front end that runs a separate program depending on the filesystem's type. Create a Linux second extended filesystem. Sets up a Linux swap area on a device or file. Used to mount a filesystem. Complement is umount. Query/set image root device, swap device, RAM disk size of video mode. What this does is code the device containing the root filesystem into the kernel image specified. Same as dump. Remote magtape protocol module. Used to restore an ext2 filesystem. Set floppy drive parameters. Used to de-activate a swap partition. Used to activate a swap partition. Forces all unwritten blocks in the buffer cache to be written to disk. Adjust tunable filesystem parameters on second extended filesystems. Unmounts a filesystem. Complement is mount.

apropos bdflush cd

chmod

Search the whatis database for files containing specific strings. Kernel daemon that saves dirty buffers in memory to the disk. Change the current directory. With no arguments "cd" changes to the users home directory. chmod <specification> <filename> - Effect: Change the file permissions. Effect: change the file Ex: chmod 751 myfile permission to rwx for owner, re for group Effect: Add read permission Ex: chmod go=+r myfile for the owner and the group character meanings u-user, g-group, o-other, + add permission, - remove, r-read, w-write,x-exe Effect: Allow all users to Ex: chmod a +rwx myfile read, write or execute myfile Effect: Remove read Ex: chmod go -r myfile permission from the group and others chmod +s myfile - Setuid bit on the file which allows the program to run with user or group privileges of the file. chmod {a,u,g,o}{+,-}{r,w,x} (filenames) - The syntax of the chmod command.

chown chgrp cksum cp dd dir dircolors file

chown <owner1> <filename> Effect: Change ownership of a file to owner1. chgrp <group1> <filename> Effect: Change group. Perform a checksum and count bytes in a file. cp <source> <destination> Copy a file from one location to another. Convert and copy a file formatting according to the options. Disk or data duplication. List directory contents. Set colors up for ls. Determines file type. Also can tell type of library (a.out or ELF). Ex: find $Home –name readme Print search for readme starting at home and output full path. How to find files quickly using the find command: Ex: find ~ -name report3 –print
• • •

find

"~" = Search starting at the home directory and proceed through all its subdirectories "-name report3" = Search for a file named report3

install ln locate losetup

ls

"-print" = Output the full path to that file Copy multiple files and set attributes. Make links between files. File locating program that uses the slocate database. Loopback device setup. List files. Option -a, lists all, see man page "man ls" Ex: "ls Docum Projects/Linux" - The contents of the directories Docum and Projects/Linux are listed. To list the contents of every subdirectory using the ls command: 1. Change to your home directory.

mkdir mknod mktemp mv pathchk pwd

2. Type: ls -R Make a directory. Make a block or character special file. Make temporary filename. Move or rename a file. Syntax: mv <source> <destination> Ex: mv filename directoryname/newfilename Check whether filenames are valid or portable. Print or list the working directory with full path (present working directory).

rm rmdir slocate stat(1u) sum test touch update vdir whatis wheris which

Ex: "rm .*" - Effect: Delete system files (Remove files) –i is interactive option. rmdir <directory> - Remove a directory. The directory must be empty. Provides a secure way to index files and search for them. It builds a database of files on the system. Used to print out inode information on a file. Checksum and count the blocks in a file. Check file types and compare values. Change file timestamps to the current time. Make the file if it doesn't exist. Kernel daemon to flush dirty buffers back to disk. List directory contents. Search the whatis database for complete words. Locate the binary, source and man page files for a command. Show full path of commands where given commands reside.

File viewing and editing
ed emacs gitview head jed joe less more pico tail vi Editor Full screen editor. A hexadecimal or ASC file viewer. head linuxdoc.txt - Look at the first 10 lines of linuxdoc.txt. Editor Editor q-mandatory to exit, Used to view files. b-back q-quit h-help, Used to view files. Simple text editor. tail linuxdoc.txt - Look at the last 10 lines of linuxdoc.txt. Editor with a command mode and text mode. Starts in command mode.

File compression, backing up and restoring
ar bunzip2 bzcat bzip2 bzip2recover compress cpio dump Create modify and extract from archives. Newer file decompression program. Decompress files to stdout. Newer file compression program. Recovers data from damaged bzip2 files. Compress data. Can store files on tapes. to/from archives. Reads the filesystem directly.

gunzip gzexe gzip mt tar uncompress unzip zcat zcmp zdiff zforce zgrep zmore znew zip

unzip <file> - unzip a gz file. Compress executable files in place. gzip <file> - zip a file to a gz file. Control magnetic tape drive operation. Can store files on tapes. Usage: tar cvf <destination> <files/directories> - Archive copy groups of files Ex: tar /dev/fdo temp Effect: Copy temp to drive A: Expand data. unzip <file> - unzip a zip file. Files ending in ".gz" or ".zip" are compressed. Used to restore compressed files. Compare compressed files. Compare compressed files. Force a .gz extension on all gzip files. Search possibly compressed files for a regular expression. File filter for crt viewing of compressed text. Recompress .z files to .gz files. zip <file> - make a zip file.

Extra control and piping for files and other outputs
basename cat cmp colrm column comm csplit cut diff diff3 dirname echo egrep expand expr false fgrep fold Strip directory and suffix information from filenames. Ex: cat < filename --- Effect: put keyboard input into the file. CTRL-D to exit (end). Compare two files. Remove columns from a file. Columnate lists. Ex: comm file1 file2 --- Effect compare the contents of file1 and file2 produces 3 columns of output. Lines in the first file, lines in second file, lines in both files. Split a file into sections determined by context lines. Remove sections from each line of files. Show the differences between files. Ex: diff file1 file2 Find differences between 3 files. Strip the non-directory suffix from a filename. Display a line of text. Similar to grep -E, compatible with UNIX egrep. Convert tabs to spaces. Evaluate expressions. Do nothing. Exit with a status indicating failure. Same as grep -F. Wrap each input line to fit in specified width.

join grep hexdump logname look mkfifo nl od patch paste printf rev script sdiff sed sleep sort split strings tac tee tr true tsort ul unexpand uniq uudecode uuencode wc xargs yes

Join lines of two files in a common field. grep pattern filename. Ex: grep " R " --- Effect: Search for R with a space on each side Ex: ls –a |grep R --- Effect: List all files with an R in them or their info listing. asc, decimal, hex, octal dump. Print user's login name. Display lines beginning with a given string. Create named pipes with the given names. Write each file to standard output with line numbers added. Dump files in octal and other formats. Apply a diff file to an original. Combines from 2 or more files. Ex: paste file1 file 2 Print and format data. Reverses lines in a file. Make a typescript of a terminal session. Find differences between 2 files and merge interactively. A stream editor. Used to perform transformations on an input stream. Delay for a specified amount ot time. Sort a file alphabetically. Split a file into pieces. Print the strings of printable characters in files. Concatenate and print files in reverse. Read from standard input and write to standard output and files. Translate or delete characters. Do nothing. Exit with a status indicating success. Perform topological sort. Do underlining. Convert tabs to spaces. Remove duplicate lines from a sorted file. Used to transform files encoded by uuencode into their original form. Encode a binary file to be sent over a medium that doesn't support non-ASC data. Count lines, words, characters in a file. Ex: wc filename. Build and execute command lines from standard input. Output the string "y" until killed.

apropos help man man manpath info

apropos keyword - Show all commands with the keyword in their description. The same as the "man -k" command. Bash shell help for the bash builtin command list. The help command gets help for a particular command. Get help from the manual for a command. man -k keyword - Show all commands with the keyword in their description "man 2 kill" - Display page 2 of the kill command Determine user's searchpath for manpages. Documentation on Linux commands and programs similar to the man pages but navigation is organized different.

Linux Job Management
at atq atrm atrun batch cron nice nohup watch Similar to cron but run only once. Lists the user's pending jobs. If the user is the superuser, everybody's jobs are listed. Deletes at jobs. Run jobs queued for later execution Executes commands when system load levels drop below 0.8 or value specified in atrun invocation. A deamon used to set commands to be run at specific times. Starts the commands in the crontab file. Used to clean up temporary files periodically in the /var/tmp and /tmp directories. Run a program with modified scheduling priority. Run a command immune to hangups, with output to a nontty. Execute a program periodically showing output full screen.

Linux Process management
bg fg gitps jobs kill killall pidof ps Starts a suspended process in the background Starts a suspended process in the foreground A graphical process viewer and killer program. Lists the jobs running Ex: "kill 34" - Effect: Kill or stop the process with the process ID number 34. Kill processes by name. Can check for and restart processes. Find the process ID of a running program Get the status of one or more processes. Options:

u (more info)

• •

a (see all) -l (technical info)

Meanings:
• •

PPID-parent process ID PID-process ID

pstree sa skill snice top CTRL-C &

ps ax |more to see all processes including daemons Display the tree of running processes. Generates a summary of information about users' processes that are stored in the /var/log/pacct file. Report process status. Report process status. Display the processes that are using the most CPU resources. Kills the current job. At the end of the command makes it run in the background.

dnsdomainname domainname hostname nisdomainname nodename ypdomainname

Show the systems DNS domain name Show or set the systems domain name Used to show or set the name of your machine for networking Show or set systems NIS/YP domain name Show or set the systems DECnet node name Show or set the system's NIS/YP domain name

Network setup and commands
arp dig(1) finger ftp ifconfig This program lets the user read or modify their arp cache. Send domain name query packets to name servers for debugging or testing. Display information about the system users. File transfer program. Configure a network interface.

ifdown ifup ipchains netconf netconfig netstat nslookup pftp ping portmap rarp rcp rexec ripquery rlogin route rsh rup ruptime rwhod showmount tcpd tcpdchk tcpdump tcpdmatch

Shutdown a network interface. Brings a network interface up. Ex: ifup eth0 IP firewall administration used to set input, forward, and output rules. A GUI interactive program to let you configure a network on Redhat systems. Another GUI step by step network configuration program. Displays information about the systems network connections, including port connections, routing tables, and more. The command "netstar -r" will display the routing table. Used to query DNS servers for information about hosts. Same as ftp. Send ICMP ECHO_REQUEST packets to network hosts. DARPA port to RPC program number mapper. Must be running to make RPC calls. Manipulate the system's RARP table. Remote file copy. Copies files between two machines. Remote execution client for an exec server. The host uses the rexecd server. Query RIP gateways. Request all routes known by an RIP gateway by sending an RIP request. Starts a terminal session on a remote host. Show or manipulate the IP routing table. Executes command on remote host. Displays summary of current system status of a remote host or all hosts on the network. Show host status of local machines. System status server, maintains database used by rwho and ruptime. Show mount information for an NFS server. Access control facility for internet services. Can be set up to monitor requests for Telnet, finger, ftp, exec, rsh, rlogin, tftp, talk, comsat. It filters access for these requests. Tcp wrapper configuration checker. Dump traffic on a network. Prints out headers of packets that match the boolean expression. Predicts how the tcp wrapper will handle a specific request for a service.

Telnet traceroute ipx_configure ncpmount nprint pqlist pserver slist

User interface to the TELNET protocol, setting up a remote console session. Print the route that packets take to the specified network host. Tool to setup Netware access. Netware filesystem mounting program. Novell print command. Netware printer list for a given server. Netware print server. Netware server list.

Communications commands (includes mail)
biff comsat expire elm ftp mailx metasend nn pine sendmail smail talk telnet tin write Notifies the system if mail arrives and who it is from. Biff server to receive reports of incoming mail. Used to purge old news articles. Electronic mail. File transfer protocol. Berkley mail program. Interface for sending non-text mail. Net news. Program for internet news and e-mail, Can send documents, graphics, local & remote messages. A popular Unix, Linux mail message transfer agent. A popular mail message transfer agent which is easier to set up than sendmail. Lets two parties talk simultaneously. Allows a user to have a login session across a network on a remote host. Net news reader. Allows users to directly interact with other users via terminal number (one way at a time).

Environment
env export printenv Show all environment variables. Set the value of a variable so it is visible to all subprocesses that belong to the current shell. Print all or part of environment.

reset set

Restores runtime parameters for session to default values. Shows how the environment is set up. This is a builtin bash command.

Library management
ldconfig ldd ltrace trace Updates the necessary links for the run time link bindings. Tells what libraries a given program needs to run. A library call tracer. Same as ltrace.

Module and kernel management
depmod dmesg genksyms insmod lsmod modprobe rmmod Handle loadable modules automatically. Creates a makefile-like dependency file. Print or control the kernel ring buffer. This shows the last kernel startup messages. Generate symbol version information. Install loadable kernel module. List currently installed kernel modules. Used to load a set of modules that are marked with a specified tag. Unload loadable modules.

Runtime level management
exit halt init initscript logout poweroff reboot runlevel setsid shutdown telinit Terminates the shell. Stop the system. Process control initialization. Script that executes inittab commands. Log the user off the system. Brings the system down. Reboot the system. List the current and previous runlevel. Run a program in a new session. If your system has many users, use the command "shutdown -h +time message", where time is the time in minutes until the system is halted, and message is a short explanation of why the system is shutting down. # shutdown -h +10 'We will install a new disk. System should be back on-line in three hours.' By requesting run level 1 a system can be taken to single user mode.

System Configuration tools

ctrlaltdel isapnp kbdconf kbdrate kernelcfg linuxconf lspci mesg mouseconfig ndc Printtool quota quotacheck quotaoff quotaon samba setpci setserial setterm setup stty swapon swapoff timeconfig tset

Set the function of the ctrl alt del combination. Configure ISA plug and play devices. A Redhat Linux tool which configures the /etc/sysconfig/keyboard file which specifies the location of the keyboard map file. This is a GUI based tool. Set the keyboard repeat rate and delay time. A Redhat GUI kernel configuration tool, Start X, then run it from a console session. Redhat's GUI linux system configuration tool. List all pci devices. Control write access to your terminal. A Redhat Linux tool used to configure the /etc/sysconfig.mouse file. This is a GUI tool. Script file used to restart, stop, start the DNS server. Redhat's GUI printer configuration tool. Display disk usage and limits. Scan a filesystem for disk usages. Turn file system quotas off. Turn file system quotas on. Script file used to stop, start, restart samba services when not run using inetd. Configure pci devices. Set/get serial port information. Set terminal attributes. Set up devices and file systems. Used to configure and print the console devices. Enable devices and files for paging and swapping. Disable devices and files for paging and swapping. A Redhat Linux tool used to configure the /etc/sysconfig/clock file. This is a GUI tool used to set timezone and whether or not the clock is set to GMT time. Used to initialize terminals.

System Information
arch df du free ipcrm ipcs lsdev lsof Print machine architecture. Shows disk free space. Shows disk usage. Display used and free memory on the system. Provide information on ipc facilities. Same as ipcrm. Display information about installed hardware via files in the /proc directory. List open files.

lspci pnpdump procinfo pstree runlevel strace stty tload tty uname vmstat xcpustate

List PCI devices . Lists ISA plug and play devices resource information. Display system status gathered from proc. Display a tree of processes. Find the current and previous system runlevel. Trace ssytem calls and signals for a binary program. Change and print terminal line settings. Prints a graphic representation of the system load average. Print the filename of the terminal connected to standard input. Print system information, Prints Linux. Report virtual memory statistics. Displays CPU states (idle, nice, system, kernel) statistics. Runs in X?

System Logging
klogd logger syslogd sysklogd Kernel log daemon which intercepts and logs Linux kernel messages. Make entries in the system log. Linux system logging utilities. Linux system logging utilities.

System Security System time
cal clock date hwclock timed timedc tzset uptime zdump zic Calendar. Used to change or get current time. The command "clock -–w" sets the hardware clock. Print or set the system date and time. Set or read the hardware CMOS clock. Time server daemon to synchronize the host's time with other machines, normally invoked at boot time from the rc(8) file. Timed control program. Used to change the users private time zone by setting the TZ environment variable. Reports how long the system has been running. Prints the current time in each zonename named on the command line. Reads text from files named on the command line and creates time conversion files.

X Management and programs
SuperProbe Xconfigurator Probe video hardware. The Redhat tool used during system setup to configure X.

xconsole xf86config XF86Setup xvidtune

Displays messages usually sent to /dev/console. Older version of XF86Setup. A newer X configuration program with a GUI interface which modifies the "/etc/X11/XF86Config" configuration file. This program will test video modes on the fly without modification to your X configuration. Read the usr/X11R6/lib/X11/doc/VideoModes.doc file before running this program.

Linux User Management
ac accton adduser chage chfn chgrp chown chpasswd chroot chsh edquota faillog finger gpasswd groupadd grpck grpconv grpunconv groupdel groupmod groups id last Print statistics about users' connect time. Turn on accounting of processes. To turn it on type "accton /var/log/pacct". Ex: adduser mark - Effect: Adds a user to the system named mark Used to change the time the user's password will expire. Change the user full name field finger information Changes the group ownership of files. Change the owner of file(s ) to another user. Update password file in batch. Run command or interactive shell with special root directory. Change the login shell. Used to edit user or group quotas. This program uses the vi editor to edit the quota.user and quota.group files. If the environment variable EDITOR is set to emacs, the emacs editor will be used. Type "export EDITOR=emacs" to set that variable. Examine faillog and set login failure limits. See what users are running on a system. Administer the /etc/group file. Create a new group. Verify the integrity of group files. Creates /etc/gshadow from the file /etc/group which converts to shadow passwords. Uses the files /etc/passwd and /etc/shadow to create /etc/passwd, then deletes /etc/shadow which converts from shadow passwords. Delete a group. Modify a group. Print the groups a user is in Print real and effective user id and group ids. Display the last users logged on and how long.

lastb lastcomm lastlog logname newgrp newusers passwd pwck pwconv quota quotaoff quotaon quotacheck repquota sa smbclient smbmount smbpasswd su sulogin ulimit useradd userdel usermod users utmpdump vigr vipw w wall who whoami

Shows failed login attempts. This command requires the file /var/log/btmp to exist in order to work. Type "touch /var/log/btmp" to begin logging to this file. Display information about previous commands in reverse order. Works only if process accounting is on. Formats and prints the contents of the last login. Print user's login name. Lets a suer log in to a new group. Update and create newusers in batch. Set a user's pass word. Verify integrity of password files. Convert to and from shadow passwords and groups. Display users' limits and current disk usage. Turns system quotas off. Turns system quotas on. Used to check a filesystem for usage, and update the quota.user file. Lists a summary of quota information on filesystems. Generates a summary of information about users' processes that are stored in the /var/log/pacct file. Works similar to an ftp client enabling the user to transfer files to and from a windows based computer. Allows a shared directory on a windows machine to be mounted on the Linux machine. Program to change users passwords for samba. Ex: su mark - Effect: changes the user to mark, If not root will need marks password. Single user login. A bash builtin command for setting the processes a user can run. Create a new user or update default new user information. Delete a user account and related files. Modify a user account. Print the user names of users currently logged in. Used for debugging. Edit the password or group files. Edit the password or group files. Display users logged in and what they are doing. Send a message to everybody's terminal. Display the users logged in. Print effective user id.

Linux Printing and Programming
Linux Printing
banner lpr lpc lpq lprm gs pr tunelp Print a large banner on printer. Print, submits a job to the printer. Ex: lpr -Pdest filename. Dest is the destination printer. the name of the file to print is filename. Lets you check the status of the printer and set its state. Shows the contents of a spool directory for a given printer. Removes a job from the printer queue. Ghostscript - A PostScript interpreter. Print a file. Ex: pr filename |pg. Set various parameters for the lp device.

Linux Programming
as86 awk bc cproto ctags dialog egcs f2c gawk gcc gdb gprof igawk indent ld ld86 make nm objcopy objdump Assembler C programming language - allows finding of lines with specific characters. A precision calculator language. Reads in c source files and generates function prototypes for all the functions. Generate tag (index) files for source code. Display dialog boxes from shell scripts. GNU project C and C++ compiler. Converts fortran code to c code. Pattern scanning and processing language. GNU's implementation of awk. GNU c and c++ compiler. -g Produce debugging information. Generate profile info that will allow the gprof program to display -pg timing info. Debugging program. In /usr/bin, allows you to tell where most of the execution time is spent in a program. Gawk with include files. Reformats c source code for consistent indenting and opening and closing brackets consistent. The GNU linker. Linker for as86. GNU make utility to maintain a group of programs. Lists symbols from object files. Copy and translate object files. Display information from object files.

p2c prompt size strip xxgdb

Converts pascal code to c code. set prompt = "waldo" (in C shell) ps1 = 'waldo' (in BOURNE shell) PS1="[\u@\h \w]\\$ " makes prompt = [username@hostname current directory] see the BASH or your shell's man page for more information. List section sizes and total size. Discard symbols from object files. X windows based graphical user interface to gdb.

Scripting Languages
Perl Python Tcl info Tk A command interpreter for the Practical Extraction and Report Language (perl). A report language. Tool command language shell. Enter by typing tclsh. Return information about the state of the Tcl interpreter. A graphical user extension to Tcl based on X windows. Commands are same as Tcl.

Linux Document Preparation
addftinfo afmtodit colcrt enscript eqn geqn git gitaction gitkeys gitmount gitps gitrgrep gitunpack gitview grodvi groff Add information to troff font files for use with groff. Create font files for use with groff. Filter nroff output for CRT previewing. Convert text files to postscript. Format equations for troff. Compiles descriptions of equations embedded in troff. Used to print special symbols and complex equations. Not user friendly. GNU interactive tools. Per file type action script. Display key sequence utility. Allows any block device to be mounted. A graphical process viewer and killer program. A recursive grep program. Used to unpack archive files in a given directory. A hexadecimal or ASC file viewer. Convert Groff output to TeX dvi format, normally run by groff. Used as a front end for the groff document formatting system.

grops gtbl hpftodit indxbib lookbib nroff pfbtops pic psbb refer rpm2html soelim tbl TeX texi2html tfmtodit troff yacc

Postscript driver for groff. invoked by groff. Used to prepare charts, multicolumn lists and tabular formats. Create font description files for use with groff. Make inverted index for bibliographic databases. Search bibliographic databases. Emulate nroff command with groff. Translate a postscript font in .pbf format to ASCII. Compile pictures for troff or Tex. Extract bounding box from postscript document. Preprocess bibliographic references for groff. Make an html database from rpm repository. Interpret .so requests in groff input. Format tables for groff. Used to format professionally typeset documents (Chapters, Headings, and paragraphs). Texinfo to html converter. Create font files for use with groff. Formats documents as part of the groff document formatting system. A parser generator.

Miscellaneous Linux Commands
Keys and keycodes and console
dumpkeys getkeycodes lesskey loadkeys psfaddtable psfgettable psfstriptable resizecons setkeycodes Dump keyboard translation tables. Print kernel scancode-to-keycode mapping table. Specify key bindings for less. Load keyboard translation tables. Add a unicode character table to a console font. Extract the embedded Unicode character table from a console font. Remove the embedded Unicode character table from a console font. Change kernel idea of the console size. Load kernel scancode-to-keycode mapping table.

Ncurses functions
captoinfo clear infocmp reset tie toe tput tset Convert a termcap description into a terminfo description. Clear the terminal screen. Compare or print out terminfo descriptions. Restore run-time parameters for session to default values. Merge or apply WEB change files. Table of terminfo entries. Initialize a terminal or query terminfo database. Terminal initialization.

CD programs
cdparanoia cdrecord An audio CD reading utility. Record audio or data compact Disks from a master.

Other
alias bison chvt crack cvs deallocvt dumpkeys Ex:: alias dir='ls -a' - Effect: Makes dir list all files (no spaces next to the = sign). GNU project parser generator. Change foreground virtual terminal. Program used to find bad passwords or crack security. Concurrent Versions System. Gets rid of unused virtual terminals. Dump keyboard translation tables.

fc gdbm gpm history lilo mc nc pdksh pilot PS1="Please enter a command" PS2="I need more information" rcs sash screen sleep tcsh unalias units variables zsh ttysnoop

Fix command. Used to edit the commands in the current history list. The GNU database manager. A cut and paste mouse server. Show commands listed in the shell history (last n). Boot management program. Visual shell for Unix like system. A file manager. A file manager. Public domain Korn shell. Filesystem browser. Set Bash level 1 response. Set Bash level 2 response. Recision Control system. Change RCS file attributes. Standalone shell with built in commands. Screen manager with VT100 terminal emulation. Ex: "sleep 2" - wait 2 seconds. C shell with filename completion and command line editing. Ex: "unalias dir" - Effect: Removes the alias dir. Unit conversion program. • set - Ex: set t=/temp • unset - Ex: unset t
• echo - Ex: echo $t The Z shell. A program that comes with some systems that lets the administrator to snoop on the user's terminals.

Sign up to vote on this title
UsefulNot useful