Table of Contents
Unix has many commands for manipulating and organizing files and for finding
out interesting things about the system and its users. Some of these commands
are listed below. Remember that Unix commands are case sensitive and most of
them are lower-case. Use the 'man' command for more details about each command.
Note that some of these commands may not work with all shells.
File Manipulation Commands
- cp:
- Copies a file from one file or directory to another.
e.g. cp /usr/local/software.txt myfile.txt
- mv:
- Moves and/or renames a file, e.g. mv myfile newfile
- more:
- Displays the contents of a file in screenfuls, e.g. more newfile
- rm:
- Removes a file, e.g. rm -i newfile
- lpr:
- Prints a file on the default printer,
e.g. lpr myfile.txt
- lpq:
- Displays the status of all print jobs you started.
- lprm:
- Removes print jobs which you want to cancel.
- chmod:
- Changes the protection on a file or directory. For more
information type man chmod
- pico, emacs, vi:
- These are three of the many text editors available to
create and change files. We recommend pico for inexperienced users.
Directory Manipulation Commands
- ls:
- List what files are available, e.g. ls -al
- mkdir:
- Create a directory, e.g. mkdir project
- rmdir:
- Remove directories, e.g. rmdir project
- cd:
- By itself it moves you to your login directory. Otherwise it moves
you to a different directory, e.g. cd /bin
- pwd:
- Displays what directory you currently are in.
- quota:
- Displays the amount of free disk space available for your use,
e.g. quota -v
General Commands
- alias:
- Make command aliases, e.g. alias dir ls
- history:
- Recall previously typed commands.
Userid Commands
- passwd:
- Change your password.
- exit or logout:
- Log out of the system. Do this before leaving your terminal so
others cannot use your account.
- groups:
- Displays what groups you belong to. People in the same groups
have "group" access to files, as specified using the chmod command.
- finger:
- Lists people logged into the computer.
e.g. finger bob@igor.gold.ac.uk
Job Control Commands
- <, >, |:
- Redirect Standard Input and Standard Output. " < " receives
input from a file, " > " sends output to a file, " | " sends program output
into another command. e.g. ls | grep ".doc" > docs.txt
- &:
- Follow any command with " & " to have it run in the background.
Even if you log off, the program will keep running. You can also use nice to
run at a lower priority. e.g. nice ls > list.txt &
- ^Z:
- Press [Control-Z] in most programs to suspend the program and get
the Unix prompt.
- jobs:
- Type "jobs" to list all programs suspended using ^Z. Each job is
identified by a number in [ ].
- bg:
- Send the suspended job into the background, as if you originally
started it using the " & " command, e.g. bg [1]
- fg:
- Bring the suspended job into the foreground so you can continue
working, e.g. fg [3]
- ps:
- List all the processes (programs) currently running. e.g. ps -l
- kill:
- This command uses the process identification number (pid) given
in the "ps" command to stop a running process. e.g. kill -9 90194
Network Commands
- rup:
- Display information about the running-time of local Unix hosts,
along with statistics about the current workload of each host.
- rusers:
- Display the user-ID of all users connected to local Unix hosts.
- rsh:
- Run a shell command on a remote Unix host, e.g. rsh spock ls
- rlogin:
- Login to a remote Unix host, e.g. rlogin scorpio.gold.ac.uk
- telnet:
- Login to a remote internet host, e.g. telnet aries.gold.ac.uk
- ftp:
- Connect to a remote internet host using the File-Transfer Protocol,
e.g. ftp src.doc.ic.ac.uk
- ssh:
- Open a secure shell on a remote internet host,
e.g. ssh igor.gold.ac.uk
- scp:
- Copy files to/from a remote internet host using the secure SSL
protocol, e.g. scp myfile bob@igor.gold.ac.uk:myfile
|