The following tables
will help you to work more easily in a UNIX environment by showing you
UNIX commands that will permit you to accomplish specific tasks. Below
the following conversion tables are explanations and examples of how to
use the UNIX commands.
||The UNIX Command|
|Show current path/directory||pwd|
|Create/make a directory||mkdir|
|Delete/remove a directory||rmdir|
|List contents of directory||ls|
||The UNIX Command|
|Find a file||find|
|Move or rename||mv|
||The UNIX Command|
|Show Quota||quota -v|
|Show printer||lpstat -a|
|Kill a process||kill|
Example: to create a subdirectory named documents, you would type:
Example: rmdir documents
if you want to list files of a certain type or name, you can use the wildcard, * (an asterisk). for example, ls *.htm would list files that have a filetype of .htm. you can also use the find command to find files. Note that in unix, filenames do not require a filetype. Also, there are no version numbers in Unix files.
For example: cd documents
To move up one directory you type cd ... To move from anywhere back to your home directory, type cd.
You can either use absolute paths with the cd command or relative paths.
User jldoe is in a subdirectory of his home directory called documents and wants to move to another subdirectory of his home directory called programs.
His current path is: /home/jldoe/documents
He can use the cd command with the following absolute path:
OR, he can use the following relative path:
This command works because he is already at the path /home/jldoe/documents. Therefore, he only needs to move up one level (which is why he uses the ..) and down one level into programs (which is why he uses /programs).
Example: find *html will
find any filenames that end in html.
Example: find proj* will find any filenames that start with "proj"
You can also use the mv command to move a file from one directory to another. For example, the following command moves a file called one.txt from the current directory into a subdirectory called documents:
mv one.txt documents
You can also give the file a new name when you move it. The following command moves a file called one.txt into a subdirectory named documents and gives it the name two.txt:
mv one.txt documents/two.txt
NOTE: You should take care when using the mv command, since it does OVERWRITE any file with the same name. If you do not feel comfortable using the mv command, you should use the copy command, which is cp. It makes a copy of a file and does not change the name of the file.
cp one.txt two.txt
You may also specify another directory for the copy. For example, to make a copy of the file one.txt and place it in the subdirectory called documents, you would type:
cp one.txt documents
You can also specify a new name for the copy, as in this example:
cp one.txt documents/two.txt
You may also specify a path to the filename as in this example, which removes the file called two.txt from the documents subdirectory:
You can also specify a keyword to search for help on. For example, if you type the following command you will get a list of topics that have to do with printing:
man -k print
This command will show you a list of the printers that are currently accepting unix print jobs. You might want to use the pipe command and pipe this to the more command so you can see one screen full of information at a time. The command would then be:
Whenever you use the more command you should use the spacebar to see the next screen full of information.
kill -9 PID
You must supply the PID number, as shown when you type the ps command. You must be careful to kill the right process and not your current process! If you kill your current process, then you will have to log back in. Killing a process is something that you should NOT have to do very often, just as you probably didn't do it very often (if ever) on the VMS system.