Commands
15 of 15 commands
C top
- chmod Linux
-
$ chmod 644 file $ chmod g+r fileChange a file’s permission bits.
Two notations, and both are worth knowing. Symbolic (
g+r) changes only what you name and leaves the rest alone. Numeric (644) sets all nine bits at once. Reach for symbolic when adjusting one thing, numeric when you want a known end state.$ chmod 600 ~/.ssh/id_ed25519Careful: Removing your own read or execute bit is easy and immediately confusing. Numeric notation overwrites every bit, not just the one you were thinking about.
- curl Networking
-
$ curl -sSI https://example.comMake an HTTP request and show what comes back.
The fastest way to prove a service answers, and to see the headers it sets.
-Ifetches headers only,-ssilences the progress meter, and-Sputs errors back after-sremoved them.$ curl -sS -o /dev/null -w '%{http_code} %{time_total}s\n' https://example.com
D top
- dig Networking
-
$ dig +short example.comQuery DNS and show the answer.
Use it rather than
pingwhen the question is about name resolution.+shortgives just the answer;@resolverasks a specific server, which is how you tell “DNS is broken” apart from “this resolver is broken”.$ dig +short @9.9.9.9 example.com
F top
- free Linux
-
$ free -hShow physical memory and swap use.
Reads its numbers from
/proc/meminfo. Theavailablecolumn is the one to look at — Linux deliberately uses spare memory for cache, so a smallfreefigure is normal rather than a problem.
G top
- grep Linux
-
$ grep -r pattern pathFind lines matching a pattern.
Most often the middle of a pipeline rather than a command on its own.
-rrecurses,-ngives line numbers,-iignores case, and-vinverts the match.$ ps -ef | grep sshd
I top
- ip Networking
-
$ ip -br address $ ip routeShow and configure addresses, routes, and interfaces.
The modern replacement for
ifconfigandroute.-brgives a brief one-line-per-interface view,-4and-6restrict it to one family, andip -s linkadds error and drop counters — a link can negotiate fine and still be marginal.$ ip -6 neigh show
L top
- ln Linux
-
$ ln -s target linknameCreate a link to a file or directory.
With
-sit makes a symbolic link. The argument order is the thing that catches people: the target that already exists comes first, the name being created second. - ls Linux
-
$ ls -l $ ls -laList directory contents.
-lis the form worth reading closely: ten characters of mode, then links, owner, group, size, time, and name.-aincludes dot files, which is most of a home directory.$ ls -ld /bin
M top
- man Linux
-
$ man 5 passwd $ man -k "disk space"Read the manual page for a command, file format, or system call.
Sections matter — the same name can appear in several. Section 1 is user commands, 5 is file formats, 8 is administration.
man -ksearches the descriptions when you do not know the name. Press/to search within a page.
P top
- ping Networking
-
$ ping -c2 hostSend ICMP echo requests to test reachability.
Proves a host answers ICMP. It says nothing about whether a service is listening — use
ssorcurlfor that. Plenty of hosts drop ICMP by policy, so silence is not proof of absence.Careful: A quiet ping is weak evidence in both directions. Do not conclude a host is down from it.
- ps Linux
-
$ ps -ef $ ps -ef --forestList running processes.
--forestdraws the parent/child tree, which makes the result offork()visible — every process descends from the first one. Usually piped intogrepto find a particular service.$ ps -ef --forest | head -20
S top
- ss Networking
-
$ ss -tlnShow sockets — what is listening, and what is connected.
The replacement for
netstat.-tis TCP,-llistening only,-nskips name resolution so the output is fast and unambiguous. Compare services bound to loopback against those bound to a wildcard: the first group is reachable only from the machine itself.$ ss -tlnp
T top
- tar Linux
-
$ tar czf archive.tar.gz dir/ $ tar tvf archive.tar.gzBundle many files into one archive, optionally compressed.
The flags are positional and old-fashioned:
ccreate,xextract,tlist,vverbose,fnaming the file, which must come last of the letters. Runtar tvfbefore extracting so you know whether the archive expands into a directory or scatters files where you stand.$ zcat archive.tar.gz | tar xvf -Careful: Ownership is restored by numeric ID and needs root to reproduce. ACLs, extended attributes, and SELinux contexts each need asking for explicitly.
- tcpdump Networking
-
$ tcpdump -i eth0 udp port 4789Capture and print packets crossing an interface.
The instrument for questions no status command answers — what is actually on the wire, and whether an encapsulated frame really carries what you think. Needs root, and a filter expression, or it will drown you.
Careful: Captures may contain credentials and payload data. Use purpose-built fixtures for examples you intend to share.
U top
- umask Linux
-
$ umask 022 $ umask 077Set the permission bits removed from newly created files.
Subtractive, and from different bases: 666 for files and 777 for directories.
022gives 644 and 755;077gives 600 and 700. It applies to the shell that runs it, so persistence means putting it in a startup file.