Update cheatsheets

This commit is contained in:
ivuorinen
2024-12-21 00:17:09 +00:00
parent 993939500e
commit 212b0d47b3
13 changed files with 266 additions and 16 deletions

View File

@@ -12,6 +12,10 @@ source: https://github.com/tldr-pages/tldr.git
`gallery-dl "{{url}}"`
- Save images to a specific directory:
`gallery-dl --destination {{path/to/directory}} "{{url}}"`
- Retrieve pre-existing cookies from your web browser (useful for sites that require login):
`gallery-dl --cookies-from-browser {{browser}} "{{url}}"`

33
tldr/lazydocker Normal file
View File

@@ -0,0 +1,33 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# lazydocker
> A terminal UI for managing Docker containers, images, volumes, and more.
> More information: <https://github.com/jesseduffield/lazydocker>.
- Open Lazydocker:
`lazydocker`
- Display the current default configuration:
`lazydocker --config`
- Run Lazydocker in debug mode:
`lazydocker --debug`
- Specify an alternate Docker Compose file:
`lazydocker --file {{path/to/docker-compose.yml}}`
- Display help:
`lazydocker --help`
- Display version:
`lazydocker --version`

26
tldr/let Normal file
View File

@@ -0,0 +1,26 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# let
> Evaluate arithmetic expressions in shell.
> Supports variables, operators, and conditional expressions.
> More information: <https://manned.org/let>.
- Evaluate a simple arithmetic expression:
`let "{{result = a + b}}"`
- Use post-increment and assignment in an expression:
`let "{{x++}}"`
- Use conditional operator in an expression:
`let "{{result = (x > 10) ? x : 0}}"`
- Display help:
`let --help`

13
tldr/linux/exch Normal file
View File

@@ -0,0 +1,13 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# exch
> Swap the filepaths and filenames of two files.
> More information: <https://manned.org/exch>.
- Swap filepaths:
`exch {{path/to/file1}} {{path/to/file2}}`

25
tldr/linux/lsfd Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# lsfd
> List open files and the corresponding processes in Linux.
> More information: <https://manned.org/lsfd>.
- List all open file descriptors:
`lsfd`
- List all files kept open by a specific program:
`lsfd -Q 'PID == {{process_ID}}'`
- Check what program has a specific file open:
`lsfd -Q "NAME == '{{/path/to/file}}'"`
- List open IPv4 or IPv6 sockets:
`lsfd -i{{4|6}}`

12
tldr/linux/pacman-q Normal file
View File

@@ -0,0 +1,12 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# pacman -Q
> This command is an alias of `pacman --query`.
- View documentation for the original command:
`tldr pacman query`

View File

@@ -9,34 +9,34 @@ source: https://github.com/tldr-pages/tldr.git
> See also: `pacman`.
> More information: <https://manned.org/pacman.8>.
- List installed packages and versions:
- [Q]uery the local package database and list installed packages and versions:
`pacman --query`
`pacman -Q`
- List only packages and versions that were explicitly installed:
- List only packages and versions that were [e]xplicitly installed:
`pacman --query --explicit`
`pacman -Qe`
- Find which package owns a file:
- Find which package [o]wns a file:
`pacman --query --owns {{filename}}`
`pacman -Qo {{filename}}`
- Display information about an installed package:
- Display information about an [i]nstalled package:
`pacman --query --info {{package}}`
`pacman -Qi {{package}}`
- List files owned by a package:
- Display the [l]ist of files owned by a specific package:
`pacman --query --list {{package}}`
`pacman -Ql {{package}}`
- List orphan packages (installed as dependencies but not required by any package):
- List orphan packages (installed as [d]ependencies but unrequired ([t]) by any package and print in [q]uiet mode (only package name is displayed)):
`pacman --query --unrequired --deps --quiet`
`pacman -Qdtq`
- List installed packages not found in the repositories:
- List installed packages foreign ([m]) to the repository database:
`pacman --query --foreign`
`pacman -Qm`
- List outdated packages:
- List packages that can be [u]pgraded:
`pacman --query --upgrades`
`pacman -Qu`

13
tldr/linux/pg Normal file
View File

@@ -0,0 +1,13 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# pg
> View files one page at a time.
> More information: <https://manned.org/pg>.
- View a file:
`pg {{path/to/file}}`

13
tldr/osx/autoraise Normal file
View File

@@ -0,0 +1,13 @@
---
syntax: markdown
tags: [tldr, osx]
source: https://github.com/tldr-pages/tldr.git
---
# AutoRaise
> Automatically raise and/or focus a window when hovering over it with the mouse.
> More information: <https://github.com/sbmpost/AutoRaise>.
- Run AutoRaise in the background:
`autoraise &`

25
tldr/osx/bclm Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, osx]
source: https://github.com/tldr-pages/tldr.git
---
# bclm
> Set a custom charge limit on MacBooks.
> More information: <https://github.com/zackelia/bclme>.
- Set the charge limit to about 80% (for Intel machines, the battery charge level may be slightly lower than the set value):
`sudo bclm write {{77}}`
- Read the current charge limit:
`bclm read`
- Keep the charge limit after rebooting/smc reset:
`sudo bclm persist`
- Remove the persistent charge limit:
`sudo bclm unpersist`

View File

@@ -35,3 +35,7 @@ source: https://github.com/tldr-pages/tldr.git
- Exit the shell when (some) commands fail:
`set -e`
- Reset all shell parameters and assign new ones:
`set -- {{argument1 argument2...}}`

41
tldr/v Normal file
View File

@@ -0,0 +1,41 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# v
> A tool for managing V source code.
> More information: <https://docs.vlang.io/getting-started.html>.
- Compile a file and output its executable:
`v {{path/to/file.v}}`
- Compile the current project or directory:
`v .`
- Compile a file and run it:
`v run {{path/to/file.v}}`
- Compile a file and run it, output its executable:
`v crun {{path/to/file.v}}`
- Re-compile on every modification to a file:
`v watch {{path/to/file.v}}`
- Re-run on every modification to a file:
`v watch run {{path/to/file.v}}`
- Open the v repl:
`v repl`
- Format a file and [w]rite to it:
`v fmt -w {{path/to/file.v}}`

41
tldr/{ Normal file
View File

@@ -0,0 +1,41 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# Curly brace
> Multipurpose shell syntax.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-hash>.
- Isolate variable names:
`echo ${HOME}work`
- Brace expand sequences:
`echo {1..3} {a..c}{dir1,dir2,dir3}`
- Check if `variable` is set before returning text:
`echo ${variable:+variable is set and contains $variable}`
- Set default values in case `variable` is unset:
`echo ${variable:-default}`
- Return `variable` length in characters:
`echo ${#variable}`
- Return a string slice:
`echo ${variable:3:7}`
- Recursively expand a `variable`:
`echo ${!variable}`
- Capitalize all the characters:
`echo ${variable^^}`