Command Syntax

Many UNIX commands take options , usually indicated by a - sign, to show how you want them to work. For example the ls command lists your files, and its many options control how the list appears and which information about the files is shown. The man page for a command documents all its options.

The shell interprets certain characters in filenames and for other purposes as well. It passes the interpreted version to commands. For example, the most commonly used special character is asterisk, * , meaning "zero or more characters". When you type a command like ls a* , the shell finds all filenames in the current directory starting with a and passes them to the ls command. Quote marks affect the shell's interpretation of the command line. See a UNIX reference book for more.

Commands may have input and output as described in the man pages. It can be directed from and to files using " < " and " > " and passed between commands with the pipe " | " symbol. Thus echo hello puts hello on screen while echo hello > foo puts hello into a file named foo . A common use of the pipe is to send output of any command into more so you can read it one screen at a time, as in ls -lR | more . See a UNIX reference book for more.

Files and Directories

UNIX uses a hierarchical file system starting with root or / . When you log in, you are in your own home directory a few levels below root, and your files are in that. You can refer to your home directory with the special shell character ~ (pronounced "squiggle" or "tilde"), and to that of user xyz999 as ~xyz999 . References to files or directories are taken to be relative to the current directory unless they begin with / or ~ , which are absolute since they mean the same thing no matter what the current directory is. Dot ( . ) refers to the current directory and dotdot ( .. ) to the one above it; this is seen in some ls output and is sometimes useful in commands.

ls list files (many options; see man ls )
ls filename list a certain file (maybe using * or similar)
ls directoryname list files in a directory
ls -l directoryname long listing of files in a directory
ls -al directoryname long listing including the normally hidden dot files
more filename view a file one screen at a time
rm filename remove a file
mkdir directoryname create a subdirectory
rmdir directoryname remove a subdirectory (if it is empty)
cd directoryname change to a subdirectory
cd .. go up one directory level
cd ~ or just cd change to your home directory
pwd display the name of the current directory
mv oldfilename newfilename rename a file
mv filename directoryname move a file to another directory
cp oldfilename newfilename copy a file
cp filename directoryname copy a file into a directory (same filename unless specified)
more displays the contents of a text file on the terminal, one screen full at a time.
find recursively descends the directory hierarchy for each path seeking file specified
up arrow key give the last command executed
tab button a nice time saving auto complete for file names

Printing

Use the lpr command, which takes the option -P (notice the capital P) with a printer name, and then the file(s) to be printed. Thus:

lpr -Pcreek filename

Account-Related Commands

cseadmin help manage your user account, password change, quota, etc...
showquota display a table of your account disk usage
finger show who's logged in (if they want you to know)

Permissions

UNIX provides for permissions (also called protections) on all files and directories, which you can manipulate to keep some things private and make others public. There are three kinds, read , write , and execute , that can be given differently to three levels, user , group , and world (meaning anyone on the system).

The most private permission is for your files to be read-write by owner (your account) only, and for your directories to be read-write-execute by owner only. You need execute permission on a directory to get to the files in it. By default your files are created read-write by owner.

To let people see your web pages, you need to allow world execute permission on your home directory, and world read-execute permission on the web directory, and then world-read permission on the files in web that you want to be seen. The web server runs as a user called www who has no special privileges, so it can only see files available to any user. Below is how to set these permissions, illustrating the chmod command:

cd make sure you're in your home directory
chmod a+x . chmod, all can execute, this directory (shown by dot)
chmod a+rx web chmod, all can read-execute, web
chmod a+r web/index.html chmod, all can read, file index.html in web

The last command could have used web/* to change all the files in web at once, if you want them all to be readable. As you add files to web, make them readable.

The commands above illustrate adding permission. Remove permission using minus instead of plus. chmod also can take numbers to set absolute permissions instead of adding and subtracting from existing permissions. See the man page for more information.

The ls -l command shows permissions at the left for user, group, and world, using rwx for permissions and hyphen for no permission, thus rwx--x--x is read-write-execute for user, and execute only for others. See the man page.