From c732d7d18d1f453ecbffd0b2aa775c3c0b1d6aca Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Mon, 25 Sep 2023 00:10:06 +0200 Subject: [PATCH 01/10] vim in bash --- vim/vim_in_bash.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 vim/vim_in_bash.md diff --git a/vim/vim_in_bash.md b/vim/vim_in_bash.md new file mode 100644 index 0000000..e045510 --- /dev/null +++ b/vim/vim_in_bash.md @@ -0,0 +1,19 @@ +--- +title: "vim in bash" +tags: [ "vim", "bash", "inputrc" ] +--- + +Put bash in vim mode! + +Place the following in your `~/.inputrc`: + +```bash +set editing-mode vi +set show-mode-in-prompt on +set vi-ins-mode-string \1\e[33;32m\2[>]=\1\e[0m\2 +set vi-cmd-mode-string \1\e[33;1m\2[?]=\1\e[0m\2 + +set keymap vi-insert +RETURN: "\e\n" +``` + From aac3df99972dbd54cd02230a8635a934886411e5 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Mon, 25 Sep 2023 20:20:00 +0200 Subject: [PATCH 02/10] add email --- data/email.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 data/email.md diff --git a/data/email.md b/data/email.md new file mode 100644 index 0000000..fbcbc57 --- /dev/null +++ b/data/email.md @@ -0,0 +1,73 @@ +--- +title: "e-mail" +tags: [ "data", "smtp" ] +--- + +This is bare-bones, original, primitive e-mail. + +Install `opensmtpd` (or similar), then `ncat` or `nc` or `netcat` (this mysterious cat has many names). + +Start the `opensmtpd` service, then use netcat to speak with the mail-daemon: + + +``` +nc localhost 25 +``` +The computer should respond with code `220`, which means 'I am listening'. + +> 220 hex ESMTP OpenSMTPD + +``` +HELO gmail.com +``` + +You say `HELO` and say where you are coming from. + + +The `smtpd` will not check, so I am going to lie to it. +Mail servers are easily impressed, so it will be pleased to meet you. + +> 250 hex Hello gmail.com [::1], pleased to meet you + +``` +MAIL FROM: +``` + +All the mail commands start with 4 bytes, because it's easier for admins to program. +Tell the mail daemon who you are in this format. + +> 250 2.0.0 Ok + +Then tell it who you're sending to. + +``` +RCPT TO: +``` + +> 250 2.1.5 Destination address valid: Recipient ok + +Finally, tell it that you want to send `DATA`. + +``` +DATA +``` + +> 354 Enter mail, end with "." on a line by itself + +``` +Subject: turn off server please + +very urgent +. +``` + +> 250 2.0.0 73864a49 Message accepted for delivery + +You will find the email under `/var/spool` or `/var/mail` or similar. + +If unsure, just take a part of your email, like `FRAGMENT="turn off server please"`, then `grep` for it: + + ```bash +sudo grep -r $FRAGMENT /var/spool/* + ``` + From c4313277e853b7edf9c56063fe8ce01dd59c617d Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 27 Sep 2023 02:18:31 +0200 Subject: [PATCH 03/10] write ls --- basics/ls.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 basics/ls.md diff --git a/basics/ls.md b/basics/ls.md new file mode 100644 index 0000000..5974eb2 --- /dev/null +++ b/basics/ls.md @@ -0,0 +1,46 @@ +--- +title: "ls" +tags: [ "basics" ] +--- + +Firstly, your `ls` is probably aliased to something. + +Check it with: + + +```bash +alias ls +``` +If the prompt shows some alias, then start by removing it: + + +```bash +unalias ls +``` + +Now we can begin. + +Check the most recently modified file: + + +```bash +ls -t +``` + +Reverse this with `tac` to see the file which has been unmodified the longest: + + +```bash +ls -t | tac +``` +Group files by extension: + +```bash +ls -X +``` +Sort largest files first: + +```bash +ls -X +``` + From 93a48fded8aa41dcf02effc5f48028a8ff5eaa9a Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 27 Sep 2023 02:18:40 +0200 Subject: [PATCH 04/10] write basic ssh --- networking/ssh.md | 89 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 networking/ssh.md diff --git a/networking/ssh.md b/networking/ssh.md new file mode 100644 index 0000000..ffb3f17 --- /dev/null +++ b/networking/ssh.md @@ -0,0 +1,89 @@ +--- +title: "ssh" +tags: [ "networking" ] +--- +# Basic `ssh` + +Try out basic ssh by accessing `git.charm.sh`, without needing authentication: + + +```bash +ssh git.charm.sh +``` + +Start an ssh server to try it out. +The ssh server is sometimes in a package called `openssh`, and sometimes only in `openssh-server`. + +Once it's installed, check it's working: + +```bash +sudo systemctl status ssh +``` + +If that doesn't work, the service may be called `sshd`. + +```bash +sudo systemctl status sshd +``` + +Then start that service: + +```bash +sudo systemctl start sshd +``` +Test it works by using ssh into your own system, from inside: + + +```bash +ssh $USER@localhost +``` + +Access the computer from another computer on the same local network by finding your computer's IP address. + + +```bash +ip address | grep inet +``` + +Here is mine: + + +> inet 127.0.0.1/8 scope host lo +> +> inet6 ::1/128 scope host noprefixroute +> +> inet 192.168.0.12/24 brd 192.168.0.255 scope global dynamic noprefixroute en + + +The first one starts `127`, which means it returns back to that computer (like `localhost`). +The second is an ipv6 address, which is too angelic for this world, and has yet to ascend. +The third will work from a remote computer. + + +```bash +ssh $USERNAME@IP_ADDRESS +``` + +Once you have that, generate some ssh keys: + +```bash +ssh-keygen +``` + +Look at your keys: + + +```bash +ls ~/.ssh +``` + +You can share the one ending in `.pub` freely. +The other is secret. + +Now send those keys to a remote computer: + +```bash +ssh-copy-id $USERNAME@IP_ADDRESS +``` + +Now you can log in without a password. From ad9054c21285e12cf9614d85e57c2da5d043f71d Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Sun, 15 Oct 2023 13:36:47 +0200 Subject: [PATCH 05/10] add void locales --- distros/void/locale.md | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 distros/void/locale.md diff --git a/distros/void/locale.md b/distros/void/locale.md new file mode 100644 index 0000000..b8470ce --- /dev/null +++ b/distros/void/locale.md @@ -0,0 +1,54 @@ +--- +title: "locales" +tags: [ "void" ] +--- + +Check the current locales: + + +```bash +locale -a +``` + +Add the languages you want by editing `/etc/default/libc-locales`, and uncommenting your choice: + +```bash +#en_DK.UTF-8 UTF-8 +#en_DK ISO-8859-1 +en_GB.UTF-8 UTF-8 +en_GB ISO-8859-1 +#en_HK.UTF-8 UTF-8 +#en_HK ISO-8859-1 +``` + +Now you can generate what you need for those languages. +However, instead of generating what you need, you're going to generate everything which needs updating: + + +```bash +sudo xbps-reconfigure --all --force +``` + +Finally, select your chosen locale by placing it in `/etc/locale.conf`. + +```bash +echo "LC_ALL=en_GB.UTF-8 +LANG=en_GB.UTF-8 +LANGUAGE=en_GB.UTF-8" > /etc/locale.conf + + +#en_DK.UTF-8 UTF-8 +#en_DK ISO-8859-1 +en_GB.UTF-8 UTF-8 +en_GB ISO-8859-1 +#en_HK.UTF-8 UTF-8 +#en_HK ISO-8859-1 +``` + +Check your new locales are available: + + +```bash +locale -a +``` + From 6525ad85adf42f210884ab04ac3c30e9b51cd88b Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Tue, 17 Oct 2023 19:04:59 +0200 Subject: [PATCH 06/10] add tree --- basics/tree.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 basics/tree.md diff --git a/basics/tree.md b/basics/tree.md new file mode 100644 index 0000000..1aa08d3 --- /dev/null +++ b/basics/tree.md @@ -0,0 +1,25 @@ +--- +title: "tree" +tags: [ "basics" ] +--- + +The `tree` utility outputs a full listing of everything in your current directory, and those below. + +- Just directories: `tree -d` +- Output colour to `less`: `tree -C --info | less -re` +- Ignore files in the `.gitignore` file: `tree --gitignore` + +You can place information about the files in a directory to use with the `tree --info` option, like this: + +``` +config + Config files. + This is a git submodule. +README.md + Summary of the git. +*.jpg + Little picture, does not display + words well. +``` + +Each description-line starts with a tab. From 69d6c1ab530daaf6e36d18ed2d19b8902712646f Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 18 Oct 2023 23:14:09 +0200 Subject: [PATCH 07/10] syntax --- data/gpg.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/gpg.md b/data/gpg.md index ec1704f..a0fe5dd 100644 --- a/data/gpg.md +++ b/data/gpg.md @@ -82,7 +82,7 @@ This is a fingerprint. You can now decide the trust level (this stays on your computer). ```bash -gpg --edit-key *CD30421FD825696BD95F1FF644C62C57B790D3CF* +gpg --edit-key CD30421FD825696BD95F1FF644C62C57B790D3CF ``` Once you're in the interface, type `trust`. @@ -94,7 +94,7 @@ gpg --sign-key alice@posteo.net Then send those trusted keys up to a server, so people can see you have verified them: ```bash -gpg --send-keys *024C6B1C84449BD1CB4DF7A152295D2377F4D70F* +gpg --send-keys 024C6B1C84449BD1CB4DF7A152295D2377F4D70F ``` # Refresh Keys @@ -108,12 +108,12 @@ gpg --refresh-keys Your public key: ```bash -gpg --output *me*.gpg --armor --export +gpg --output me.gpg --armor --export ``` or ```bash -gpg --export -a *person@email.tld* > *my_key*.pub +gpg --export -a person@email.tld > my_key.pub ``` From 772f64267948a922484539c2b611ac62c8eda083 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 18 Oct 2023 23:25:54 +0200 Subject: [PATCH 08/10] add keyserver list --- data/gpg.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/data/gpg.md b/data/gpg.md index a0fe5dd..4402f79 100644 --- a/data/gpg.md +++ b/data/gpg.md @@ -91,18 +91,41 @@ Once you're in the interface, type `trust`. gpg --sign-key alice@posteo.net ``` -Then send those trusted keys up to a server, so people can see you have verified them: +# Swapping Keys + +This system relies on a ring of people swapping key information. + +## Sending + +Send those trusted keys up to a server, so people can see you have verified them: ```bash gpg --send-keys 024C6B1C84449BD1CB4DF7A152295D2377F4D70F ``` +## Upload Your Keys + +## Add More Key Servers + +Key servers often swap keys, but it's best to just send to multiple places immediately. +You can add key servers by adding this to `~/.gnupg/gpg.conf`. + +``` +keyserver hkps://keys.openpgp.org +keyserver hkps://mail-api.proton.me +keyserver hkps://keys.mailvelope.com +``` + # Refresh Keys +Refreshing keys will tell you if some key you have contains a signature from someone you already trust, or if someone has published a revocation certificate (meaning their key should not be trusted any more). + ```bash gpg --refresh-keys ``` +You can use the [crontab](../basics/cron.md) to refresh keys. + # Export Your public key: From c6e673f1b036c761b7c8709966c6d01340e62eb5 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 18 Oct 2023 23:25:59 +0200 Subject: [PATCH 09/10] add cron symlink --- system/cron.md | 1 + 1 file changed, 1 insertion(+) create mode 120000 system/cron.md diff --git a/system/cron.md b/system/cron.md new file mode 120000 index 0000000..2f0527b --- /dev/null +++ b/system/cron.md @@ -0,0 +1 @@ +../basics/cron.md \ No newline at end of file From e77d0676cfa4aa51ac3c2dfa68cfec0fbaba279a Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Sat, 2 Dec 2023 03:09:31 +0100 Subject: [PATCH 10/10] fix void locale notes --- distros/void/locale.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/void/locale.md b/distros/void/locale.md index b8470ce..a3fe25c 100644 --- a/distros/void/locale.md +++ b/distros/void/locale.md @@ -26,7 +26,7 @@ However, instead of generating what you need, you're going to generate everythin ```bash -sudo xbps-reconfigure --all --force +sudo xbps-reconfigure glibc-locales ``` Finally, select your chosen locale by placing it in `/etc/locale.conf`.