Source

Command line, also known as CLI, console, terminal, shell.

Difference

  • Console: physical device to interact with computer — computer, keyboard, mouse.

  • Terminal: text input & output environment. A program that acts as a wrapper and we can enter commands that computer processes. Can install or uninstall, or install many terminals in your computer.

  • Shell: A program that acts as command-line interpreter. It processes commands and outputs the results. Eg: Bash, Powershell, Zsh, Fish. Shells also work as programming languages, as we can build scripts to make computer execute a certain task.

The terminal is the program in which the shell will run. Both are independent.

  • CLI (command line interface): the interface in which we enter commands for the computer to process. Practically the same as terminal.

  • GUI (graphical user interface): user can see things & click on & computer execute the corresponding task.

Why use terminal?

  • More efficient than using GUI. A command line can excute some tasks that may require many clicks using GUI.

  • Automate tasks: build scripts for repetitive tasks.

  • Sometimes CLI is the only way to interact with computer.

  • It’s cool and fun lol.

Notes

  • Bash is recommended as it’s the most standard & commonly used.

  • Shells & terminals are customizable. Plugins like OhMyZsh or Starship allow to customize easier.

Most useful commands

  • pwd: print working directory - show where we are

  • ls: show contents of the directory you’re currently in

  • cd ..: go to the directory that contains the current directory

  • mkdir cat: make directory named cat

  • rmdir cat: remove directory

  • touch test.md: create a file in current directory

  • rm test.md: delete file

  • :q!: exit editor

  • ctrl c: exit the process the terminal is running

  • ctrl shift c/v to copy and paste

  • clear: clear previous content

  • tab: autocompletion