From b7fa4ab8c72e9e830696005bf36120950162f8d7 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Fri, 8 Sep 2023 19:11:08 +0200 Subject: [PATCH 1/3] edit bash_tricks --- system/bash_tricks.md | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/system/bash_tricks.md b/system/bash_tricks.md index 05dff77..67226ef 100644 --- a/system/bash_tricks.md +++ b/system/bash_tricks.md @@ -12,6 +12,11 @@ See changes in a directory, as it changes: `watch -d ls *directory*` +Or use the `-g` flag to exit once the output changes. +This command will look at whether you're connected to the internet, and turn into a rainbow once the connection hits. + +> watch -g ip address && clear && ip address | lolcat + ## Automatic Renaming There are a bunch of files: @@ -34,17 +39,19 @@ done IFS is the field separator. This is required to denote the different files as marked by a new line, and not the spaces. +(Alternatively, just install `renameutils` and do `rename Column Alice *`) + ## Arguments and Input The `rm' program takes arguments, but not `stdin' from a keyboard, and therefore programs cannot pipe results into rm. - -That said, we can sometimes pipe into rm with `xargs rm' to turn the stdin into an argument. For example, if we have a list of files called `list.txt' then we could use cat as so: +To fix this, use `xargs` to turn the stdin into an argument. +For example, if we have a list of files called `list.txt' then we could use cat as so: ```bash cat list.txt | xargs rm ``` -... *However*, this wouldn't work if spaces were included, as rm would take everything literally. +Of course if spaces are included in the file, you would have to account for that. ## Numbers @@ -71,3 +78,22 @@ find . -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 15 ```bash cat /dev/urandom | tr -cd [:alnum:] | dd bs=1 count=200 status=none && echo ``` + +## Temporary Working Directory + +Try something out in a random directory in `/tmp` so the files will be deleted when you next shut down. + +```bash +mktemp -d +``` + +That gives you a random directory to mess about in. + +```bash + dir=$(mktemp -d) + for x in {A..Z}; do + fortune > "$dir"/chimpan-$x + done + cd $dir +``` + From fac575fc59bf433d5213eb83e8cb8ff174c08f5f Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Sun, 10 Sep 2023 18:22:18 +0200 Subject: [PATCH 2/3] add void wallpaper nonsense --- distros/void/Brand_Name_Wallpaper.md | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 distros/void/Brand_Name_Wallpaper.md diff --git a/distros/void/Brand_Name_Wallpaper.md b/distros/void/Brand_Name_Wallpaper.md new file mode 100644 index 0000000..a30f8a1 --- /dev/null +++ b/distros/void/Brand_Name_Wallpaper.md @@ -0,0 +1,33 @@ +--- +title: "Brand Name Wallpaper" +tags: [ "void" ] +--- + +To automatically stick the logo onto your background, do these commands in the directory. + +Get the void linux logo from wikipedia + +```bash +wget https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Void_Linux_logo.svg/256px-Void_Linux_logo.svg.png?20170131170632 +``` + +Rename it, and resize it (the standard size is too small for most wallpapers) + +```bash +convert -resize 200% '256px-Void_Linux_logo.svg.png?20170131170632' void-logo.png +``` +Download a pretty wallpaper + +```bash +wget http://wallpapercave.com/wp/Wlm9Gv0.jpg +``` + +Put the void logo on all *jpg and *png images + +```bash +for x in *.jpg + do + composite -compose multiply -gravity Center void-logo.png "$x" "$x" +done +``` + From aa34b8b6e8a0cabc69188241c39a0591f7246746 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Thu, 14 Sep 2023 18:59:50 +0200 Subject: [PATCH 3/3] yes yes yes yes --- basics/yes.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 basics/yes.md diff --git a/basics/yes.md b/basics/yes.md new file mode 100644 index 0000000..ba3425f --- /dev/null +++ b/basics/yes.md @@ -0,0 +1,24 @@ +--- +title: "yes" +tags: [ "basics" ] +--- +# The Best Linux Program: `yes` + +The program `yes` prints the word `yes` to your terminal until you cancel it, perhaps with 'Control + c'. +Or technically it prints `yes\n`, meaning `yes` and then a new line (like pressing the Return key). + +This is extremely powerful. + +If you ever want to automatically install something which persistently nags you with `do you want to do the thing? [y/N]?`, then you can just pipe `yes` into that program, and it will answer 'yes' to all questions. + +```bash +yes | $INSTALL_SCRIPT_FILE.sh +``` + +This works best for disposable systems, like VMs or containers. +Try this on a live system, and you might find out that you should have read that message fully. + +```bash +yes | yay +``` +