RU | EN | DE

CommandDescription
Quick system information
hostnamectlshows the host name and basic system data (virtual/hardware, hostname)
uname -ainformation about the Linux kernel (version, architecture).
lsb_release -aUbuntu distribution version (release, codename)
uptimehow long the server is running + current load average.
wwho is logged in and what they are doing (sessions, load, commands).
wholist of logged in users
idUID/GID of the current user and his group.
datecurrent date/time.
timedatectltime, time zone, NTP synchronization.
who -bdate and time of last download
uptime -sdate and time of last download
last -x | grep boot | head -n 1date and time of last download
Users and Groups
adduser vitcreates a user (with a home folder and basic settings).
deluser vitdeletes the user (usually does not touch the home folder without options).
passwd vitsets/changes the user password.
usermod -aG sudo vitadds the user to the sudo group (gives sudo rights).
chage -l vitShows password policy (validity/expiration).
groupadd devscreates the group devs.
usermod -aG devs vitadds the user to the devs group.
Permissions and Ownership
chmod 640 filechanges access rights (example: owner rw, group r, others without rights).
chown user:group filechanges the owner and group of a file.
getfacl fileshows ACL rights (extended rights besides chmod).
setfacl -m u:vit:rwx dirissues ACL rights to the user vit on the directory.
Sudo (admin access)
sudo -iopen root-shell (almost like a full root login).
sudo -lshows what commands the current user can run through sudo.
visudosecure editing /etc/sudoers (checks syntax before saving).
journalctl _COMM=sudoshows events related to sudo (who/when called).
systemd/systemctl - service management
systemctl status nginxservice status: whether it is active, PID, last lines of logs.
systemctl start nginxstarts the service.
systemctl stop nginxstops the service.
systemctl restart nginxrestarts the service.
systemctl enable nginxEnables autorun on boot.
systemctl disable nginxturns off autorun
systemctl is-enabled nginxquick answer: autorun is enabled or not.
systemctl list-units --type=service --state=runninglist of all running services.
systemctl list-unit-files --type=servicelist of units and their autorun mode.
systemctl status nginx -lstatus with “long” lines without trimming.
journalctl -u nginx -blogs of a specific service from the moment of loading.
journalctl -u nginx --since "1 hour ago"service logs for the last hour.
Processes and load
topinteractively shows processes, CPU, memory, load.
htopa more convenient analogue of top (if installed).
ps aux --sort=-%cpu | headtop processes by CPU.
ps aux --sort=-%mem | headtop processes by memory.
pidof nginxPID of the process by name (if one/several, it will show everything).
pgrep -a nginxPID + run command (more useful than pidof)
kill -TERM <pid>”gently” asks the process to terminate (preferred).
kill -9 <pid>“hard” kills (use only if frozen).
nice -n 10 <cmd>runs a command with reduced CPU priority.
renice 10 -p <pid>changes the priority of an already running process.
Memory, disk, file systems
free -hUsing RAM and swap in human readable form.
vmstat 1 5brief CPU/memory/IO statistics every 1 second (5 times).
df -hbusy/free on file systems.
df -ichecking the inode (sometimes there is space, but the inode has run out).
lsblk -fdisks/partitions/FS/UUID (convenient for diagnostics and mounting).
blkidUUID and file system types.
du -h --max-depth=1 /var | sort -hwhich folders in /var are taking up space.
sudo du -xh / | sort -h | tail -n 30the heaviest directories are on the root.
lsof | grep deletedShows processes that keep deleted files open.
Network and Ports
ip aIP addresses, interfaces, status.
ip rrouting table (where traffic goes by default).
ss -tulpnwhich ports are listened to (TCP/UDP) and by which processes.
ss -tpnactive TCP connections and processes.
ping -c 4 1.1.1.1checking ICMP to IP (whether there is a connection to the Internet/network).
ping -c 4 google.comDNS + connection check.
curl -I https://example.comcheck HTTP(S) headers and availability.
wget -S --spider https://example.com“check without downloading” shows the server response.
resolvectl statuscurrent DNS settings are systemd-resolved.
resolvectl query example.comcheck how the domain resolves.
traceroute 8.8.8.8the path of packets to the node (where it “dies”).
`mtr -rw 8.8.8.8traceroute + loss statistics (very convenient).
Firewall (UFW)
ufw status verbosecurrent rules and operating hours.
ufw allow 22/tcpallow incoming SSH.
ufw allow 80,443/tcpallow HTTP/HTTPS.
ufw deny 23/tcpdeny port (example: telnet).
ufw delete allow 80/tcpdelete a specific rule.
ufw enableenable firewall.
ufw disableturn off the firewall.
SSH (access and diagnostics)
ssh user@hostconnection via SSH.
ssh -v user@hostdetailed debugging: keys, algorithms, reasons for failure.
ssh-keygen -t ed25519create an SSH key.
ssh-copy-id user@hostcopy the key to the server (to log in without a password).
systemctl status sshsshd status.
journalctl -u ssh -bsshd logs from the moment of boot.
Packages and Updates (APT/dpkg)
apt updateupdates the list of packages from the repositories.
apt upgradeupdates packages without “dangerous” dependency replacements.
apt full-upgradeupdates packages, may remove/replace dependencies (sometimes necessary).
apt install pkgpackage installation.
apt remove pkgremoving the package (configs may remain).
apt purge pkgremoving the package along with its configs.
apt autoremoveremoves orphaned dependencies.
apt cleanclears the cache of downloaded packages.
apt policy nginxshows versions (installed/available sources).
apt-cache madison nginxlist of available package versions.
dpkg -l | grep nginxwhat nginx packages are installed.
dpkg -S /path/to/filewhich package “owns” the file.
File/string search and orientation
find / -name "nginx.conf" 2>/dev/nullsearch for a file by name (we hide access errors).
grep -R "PermitRootLogin" /etc/ssh -nsearch for a line in files recursively + line numbers.
rg "server_name" /etc/nginxquick search (ripgrep), if installed.
which nginxpath to the executable file that will be launched from the shell.
whereis nginxwhere is the binary/sources/man pages (wider than which).
type nginxwill show what it is: alias/function/built-in/file.
Schedulers: cron and systemd timers
crontab -llist of cron jobs for the current user.
sudo crontab -lcron jobs for root.
crontab -eediting cron.
ls -l /etc/cron.*system cron directories (daily/weekly/monthly).
systemctl list-timers --alllist of systemd timers (what runs and when).
Docker (if used)
docker psrunning containers.
docker logs -f <container>container logs (monitor in real time).
docker exec -it <container> bashgo inside the container.
docker statscontainer load (CPU/RAM/IO).
Quick diagnostic checklist (5 commands)
systemctl status <service> -lIs the service alive and what does it say?
journalctl -u <service> -b | tail -n 200service errors.
ss -tulpnwhether the port is listening.
df -h; df -i; free -hlocation/inodes/memory.
ip r; resolvectl query google.com; curl -I https://example.comroute/DNS/HTTP.