Back to Cheatsheets

Terminal Cheatsheet

Essential terminal commands and shortcuts for efficient command-line usage.

File Operations

ls -la

List all files with details

cp file1 file2

Copy file1 to file2

mv file1 file2

Move/rename file1 to file2

rm -rf dir

Remove directory recursively

chmod +x file

Make file executable

Text Processing

cat file

Display file contents

grep pattern file

Search for pattern in file

sed 's/old/new/g' file

Replace text in file

awk '{print $1}' file

Print first column

sort file

Sort file contents

Process Management

ps aux

List all processes

kill -9 pid

Force kill process

top

Monitor system processes

htop

Interactive process viewer

bg %1

Run job in background

System Info

uname -a

Show system info

df -h

Show disk usage

free -h

Show memory usage

uptime

Show system uptime

whoami

Show current user

Terminal Shortcuts

Ctrl + C

Interrupt process

Ctrl + D

End of file/Exit

Ctrl + Z

Suspend process

Ctrl + R

Search history

Ctrl + L

Clear screen

Navigation

cd ~

Go to home directory

cd -

Go to previous directory

pushd dir

Save and change directory

popd

Return to saved directory

pwd

Show current directory