Common UNIX Commands/Symbols

The following commands and symbols are commonly used with generic UNIX operating systems. They are not, I repeat, they are not commands that work with MSDOS or Windows (3.1, 95, NT). Remember you have to telnet into the Tequity server (or other UNIX servers) to use these commands. Please familiarize yourself with the list below. REMEMBER, THIS IS NOT A COMPREHENSIVE LIST OF ALL COMMANDS AND NUANCES OF UNIX!!!!

Myungsu Suh

Symbols for controlling output and piping

(command) | (command) (piping)
This symbol is usually preceded and superceded by a command. This symbol sends the output of the first command to the second command for processing/output. e.g. ls -l | more This sends the listing of the directory to the command more, which shows the output one page at a time.

(command) > (file-name)
This symbol saves the output of the command to the specified filename. e.g. ls -l > listing This saves the directory listing to the file called listing.

(command) ; (command) ; (command) ;
The semicolon is equivalent to a return (pressing enter button) in UNIX. You can type in a command after command after command with the use of the semicolon (the entire string length is restricted to 256 characters in UNIX). e.g. ls -l ; cd public_html ; ls -l fss ; pico fss The example shows a typical command string. The first command shows the directory list, the second changes the current directory to public_html, the third shows the directory list of file called fss, the fourth starts up the text editor pico to edit the file fss.

(command or string of commands) &
The ampersand symbol at the end of a command string puts it into a background processing job. UNIX is unique in that it supports true multitasking capabilities. It allows jobs (commands) to run in the foreground or in background mode, the foreground meaning you have to wait for your command to finish before typing something into the terminal and the background meaning you can type other commands while the cpu is processing the current job. e.g. ls -laR > listing & ; pico fss.htm The first command saves the directory list of the current directory and the directories below to file called listing (processed in background). With the use of the ampersand, a second command is called, a text editor program called pico (processed in foreground). Please remember that programs that require input from the user such as a text editor should not be processed in background.

Commands for requesting help on commands

apropos (string)
This command shows a list of possible commands related to the given string. e.g. apropos ftp This will show a list of commands related with ftp (file transfer protocol).

man (command)
This command shows the specifications and switches for the specified command. e.g. man ls This will show the specs for the command ls (directory list). You can also type man man to learn how to navigate in man. Do this right now, because you'll have to use man many times in this tutorial.

Commands for manipulating files and directories

cd (directory)
cd changes the current directory to the specified directory.

ls (switches) (optional specified files)
ls shows the list of contents in the current directory. ls can output in different formats. With only ls it outputs much like dir/w in MSDOS. With ls -l, it shows an output much like dir in MSDOS. With ls -a, it lists the hidden files of the current directory. Hidden files in UNIX have . as the first character in their names. ls -R recurses into subdirectories and show their contents. These switches can be combined to have different outputs. e.g. ls -la Shows extra file info and hidden files. e.g. ls -laR List extra file info, hidden files, and recurse into subdirectories. Uses of wildcards are allowed. e.g. ls -l file.* Shows files with name file that has any extensions. e.g. ls -l file.??? Shows files with name file that has any three character extensions.

chmod (switches) (specified files)

If you plan to create a web page, READ THIS NOW!!!!!

chmod modifies the user access rights to specified files and directories. A typical UNIX file has three rights for each type of user -- the owner of the file, the group of the owner belongs in, and other users (totals to nine rights). If you type in ls -l, a file's access rights are shown as -rwxrwxrwx (first rwx for owner, second rwx for the group which the owner belongs, third rwx for others). If the first character is d, that means the file is a directory. e.g. drwxr-xr-x (stuff deleted) public_html Now to the explanation of rwx. r means a person can read the file, w means he can modify the file, and x means he can execute the file. e.g. -rwxr--r-- (stuff deleted) fss.html This shows that the file fss.html can be read, changed and executed by the owner. However, all the other users can only read the file. Please remember this: when creating a directory, make sure you give all the users the right to execute. You can only change into that directory if it has the execution right. e.g. drwxr-xr-x You can change these rights with chmod. e.g. chmod ugo+rwx fss.html The switches ugo+rwx gives the owner (u), group (g), and others (o, e.g. people who are remotely accessing the file/directory, such as with Netscape) all the rights to the file fss.html. Of course, you don't want to do that, because ANYONE can change your files! Using the + symbol allows the specified users to have the rights that follow after it. Using the - symbol (e.g. ugo-rwx) takes away the rights from the specified users. So if you want your group members and others to only read and have execution rights, you type in chmod go+rx (filename). For yourself, you want all the rights, so type in chmod u+rwx (filename).

mkdir (new directory name)
Makes new directory. Use man mkdir for more info.

mv (current filename) (new filename)
Renames specified file/directory. Use man mv for more info.

cp (filename) (target directory)
Copies files to specified directory. Use man cp for more info.

Some miscellaneous (but important in some aspects) commands

You should look up these commands for future reference!! (especially ps, more, du, setenv, env, set)

df
Use man df.

du
Use man du.

netstat
Use man netstat.

ps
Use man ps.

more
Use man more.

setenv
Use man setenv.

env
Use man env.

chown
Use man chown.

chgrp
Use man chgrp.

set
Use man set. One note, type in set term=vt100 if you get an error message that you have an unknown terminal setting. Without this, you can't use pine, pico, lynx, or any other programs that has fancy stuff.

Important programs

pine
Easy-to-use email program. Read the screen and the help function to learn how to use it.

ftp
File-Transfer-Protocol program. Use man ftp, or in the program, type help.

ncftp
Nik-FTP program. A good, easy-to-use ftp program. Use man ncftp, or in the program, type help.

lynx
Text WWW browser for the UNIX terminal. Use man lynx, or in the program, read the screen and use the help menu to learn how to use it.

pico
Easy-to-use text editor. Use man pico, or in the program, read the screen or use the help function.

Please remember that learning all these commands and programs will take some time. Do not become frustrated or feel helpless just because you do not understand. Use the man command or the help menus of the programs. If you still do not understand it, go to Yahoo and search for unix commands. Maybe it will return relevant web pages that will tell you more in detail how to use the commands. You should only request help from a person as a last choice. You do not learn anything by requesting some one to help you with these commands. You only learn and understand how and why these commands work by trying to figure out these command by yourself.