From d1f45d718c9d8f232011ed643516bec203b2769b Mon Sep 17 00:00:00 2001 From: ivuorinen Date: Sun, 25 Feb 2024 00:14:24 +0000 Subject: [PATCH] Update cheatsheets --- tldr/^ | 22 ++++++++++++++++++++++ tldr/bats | 25 +++++++++++++++++++++++++ tldr/ffuf | 2 +- tldr/git-clean | 14 +++++++------- tldr/jq | 4 ++-- tldr/linux/aur | 2 +- tldr/linux/repo-add | 4 ++++ tldr/mpc | 12 ++++++------ 8 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 tldr/^ create mode 100644 tldr/bats diff --git a/tldr/^ b/tldr/^ new file mode 100644 index 00000000..0b205e93 --- /dev/null +++ b/tldr/^ @@ -0,0 +1,22 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# Caret + +> Bash builtin to quick substitute a string in the previous command and run the result. +> Equivalent to `!!:s^string1^string2`. +> More information: . + +- Run the previous command replacing `string1` with `string2`: + +`^{{string1}}^{{string2}}` + +- Remove `string1` from the previous command: + +`^{{string1}}^` + +- Replace `string1` with `string2` in the previous command and add `string3` to its end: + +`^{{string1}}^{{string2}}^{{string3}}` diff --git a/tldr/bats b/tldr/bats new file mode 100644 index 00000000..22a6bdda --- /dev/null +++ b/tldr/bats @@ -0,0 +1,25 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# bats + +> Bash Automated Testing System: a TAP () compliant testing framework for Bash. +> More information: . + +- Run a BATS test script and output results in the TAP (Test Anything Protocol) format: + +`bats --tap {{path/to/test.bats}}` + +- Count test cases of a test script without running any tests: + +`bats --count {{path/to/test.bats}}` + +- Run BATS test cases contained in a directory and its subdirectories (files with a `.bats` extension): + +`bats --recursive {{path/to/directory}}` + +- Output results in a specific format: + +`bats --formatter {{pretty|tap|junit}} {{path/to/test.bats}}` diff --git a/tldr/ffuf b/tldr/ffuf index 8de893b7..13ef30ff 100644 --- a/tldr/ffuf +++ b/tldr/ffuf @@ -25,6 +25,6 @@ source: https://github.com/tldr-pages/tldr.git `ffuf -w {{path/to/wordlist.txt}} -u {{http://target.com}} -H "{{Host: FUZZ}}" -mc {{200}}` -- Fuzz with specified HTTP method and payloa[d], while [f]iltering out comma separated status [c]odes: +- Fuzz with specified HTTP method and [d]ata, while [f]iltering out comma separated status [c]odes: `ffuf -w {{path/to/postdata.txt}} -X {{POST}} -d "{{username=admin\&password=FUZZ}}" -u {{http://target/login.php}} -fc {{401,403}}` diff --git a/tldr/git-clean b/tldr/git-clean index 86bc8835..306819f8 100644 --- a/tldr/git-clean +++ b/tldr/git-clean @@ -5,29 +5,29 @@ source: https://github.com/tldr-pages/tldr.git --- # git clean -> Remove untracked files from the working tree. +> Remove files not tracked by Git from the working tree. > More information: . -- Delete files that are not tracked by Git: +- Delete untracked files: `git clean` -- Interactively delete files that are not tracked by Git: +- [i]nteractively delete untracked files: `git clean -i` -- Show what files would be deleted without actually deleting them: +- Show which files would be deleted without actually deleting them: `git clean --dry-run` -- Forcefully delete files that are not tracked by Git: +- [f]orcefully delete untracked files: `git clean -f` -- Forcefully delete directories that are not tracked by Git: +- [f]orcefully delete untracked [d]irectories: `git clean -fd` -- Delete untracked files, including ignored files in `.gitignore` and `.git/info/exclude`: +- Delete untracked files, including e[x]cluded files (files ignored in `.gitignore` and `.git/info/exclude`): `git clean -x` diff --git a/tldr/jq b/tldr/jq index 50ab0462..99481017 100644 --- a/tldr/jq +++ b/tldr/jq @@ -6,7 +6,7 @@ source: https://github.com/tldr-pages/tldr.git # jq > A command-line JSON processor that uses a domain-specific language (DSL). -> More information: . +> More information: . - Execute a specific expression (print a colored and formatted JSON output): @@ -28,7 +28,7 @@ source: https://github.com/tldr-pages/tldr.git `{{cat path/to/file.json}} | jq '{{.[index1], .[index2], ...}}'` -- Print all array items/object keys: +- Print all array/object values: `{{cat path/to/file.json}} | jq '.[]'` diff --git a/tldr/linux/aur b/tldr/linux/aur index 9b734b15..38a0db65 100644 --- a/tldr/linux/aur +++ b/tldr/linux/aur @@ -6,7 +6,7 @@ source: https://github.com/tldr-pages/tldr.git # aur > Build packages from the AUR and manage local repositories. -> Note: A local repository needs to be set in `/etc/pacman.conf` and `vifm` needs to be installed for this to fully function. +> Note: A local repository needs to be defined in `/etc/pacman.conf` and `vifm` needs to be installed for this to fully function. > More information: . - Search the AUR database for a package: diff --git a/tldr/linux/repo-add b/tldr/linux/repo-add index b90ef1f4..fb50347b 100644 --- a/tldr/linux/repo-add +++ b/tldr/linux/repo-add @@ -8,6 +8,10 @@ source: https://github.com/tldr-pages/tldr.git > Package database maintenance utility which enables installation of said package via Pacman. > More information: . +- Create an empty repository: + +`repo-add {{path/to/database.db.tar.gz}}` + - Add all package binaries in the current directory and remove the old database file: `repo-add --remove {{path/to/database.db.tar.gz}} {{*.pkg.tar.zst}}` diff --git a/tldr/mpc b/tldr/mpc index e72fc9ff..166183bd 100644 --- a/tldr/mpc +++ b/tldr/mpc @@ -6,8 +6,8 @@ source: https://github.com/tldr-pages/tldr.git # mpc > Music Player Client. -> Program for controlling the Music Player Daemon (MPD). -> More information: . +> Control the Music Player Daemon (MPD). +> More information: . - Toggle play/pause: @@ -21,14 +21,14 @@ source: https://github.com/tldr-pages/tldr.git `mpc status` -- Play next song: +- Play the next song: `mpc next` -- Play previous song: +- Play the previous song: `mpc prev` -- Forward or rewind the currently playing song: +- Seek `n` seconds forward (`+`) or backward (`-`): -`mpc [+-]{{seconds}}` +`mpc {{+n|-n}}`