Sunteți pe pagina 1din 4

Quick Reference: Unix Commands

1/27/14, 4:28 PM

Search | Directories | Reference Tools UW Home > Discover UW > IT Connect > Unix

Quick Reference: Unix Commands


Commonly used commands and options on Unix computers.
The following format is used for commands: Italic indicates a variable that you supply Bold indicates exactly what you type To display a command description from the Unix Manual: man command A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z

Command
alias To remove an alias: ansiprint assets bg cat cd

Action
Creates a temporary name for a Unix command.

Example
alias name command unalias name ansiprint le

Prints a le to a printer connected to your computer. Displays your account resources, use, and threshold. Places a suspended job in the background. Displays a specied le. Changes current directory to a different directory. To change back to your home directory: Directory abbreviations: ~ Home directory .. Parent directory . Current working directory

cat le cd directory cd

chmod

Changes permission status for a le or directory. To keep a le private: To give everyone read permission:

chmod code le chmod code directory chmod 600 le chmod 664 le compress le uncompress le.Z
Page 1 of 4

compress

Reduces the size of a le and adds .Z to the le's name. To restore a compressed le:

http://www.washington.edu/computing/unix/unixqr.html

Quick Reference: Unix Commands

1/27/14, 4:28 PM

cp

Makes a copy of a le. To copy a le into a different directory: To inquire before overwriting an existing le:

cp le1 le2 cp le directory cp -i le1 le2

diff fg nger

Compares two les and displays the differences. Restarts a suspended job in the foreground. Displays user information at the specied computer. To change your nger entry information: nger userid@computer chfn ftp address grep -icvn pattern le

ftp grep

Starts the le transfer program with a remote computer. Finds lines in a le matching a character pattern. -i Ignores case -c Lists count of lines that contain pattern -v Lists all lines except those with pattern -n Lists line number for each found pattern

head

Displays the rst ten lines of a le. To display the rst n number of lines:

head le head -n le help note help -l history ! n !! jobs job & fg %number <Control>z bg kill pid kill -9 pid

help

Displays an online help note. To display a list of help notes:

history

Displays a list of your most recent commands. To repeat the nth command from the list: To repeat your most recent command:

jobs

Displays active jobs and their corresponding job numbers. To start a job in the background: To return a job to the foreground by the job number: To send a running job to the background:

kill

Terminates a process by its process identication number. To use the strongest form of the kill command:

logout ls

Ends your computer session. Lists the les and subdirectories in your current directory. -l Lists long format -t Lists by modication time -r Lists in reverse order -F Lists le type with special character -a Lists all les including dot (.) les ls -Fltra

http://www.washington.edu/computing/unix/unixqr.html

Page 2 of 4

Quick Reference: Unix Commands

1/27/14, 4:28 PM

lynx

Starts a text-only Web browser session Starts a Web browser session at a specic Web address.

lynx lynx url man command man -k keyword mesg mesg y (or n) mkdir directory more le

man

Displays Unix Manual entry for a command. To search Manual Index for a keyword or topic:

mesg

Displays your talk and write message access status. To set your message status to yes or no:

mkdir more

Creates a new directory within your current directory. Displays a le one screen at a time. Use <Spacebar> to scroll forward and q to quit.

mv

Moves a le to a different directory. Moves a directory to a second directory. To rename le1 as le2: To rename directory1 as directory2: To inquire before overwriting an existing le:

mv le directory mv directory1 directory2 mv le1 le2 mv directory1 directory2 mv -i le1 le2

passwd pico pine ps pwd rm

Starts program to change account password. Starts the Pico text editor with a le. Starts the Pine electronic mail program. Displays processes and their corresponding process identication numbers. Displays absolute pathname of current directory. Permanently deletes a le. To verify prior to removal: rm le rm -i le rmdir directory rmdir -i directory spell le telnet address vi le pico le

rmdir

Deletes an empty directory. To verify prior to removal:

spell telnet vi w wc

Checks the spelling in a le. Starts a telnet session with a remote computer. Starts the vi text editor with a le. Displays a list of who is on system. Counts lines, words, and characters in a le.

wc le

Special commands and characters:


Redirection < Routes input to command from le

http://www.washington.edu/computing/unix/unixqr.html

Page 3 of 4

Quick Reference: Unix Commands

1/27/14, 4:28 PM

> >> |

Routes output from command to le Appends output to existing le Routes output between commands

Wildcards used in lenames * ? Matches any number of characters Matches one character

Control codes <Control>s <Control>q <Control>d <Control>c <Control>z <Control>u Suspends the screen display Restarts suspended display Signals end of le Cancels a command Suspends a process or job: use fg to restart Clears the command line

UW Information Technology help@uw.edu Modified: May 6, 2010 Privacy Terms

http://www.washington.edu/computing/unix/unixqr.html

Page 4 of 4

S-ar putea să vă placă și