Useful Linux and Unix Commands

Command   Description
man <command>   On-line manual pages for <command> (e.g., man g++)
apropos <keyword>   Find on-line manual pages containing <keyword> (e.g., apropos compiler)
script   Makes a transcript of a terminal session. exit terminates.
ls   Lists the current directory
pwd   Prints the present working directory
mkdir <directory>   Creates a the directory named <directory> (e.g., mkdir cosc071)
cd <directory>   Changes to the directory named <directory> (e.g., cd p1)
cd ..   Changes to the directory one level up in the hierarchy
rmdir <directory>   Removes the empty directory named <directory> (e.g., rmdir cosc071)
more <file>   Prints the contents of <file> to the console (e.g., more proj1.cc)
rm <file>   Removes the file named <file> (e.g., rm a.out)
mv <source> <target>   Moves or renames the file named <source> to the file named <target> (e.g., mv a.out proj1.exe)
cp <source> <target>   Copies the file named <source> to the file named <target> (e.g., cp proj1.cc cosc071/proj1.bak)
nano <file>   Edits the <file> using the nano editor (e.g., nano proj1.cc)
vi <file>   Edits the <file> using the vi editor (e.g., vi proj1.cc)
emacs <file>   Edits the <file> using the emacs editor (e.g., emacs proj1.cc)
ident <file>   Formats the C++ source file named <file> (e.g., indent -kr proj1.cc)
g++ <file>   Compiles the C++ source file named <file> and writes the executable code to the file named a.out (e.g., g++ proj1.cc)
gdb <file> [core]   Debugs the executable file named <file> with an optional core file. Note that the executable must be compiled with the -g switch (e.g., gdb a.out core)
valgrind <file>   Performs a memory/leak check on the executable named <file> Note that the executable must be compiled with the -g switch (e.g., valgrind a.out)
ssh <host>   Secure shell program: Starts a secure session with (e.g., ssh cs-class.uis.georgetown.edu)
sftp <host>   Secure file transfer program: Starts a secure ftp session with (e.g., sftp cs-class.uis.georgetown.edu)
logout   Terminates the UNIX session