DEV Community

avery
avery

Posted on

18. The Unix Command Line

BootCamp by Dr.Angela

1. Install Git Bash on Windows

2. Understanding the Command Line

  • Shell vs Kernel
    • Shell: user interface (CLI/GUI) that interacts with the system
    • Kernel: core of the OS that manages CPU, memory, and disks
  • Bash (Bourne Again Shell) : A popular Unix shell (used in macOS and Linux)
  • Why use CLI (Command Line Interface)? : Faster, More control, More flexible

3. Command Line Navigation

  • ls : list files and directories
  • cd : change directory
  • cd .. : move up one level
  • Tips
    • Tab : auto-complete
    • ↑ / ↓ : reuse previous commands
    • Drag & drop folder : auto path input
    • Alt + Click : move cursor
    • Ctrl + A : move to beginning of line
    • Ctrl + E : move to end of line
    • Ctrl + U : delete to the beginning

4. File & Directory Management

  • Create
    • mkdir folder-name # create folder
    • touch file.txt # create file
  • Open
    • start file.txt # Windows
    • open file.txt # macOS
    • code file.txt # open in VS Code
  • Delete
    • rm file.txt # delete file
    • rm * # delete all files in current folder
    • rm -r folder-name # delete folder
  • Other commands
    • pwd # show current path
    • clear # clear terminal
  • Reference : https://www.learnenough.com/command-line-tutorial
  • Note (Important)
    • rm * and rm -r are dangerous commands, Always double-check before running them (no undo)

Top comments (0)