CENG 303

Rice University

Basic Unix Information


All workstations here at Rice are Unix based. To be efficient in a Unix system, you need to know a few basic commands listed in the following Tables. To get more detailed information, see the Unix documents: Unix Reference Card: On-Line documantation has brief descriptions of many useful commands, Introduction to the UNIX Operating System has more details Rice UNIX Documents is the parent directory to many such documents. An extensive set of on-line documents may also be found at Indiana University's UCS Knowledge Base.

The following tables list a few ot the UNIX commands that you will find useful. Most of them have links to further information about the commands. Follow those links for added help and a more extensive list of commands.

Table 1 of Unix Commands


command

performs

example(s)

login

Login prompt at a workstation or X terminal.

servernm login: yourid

logout or exit

Ending a Unix session.

servernm% logout

man

gives help information about commands, frequently this is very detailed and long

server% man passwd

ls

lists file and directory names;
long form gives details about the objects;
long form and ordered by date

server% ls
server% ls -l
server% ls -lt

cat

lists contents of a file

server% cat filenm

more

lists contents of a file, but gives one screenful at a time.

server% more filenm

lpr

prints contents of a file to your default printer
print file to designated printer

server% lpr filenm
server% lpr filenm -Palb223

lprloc

lists the printers and designates your default printer

server% lprloc

lpq

display the queue of printer jobs on your default printer

server% lpq

lprm

removes a print job you submitted

server% lprm 10

passwd

allows you to change your password

server% passwd

which

determines where an executable is located in your path

server% which lpr

Table 2 of Unix Commands

Command

Performs

Example(s)

cd

change directories
change to your home directory

server% cd /home/ceng303
server% cd

rm

remove (delete) one or more file(s)

server% rm filenm
server% rm file*

mv

move (rename) one or more files

server% mv filenm newnm
server% mv filenm dirnm

mkdir

create a new directory

server% mkdir dirnm

rmdir

delete an empty directory

server% rmdir dirnm

pwd

determine the complete name of the current directory.

server% pwd

ps

list the status of current processes running on your server and give id numbers for each.

server% ps

kill

terminate a process

server% kill 29973

~

"home of" applied to a directory

server% cd ~ceng301 same as:
server% cd /home/ceng301

?

wild card for one character

server% ls file?

*

wild card for any number of characters

server% ls file*

Table 3 of Unix Commands

Command

Performs

Example(s)

chmod

Change file or directory permissions

server% chmod g-r

diff

Compare contents of two files

server% diff file1 file2

grep

Look for a string in one or more files

server% grep ceng303 filenm
server% grep 'is it not' file*

finger

Determine whether a user has an Owlnet account; Get more information about a user.

server% finger ceng301
server% finger shdavis@moe


Return to CENG 303 homepage