Skip to content

Latest commit

 

History

History
76 lines (39 loc) · 2.43 KB

command-line.md

File metadata and controls

76 lines (39 loc) · 2.43 KB

Introduction to using the command line

  • For more info on bash: https://programminghistorian.org/en/lessons/intro-to-bash#opening-your-shell

    • Contains information, tutorials, and commands
  • Command: man \[command, e.g., ls\]

    • Brings up the manual for that particular command, showing its rules
  • Command: git status

    • Lets you know the relative status of your local repo v the remote/origin
  • Command: git log

    • Lets you see what’s been going on in Git recently
  • Command: df -h

    • Checks how much free space you have on your computer
  • Command: ls

    • Gives you a list of the folders/files in your current directory
  • Command: ls -la

    • Gives you a list of ALL (even hidden) files in your current directory
  • Command: cd

    • = change directory: helps you change directories

    • If you type “cd” with nothing after it, it will take you back to your home directory

    • If you type “cd” with the name of a parent or child directory relative to where you are, you will move to that directory

    • SHORTCUT: type “cd” and then the first character or two of your desired directory, then press [tab] and it will fill in the directory that matches the beginning of these characters

      • If this freezes, then there is more than one directory that begins the same way. Type another character or two so it is unique
  • Command: cd ..

    • = go up a level in directories

    • cd ../.. = go up 2 levels!

  • Command: less [filename of a file in your current directory]

    • Allows you to see the file’s contents

    • NB: for filenames with spaces, precede each space with a backslash

  • Command: pwd

    • = print working directory: tells you where you are (what directory you’re in)
  • Command: mkdir

    • = make directory: create new directory
  • Command: mv [filename] [new filename]

    • = move (but actually means rename the file)
  • Command: touch

    • Creates a quick file
  • DANGER: Command: rm -f [filename]

    • = remove, force (don’t ask questions or check if you’re sure)

For more information: