Department of Mathematics

Math 300: Mathematical Computing

Basic Linux Commands

One does not need to know very many commands in order to get around on a connection to a remote machine pretty easily. Here we give a simple list of some of the most commonly used commands for Linux/Unix. Note that most commands can accept options that change their behavior. For example, ls provides a listing of the contents of the current directory, while ls -l gives that listing in long format, including many more details about each file in the directory. On the other hand, ls -a lists all the files in the directory, including the "hidden" ones. We can mix options simply by chaining them together; e.g. ls -la gives a listing of all files in a long format.

Remember that you can get a full description of the usage of any command by typing man commandname in a terminal.
CommandFunctionExample Formats
cdChange Directory cd
cd directory/path
chmodChange Mode - file permissions chmod u+w file_name
chmod 755 file_name
cpCopy files cp from_file to_file
exitExit the shell exit
lessList contents of a file less file_name
lsList filenames in a directory ls
ls -l
ls file_name
manManual pages man cp
man mv
mkdirMake a Directory mkdir directory_name
mvMove a file mv from_file to_file
nanoStart a primitive editor nano file_name
pwdPrint Working Directory pwd
rmRemove a file rm file_name
rmdirRemove a Directory rmdir directory_name

There are a few "wildcard" characters that can match many things. The question mark matches any single character. Thus, ls image?.jpg would list all of the files image1.jpg, image9.jpg, and imageA.jpg on a directory, but would not list image23.jpg The asterisk matches any number of characters, so that ls image*.jpg would list image1.jpg, image23.jpg and image49027.jpg.


The "final exam" for this course will take place at 8:00 AM on Tuesday, 12 December. This will be an ordinary 50 minute test. It will be comprehensive, but weighted toward the latter half of the semester. As always, paper notes will be permitted, but no electronic devices will be allowed.




A Solution example is available for the quiz.




Assignment A is posted.

Department of Mathematics, PO Box 643113, Neill Hall 103, Washington State University, Pullman WA 99164-3113, 509-335-3926, Contact Us
Copyright © 1996-2015 Kevin Cooper