CSC 212: Programming with Data Structures

Spring 2016

Quick start guide to common Unix commands, with examples. What you type is in red, comments and output are in blue.


  • cd : change directory
     cd public_html/    // move down a level into the public_html directory 
     cd ..              // move up a level back into the enclosing directory 
     cd                 // move to your home directory 
    
    
      

  • mv : move a folder/file, or rename a folder/file
    // move java file into lab0 directory 
    mv HelloWorld.java lab0/ 
    
    // keep java file where it is, but rename it  
    mv helloworld.java HelloWorld.java 
    
        
    

  • ls : list the folders/files within a directory
    ls 
    hw1/ lab0/ lab1/  // directories within public_html, for example
    
    
    

  • less/q : view the first part of a file, "q" to quit
    less HelloWorld.java   // this should bring up your code 
     q // quit viewing the code 
    
    
  • [TAB] key :

    Very useful! The tab key helps auto-complete folder and file names as you're typing them. For example, if you wanted to access HelloWorld.java, you could start by typing "H", then hit tab to complete the word.

  • Up/Down arrow keys :

    Also very time-saving, if you want to access or modify a command you've typed before, you can use the arrow keys to scroll through the commands you've already used.