Guides / The shell is the admin surface

Linux commands

Files, permissions, processes, and archives from a login shell. Know the defaults before you chain flags. The man page is the contract.

Linux commands: files, permissions, processA login shell is how you move files, set permissions, and control processes. Learn the defaults before you chain flags.MODERUNPATHFilesls · cp · tarMODEPermschmod · sudoPIDProcessps · kill · dfTHE SHELL IS THE ADMIN SURFACENavigate, set mode, then manage what is running. Octal is owner · group · other.rm is permanent. 777 is not a fix. man is the contract.

Everyday Linux admin work is a small set of file, permission, process, and archive commands used carefully. Community Linux command references motivated this set — three digests for Linux, Windows, and macOS that cover the same domains without reprinting any one sheet. Learn the defaults. Read the man page before you invent a one-liner you will not remember under pressure.

First principles

The shell runs as you. sudo elevates to root for one command or a session. Paths are case-sensitive. A deleted file is usually gone from that filesystem; there is no Recycle Bin unless you installed one. Permissions are owner, group, and other — read, write, execute — often written as an octal triple. 644 is a normal file. 755 is a normal directory or executable. 777 is almost never the right answer on a shared host.

Navigate and move files

pwd
ls -la
cd /var/log
cp -a src/ dest/
mv oldname newname
rm file.txt
cat notes.txt
less /var/log/syslog
du -sh *
df -h

ls -la shows hidden files and modes. cp -a preserves mode, ownership, and timestamps where you are allowed. rm removes; it does not ask twice unless you alias it. Prefer a trash helper (gio trash, trash-cli) for interactive desktop use. On servers, pause before rm -r.

Permissions

ls -l file
chmod 644 file
chmod u+x script.sh
chown user:group file
sudo -l
sudo command

Octal: hundreds digit is owner, tens is group, ones is other. 4 read, 2 write, 1 execute. Add them. chmod 600 is private to the owner — right for keys and some configs. Never chmod 777 on production paths to "make it work". Fix the owner or the group instead.

Archives and a glance at GPG

tar -czf bundle.tgz ./folder
tar -tzf bundle.tgz
tar -xzf bundle.tgz
zip -r bundle.zip ./folder
unzip -l bundle.zip
gpg --encrypt --recipient you@org secret.txt
gpg --decrypt secret.txt.gpg

tar -c create, -x extract, -t list, -z gzip, -f the archive name. zip and unzip are fine for handovers that do not need Unix ownership. GPG here is identity-based encryption, not a zip password. Separate from the password-zip guide.

Processes and memory

ps aux | less
top
free -h
df -h
kill PID
kill -9 PID

ps lists. top refreshes. free and df are capacity, not health. kill sends SIGTERM by default — give the process a chance. kill -9 is SIGKILL; use it when the process will not exit, and expect unclean state.

Terminal shortcuts

Ctrl+C     interrupt the foreground job
Ctrl+Z     suspend; then fg or bg
Ctrl+R     reverse-search shell history
Tab        complete; Tab Tab lists matches
man cmd    the manual for that command
man 5 passwd   section 5 when names collide

House rules

  • rm -r is permanent on that filesystem. Prefer trash tools on a desktop. On a server, name the path twice before you press Enter.
  • Never chmod 777 to clear an access error. Fix ownership, group membership, or the mode you actually need.
  • Do not paste sudo passwords into chat or scripts. sudo -l shows what you may run.
  • Read man before you chain unfamiliar flags. The man page is the contract for that binary on that host.

Informed by GNU coreutils — manual.