Skip to content

Overview

Learning Objectives

At the end of this week, students will be able to:

  1. Learn to use tab completion to simplify typing file and directory paths.
  2. Use of the asterisk * wildcard to match and select multiple files in a directory.
  3. View the contents of a file using commands such as less, head, or cat.
  4. Use Nano, a simple text editor, to create and edit files directly from terminal.

Ongoing List of Commands

cd          # Change Directory
               +   used to move throughout the filesystem of a computer 

ls          # List 
              +   list the contents of a directory

pwd         # Print Working Directory   
              +  displays the file path from the root directory to the current working directory 

cp          # Copy
              +   used to copy files or directories 

mkdir       # Make Directory
              +   used to make a new directory 

mv          # Move 
              +   move a file into a directory 

rm          # Remove
              +   used to delete files and directories 

Home directory or ~

Dealing with the home directory is very common. In shell, the tilde character ~ is a shortcut for your home directory. Let's navigate to the raw_fastq directory:

Then enter the command:

cd ~

This allows you to easily navigate to your home directory. The tilde "~" is equivalent to /gpfs1/home/p/d/pdrodrig as we had mentioned in the previous lesson.

Parent directory or ..

Another shortcut you encountered in the previous lesson is ..

cd ..

The shortcut .. always refers to the parent directory of whatever directory you are in currently. Let navigate to reference_data to test .. once again.

We can also chain .. together and separate them by / to navigate to two directories above.

cd ../..

Current directory or .

Finally, . always refers to your current directory. Recall that we use . a number of times, when copying data to your home directory.