[ Home ] [ Classes ] [ Research ] [ Links ] [ Biography ]


Up

CS Dept.
 

 

 



Quick Reference to Using the Unix Operation System

For the commands listed below, bold indicates a keyword or characters that should be typed verbatim, and italics indicates a name or information that you need to provide.  For example, the command "cp file1 file2" means that you should type "cp" followed by two filenames.  You will provide the actual names of the two files.

Connecting 

To log on to webdev
  1. Double-click on the "SSH Secure Shell Client" icon on the desktop
  2. Press "Enter" to bring up the "Connect to Remote Host" window
  3. Specify "webdev.cislabs.uncw.edu" as the host name and your student login as the user name (the port should be "22" and the authentication should be "password".)
  4. Click "Connect"
  5. Enter your password and press "Enter"

Files

cp file1 file2
make a copy of file1 and call it file2 (destroys the old file2 if it existed)
cp file subdir copy file into subdirectory (with the same name)
mv file1 file2 
move (rename) file1 to file2 (destroys old file2 if it existed; file1 no longer exists)
mv file subdir
move file into subdirectory 
rm file
removes (deletes) file 
cat file
display file contents on screen
more file

    or

less file

display file contents on screen one page at a time (use space bar to go forward one page, 'b' to go backward one page, and 'q' to quit)
br202 file
print a file on the printer in room BR202 
vi file
evoke the vi editor on file (create the file if it doesn't exist)
javac file.java
compile a JAVA source file 
java classname
execute a JAVA class (must contain a main method)

Directories

ls

    or

ls subdir

list the files in the current directory or another directory
ls -l

    or

ll

list the files and details (file size, owner, group, permissions, etc.) in the current directory or another directory
mkdir subdir
create a new subdirectory 
rmdir subdir
remove the subdirectory (it must first be empty) 
cd subdir
change current directory
cd
change back to your home directory 
cd ..  
go up one level in directory hierarchy 
pwd
print working directory (full path name) on the screen

Other Users

elm
read or send mail w 
w
show who is currently logged on
finger username
show information about person who owns the login name

Starting and Stopping

Ctrl-d

    or

logout

    or

exit

logout of torvalds
Ctrl-c
interrupt the current program or process

Miscellaneous

passwd change password (You will be asked to enter your old password, then your new one, then your new one again to confirm that you typed it correctly.  If it does not say it was successful, then your password remains the same.)

I/O Redirections

command > file execute the command and write the output into the file (overwrites the file if it exists)
command >> file  execute the command and write the output to the end (append) of  the file (does not overwrite the file if it exists)

Examples:
 
cat file1 file2 file3 > file4 create file4 containing the concatenation of file1, file2, and file3 (the number of files specified can be unlimited)
java classname > file execute JAVA program and write output (from System.out.println(...) statements) to file 
java classname < file execute program using the file as input for System.in
java classname &> file execute JAVA program and write output (from BOTH System.out and System.err ) to the file 
java classname < file1 > file2 execute program with input file1 as System.in and output file2 as System.out 
mail -s "subject" username < file email the file to the user with the subject line give in quotes. BE VERY CAREFUL TO USE THE SYMBOL '<' (and not '>').  Otherwise, you will overwrite your file



This page was last updated: January 8, 2002

Email:

[ Home ] [ Classes ] [ Research ] [ Links ] [ Biography ]