Update cheatsheets

This commit is contained in:
ivuorinen
2024-02-25 00:14:24 +00:00
parent 40892cc890
commit d1f45d718c
8 changed files with 68 additions and 17 deletions

22
tldr/^ Normal file
View File

@@ -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: <https://www.gnu.org/software/bash/manual/bash.html#Event-Designators>.
- 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}}`

25
tldr/bats Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# bats
> Bash Automated Testing System: a TAP (<https://testanything.org/>) compliant testing framework for Bash.
> More information: <https://bats-core.readthedocs.io/en/stable/usage.html>.
- 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}}`

View File

@@ -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}}` `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}}` `ffuf -w {{path/to/postdata.txt}} -X {{POST}} -d "{{username=admin\&password=FUZZ}}" -u {{http://target/login.php}} -fc {{401,403}}`

View File

@@ -5,29 +5,29 @@ source: https://github.com/tldr-pages/tldr.git
--- ---
# git clean # git clean
> Remove untracked files from the working tree. > Remove files not tracked by Git from the working tree.
> More information: <https://git-scm.com/docs/git-clean>. > More information: <https://git-scm.com/docs/git-clean>.
- Delete files that are not tracked by Git: - Delete untracked files:
`git clean` `git clean`
- Interactively delete files that are not tracked by Git: - [i]nteractively delete untracked files:
`git clean -i` `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` `git clean --dry-run`
- Forcefully delete files that are not tracked by Git: - [f]orcefully delete untracked files:
`git clean -f` `git clean -f`
- Forcefully delete directories that are not tracked by Git: - [f]orcefully delete untracked [d]irectories:
`git clean -fd` `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` `git clean -x`

View File

@@ -6,7 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
# jq # jq
> A command-line JSON processor that uses a domain-specific language (DSL). > A command-line JSON processor that uses a domain-specific language (DSL).
> More information: <https://stedolan.github.io/jq/manual/>. > More information: <https://jqlang.github.io/jq/manual/>.
- Execute a specific expression (print a colored and formatted JSON output): - 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], ...}}'` `{{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 '.[]'` `{{cat path/to/file.json}} | jq '.[]'`

View File

@@ -6,7 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
# aur # aur
> Build packages from the AUR and manage local repositories. > 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: <https://github.com/aurutils/aurutils>. > More information: <https://github.com/aurutils/aurutils>.
- Search the AUR database for a package: - Search the AUR database for a package:

View File

@@ -8,6 +8,10 @@ source: https://github.com/tldr-pages/tldr.git
> Package database maintenance utility which enables installation of said package via Pacman. > Package database maintenance utility which enables installation of said package via Pacman.
> More information: <https://man.archlinux.org/man/repo-add>. > More information: <https://man.archlinux.org/man/repo-add>.
- 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: - 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}}` `repo-add --remove {{path/to/database.db.tar.gz}} {{*.pkg.tar.zst}}`

View File

@@ -6,8 +6,8 @@ source: https://github.com/tldr-pages/tldr.git
# mpc # mpc
> Music Player Client. > Music Player Client.
> Program for controlling the Music Player Daemon (MPD). > Control the Music Player Daemon (MPD).
> More information: <https://www.musicpd.org/clients/mpc>. > More information: <https://www.musicpd.org/doc/mpc/html>.
- Toggle play/pause: - Toggle play/pause:
@@ -21,14 +21,14 @@ source: https://github.com/tldr-pages/tldr.git
`mpc status` `mpc status`
- Play next song: - Play the next song:
`mpc next` `mpc next`
- Play previous song: - Play the previous song:
`mpc prev` `mpc prev`
- Forward or rewind the currently playing song: - Seek `n` seconds forward (`+`) or backward (`-`):
`mpc [+-]{{seconds}}` `mpc {{+n|-n}}`