The Unix operating system supports many commands. To review a more complete definition of any of the commands listed below, type man command at the Unix shell prompt (%), where you have replaced command with the name of a Unix command. For example, type man exit to find out more about the exit command.
Note This document assumes you are using Unix on the ITS Login Service (host name login.itd.umich.edu). These instructions apply to many other Unix machines; however, you may notice different behavior if you are not using the ITS Login Service.
Tip The variable files refers to a list of any number of files separated by white space; in the same way; names refers to a list of file or directory names separated by white space.
- apropos command
- Locates commands by keyword lookup.
- Terminates your current session, or shell.
- man command
- Displays the Unix manual page describing a given Unix command.
File System Navigation
- Returns to your home directory.
- cd directory
- Changes directory to make directory your current directory.
- file files
- Determines file type.
- Lists the contents of the current directory.
- ls names
- Lists the contents of the directories; names can name files and/or directories:
- ls -l
- . . . in a long format, showing permissions, owner, size, and other file info.
- ls -a
- . . . all files, including "hidden" files (file names that begin with a dot ".").
- ls -R
- . . . Recursively, for all subdirectories.
- ls -t
- . . . in time order (when modified, newest to oldest) rather than in name order.
- Displays the name of the current directory, or "print working directory."
- compress files
- Reduces the size of a file.
- uncompress files
- Restores compressed files to their original form.
- cp file1 file2
- Copies file(s).
- cp files directory
- Copies file(s) into a directory.
- cp -r dir1 dir2
- Copies a directory and, recursively, its subdirectories.
- mkdir directory
- Creates, or "make" a directory.
- mv file1 file2
- Moves a file or, if file1 and file2 are in the same directory, rename a file.
- mv files directory
- Moves files into a directory.
- mv dir1 dir2
- If directory dir2 exists, moves dir1 into dir2; otherwise, rename dir1 as dir2.
- rm files
- Removes (erase) file(s).
- rm -r names
- Removes files, directories, and recursively, any subdirectories.
- rmdir directory
- Removes directory (directory must be empty).
- cat files
- Concatenates file(s); you can use cat to display the contents of a file (this is not advisable if the file is a binary file).
- grep "pattern" files
- Displays all lines in the files that match a pattern.
- more files
- Displays contents of files one screen at a time.
- sort files
- Orders the lines in a file or files alphabetically (this command does not alter the file or files -- it merely displays the sorted output to the screen):
- sort -r files
- . . . in reverse order.
- sort -n files
- . . . numerically (puts 2 before 10 instead of after).
- ssh hostname
- Connects to a remote host using Secure Shell.
- Repeats last shell command.
- Repeats last shell command that began with string (for example, type "!m" to repeat the last command that began with "m").
- Displays a calendar of the current month.
- cal month year
- Displays a calendar of the given month and year. Note that the year must be fully qualified, for example, "2003" and not "03."
- Clears terminal screen.
- Displays the current local date and time.
- Displays a list of users currently logged in.