Bash is a command line-based shell program for UNIX/Linux systems.

Index of commands

Basic commands

  • pwd prints the current working directory.
  • ls prints what is in the current working directory.
  • cd changes the current directory.
    • cd .. navigates up a folder.
    • cd foldername navigates into a folder.
    • For directories with spaces, we can wrap the folder name in quotation marks to access properly.
  • mkdir foldername creates a new sub-directory.
  • cp file1 dir/file1 copies file1 to the second path/name specified. This also allows us to create a copy with a different name of the folder.
  • rm deletes a file.
    • -d for removing empty directories.
    • -r for removing non-empty directories.
  • man gives us the manual page for a given command.
  • ./programname will run a given program.
    • ./programname < input.txt will run the program against the inputs in a txt file — which is super convenient for debugging.
  • chmod changes user permissions.