ls -lah
Lists files with details, hidden files and human-readable sizes
Practical example
ls -lah
ls -lah /etc
developer reference
A practical Linux reference with search, one-click copy and printable PDF output.
43 commands visible
ls -lah
Lists files with details, hidden files and human-readable sizes
ls -lah
ls -lah /etc
find <path> -name "<pattern>"
Finds files by name or attributes
find . -name "*.py"
find /var -mtime -7 -type f # modified in the last 7 days
find . -size +10M
cp -r <src> <dst>
Copies files or directories
cp file.txt backup.txt
cp -r src/ dst/
mv <src> <dst>
Moves or renames files
mv old.txt new.txt
mv *.log /var/logs/
rm -rf <path>
Removes files or directories, irreversible
Permanently deletes files and directories. Verify the resolved path before using -rf.
rm file.txt
rm -rf ./tmpdir
mkdir -p <path>
Creates directories (-p also creates parents)
mkdir -p /opt/myapp/logs
ln -s <target> <link>
Creates a symbolic link
ln -s /opt/myapp /usr/local/bin/myapp
du -sh <path>
Size of files or directories
du -sh /var/log
du -sh * | sort -h # sort by size
cat <file>
Prints file content
cat /etc/hosts
cat file1 file2 > merged.txt
grep -rn "<pattern>" <path>
Searches patterns in files/directories
grep -rn "TODO" ./src
grep -v "^#" config.txt # exclude comments
grep -E "error|warn" app.log
sed 's/<old>/<new>/g' <file>
Replaces text in files with a stream editor
sed 's/http/https/g' urls.txt
sed -i 's/foo/bar/g' file.txt # edit in place
awk '{ print $1 }' <file>
Processes and transforms text column by column
awk '{print $1, $3}' data.txt
awk -F: '{print $1}' /etc/passwd # list users
sort
Sorts lines (--numeric-sort, --reverse, -u unique)
sort file.txt
sort -k2 -n data.txt
sort -u file.txt # remove duplicates
cut -d'<sep>' -f<n>
Extracts columns from delimited text
cut -d: -f1 /etc/passwd
cut -d',' -f2,4 data.csv
tail -f <file>
Shows last N lines; -f follows in real time
tail -100 app.log
tail -f /var/log/syslog
wc -l <file>
Counts lines (-l), words (-w), characters (-c)
wc -l access.log
grep "ERROR" app.log | wc -l
ps aux
Lists all processes with CPU/RAM usage
ps aux
ps aux | grep nginx
top
Interactive real-time process monitor
top
top -u www-data # filter by user
kill -<signal> <pid>
Sends a signal to a process
Verify the PID. Prefer SIGTERM; SIGKILL prevents cleanup and may lose unsaved data.
kill -9 1234 # SIGKILL: force termination
kill -15 1234 # SIGTERM: request a clean shutdown
killall <name>
Kills all processes with that name
Targets all matching process names. Verify the name and signal first.
killall nginx
nohup <cmd> &
Runs a command that survives logout
nohup python3 server.py &
nohup ./script.sh > out.log 2>&1 &
jobs
Lists background jobs in the session
jobs
bg %1 # send to the background
fg %1 # return to the foreground
chmod <mode> <file>
Changes file permissions
Linux permissions: what do chmod 644 and 755 mean? →Chmod calculator →
chmod 755 script.sh
chmod +x deploy.sh
find /var/www/html -type d -exec chmod 755 {} \;
find /var/www/html -type f -exec chmod 644 {} \;
chown <user>:<group> <file>
Changes owner of files/directories
chown www-data:www-data /var/www
chown -R enzo:enzo /opt/myapp
sudo <cmd>
Runs a command as superuser
sudo apt update
sudo -u postgres psql # as another user
sudo visudo
Safely edits the sudoers file
sudo visudo
curl -X <METHOD> <url>
Transfers HTTP/FTP data from the command line
curl -X GET https://api.example.com/users
curl -X POST -H "Content-Type: application/json" -d '{"k":"v"}' <url>
curl -O https://example.com/file.zip
ssh <user>@<host>
Remote SSH connection
ssh enzo@192.168.1.100
ssh -i ~/.ssh/id_rsa user@server
ssh -L 8080:localhost:80 user@server # tunnel
scp <src> <user>@<host>:<dst>
Copies files over SSH
scp file.txt enzo@server:/home/enzo/
scp -r ./dist user@server:/var/www/
ss -tulnp
Shows listening ports with processes
ss -tulnp
ss -tulnp | grep 8080
ip addr
Shows network interfaces and IP addresses
ip addr
ip addr show eth0
ping -c 4 <host>
Checks connectivity with a host
ping -c 4 google.com
ping -c 1 192.168.1.1
df -h
Free space per filesystem
df -h
df -h /var
lsblk
Lists block devices and partitions
lsblk
lsblk -f # include filesystems
tar -czf <archive.tar.gz> <path>
Creates a gzip-compressed archive
# create
tar -czf backup.tar.gz /opt/myapp
# extract
tar -xzf backup.tar.gz -C /tmp
# list archive contents
tar -tzf backup.tar.gz
rsync -avz <src> <dst>
Efficient file synchronization, local or SSH
rsync -avz ./dist/ user@server:/var/www/
rsync -avz --delete src/ dst/
uname -a
Kernel version and system info
uname -a
uptime
Uptime and load average
uptime
uptime -p # human-readable
systemctl <action> <service>
Manages systemd services
systemctl start nginx
systemctl enable nginx
systemctl status nginx
systemctl restart nginx
journalctl -u <service> -f
systemd logs for a service, follow mode
journalctl -u nginx -f
journalctl -u nginx --since "1 hour ago"
env
Shows environment variables
env
env | grep PATH
export VAR=value
Sets an environment variable for the session
export NODE_ENV=production
export PATH="$PATH:/opt/myapp/bin"
crontab -e
Edits current user cron jobs
# format: minute hour day month weekday command
0 2 * * * /opt/backup.sh # every night at 02:00
*/5 * * * * /opt/check.sh # every 5 minutes
Directories require the execute bit to traverse them. Applying 644 recursively makes directories inaccessible; set directory and file permissions separately for your use case.
Use Print PDF. The printable version includes all commands and practical examples, including sections hidden by a search.
Yes. Serve the static files with a local HTTP server. Search, filters and copying run in your browser; the Regex tester requires a worker-enabled HTTP context.