book.rymcg.tech
This repository contains a collection of books written by EnigmaCurry.
This content is open-source, CC BY 4.0. See LICENSE for attribution rules.
Books
Site features
Navigation
This website is presented as a book of books, so you can read everything from beginning to end. Use your keyboard left/right arrow keys to flip through the pages.
If you are using a touch screen interface, use the arrow buttons at the top right of the page.
Table of contents
The menu bar on the left contains the index of all the books, with the titles as top level headings. On smaller screens, you may need to expand this menu using the top left hamburger menu.
At the top left of every page (and just to the right of the sidebar), there is a button to show the outline of the current page.
Theme
This website uses the Zen Light/Dark
theme by default, which tracks
your operating system and/or browser preference for light or dark
mode. You can change the desired theme in the lower left menu, below
the table of contents.
Search
Use the search box in the left hand menu to search all of the books on the site.
Blocks
Shell command blocks
Throughout these books, you will find literal command blocks that you should copy and paste to run in your Bash shell.
Commands that are to be run on your primary workstation are in blue:
whoami
hostname
Each code block is intended to be run as a whole (don’t copy
individual lines). Click the Copy to clipboard
button on the right
hand side of every code block (it only shows up when your mouse cursor
is hovering over it.)
Paste the copied command block into your terminal, edit it as
necessary, and then press Enter
to run it.
You will also sometimes see the example output that a command prints:
ryan toolbox
Pay attention to the color and the title of the box to provide important context. Commands that are to be run on a different machine, or in a container, etc. are usually orange:
whoami
hostname
root foo
Config blocks
Temporary shell variables are used to carry common config values across multiple command blocks. You can copy and paste them just like you do when running a command, but they are used only for configuration before running another command:
COLOR=orange
FOOD="milk chocolate covered raisins"
Subsequent code blocks can reference these temporary variables:
echo "Favorite color : ${COLOR}"
echo "Favorite food : ${FOOD}"
Favorite color : orange Favorite food : milk chocolate covered raisins
Edit file blocks
Sometimes it’s easiest to edit a file by hand. These green blocks invite you to edit the given file, with your preferred text editor:
this text goes into /tmp/foo.txt
Use Bash 5.1+
$ bash --version | head -1
GNU bash, version 5.2.26(1)-release
The commands written in this book are tested with Bash version 5.2:
Bracketed Paste
Since Bash 5.1, an important feature has been turned on by default:
bracketed paste. This lets you copy and paste multi-line commands,
from this web page, into your terminal, and edit the entire command
directly on the command line, before anything is run. It gives you a
chance to read, and edit, the entire command block that you paste,
to be sure its all correct, before you run it. When you’re ready,
you press the Enter
key, and then the whole block is run. To cancel,
press Ctrl-C
.
- When you paste a block into Bash, it is automatically highlighted in inverse color. This should indicate to you that the command has not yet been run.
- You can edit the entire multiline code block, but you need to be careful, do not press the up or down arrow keys, because this will cancel the command and begin searching your command history instead.
- Use the linear left/right movement keys for readline mode:
- Left / Right arrow keys to move the cursor one character at a time.
- Ctrl + Left/Right arrow keys, move by words at a time.
- Ctrl-A moves the cursor to the very beginning of the block.
- Ctrl-E moves the cursor to the very end of the block.
- Ctrl-K will “kill” the text after the cursor.
- To cancel the command before running it, press
Ctrl-C
. - To run the reviewed command, press
Enter
.
Before Bash 5.1, unless you specifically turned this feature on, commands that you paste would be run immediately, which is such an insecure anti-feature for a default setting!
If you need to be running an old version of Bash, you should at least turn on bracketed paste:
## Only necessary for Bash < 5.1:
echo "bind 'set enable-bracketed-paste on'" >> ~/.bashrc
bind 'set enable-bracketed-paste on'