Basic Linux commands

Basic commands

[Jump to the Video Tutorial]

Holland clusters all run on the Linux operating system, similarly to how your personal computer might run Windows or Mac OS. However, unlike Windows or Mac OS, our systems do not utilize a graphical user interface where you can use a mouse to navigate and initiate commands. Instead, we use a command line interface, where the user types in commands which are then processed and text output is displayed on the screen. The default shell used is Bash. Bash may seem complicated to learn at first, but with just a small handful of commands, you can do anything that you would usually do with a mouse. In fact, once people become proficient in Bash, many of them prefer it over graphical interfaces due to its versatility and performance.

Below, we have compiled a list of common commands and usage examples. For a more information, check out one of these references:

Linux Commands Reference List:

ls list: Lists the files and directories located in the current directory
  • ls
  • ls -a
    • shows all the files in the directory, including hidden ones
  • ls -l
    • shows contents in a list format including information such as file size, file permissions and date the file was modified
  • ls *.txt
    • shows all files in the current directory which end with .txt
cd change directory: this allows users to navigate in or out of file directories
  • cd <folder path>
  • cd <folder_name>
    • navigates into directory <folder_name> located in the current directory
  • cd ..
    • navigates out of a directory and into the parent directory
  • cd $HOME (or $WORK)
    • navigates to a user’s home (or work) directory
mv move: used to move a file or directory to another location
  • mv <current file(s)> <target file(s)>
  • mv * ../
    • moves all files from the current directory into the parent directory
  • mv <old_filename> <new_filename>
    • renames the file <old_filename> to <new_filename>
cp copy: used to copy a file or directory to another location
  • cp <current file(s)> <target file(s)>
  • cp * ../
    • copies all files in the current directory and puts the copies into the parent directory
  • cp -r ./orig_folder ./new_folder
    • copies all files and directories within orig_folder into new_folder (-r indicates this is a recursive copy, so all sub-directories and files within orig_folder will be included in new_folder)
man manual: displays documentation for commands

Note: Use up and down arrows to scroll through the text. To exit the manual display, press ‘q’
  • man <command name>
  • man ls
    • displays documentation for the ls command
mkdir make directory: creates a directory with the specified name
  • mkdir new_folder
    • creates the directory new_folder within the current directory
rmdir remove directory: deletes a directory with the specified name

Note: rmdir only works on empty directories
  • rmdir folder_name
    • removes the directory folder_name if the directory is empty
  • rmdir *
    • removes all directories within the current directory
rm remove: deletes file or files with the specified name(s)
  • rm file_name
    • deletes the file file_name
  • rm *
    • deletes all files in the current directory
nano nano text editor: opens the nano text editor

Note: To access the menu options, ^ indicates the control (CTRL) key.
  • nano
    • opens the text editor in a blank file
  • nano file_name
    • opens the text editor with file_name open. If file_name does not exist, it will be created if the file is saved
clear clear: clears the screen of all input/output
  • clear
less less: opens an extended view of a file

Note: Use up and down arrows to scroll through the text. To exit the extended view, press ‘q
  • less <file_name>
    • opens an extended view of the file file_name
cat concatenate: sends file contents to standard input - used frequently with pipes
  • cat <file_name>
    • prints the contents of the file file_name
  • cat *.txt
    • prints the contents of all files in the current directory that end in .txt

Tutorial Video