remove mkdocs specific syntax

This commit is contained in:
Marcello 2024-06-16 19:14:59 +02:00
parent 8d08c1964f
commit 8026e1465b
Signed by: m-lamonaca
SSH key fingerprint: SHA256:8db8uii6Gweq7TbKixFBioW2T8CbgtyFETyYL3cr3zk
77 changed files with 1128 additions and 1128 deletions

View file

@ -8,7 +8,7 @@
[sudo vs su](https://unix.stackexchange.com/questions/35338/su-vs-sudo-s-vs-sudo-i-vs-sudo-bash/35342)
```bash linenums="1"
```bash
sudo su # login as root (user must be sudoers, root password not required) DANGEROUS
sudo -s # act as root and inherit current user environment (env as is now, along current dir and env vars) SAFE (can modify user environment)
sudo -i # act as root and and use a clean environment (goes to user's home, runs .bashrc) SAFEST
@ -22,7 +22,7 @@ su USER # change user but don't load it's home folder
### Getting Info
```sh linenums="1"
```sh
man COMMAND # show command manual
help COMMAND # show command info
whatis COMMAND # one-line command explanation
@ -35,7 +35,7 @@ id # Print user and group information for the specified USER, or (when USER omi
### Moving & Showing Directory Contents
```sh linenums="1"
```sh
pwd # print working (current) directory
ls [option]... [FILE]... # list directory contents ("list storage")
cd rel_path # change directory to path (rel_path must be inside current directory)
@ -49,7 +49,7 @@ popd # return to previous directory (before pushd)
### Creating, Reading, Copying, Moving, Modifying Files And Directories
```sh linenums="1"
```sh
touch FILE # change FILE timestamp fi exists, create file otherwise
cat [FILE] # concatenate files and print on standard output (FD 1)
cat >> FILE # append following content ot file (Ctrl+D to stop)
@ -84,7 +84,7 @@ cp SOURCE DESTINATION # copy SOURCE to DESTINATION
![Linux Permissions](../../img/bash_files-permissions-and-ownership-basics-in-linux.png "files info and permissions")
```sh linenums="1"
```sh
chmod MODE FILE # change file (or directory) permissions
chmod OCTAL-MODE FILE # change file (or directory) permissions
@ -121,7 +121,7 @@ chgrp [OPTION]... GROUP FILE... # change group ownership
### Finding Files And Directories
```sh linenums="1"
```sh
find [path] [expression] # search file in directory hierarchy
find [start-position] -type f -name FILENAME # search for a file named "filename"
find [start-position] -type d -name DIRNAME # search for a directory named "dirname"
@ -134,7 +134,7 @@ find [path] -exec <command> {} \; # execute command on found items (identified
### Other
```sh linenums="1"
```sh
tee # copy standard input and write to standard output AND files simultaneously
tee [FILE]
command | sudo tee FILE # operate on file w/o using shell as su
@ -171,7 +171,7 @@ watch -n SECONDS COMMAND # execute command every SECONDS seconds (no less than
**Data wrangling** is the process of transforming and mapping data from one "raw" data form into another format with the intent of making it more appropriate and valuable for a variety of downstream purposes such as analytics.
```bash linenums="1"
```bash
sed # stream editor for filtering and transforming text
sed -E "s/REGEX/replacement/" # substitute text ONCE (-E uses modern REGEX)
sed -E "s/REGEX/replacement/g" # substitute text multiple times (every match)

View file

@ -44,20 +44,20 @@ shebang indicating which interpreter to use
### Simple Command
```bash linenums="1"
```bash
[ var=value ... ] command [ arg ... ] [ redirection ... ] # [.] is optional component
```
### Pipelines (commands concatenation)
```bash linenums="1"
```bash
command | file.ext # link the first process' standard output to the second process' standard input
command |& file.ext # link the first process' standard output & standard error to the second process' standard input
```
### Lists (sequence of commands)
```bash linenums="1"
```bash
command_1; command_2; ... # execute command in sequence, one after the other
command_1 || command_2 || ... # execute successive commands only if preceding ones fail
command_1 && command_2 && .. # execute successive commands only if preceding ones succeeds
@ -65,7 +65,7 @@ command_1 && command_2 && .. # execute successive commands only if preceding on
### COMPOUND COMMANDs (multiple commands as one)
```bash linenums="1"
```bash
# block of commands executed as one
<keyword>
command_1; command_2; ...
@ -108,7 +108,7 @@ We can copy file descriptors to make them share a stream. There are also many ot
### Redirections
```bash linenums="1"
```bash
[x]>file # make FD x write to file
[x]<file # make FD x read from file
@ -142,7 +142,7 @@ x>&-, x<&- # close FD x (stream disconnected from FD x)
With Command Substitution, we effectively write a command within a command, and we ask bash to expand the inner command into its output and use that output as argument data for the main command.
```bash linenums="1"
```bash
$(inner_command) # $ --> value-expansion prefix
command !* # !* expands to everything except the first argument in the previous line
command !$ # refers to the last argument of the previous command
@ -151,7 +151,7 @@ sudo !! # !! expands to the entire previous command
## Shell Variables
```bash linenums="1"
```bash
varname=value # variable assignment
varname="$(command)" # command substitution, MUST be double-quoted
"$varname", "${varname}" # variable expansion, MUST be double-quoted (name substituted w/ variable content)
@ -188,7 +188,7 @@ Omit the pattern to match any character.
Only the final exit code after executing the entire list is relevant for the branch's evaluation.
```bash linenums="1"
```bash
if command_list; then
command_list;
elif command_list; then
@ -207,7 +207,7 @@ fi
### Comparison Operators
```bash linenums="1"
```bash
[[ "$a" -eq "$b" ]] # is equal to
[[ "$a" -ne "$b" ]] # in not equal to
[[ "$a" -gt "$b" ]] # greater than
@ -218,7 +218,7 @@ fi
### Arithmetic Comparison Operators
```bash linenums="1"
```bash
(("$a" > "$b")) # greater than
(("$a" >= "$b")) # greater than or equal to
(("$a" < "$b")) # less than
@ -227,7 +227,7 @@ fi
### String Comparison Operators
```bash linenums="1"
```bash
[ "$a" = "$b" ] # is equal to (whitespace around operator)
[[ $a == z* ]] # True if $a starts with an "z" (pattern matching)
@ -246,14 +246,14 @@ fi
## Commands short circuit evaluation
```bash linenums="1"
```bash
command_1 || command_2 # if command_1 fails executes command_2
command_1 && command_2 # executes command_2 only if command_1 succeeds
```
## Loops
```bash linenums="1"
```bash
for var in iterable ; do
# command here
done
@ -261,7 +261,7 @@ done
## Script Hardening
```sh linenums="1"
```sh
set -o errexit # exit on error
set -o nounset # fail on unset variable (bypass with ${VAR:-})
set -o pipefail # file entire pipeline if one step fails