Linux Commands Cheatsheet

Essential Linux terminal commands for file management, system operations, and administration.

File Management

ls

List directory contents

Example:

ls -la
cd [directory]

Change directory

Example:

cd /var/www
pwd

Print working directory

Example:

pwd
mkdir [name]

Create a directory

Example:

mkdir my-project
rm [file]

Remove file

Example:

rm file.txt
rm -rf [directory]

Remove directory recursively

Example:

rm -rf node_modules
cp [source] [dest]

Copy file or directory

Example:

cp file.txt backup.txt
mv [source] [dest]

Move or rename file

Example:

mv old.txt new.txt

File Content

cat [file]

Display file contents

Example:

cat config.json
grep [pattern] [file]

Search for pattern in file

Example:

grep "error" log.txt

Permissions

chmod [permissions] [file]

Change file permissions

Example:

chmod 755 script.sh
chown [user]:[group] [file]

Change file owner

Example:

chown www-data:www-data index.html

System

ps aux

List running processes

Example:

ps aux | grep node
top

Display system processes

Example:

top
kill [pid]

Kill a process

Example:

kill 1234
df -h

Show disk usage

Example:

df -h
du -sh [directory]

Show directory size

Example:

du -sh /var/log

Archive

tar -czf [archive.tar.gz] [files]

Create compressed archive

Example:

tar -czf backup.tar.gz /home/user

Related Resources

1 items

Compare Options

Frequently Asked Questions

How do I use this linux commands cheatsheet?

Simply find the command you need, click the copy button to copy it to your clipboard, and paste it into your terminal or code editor. Each command includes a description and example to help you understand its usage.

Can I download this cheatsheet?

Currently, this cheatsheet is available online. You can bookmark this page for quick access.