Linux / Bash
Beginner
1 min read
The Linux Shell and Terminal Basics
Example
# Display the current shell
echo $SHELL
# /bin/bash
# Display the Bash version
bash --version
# Show command history
history
history 20 # Show last 20 entries
!42 # Re-run command number 42
!! # Re-run the last command
!ls # Re-run the last command starting with 'ls'
# Useful keyboard shortcuts (reference)
# Ctrl+C — interrupt / cancel current process
# Ctrl+Z — suspend current process (resume with fg)
# Ctrl+D — send EOF / logout
# Ctrl+L — clear the screen
# Ctrl+A — move cursor to beginning of line
# Ctrl+E — move cursor to end of line
# Ctrl+R — reverse search through history
# Tab — autocomplete command or filename
# Alt+. — insert last argument of previous command
# Get help for a command
man ls # Open manual page for ls
ls --help # Short inline help
info bash # Detailed info pages
# Identify where a command lives
which bash
# /bin/bash
type ls
# ls is aliased to `ls --color=auto`
Related Resources
Linux / Bash Reference
Complete tag & property list
Linux / Bash How-To Guides
Step-by-step practical guides
Linux / Bash Exercises
Practice what you've learned
More in Linux / Bash