Sachin Chaurasiya

Toolbox · Systems

Linux Commands

Process, disk, memory, file and service inspection for production hosts.

Last reviewed
2026-09-18
On this page

Processes and load

CommandPurpose
uptimeLoad averages (1/5/15 min)
top -o %MEM / htopLive process view
ps -eo pid,ppid,user,%cpu,%mem,etime,cmd --sort=-%cpu | headTop CPU consumers
pgrep -af nginxFind processes by name
strace -f -p <pid> -e trace=networkTrace syscalls of a running process
lsof -p <pid>Open files/sockets of a process
kill -TERM <pid> then kill -KILL <pid>Graceful, then forced

Memory and disk

CommandPurpose
free -hMemory incl. cache/buffers
vmstat 1 5Paging, IO wait, context switches
df -hTFilesystem usage
du -xsh /var/* 2>/dev/null | sort -h | tailWhat is filling the disk
lsof +L1Deleted-but-open files holding space
iostat -xz 1 3Disk latency and utilisation
dmesg -T | tail -50Kernel messages (OOM killer, disk errors)

Files and text

CommandPurpose
find /var/log -name '*.log' -mtime -1 -size +50MRecent large logs
grep -rn --include='*.conf' 'listen' /etc/nginxRecursive search
tail -F /var/log/app.logFollow, survive rotation
journalctl -u nginx -f --since "10 min ago"Service logs
sed -n '120,140p' filePrint a line range
awk -F: '$3 >= 1000 {print $1}' /etc/passwdHuman users
stat -c '%U:%G %a %n' /etc/ssh/sshd_configOwner and mode

Services and boot

CommandPurpose
systemctl status nginxState and recent logs
systemctl list-units --failedFailed units
systemctl cat nginxEffective unit file
systemd-analyze blameSlow boot units

Users and permissions

CommandPurpose
id user / groups userIdentity
last -n 20 / lastlogLogins
sudo -l -U userSudo rights
chmod 600 file / chown app:app filePermissions
getfacl fileACLs