Linux Cheatsheet

A quick reference for common Linux commands.

File Commands

Command Description
ls List directory contents.
ls -la List all files (including hidden) in long format.
cd [dir] Change the current directory.
pwd Show the present working directory.
mkdir [dir] Create a new directory.
rm [file] Remove a file.
rm -r [dir] Remove a directory and its contents recursively.
cp [file1] [file2] Copy a file.
mv [file1] [file2] Move or rename a file.
touch [file] Create a new empty file or update the timestamp of an existing file.
cat [file] Display the contents of a file.
head [file] Display the first 10 lines of a file.
tail [file] Display the last 10 lines of a file.

File Permissions

Command Description
chmod [permissions] [file] Change the permissions of a file (e.g., chmod 755 myfile).
chown [user:group] [file] Change the ownership of a file.

Networking

Command Description
ping [host] Check network connectivity to a host.
ifconfig Display network interface information (deprecated, use 'ip addr').
ip addr Display network interface information.
netstat -tulpn Show all listening ports and services.

Process Management

Command Description
ps Display currently active processes.
top Display all running processes in real-time.
kill [pid] Terminate a process with the given process ID (pid).
killall [proc] Kill all processes named [proc].

Searching

Command Description
grep [pattern] [file] Search for a pattern within a file.
find [dir] -name [filename] Search for files in a directory.

System Information

Command Description
df Display disk space usage.
du Display directory space usage.
free Display memory and swap usage.
uname -a Show kernel and system information.

© 2025 devcortex.ai ・ AI-powered developer tools.