ls

Lists the files in the current directory.

ls -l gives more information about the files. The -l stands for the “long” version.

cp

Copies a file.

cp Sample.java Example.java makes a copy of sample.c and names the new copy Example.java. Sample.java still exists.

mv

Renames a file.

mv Average.java Mean.java changes the name of the file from Average.java to Mean.java. Average.java no longer exists.

rm

Removes or deletes a file.

rm olddata.dat would delete the file olddata.dat

cat

Displays the contents of a file onto the screen all at once. If the file is too long to fit onto the screen, it scrolls. cat is also used to combine two or more files.

cat Mean.java just displays the contents of Mean.java to the screen

cat Mean.java Counts.java > Statistics.java concatenates the two files Mean.java and Counts.java by tacking the contents of Counts.java onto the end of Mean.java and calls the new, combined file Statistics.java. Mean.java and Counts.java still exists in their original form.

Okay for short files, but see more or less for use with bigger files.

more

Displays the contents of a file onto the screen one page at a time.

more example.txt would show the contents of the file example.txt one screenfull at a time.

Press the ENTER key to advance one line.

Press the spacebar to advance to the next page.

You may type q to quit or b to go back to the beginning of the file.

less

Similar to more because it displays the contents of a file one screen at a time. Better than more because it allows you to scroll forward or backward in the file using the arrow keys.

You may type q to quit or b to go back to the beginning of the file.

mkdir

Makes a new subdirectory in the current directory.

mkdir 202 will make a new directory called 202 in the current directory.

rmdir

Removes a subdirectory from the current directory, but the subdirectory must contain no files. You must delete all of the files from a directory before you are allowed to delete it.

cd

The command cd with no parameters will return you to your home directory.

cd followed by a directory name that is found in the current directory, as in cd 202, will change from the current directory to its subdirectory called 202, if that subdirectory exists.

cd .. moves you up one level in the directory tree.

In general, cd <absolute or relative path to a directory> moves you to that directory.

pwd

Tells you the directory you are currently in (your “working directory”)

lpr

Prints a file

lpr -Pacsps sample.txt would print the file called sample.txt on the Division of Information Technology postscript printers found in Room ENG 019. There is a charge per page for printing.

man

Gives a description of a UNIX command. For example, man cat will tell you all about the cat command. If you don't know the name of a command, but you do know what you want to do, use man -k. If you've forgotten the command for copy, you could type in man -k copy and you would be supplied with the name of the command (in this case cp) and a description of how the command works.

The command appropos is the equivalent of man -k

finger

The finger command lets you get information about a user. If you know their login name, finger jdoe1@gl will tell you if that person is logged on, what programs they are running and how long they've been idle. If they're not logged on, it will tell you when they were last logged on and whether they have any unread mail. If you want to find a person's email address, use finger frey. In this case you will see the address frey@umbc.edu. If the person has a common name (i.e. there is more than one “frey” you will get everyone with that name.

|

The “pipe” is used to combine commands. It “pipes” the output of one command to be used as input to the next command. Here's a typical use of the pipe. who | sort | more will give you the login names of everyone that is currently logged onto the same machine as you, in sorted order, one page at a time.