Wrap command names in headings as inline code
This commit is contained in:
@@ -73,7 +73,7 @@ Once the pattern clicks, commands can be plugged into each other:
|
||||
|
||||
Most command names are abbreviations of an English phrase. Once you know what they stand for, they stop looking like keyboard noise.
|
||||
|
||||
### pwd, print working directory
|
||||
### `pwd`, print working directory
|
||||
|
||||
Tells you where you are. It changes nothing, it just answers the question.
|
||||
|
||||
@@ -85,7 +85,7 @@ pwd
|
||||
/home/username/docker
|
||||
```
|
||||
|
||||
### ls, list
|
||||
### `ls`, list
|
||||
|
||||
Lists what's in the current folder. On its own it prints bare names, so it's almost always used with options: `-l` for the long format with sizes, dates and permissions, `-a` to also show hidden files (the ones starting with a dot), `-h` for sizes in K/M/G instead of raw bytes.
|
||||
|
||||
@@ -104,7 +104,7 @@ drwxr-xr-x 3 username username 4.0K Sep 2 18:44 immich
|
||||
|
||||
The first column is the permissions, `d` at the very start meaning it's a folder. Then the owner, the size, the date of the last change, and the name.
|
||||
|
||||
### cd, change directory
|
||||
### `cd`, change directory
|
||||
|
||||
Moves you around. With a path it goes there, with `..` it goes up one level, and with nothing at all it takes you back home.
|
||||
|
||||
@@ -117,7 +117,7 @@ username@serveex:~$
|
||||
|
||||
Notice the prompt following you around: it always shows where you currently stand, so you rarely need `pwd` in practice.
|
||||
|
||||
### mkdir, make directory
|
||||
### `mkdir`, make directory
|
||||
|
||||
Creates a folder. Several at once if you list them, and `-p` creates the whole chain of parents in one shot, which is the version you'll actually use.
|
||||
|
||||
@@ -132,7 +132,7 @@ mkdir -p docker/immich/config
|
||||
|
||||
Nothing. That's not a bug, it's the rule: most commands say nothing when they succeed and only speak up when something goes wrong. Silence is good news, and `ls` confirms the folder is there.
|
||||
|
||||
### cp and mv, copy and move
|
||||
### `cp` and `mv`, copy and move
|
||||
|
||||
`cp` copies, `mv` moves. Same shape both times: first the source, then the destination. Copying a folder needs `-r`, for *recursive*, since a folder means everything inside it too. `mv` doubles as the rename command, because renaming a file is just moving it to a new name.
|
||||
|
||||
@@ -149,7 +149,7 @@ compose.yaml compose.yaml.bak config config-backup new-name.txt
|
||||
|
||||
Three silent commands, and `ls` showing the result: the copy sits next to the original, the folder was duplicated, and `old-name.txt` is gone because moving it to another name is exactly what renaming means.
|
||||
|
||||
### rm, remove
|
||||
### `rm`, remove
|
||||
|
||||
Deletes. There is no recycle bin, no undo, no confirmation dialog. `-r` deletes a folder and its contents, `-f` forces without asking.
|
||||
|
||||
@@ -157,7 +157,7 @@ Deletes. There is no recycle bin, no undo, no confirmation dialog. `-r` deletes
|
||||
`rm -rf` is the command that wipes homelabs. It doesn't check, doesn't warn, and doesn't stop. Read the path twice before pressing :kbd{value="Enter"}, especially when the line starts with `sudo` and contains a `/` or a `*`. You can also prevent this by wrapping `sudo` in a small Bash function that asks **"are you sure?"** before it lets an `rm` through, covered in **rm confirmation guard**.
|
||||
::
|
||||
|
||||
### cat and nano, read and edit
|
||||
### `cat` and `nano`, read and edit
|
||||
|
||||
`cat` (short for *concatenate*) dumps a whole file to the screen, perfect for a short config. For anything longer, `less` scrolls through it (named as a joke on `more`, the older pager it replaced), and you quit it with :kbd{value="Q"}.
|
||||
|
||||
@@ -173,7 +173,7 @@ PGID=1000
|
||||
TZ=Europe/Paris
|
||||
```
|
||||
|
||||
### grep, search inside files
|
||||
### `grep`, search inside files
|
||||
|
||||
`grep` stands for *global regular expression print*, which is a mouthful for "find me this text". You give it what to look for and where, and it prints every matching line. `-r` searches a whole folder, `-i` ignores upper and lower case, `-n` shows line numbers.
|
||||
|
||||
@@ -188,7 +188,7 @@ grep -rin "password" /home/username/docker
|
||||
|
||||
Each line is the file, then the line number inside it, then the matching line itself. Very handy for the day you can't remember which stack holds a setting.
|
||||
|
||||
### sudo, run as administrator
|
||||
### `sudo`, run as administrator
|
||||
|
||||
*Substitute user do*. A normal user can't touch the system's files, which is exactly what protects you from wrecking the machine by accident. Prefixing a command with `sudo` runs that single command with administrator rights, and asks for your password the first time.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user