Common Unix Commands

When we interact with the terminal window on the classroom computers, we use Unix/Linux commands. You do not need an in-depth knowledge of Unix, but these are commands that you should know.

  cat file This is short for concatenate files. You can specify multiple files. It shows all the contents of the file(s) to the screen. This command can also be used to create files. The MATLAB equivalent is   type file

  cd change directory. By itself, it will change to your home directory. The MATLAB equivalent is   cd ~

  cd /home/mweeks change directory to /home/mweeks, your professor's home directory The MATLAB equivalent is   cd /home/mweeks

  cd .. change directory to one level up. For example, if you are in /home/mweeks, this will change it to the /home directory. The MATLAB equivalent is   cd ..

  chmod change mode. You probably will not need this. It allows you to set permissions on your files, for example, chmod 644 myfile sets read/write access for you for myfile, read access for everyone in your group, and read access for anyone else on the computer. The MATLAB equivalent is fileattrib

  ls list files in the current directory. The MATLAB equivalent is   ls

  ls -l list files in the current directory in long format (it gives more information). The MATLAB equivalent is   ls -l

  man command shows the manual entry for the command. This is like help command in MATLAB.

  matlab calls the MATLAB program.

  more file shows the contents of file to the screen, one screen at a time. The MATLAB equivalent is more on followed by type file

  pwd print working directory. This shows what directory you are currently in. The MATLAB equivalent is pwd

  ssh -Y -l account computer This runs secure shell, allowing you to log in to a remote computer. -Y is for X-window forwarding. There is no MATLAB equivalent.

by Michael Weeks
Last update: September 5, 2010