ls |
Lists names of files in current directory. |
ls -l |
Long listing, gives more information. |
ls Hello* |
Lists only files whose names start with Hello. |
ls -l Hello* |
Long listing of same files. |
cat names.txt |
Displays contents of textfile names.txt on screen. See also more command below. |
more names.txt |
Same as above, but shows only one "page" at a time. Use space bar to advance to next page, type q to quit at any point. |
cp a.dat b.dat |
Copies file a.dat to b.dat. |
mv a.dat b.dat |
Renames ("moves") file a.dat to b.dat. |
rm Hello.java |
Deletes ("removes") file Hello.java. Be careful with this command... |
rm Hello* |
Deletes all files whose names start with Hello. Be even more careful with this command... |
Use the following commands to create and manage directories for organizing your files.
mkdir playpen |
Creates new directory named playpen. |
rmdir playpen |
Removes directory playpen (must be empty). |
cp a.dat playpen |
Copies a.dat into directory playpen. (Keeps copy in current directory). |
mv a.dat playpen |
Moves a.dat into directory playpen. (Removes file from current directory). |
ls playpen |
Lists files in playpen directory. |
cd playpen |
Changes current "default" directory to playpen ("enters" playpen). |
cd .. |
Enters "parent" of current directory. |
cd |
Enters "home" (login) directory. |
pwd |
Displays name of current directory. |
vi Hello.java |
Edits textfile Hello.java (Java source file). Creates file if it does not already exist. Ancient Unix editor, but available on almost all Unix/Linux systems. Can be used remotely via telnet connection. |
pico Hello.java |
Edits textfile Hello.java (Java source file). Creates file if it does not already exist. Can be used remotely via telnet connection. |
gedit Hello.java & |
Edits textfile Hello.java (Java source file). Creates file if it does not already exist. Not suitable for remote use via telnet connection. |
javac Hello.java |
Compiles source file Hello.java, produces Java bytecode file Hello.class. |
java Hello |
Invokes Java Virtual Machine (JVM) to execute bytecode file Hello.class. |
jar cf Project1.jar Project1 |
Creates new JAR (Java Archive) file named Project1.jar, compresses and stores Project1 directory and all its contents (including both data files and subdirectories). |
jar tf Project1.jar |
Displays contents of JAR file Project1.jar. Lists complete directory structure (including subdirectories and their contents). |
jar xf Project1.jar |
Extracts (uncompresses) complete contents of JAR file Project1.jar. Reconstructs directory Project1 and all its contents as subfolder of current working directory. |
c++ Hello.cpp |
Compiles C++ source file Hello.cpp to binary executable file a.out. |
c++ Hello.cpp -o Hello |
Compiles to executable file Hello. |
a.out |
Loads, runs machine code in executable file a.out. |
Hello |
Loads, runs machine code in executable file Hello. |
zip proj1 proj1/* |
Creates new zip file named proj1.zip, compresses and stores proj1 directory and all its toplevel contents (data files). |
zip projfiles * |
Creates new zip file named projfiles.zip, compresses and stores all data files contained within current directory (but not current directory itself). |
unzip proj1.zip |
Unzips project (reconstructs proj1 directory and its toplevel contents). |
unzip -t proj1.zip |
Lists zip file contents without actually unzipping. |
history |
Displays numbered list of most recent commands. |
!100 |
Repeats command 100 in history list. |
!p |
Repeats most recent command starting with p. |
!ca |
Repeats most recent command starting with ca. |
man ls |
Shows help page for ls command. |
man g++ |
Shows help page for g++ (real name for GNU c++ compiler). |
man man |
Shows help page for man help pages themselves. |
logout |
Don't forget!. |