Command | Description |
---|---|
cd - |
๐ Teleport to previous directory |
pushd <dir> |
๐ Change directory, save current to stack |
popd |
๐ Return to most recently pushed directory |
cd ~ |
๐ Go to home directory |
cd .. |
โฌ๏ธ Go up one directory |
pwd |
๐บ๏ธ Print working directory |
ls -lah |
๐ List all files (including hidden) with details |
tree |
๐ณ Display directory structure |
Command | Description |
---|---|
Ctrl + L |
๐งผ Quick clear screen |
reset |
๐ Deep clean terminal state |
clear |
๐งฝ Clear screen (alternative to Ctrl + L) |
history -c |
๐๏ธ Clear command history |
Command | Description |
---|---|
Ctrl + Z |
โธ๏ธ Suspend foreground process |
fg |
|
bg |
๐โโ๏ธ Resume job in background |
jobs |
๐ List all background jobs |
command & |
๐โโ๏ธ Run command in background |
nohup command & |
๐โโ๏ธ๐ช Run command in background, immune to hangups |
screen |
๐บ Terminal multiplexer |
tmux |
๐ฅ๏ธ Terminal multiplexer (alternative to screen) |
Command | Description |
---|---|
sudo !! |
๐งโโ๏ธ Re-run last command with sudo |
sudo -i |
๐ Start a root shell |
sudo -u <user> command |
๐ญ Run command as another user |
visudo |
๐ Safely edit sudoers file |
Command | Description |
---|---|
Ctrl + R |
๐ Search command history |
history |
๐ Display full command history |
!<number> |
๐ข Run command by history number |
!! |
โฉ๏ธ Repeat last command |
!$ |
๐ Use last argument of previous command |
!* |
๐ Use all arguments of previous command |
!string |
๐ฎ Run most recent command starting with 'string' |
export HISTTIMEFORMAT="%F %T " |
โฐ Add timestamps to history |
export HISTCONTROL=ignorespace |
๐ต๏ธ Hide commands starting with space |
export HISTIGNORE="ls:cd:exit" |
๐ Ignore common commands in history |
Command | Description |
---|---|
F11 |
๐ฅ๏ธ Toggle fullscreen mode |
Ctrl + Shift + Plus |
๐ Increase font size |
Ctrl + Shift + Minus |
๐ Decrease font size |
Ctrl + Shift + C |
๐ Copy selected text |
Ctrl + Shift + V |
๐ Paste clipboard content |
tput cols |
๐ Get terminal width |
tput lines |
๐ Get terminal height |
Command | Description |
---|---|
Ctrl + U |
โ๏ธ Cut from cursor to line start |
Ctrl + K |
โ๏ธ Cut from cursor to line end |
Ctrl + Y |
๐ Paste previously cut text |
Ctrl + A |
โฌ ๏ธ Move to start of line |
Ctrl + E |
โก๏ธ Move to end of line |
Alt + B |
๐ Move back one word |
Alt + F |
๐ Move forward one word |
Ctrl + W |
๐๏ธ Delete word before cursor |
Alt + D |
๐๏ธ Delete word after cursor |
Ctrl + _ |
โฉ๏ธ Undo last edit |
Command | Description |
---|---|
command1 ; command2 |
๐ Run commands sequentially |
command1 && command2 |
โ Run command2 if command1 succeeds |
command1 || command2 |
โ Run command2 if command1 fails |
command1 | command2 |
๐ฟ Pipe output of command1 to command2 |
command1 &> /dev/null |
๐คซ Redirect all output to null |
Command | Description |
---|---|
tail -f <file> |
๐ Monitor file in real-time |
head -n 20 <file> |
๐ Display first 20 lines of file |
truncate -s 0 <file> |
๐๏ธ Clear file contents |
command | column -t |
๐ Align output in columns |
command | less |
๐ Paginate command output |
command | tee <file> |
๐๐ฅ๏ธ Write output to file and display on screen |
command | xargs |
๐จ Build command lines from standard input |
Command | Description |
---|---|
find . -name "*.txt" |
๐ Find all .txt files in current directory and subdirectories |
grep "pattern" <file> |
๐ Search for pattern in file |
sed 's/foo/bar/g' <file> |
๐ Replace 'foo' with 'bar' in file |
awk '{print $1}' <file> |
โ๏ธ Print first column of file |
sort <file> |
๐ค Sort lines in file |
uniq <file> |
๐ญ Remove duplicate lines from file |
wc -l <file> |
๐ข Count lines in file |
Command | Description |
---|---|
uname -a |
๐ป Display system information |
lscpu |
๐ง Display CPU information |
free -h |
๐งฎ Display memory usage |
df -h |
๐ฝ Display disk usage |
du -sh * |
๐ Display size of files and directories |
ps aux |
๐ List all running processes |
top |
๐ Dynamic real-time view of running processes |
htop |
๐ Interactive process viewer |
Command | Description |
---|---|
ifconfig |
๐ง Display network interfaces |
ip addr |
๐ง Modern alternative to ifconfig |
netstat -tuln |
๐ Display network connections |
ss -tuln |
๐ Modern alternative to netstat |
ping <host> |
๐ก Test network connectivity |
traceroute <host> |
๐บ๏ธ Trace route to host |
nslookup <domain> |
๐ Query DNS |
curl <url> |
๐ฅ Transfer data from or to a server |
wget <url> |
๐ฅ Download files from the web |
Command | Description |
---|---|
chmod 755 <file> |
๐ Change file permissions |
chown user:group <file> |
๐ค Change file owner and group |
umask 022 |
๐ญ Set default permissions for new files |
- ๐ก Use tab completion to save time
- ๐จ Customize your shell prompt (
PS1
) - ๐ท๏ธ Create aliases for frequent commands
- ๐ Use
Ctrl + X + E
to edit long commands in text editor - ๐ง Master Vim or Nano for quick edits
- ๐ Use
htop
for system monitoring - ๐ฆ Learn package management commands
- ๐ง Explore advanced shell features
- ๐ Use SSH keys for secure remote access
- ๐ Write shell scripts to automate repetitive tasks
- ๐ Learn regular expressions for powerful text processing
- ๐ Read man pages (
man <command>
) to learn more about commands