CSE 214 - Unix Tutorial

By completing this Tutorial, students should learn the following:


What is SSH?

SSH (Secure Shell) is a program that can securely connect to Sparky, a Unix-based server where each student has ones own account. SSH is installed in most campus labs, including the SINC sites. In addition, students may download and install SSH on their own computers via Softweb. A secure connection is one where all communications between client and server are encrypted, and thus not accessible to packet sniffers and other snooping mechanisms.


Steps to Follow:



SUMMARY OF USEFUL UNIX COMMANDS

Unix Command Function Example Usage
. Refers to the present working directory. See the cp example
.. Refers to the parent directory of the present working directory. See the cp example
~ Refers to the home directory of your account. See the ls example
* A wildcard reference, it means everything in a directory. See the chmod example
cd Traverse through existing directories by changing the present working directory. Change to the hw1 directory:

cd hw1
chmod 700 Sets the file permissions for a file or files (first argument) such that no one but the account owner may read, write or, execute the given file(s). Sets proper permissions for all .java files in the hw5 directory:

chmod 700 hw5/*.java
chmod -R 700 Sets the file permissions for a directory or directories and its contents (first argument) such that no one but the account owner may read, write or, execute (traverse through) the given directory or directories. Sets proper permissions for the complete contents of the given account:
chmod -R 700 ~/*
cp Copies a file or files (first argument) from one location to another (second argument). To copy Hello.java from the parent directory into the current directory:

cp ../Hello.java .
cp -R Copies a directory or directories (first argument) from one location to another (second argument). To copy the hw1 directory and all its contents into the parent directory:

cp -R hw1 ..
javac To compile a Java program. To compile all .java files in the present working directory

javac *.java
java To run a compiled Java program. After compiling Test.java and all other classes needed to run the Test program (Test would need a main method):

java Test
ls Lists the contents of a directory (first and only argument). To list the contents of your home directory:

ls ~
ls -l Lists the contents of a directory (first and only argument) in a long output format, which gives complete information on all contents. To list the contents of your home directory in long form:

ls -l ~
man The Unix manual, it opens a help screen on a command topic (first and only argument). To get info on how to use the cp command:

man cp
mkdir Makes a directory using the name(s) of the argument(s). To create a directory named hw99:

mkdir hw99
mv Moves a file or files (first argument) from one location to another (second argument). To move all .java files from the present working directory to the home directory:

mv *.java ~
mv -R Moves a directory or directories (first argument) from one location to another (second argument). To move all directories starting with the letters "hw" files from the present working directory to the home directory:

mv -R hw* ~
passwd Allows the user to change his/her login password. passwd
pwd Displays the full path to the present working directory. pwd
quota -v Displays the disk quota and usage for the user's account. quota -v
rm Removes a file or files (first argument) from one location to another (second argument).

WARNING: Be careful using rm, it deletes files!
Remove all .class files from the present working directory:

rm *.class
rm -R Removes a directory or directories (first argument) from one location to another (second argument).

WARNING: Be extremely careful using rm -R, it deletes entire directories!
Delete your test directory and all its contents:

rm -R test



SUNYSB CSWeb page created and maintained
by Richard McKenna