Common Unix CommandsGeneral Syntax: | |||
| Cmd | Syntax | Examples | Description |
|---|---|---|---|
| pwd | pwd |
$ pwd |
Print the current working directory |
| ls | ls <directory> |
$ ls |
List contents of a directory |
| cd | cd |
$ cd ../private/files |
Change current working directory |
| man | man <command name> |
$ man ls |
Get manual page for command |
| cp | cp <src path> <destination path> |
$ cp file1.txt public/cs110/ |
Copy a File |
| mv | mv <src path> <destination path> |
$ mv file2.txt textfile.txt |
Move or Rename a file |
| rm | rm <path> |
$ rm public/html/hello.html |
Delete a file |
| mkdir | mkdir <path to create> |
$ mkdir cs110 |
Create a directory |
| rmdir | rmdir <path> |
$ rmdir /afs/pitt.edu/home/x/x/xxx99/cs110 |
Remove a directory |
| echo | echo <src path> |
$ echo "A line of text" |
Print text to the terminal |
| ln | ln <src path> <destination path> |
$ ln file.txt ../public/file.txt |
link file to another path (with -s option, it creates a shortcut) |
| who | who |
$ who |
Display other users currently logged into the system |
| finger | finger <search criteria> |
$ finger xxx99 |
Search user information |
| cat | cat <path1> <path2> ... |
$ cat file1.txt file2.txt file3.txt |
Concatenate files |
| less | less <path> |
$ less file1.txt |
Display a file (or any output) one screen at a time with scrolling |
| more | more <path> |
$ more file2.txt |
Display a file (or any output) one screen at a time |
| find | find <path> <option1> <arg1> <opt2> <arg2> ... |
$ find ~/public -name "*.txt" |
Search for files |
| grep | grep <search criteria> <path or files> |
$ grep "<html>" ~/public/html |
Search contents of files |
| chmod | chmod <new permissions> <path> |
$ chmod 0777 file.txt |
Change file permissions (Unix only) |
| fs | fs <subcommand> <args> |
$ fs lq |
AFS utility (file permissions on AFS) |
| script | script <path> |
$ script typescript.txt |
Begin recording keystrokes to a file |
| lpr | lpr <path> |
$ lpr file.txt |
Send afile to a printer |
| zip | zip <destination path> <file1> <file2> ... |
$ zip files.zip file1.txt file2.txt file3.txt |
Create a ZIP archive |
| unzip | unzip <path> |
$ unzip files.zip |
Extract files from a ZIP archive |
| telnet | telnet <address> |
$ telnet unixs.cis.pitt.edu |
connect to a remote system |
| ssh | ssh <address> |
$ ssh unixs.cis.pitt.edu |
connect to a remote system (securely) |
| ftp | ftp <address> |
$ ftp unixs.cis.pitt.edu |
file transfer utility |
| env | env |
$ env |
Display shell environment variables |