Command-Line Interfaces (CLI)
A Command-Line Interface (CLI) is a text-based way to interact with your computer. Instead of clicking through menus, you type commands into a terminal to navigate directories, manage files, run programs, and more. While it may seem intimidating at first, the CLI is powerful for automation, customization, and efficiency.
Why use CLI
Efficiency: Perform tasks faster than through graphical interfaces.
Automation: Combine commands into scripts for repeatable workflows.
Control: Access deeper system functionality and options.
Remote Work: SSH into servers and manage systems without a GUI.
Common CLIs include bash, zsh, and PowerShell. On macOS and Linux, bash or zsh are standard; on Windows, PowerShell is the default.
The Shell
The shell is the program that interprets commands you type and executes them.
Popular shells:
Bash: Common on Linux
Zsh: Default on macOS
PowerShell: Default on Windows
The shell supports built-in commands and lets you run programs, pipe outputs, and customize your environment.
Aliases
An alias is a shortcut for commands.
Optimize your workflow by:
Shortening commands
Reduce errors from mistyping
Customize common CLI commands
What is an alias?
An alias is a shortcut for commands.
alias ll='ls -lah'Why use aliases?
- Save time by shortening commands
- Reduce errors from mistyping
- Customize your CLI workflow
Make it permanent
Add to your shell configuration:
echo "alias ll='ls -lah'" >> ~/.zshrc && source ~/.zshrcMultiple Aliases
alias gs='git status'
alias gp='git pull'
alias gpush='git push origin main'