Lesson 2: The Quick Draw (Nano & Shell Configuration)
Vim is powerful, but it has a steep learning curve. For quick edits, Nano is the friendlier alternative — and knowing both makes you versatile.
Nano: The Friendly Editor
Nano shows its shortcuts right at the bottom of the screen. No modes, no surprises.
nano filename.txt
Essential Nano Shortcuts:
| Shortcut | Action |
|----------|--------|
| Ctrl + O | Save (Write Out) |
| Ctrl + X | Exit |
| Ctrl + K | Cut (delete) current line |
| Ctrl + U | Paste the cut line |
| Ctrl + W | Search for text |
| Ctrl + G | Show help |
When to Use What?
| Editor | Best For | Learning Curve | |--------|----------|---------------| | Vim | Complex edits, macros, speed | Steep 🏔️ | | Nano | Quick config changes | Gentle 🌊 | | VS Code (via SSH) | Full development | Moderate 🏕️ |
The Magic of .bashrc
The .bashrc file is your shell's configuration file. It runs every time you open a new terminal. You can customize:
-
Aliases — Shortcuts for long commands:
alias ll='ls -la' alias gs='git status' alias deploy='cd /opt/app && git pull && npm run build' -
Environment Variables — Settings for your tools:
export EDITOR=nano export PATH="$PATH:/usr/local/go/bin" -
Custom Prompt — Make your terminal look professional:
PS1='\[\e[32m\]\u@\h\[\e[0m\]:\[\e[34m\]\w\[\e[0m\]\$ '
After editing .bashrc, apply changes with:
source ~/.bashrc
Mission Objective
Customize your terminal environment:
- Try nano: Open a file with
nano notes.txt(type something, thenCtrl+Oto save,Ctrl+Xto exit). - Inspect your config: View your current shell settings with
cat ~/.bashrc. - Create a shortcut: Add an alias with
echo "alias ll='ls -la'" >> ~/.bashrc.
Pro Tip
Many DevOps engineers keep their dotfiles (.bashrc, .vimrc, .gitconfig) in a Git repository so they can set up any new server in seconds with their preferred configuration.