terminal

root@cheat

Filtering by:systemcloseClear

free -h

Display memory usage in human-readable format. Shows RAM and swap usage statistics.

$ free -h free -m watch free -h
systembeginner

journalctl -xe

View systemd journal logs with extended info. -x adds explanatory help text, -e jumps to the end.

$ journalctl -u nginx journalctl --since '1 hour ago'
system

systemctl restart

Restart a systemd service. Stops and then starts the service, applying any configuration changes.

WARNING: sudo systemctl restart apache2 sudo systemctl restart sshd
Dangeroussystem

systemctl status

Check the status of a systemd service. Shows if the service is running and recent log entries.

$ systemctl status nginx systemctl status --user
system

uname -a

Print detailed system information including kernel name, version, hostname, and architecture.

$ uname -a uname -r uname -m
systembeginner

uptime

Show how long the system has been running, number of users logged in, and system load averages.

$ uptime uptime -p
systembeginner

kill -9

Forcefully terminate a process by its PID. Signal 9 (SIGKILL) cannot be caught or ignored.

WARNING: kill -9 $(pgrep firefox) killall -9 chrome
Dangeroussystem

htop

Enhanced interactive process viewer with color display and mouse support. More user-friendly than top.

$ htop -u root htop -t
system

top

Interactive real-time process viewer. Shows system summary and list of processes updated continuously.

$ top -u username top -p 1234
system

ps aux

Display all running processes with detailed information including CPU and memory usage.

$ ps aux | grep nginx ps aux --sort=-%mem | head
system

tail -f

Display the last lines of a file and follow new additions. -f flag follows the file in real-time.

$ tail -n 50 /var/log/syslog tail -f /var/log/nginx/access.log
filessystem

apt

Install packages on Debian/Ubuntu systems

$ sudo apt install nginx
packagessystem

sudo

Execute a command with superuser privileges

WARNING: sudo apt update
Dangeroussystemsecurity

df

Display disk space usage in human-readable format

$ df -h /dev/sda1
disksystem