Boot, systemd, journalctl, df/du, memory, networking, performance
Practise these as flashcards. One or two lines each; the ones you miss come back first.
Start freeFirmware runs POST and hands off to GRUB. GRUB loads the kernel and initramfs. The kernel starts the hardware, mounts the real root filesystem and launches systemd as PID 1. systemd brings up the default target and its services.
df -h to find the filesystem, then du -xsh /path/* | sort -h to find the biggest folder. It's usually logs: truncate or compress them, then fix logrotate so it doesn't come back. If du doesn't add up, a deleted file is still open. Find it with lsof +L1 and restart that process.
start runs the service now. enable makes it start at boot. enable --now does both.
Owner can read, write and execute. Group and others can read and execute. It's the normal mode for scripts and directories.
su switches to another user and needs that user's password. sudo runs one command as root with your own password, is logged, and can be limited per command in sudoers.
journalctl -u <service> --since "1 hour ago", and journalctl -u <service> -f to follow. Add -p err for errors only, -b for this boot, -b -1 for the previous boot.
df reports used and free space per mounted filesystem, from the filesystem's own accounting. du adds up the sizes of files it can walk to. -h makes both human-readable. Use df -h to find which mount is full, then du -xh --max-depth=1 <mount> | sort -h to find what's filling it.
ss -tlnp | grep 8080 (or lsof -i :8080). It shows the process, PID and bind address. If it's bound to 127.0.0.1, only local clients can reach it.
/etc/passwd is world-readable and holds username, UID, GID, home directory and shell. /etc/shadow is readable only by root and holds the password hashes and expiry settings.
A hard link is another name for the same inode: same data, survives deleting the original, can't cross filesystems or point at directories. A symlink is a small file containing a path: can cross filesystems, but breaks if the target moves.
> file 2>&1 mean?Send stdout (1) to the file, then send stderr (2) to wherever stdout is going, so both end up in the file. Order matters: 2>&1 > file sends stderr to the terminal.
find / -xdev -type f -size +1G -exec ls -lh {} \;. -xdev keeps it on one filesystem so it doesn't crawl NFS mounts or /proc.