Skip to content

Latest commit

 

History

History
45 lines (39 loc) · 1.7 KB

04_basic_commands.md

File metadata and controls

45 lines (39 loc) · 1.7 KB

Basic Commands

Memorize these commands and their basic usage. These will help you navigate, and view and manage files.

  • pwd - print current working directory
  • cd - change directory
  • mkdir - make directory
  • ls - list
  • cp - copy
  • mv - move (a.k.a. rename)
  • rm - remove
  • less - page back and forth through a file without opening up a text editor
  • cat - concatenates files and prints them
  • man - view the man pages for a command
  • which - locates a command on your path
  • touch - change the timestamp of a file (or creates it if it doesn’t already exist)
  • grep - find a string within directory/files
  • echo - print something out
  • history - prints out your command history
  • exit - exits the terminal

Tips to Navigating the Command Line

  • up arrow - recall a previous command
  • !123 - recall command number 123
  • tab key - auto-complete a command or file name; hit tab twice to show options
  • clear - command to clear the screen
  • CTRL-a - go to the beginning of the line
  • CTRL-e - go to the end of the line
  • CTRL-_ - undo last change
  • CTRL-u - put everything back to the beginning of the line in your shell's copy buffer
  • CTRL-y - bring back everything from the shell's copy buffer and add it your commands
  • CTRL-k - kill/delete to the end of the line
  • q - quit commands like less or man to return to the command line
  • CTRL-c - stop running commands

Let’s play around with these commands and keystrokes and see what they output. Remember to use man to figure out the format of the command.

Experiment!

Try this now:

BabyMac:~ jennapederson$

Back: Basics of the Bash Shell Forward: How to Not Hate Vim