Useful Linux Commands

Command Meaning
ls List files in the current directory
ls -l Same, but show long listing with permissions, file size, date modified, etc.
cat FileName Display the contents of FileName
less FileName Display the contents of FileName, but one screen at a time (use 'f' and 'b' and arrow keys to scroll; 'q' quits)
lpr FileName Print the contents of FileName to the default printer
cd Change to your home directory
cd ~/161 Change to the 161 subdirectory within your home directory
cd .. Change to the parent directory
mkdir 362 Make a 362 subdirectory in the current directory
rmdir DirName Remove DirName, which must be empty
rm FileName Remove FileName
cp SourceFile DestFile Copy SourceFile to DestFile
mv SourceFile DestFile Move (rename) SourceFile to DestFile
mv File1 File2 File3 DirName/ Move files File1, File2, and File3 into directory DirName
javac Program.java Compile Java source file Program.java (produces Program.class)
java Program Execute Java program Program
g++ -Wall -std=c++11 Program.cc -o Program Compile C++11 source file Program.cc (produces Program)
./Program Execute native program Program
emacs FileName & Run the Emacs editor in the background; use to edit or create FileName
submit Submit files to a grader account
submitlog View the files you've submitted

Control-C stops the running program.

Control-D indicates end of input (EOF).


Gary M. Zoppetti, Ph.D.