Simple Unix Commands

This is a very basic introduction to some very common unix commands. Unix is an operating system that we use on our servers here at Shouting Ground. It's a command driven operating system much like DOS, and unlike Windows (which is a graphical operating system). After you log in, unix will give you a prompt and wait for you to type in a command and then hit enter. After you do that, it will carry out the command you've just given it and then return you to a prompt and await further instructions. Below are some useful commands to know.


cd: Change directory. This moves you from one directory to another.

duracef:~> cd public_html

This moves you from one directory into your "public_html" directory


cp: Copy. Use this to duplicate files while retaining the original.

duracef:~> cp blah.html public_html/blah.html

This command will give you a blah.html in the directory you're in, as well as a duplicate blah.html in the directory "public_html"


Another thing you'll need to know about unix files and web sites is permissions. Files have sets of permissions that define who can and cannot read, write, or execute the files. If the permissions aren't set properly, your gifs, for instance, won't appear on the web browser.

chmod: Change mode. This is what's used to change the permissions on files and directories. For web purposes, your web directories (and ONLY your web directories) should be set to 711 and your web files should be set to 644.

duracef:~> chmod 711 images

This changes the directory "images" to readable, writeable, and executable by everyone. This is what you want for web directories, but obviously, this is NOT what you want for your personal files.

duracef:~> chmod 644 bg2.gif

This changes the file "bg2.gif" to readable to everyone, which is what you want for web files.


mkdir: Make directory. This creates a new directory with the name you choose

duracef:~/public_html> mkdir images

This creates a directory called images in the directory you're currently in.


mv: Move. Use this to move a file from one spot to another.

duracef:~> mv blah.html public_html/blah.html

This command will remove the blah.html from the directory you're in and put it in your "public_html"


quota: The quota command tells you what your quota is. Following it with the -v option gives you how much space you're currently using as well as your quota.

duracef:~> quota -v

This command returns the following data.

Disk quotas for user joeuser (uid 1234):
Filesystem blocks quota limit grace files quota limit grace /dev/md0 13 5000 10000 8 0 0

Blocks are how many kilobytes you have in use. Quota is the limit of kilobytes you can use. Limit is the hard limit of kilobytes you can use. Grace is the grace period or number of days remaining before your quota becomes your hard limit. Once you surpass your quota, a grace period begins that counts down for 7 days. If you still have not removed enough files to get under your quota after 7 days, then the quota goes into stern effect. Which means you will be allowed to put absolutely no files on your account until you get under your quota.


rm: Remove. This is deletes files.

duracef:~> rm blah.html

This gets rid of blah.html from the directory you're in.


rmdir: Remove directory. This is the opposites of opposite. The only stipulation is that the directory has to be empty before it will work. It'll tell you that your directory is not empty if you try to remove a directory with files still in it.

duracef:~> rmdir public_html

This will remove the "public_html" directory (assuming it's empty)


*: wild card. This is not a command but rather a variable. It works similarly to the * in DOS. It means "match everything."

duracef:~> mv *.html public_html

This will move all files that end in .html to the directory public_html

duracef:~> rm *

This command removes EVERYTHING in your current directory. Be careful with the *


Updated 12/22/98