Linux/Unix

There are several types of Unix: IRIX, Solaris, Linux, etc. For this class your program must compile and run on Linux. When you log onto GL, be sure that you log onto gl.umbc.edu or linux.gl.umbc.edu. This will put you onto one of three machines, either linux1.gl.umbc.edu, linux2.gl.umbc.edu, or linux3.gl.umbc.edu, depending on the load of each machine.

Simple UNIX Commands

ls
Lists the files in the current directory.
ls -l gives more information about the files. -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 (“moves”) 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

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 screenful at a time.
You must 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.

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 with this command.

cd
The command cd alone will return you to your home directory.
cd followed by a directory name 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.

man
Gives a description of a UNIX command. So 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 man command uses the more facility to present the information, so you must 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.