-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- [Back] [Bottom] [Index] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- UNIX Quick Reference - A partial list of useful commands By Michael Walden 2014/01/10 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The following information has been collected over the years, starting in 1989. This began when I started using various shell accounts to gain access to the Internet. I initially used shell accounts on an AT&T 3B1 (7300) Unix PC and then Sun SPARC based systems. Later, other system types followed. So, not all of the following will apply to your system. There have been no updates to cover the latest Linux specific commands. I may add Linux commands in the future. ************ HELP man - VERY HANDY! I suggest you use this to get the help info & syntax on all of the other commands. Syntax is man command [enter] whatis - Display a one-line summary about a keyword (whatis ls) apropos - Locate commands by keyword lookup info - GNU's hypertext system help - Display the shell's help ************ INTERNET / NETWORK telnet - User interface to a remote system ftp - File transfer program (binary, ascii, get) lftp - Sophisticated ftp program ncftp - Anonymous oriented file transfer program (lookup, !ls) archie - File locater (prog ____, set search sub, set search exact) gopher - Connect to gopher document server lynx - WWW text browser irc - Internet relay chat (irc.duq.edu) rlogin - Remote login talk - Talk to another user finger - Display information about users whois - TCP/IP internet user name directory service ping - Send ICMP ECHO_REQUEST packets to network hosts uucp - System to system copy nslookup - Query Internet domain name servers. host - look up host names using domain server traceroute - Print the route packets take to network host ************ MAIL / NEWS elm - An interactive mail reader mail - Runs the mail program, lets you send mail to other users tin - An interactive news reader (rtin, cdtin, tind) pine - An interactive news AND mail reader (OLD) alpine - An interactive news AND mail reader (NEW) slrn - An easy to use NNTP based newsreader mutt - The Mutt Mail User Agent rn,rrn - Read news trn,trrn - Threaded read news program newsgroups - A program to list unsubscribed newsgroups uuencode - Encode a binary file into text uudecode - Decode a text file into binary ************ FILE TRANSFER kermit - Kermit file transfer protocol rz - Receive a file using the zmodem file transfer protocol sz - Send a file using the zmodem file transfer protocol sz -w 2048 - Send a file using zmodem with a 2048 byte window size (Faster) ************ FILE ENCRYPTION pgp - Pretty Good Privacy encryption system ************ FILE COMPRESSION compress - Compress a file uncompress - Uncompress a file tar - Create tape archives, and add or extract files gzip - GNU zip gunzip - GNU un-zip gzexe - Compress executables zcmp - Compressed file compare zdiff - Compressed file diff zmore - Compressed file more zcat - Compressed file cat zgrep - Compressed file grep znew - Recompress .z files to .gz files ************ SHELL echo $SHELL- Display current shell name in environment variable SHELL sh - Bourne shell csh - C shell ksh - Korn shell bash - GNU Bourne-Again SHell tcsh - C shell with filename completion and command line editing alias - Create/display alias names for commands (alias dir="ls -lF") unalias - Remove an alias name for commands (unalias rm) listalias - List user and system aliases checkalias - Check to see if an alias is defined newalias - Install new aliases for user and/or system elmalias - Expand and display elm address aliases ************ DATE / TIME cal - Display the current months calendar date - Gives date AND time (2 for one, not like DOS) ************ TERMINAL stty - Set or alter the options for a terminal clear - Clear the terminal screen (Like DOS CLS command) tput clear - Clear the terminal screen (Like DOS CLS command) banner - Display a string in big letters ************ FILE / DIRECTORY MANAGEMENT ls - Lists files, directories, etc. (ls -sail) cd - Works like DOS, typed by itself will return you to your home dir pwd - Print working directory - tells where in a file system you are mkdir - Create a directory - can not be abbreviated rmdir - Removes directories - again be careful rm - Removes files - use with caution rename - Renames a file cp - Copies a file, directory from one place to another mv - Move a file from one place to another - not the same as copy mv - Also renames a file (mv fname fname.new) file - Tells what kind of a file it is, text, binary, etc. find - Looks for specified files - like Norton file find whereis - Locate the binary, source, and man page for a command which - Show the path of a command (e.g. which ls -> /bin/ls) ln - (link) Make a file appear under two different names lk - Link editor umask - Set the default permission for new file creation (umask 077) chmod - Change the permission settings (read, write, execute) on a file chown - Change the ownership of a file chgrp - Change the group associated with a file touch - Update the access and modification times of an existing file touch - Create a new empty (zero byte) file ************ TEXT FILE VIEWERS cat - Looks at a file raw, no pause like in more (cat /etc/motd) more - Shows a file n lines at a time, n being set in env file less - Opposite of more - allows backward movement page - Same as more, effectively head - Looks at the first n lines of a file tail - Looks at the last n lines of a file ************ TEXT FILE EDITORS pico - Editor (OLD) nano - Editor (NEW) ed - Editor emacs - Editor e - Line editor ex - Line editor edit - Line editor view - Visual display editor vi - Visual display editor vedit - Visual display editor ************ TEXT FILE UTILITIES ispell - Interactive spelling checking spell - Report spelling errors expand - Expand tab characters to spaces in a text file unexpand - Unexpand spaces to tab characters in a text file grep - Search a file for a pattern egrep - Search a file for a pattern using full regular expression fgrep - Search a file for a fixed-character string cut - Remove sections from each line of files wc - Display a count of lines, words and characters cmp - Perform a byte-by-byte comparison of two files sort - Sort lines of text files comm - Display lines in common / not in common, between two sorted lists diff - Display line-by-line differences between pairs of text files uniq - Remove or report adjacent duplicate lines tr - Translate characters sum - Display 16-bit checksum and count the blocks in a file awk - Pattern scanning and processing language sed - Stream editor ************ PRINTING lp - Send to a line printer lprm - Remove jobs from a line printer queue ************ COMPILERS gcc - GNU C and C++ compiler g++ - GNU C++ compiler cc - C compiler ************ SYSTEM STATUS / USER w - Who is logged in, and what are they doing who - Shows who is logged in - TTYs are Xwindow terms, others dial-in who am i - Display your hostname, login name, terminal name, and login time. whoami - Display the effective current username hostname - Display the system's host name users - Display a compact list of users logged in last - Shows last logins by user or terminal netstat - Shows network status passwd - Changes your password lastcomm - Show LAST COMMands executed, in reverse order tty - Shows current terminal name uptime - Show how long the system has been up groups - Display a user's group membership quota -v - Display a user's disk quota and usage df - Shows filesystems mounted and how much disk space is used/free du - Shows disk usage for specified directory uname -a - Display the name of the current system and OS version ************ PROCESSES ps - Shows the status of current processes, etc depending on options cmd & - Following a command with '&' runs it in the background screen - (virtual) Screen manager with VT100/ANSI terminal emulation nohup cmd - Run a command immune to hangups and quits cron - Clock daemon, executes commands at specified dates and times at/batch - Execute a command or script at a specified time. sleep - Suspend execution for a specified interval atq - Displays the queue of jobs to be run at specified times atrm - Remove jobs spooled by 'at' or 'batch' jobs -l - List the active jobs under job control. kill - Terminate a process (use kill -9 PID to Immediately kill a PID) nice - Run a command at low priority leave - Remind you when you have to leave (alarm program) exec cmd - Execute command in place of the current shell, which terminates. login - Log in to the system logout - End current session/hangup (may be exit) exit - End current session/hangup -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- DOS to UNIX Command Translations A quick reference for users of DOS who are moving to UNIX. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- DOS UNIX --- ---- HELP man, whatis, apropos, info DIR ls -alF ls -sail DIR/W ls -f ls -F ls -elf RENAME, REN mv ERASE, DEL rm TYPE cat TYPE filename | MORE more filename COPY cp MOVE mv DATE, TIME date, cal VER uname -a CHDIR, CD pwd CHDIR, CD \ cd CHDIR, CD .. cd .. CHDIR, CD path cd path MKDIR, MD mkdir RMDIR, RD rmdir VERIFY=ON sum PROMPT $p$g PS1=\$PWD\> PROMPT $p$g set prompt="\n%n %~\n%m # " CLS clear ATTRIB chmod (Roughly equivalent) ATTRIB +r filename chmod -w filename ATTRIB -r filename chmod +w filename HELP man SORT sort TREE ls -r MODE stty FIND grep, fgrep EDLIN ed PRINT lp, lpr, lpq EDIT edit COMP cmp, diff CHKDSK df -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Set File Permissions - Text method -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- drwxrwxrwx |||||||||| |||||||||+----[O]ther may e[X]ecute the file \ ||||||||+-----[O]ther may [W]rite to the file \ |||||||+------[O]ther may [R]ead the file \ ||||||+-------The [G]roup may e[X]ecute the file \ |||||+--------The [G]roup may [W]rite to the file > [A]ll Groups ||||+---------The [G]roup may [R]ead the file / |||+----------The [U]ser may e[X]ecute the file / ||+-----------The [U]ser may [W]rite to the file / |+------------The [U]ser may [R]ead the file / +-------------'d' = This entry is a Directory '-' = This entry is a normal file (hyphen) 'l' = This entry is a symbolic link (ell) Note: '+' and '-' are used with 'X','W', and 'R' Examples: chmod +x filename (Add EXECUTE attribute to filename) chmod -w filename (Remove WRITE attribute from filename) chmod u-w filename (Removes WRITE attribute from USER (the owner)) chmod go-r filename (Remove READ attribute from GROUP and OTHER) chmod go+r filename.html (Add READ attribute to GROUP and OTHER) chmod go+w filename (Add WRITE attribute to GROUP and OTHER) chmod go+x public_html/ (Add EXECUTE attribute to GROUP and OTHER) chmod go+rx picture.jpg (Add READ & EXECUTE attribute to GROUP and OTHER) chmod a+x ~/public_html (This will allow ALL people to enter that directory) chmod a+r ~/public_html/* (To make the files viewable by ALL) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Set File Permissions - Octal method -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Permission drwxrwxrwx r w x Octal |\./\./\./ ----- ----- | | | | - - - 0 | | | +- [O]ther Permission -> - - x 1 | | +---- [G]roup Permission -> - w - 2 | +------- [U]ser Permission -> - w x 3 +--------- See 'Text method' above r - - 4 r - x 5 r w - 6 r w x 7 Examples: UGO UUUGGGOOO chmod 700 ~ -> Private rwx------ (For me) chmod 700 .??* -> Private rwx------ chmod 700 * -> Private rwx------ chmod 755 * -> Public rwxr-xr-x (For the world) chmod 777 * -> Public rwxrwxrwx -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- [Back] [Top] [Index] [Contact Michael Walden] [Validates as HTML 4.01 Transitional] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- [EOF]