2022-01-16 19:28:02 +00:00
---
2025-02-11 19:38:45 +00:00
title: "Linux Knowledge Base"
2022-01-16 19:28:02 +00:00
---
2025-02-11 19:38:45 +00:00
The Linux Knowledge-Base provides quick-start guides for working with terminal programs.
2021-05-15 14:10:30 +00:00
2025-02-11 19:39:24 +00:00
# Setup
2022-12-01 18:53:50 +00:00
2025-02-11 19:39:24 +00:00
Install `make` , `recutils` , and any fuzzy-finder (i.e. `sk` , `fzy` , or `fzf` ).
2022-12-01 18:53:50 +00:00
2025-02-11 20:26:55 +00:00
## Usage
```sh
make
make database
recsel db.rec -q database
recsel db.rec -q gpg
recsel db.rec -e "title = 'ssh'"
recsel db.rec -e "title ~ 'ssh'"
recsel db.rec -e "title ~ 'bash'" -R title,wordcount
2025-02-13 16:39:55 +00:00
recsel db.rec -m 1 -P content | less -R
2025-02-11 20:26:55 +00:00
```
2022-12-01 18:53:50 +00:00
2025-02-11 19:39:24 +00:00
# Style
2022-12-01 18:53:50 +00:00
2025-02-11 19:39:24 +00:00
## No History, No Context
2024-04-19 15:28:37 +00:00
2025-02-11 19:39:24 +00:00
- Nobody cares about how the project started.
- Nobody wants to read what `ffmpeg` is, because anyone who wants to use it already knows what it is.
2023-08-03 16:48:13 +00:00
2025-02-11 19:39:24 +00:00
## Be Opinionated
2023-08-03 16:48:13 +00:00
2025-02-11 19:39:24 +00:00
- Guides should not ask the reader to select options half-way through.
- Options for different filesystems, databases, et c., should be written as separate guides.
2022-12-01 18:53:50 +00:00
2025-02-11 19:39:24 +00:00
## Repetition Beats Reference
2022-12-01 18:53:50 +00:00
2025-02-11 19:39:24 +00:00
If a database requires three commands to set up, it's better to repeat those three commands for every program that requires a database than to just link to another file which discusses databases.
2022-12-01 18:53:50 +00:00
2025-02-11 19:39:24 +00:00
## Show Arguments as Variables
2022-12-01 18:53:50 +00:00
2025-02-11 19:39:24 +00:00
Look at this line:
2022-12-01 18:53:50 +00:00
2025-02-11 19:39:24 +00:00
```sh
grep ls --color=always $HISTFILE | less -R
2023-08-03 16:48:13 +00:00
```
2022-12-01 18:53:50 +00:00
2025-02-11 19:39:24 +00:00
What else can go in place of `always` ?
Can you say `--color=red` ?
Can you put anything?
The answer is not obvious.
2022-12-01 18:53:50 +00:00
2025-02-11 19:39:24 +00:00
What about this line:
2021-02-23 22:10:01 +00:00
2025-02-11 19:39:24 +00:00
```sh
git branch new
git checkout new
2021-02-23 22:10:01 +00:00
```
2025-02-11 19:39:24 +00:00
Do you always use `new` ?
Can you use another word here?
The answer is not obvious.
2023-08-03 16:48:13 +00:00
2025-02-11 19:39:24 +00:00
It's better to make all arbitrary values variables.
2021-02-23 22:10:01 +00:00
2025-02-11 19:39:24 +00:00
```sh
git branch $branch_name
git checkout $branch_name
PAGER='less -R'
grep ls --color=always $HISTFILE | $PAGER
2021-02-23 22:10:01 +00:00
```
2025-02-11 19:39:24 +00:00
Now we can see what can be changed.
# What's Wrong with Everything Else?
2020-01-02 00:30:38 +00:00
## Man pages
- Orders items by the alphabet rather than by relevance.
- Often presumes you know everything except that one program.
- Often written in the 80's, and it shows.
- Zero respect for your time.
2025-02-11 19:38:45 +00:00
- Often references `info` pages (yuck).
2020-01-02 00:30:38 +00:00
2025-02-11 19:39:24 +00:00
## `curl cheat.sh`
2020-01-02 00:30:38 +00:00
- Doesn't have the programs I like.
- Too short to get you started on many programs.
2020-01-26 16:08:17 +00:00
- Poor understanding of priority (`git stash` is covered before `git commit` ).
2025-02-11 19:38:45 +00:00
- Repetitive
2020-01-02 00:30:38 +00:00
2020-01-02 02:49:45 +00:00
# Current State
2020-01-02 00:30:38 +00:00
2020-01-02 02:49:45 +00:00
This started as a few personal notes, and will probably continue to look like that for some time.
It's a bit of a mess.
2020-01-02 18:24:30 +00:00
2022-01-26 22:35:07 +00:00
Systemd is taken as a default.
2023-08-03 16:48:13 +00:00
Non-systemd commands are mentioned when required for a distro, e.g. runit for Void Linux.
2022-01-26 22:35:07 +00:00