Update cheatsheets

This commit is contained in:
ivuorinen
2024-03-04 00:13:37 +00:00
parent d5be0a5308
commit 4fc14b09a3
10 changed files with 195 additions and 45 deletions

View File

@@ -16,3 +16,11 @@ source: https://github.com/tldr-pages/tldr.git
- Start `btop` with the specified settings preset:
`btop --preset {{0..9}}`
- Start `btop` in TTY mode using 16 colors and TTY-friendly graph symbols:
`btop --tty_on`
- Start `btop` in 256-color mode instead of 24-bit color mode:
`btop --low-color`

22
tldr/dd
View File

@@ -6,28 +6,24 @@ source: https://github.com/tldr-pages/tldr.git
# dd
> Convert and copy a file.
> More information: <https://www.gnu.org/software/coreutils/dd>.
> More information: <https://manned.org/man/dd.1p>.
- Make a bootable USB drive from an isohybrid file (such like `archlinux-xxx.iso`):
- Make a bootable USB drive from an isohybrid file (such as `archlinux-xxx.iso`):
`dd if={{path/to/file.iso}} of=/dev/{{usb_drive}}`
- Clone a drive to another drive with 4 MiB block and ignore error:
- Clone a drive to another drive with 4 MiB block size and flush writes before the command terminates:
`dd if=/dev/{{source_drive}} of=/dev/{{dest_drive}} bs={{4194304}} conv={{noerror}}`
`dd bs={{4194304}} conv={{fsync}} if=/dev/{{source_drive}} of=/dev/{{dest_drive}}`
- Generate a file of 100 random bytes by using kernel random driver:
- Generate a file with a specific number of random bytes by using kernel random driver:
`dd if=/dev/urandom of={{path/to/random_file}} bs={{100}} count={{1}}`
`dd bs={{100}} count={{1}} if=/dev/urandom of={{path/to/random_file}}`
- Benchmark the write performance of a disk:
- Benchmark the sequential write performance of a disk:
`dd if=/dev/zero of={{path/to/file_1GB}} bs={{1024}} count={{1000000}}`
`dd bs={{1024}} count={{1000000}} if=/dev/zero of={{path/to/file_1GB}}`
- Generate a system backup into an IMG file:
- Create a system backup and save it into an IMG file (can be restored later by swapping `if` and `of`):
`dd if={{/dev/drive_device}} of={{path/to/file.img}}`
- Restore a drive from an IMG file:
`dd if={{path/to/file.img}} of={{/dev/drive_device}}`

View File

@@ -8,29 +8,25 @@ source: https://github.com/tldr-pages/tldr.git
> Convert and copy a file.
> More information: <https://www.gnu.org/software/coreutils/dd>.
- Make a bootable USB drive from an isohybrid file (such like `archlinux-xxx.iso`) and show the progress:
- Make a bootable USB drive from an isohybrid file (such as `archlinux-xxx.iso`) and show the progress:
`dd if={{path/to/file.iso}} of={{/dev/usb_drive}} status=progress`
`dd status=progress if={{path/to/file.iso}} of={{/dev/usb_drive}}`
- Clone a drive to another drive with 4 MiB block, ignore error and show the progress:
- Clone a drive to another drive with 4 MiB block size and flush writes before the command terminates:
`dd if={{/dev/source_drive}} of={{/dev/dest_drive}} bs={{4M}} conv={{noerror}} status=progress`
`dd bs={{4M}} conv={{fsync}} if={{/dev/source_drive}} of={{/dev/dest_drive}}`
- Generate a file of 100 random bytes by using kernel random driver:
- Generate a file with a specific number of random bytes by using kernel random driver:
`dd if=/dev/urandom of={{path/to/random_file}} bs={{100}} count={{1}}`
`dd bs={{100}} count={{1}} if=/dev/urandom of={{path/to/random_file}}`
- Benchmark the write performance of a disk:
`dd if=/dev/zero of={{path/to/file_1GB}} bs={{1024}} count={{1000000}}`
`dd bs={{1M}} count={{1000000}} if=/dev/zero of={{path/to/file_1GB}}`
- Generate a system backup into an IMG file and show the progress:
- Create a system backup and save it into an IMG file (can be restored later by swapping `if` and `of`):
`dd if={{/dev/drive_device}} of={{path/to/file.img}} status=progress`
- Restore a drive from an IMG file and show the progress:
`dd if={{path/to/file.img}} of={{/dev/drive_device}} status=progress`
`dd if={{/dev/drive_device}} of={{path/to/file.img}}`
- Check the progress of an ongoing dd operation (run this command from another shell):

View File

@@ -8,7 +8,7 @@ source: https://github.com/tldr-pages/tldr.git
> Exploit Development Library designed for rapid prototyping.
> More information: <https://docs.pwntools.com/en/stable/commandline.html>.
- Convert the given assembly code to `bytes`:
- Convert the given assembly code to `bytes`:
`pwn asm "{{xor edi, edi}}"`

37
tldr/mise Normal file
View File

@@ -0,0 +1,37 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# mise
> Manage versions of different packages.
> More information: <https://mise.jdx.dev>.
- List all available plugins:
`mise plugins list-all`
- Install a plugin:
`mise plugins add {{name}}`
- List runtime versions available for install:
`mise ls-remote {{name}}`
- Install a specific version of a package:
`mise install {{name}}@{{version}}`
- Set global version for a package:
`mise use --global {{name}}@{{version}}`
- Set local version for a package:
`mise use {{name}}@{{version}}`
- Set environment variable in configuration:
`mise set {{variable}}={{value}}`

View File

@@ -6,37 +6,37 @@ source: https://github.com/tldr-pages/tldr.git
# nmap
> Network exploration tool and security/port scanner.
> Some features only activate when Nmap is run with root privileges.
> More information: <https://nmap.org>.
> Some features (e.g. SYN scan) activate only when `nmap` is run with root privileges.
> More information: <https://nmap.org/book/man.html>.
- Check if an IP address is up, and guess the remote host's operating system:
- Scan the top 1000 ports of a remote host with various [v]erbosity levels:
`nmap -O {{ip_or_hostname}}`
`nmap -v{{1|2|3}} {{ip_or_hostname}}`
- Try to determine whether the specified hosts are up (ping scan) and what their names and MAC addresses are:
- Run a ping sweep over an entire subnet or individual hosts very aggressively:
`sudo nmap -sn {{ip_or_hostname}} {{optional_another_address}}`
`nmap -T5 -sn {{192.168.0.0/24|ip_or_hostname1,ip_or_hostname2,...}}`
- Also enable scripts, service detection, OS fingerprinting and traceroute:
- Enable OS detection, version detection, script scanning, and traceroute:
`nmap -A {{address_or_addresses}}`
`sudo nmap -A {{ip_or_hostname1,ip_or_hostname2,...}}`
- Scan a specific list of ports (use '-p-' for all ports from 1 to 65535):
- Scan a specific list of ports (use `-p-` for all ports from 1 to 65535):
`nmap -p {{port1,port2,...,portN}} {{address_or_addresses}}`
`nmap -p {{port1,port2,...}} {{ip_or_host1,ip_or_host2,...}}`
- Perform service and version detection of the top 1000 ports using default NSE scripts; writing results ('-oN') to output file:
- Perform service and version detection of the top 1000 ports using default NSE scripts, writing results (`-oA`) to output files:
`nmap -sC -sV -oN {{top-1000-ports.txt}} {{address_or_addresses}}`
`nmap -sC -sV -oA {{top-1000-ports}} {{ip_or_host1,ip_or_host2,...}}`
- Scan target(s) carefully using 'default and safe' NSE scripts:
- Scan target(s) carefully using `default and safe` NSE scripts:
`nmap --script "default and safe" {{address_or_addresses}}`
`nmap --script "default and safe" {{ip_or_host1,ip_or_host2,...}}`
- Scan web server running on standard ports 80 and 443 using all available 'http-*' NSE scripts:
- Scan for web servers running on standard ports 80 and 443 using all available `http-*` NSE scripts:
`nmap --script "http-*" {{address_or_addresses}} -p 80,443`
`nmap --script "http-*" {{ip_or_host1,ip_or_host2,...}} -p 80,443`
- Perform a stealthy very slow scan ('-T0') trying to avoid detection by IDS/IPS and use decoy ('-D') source IP addresses:
- Attempt evading IDS/IPS detection by using an extremely slow scan (`-T0`), decoy source addresses (`-D`), [f]ragmented packets, random data and other methods:
`nmap -T0 -D {{decoy1_ipaddress,decoy2_ipaddress,...,decoyN_ipaddress}} {{address_or_addresses}}`
`sudo nmap -T0 -D {{decoy_ip1,decoy_ip2,...}} --source-port {{53}} -f --data-length {{16}} -Pn {{ip_or_host}}`

42
tldr/pnpm-audit Normal file
View File

@@ -0,0 +1,42 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# pnpm audit
> Scan project dependencies.
> Check for known security issues with the installed packages.
> More information: <https://pnpm.io/cli/audit>.
- Identify vulnerabilities in the project:
`pnpm audit`
- Automatically fix vulnerabilities:
`pnpm audit fix`
- Generate a security report in JSON format:
`pnpm audit --json > {{path/to/audit-report.json}}`
- Audit only [D]ev dependencies:
`pnpm audit --dev`
- Audit only [P]roduction dependencies:
`pnpm audit --prod`
- Exclude optional dependencies from the audit:
`pnpm audit --no-optional`
- Ignore registry errors during the audit process:
`pnpm audit --ignore-registry-errors`
- Filter advisories by severity (low, moderate, high, critical):
`pnpm audit --audit-level {{severity}}`

42
tldr/pnpm-outdated Normal file
View File

@@ -0,0 +1,42 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# pnpm outdated
> Check for outdated packages.
> The check can be limited to a subset of the installed packages by providing arguments (patterns are supported).
> More information: <https://pnpm.io/cli/outdated>.
- Check for outdated packages:
`pnpm outdated`
- Check for outdated dependencies found in every workspace package:
`pnpm outdated -r`
- Filter outdated packages using a package selector:
`pnpm outdated --filter {{package_selector}}`
- List outdated packages [g]lobally:
`pnpm outdated --global`
- Print details of outdated packages:
`pnpm outdated --long`
- Print outdated dependencies in a specific format:
`pnpm outdated --format {{format}}`
- Print only versions that satisfy specifications in `package.json`:
`pnpm outdated --compatible`
- Check only outdated [D]ev dependencies:
`pnpm outdated --dev`

View File

@@ -32,3 +32,7 @@ source: https://github.com/tldr-pages/tldr.git
`printf -v {{myvar}} {{"This is %s = %d
" "a year" 2016}}`
- Print a hexadecimal, octal and scientific number:
`printf "{{hex=%x octal=%o scientific=%e}}" 0x{{FF}} 0{{377}} {{100000}}`

25
tldr/select Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# select
> Bash builtin construct for creating menus.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-select>.
- Create a menu out of individual words:
`select {{word}} in {{apple orange pear banana}}; do echo ${{word}}; done`
- Create a menu from the output of another command:
`select {{line}} in $({{command}}); do echo ${{line}}; done`
- Specify the prompt string for `select` and create a menu for picking a file or folder from the current directory:
`PS3="{{Select a file: }}"; select {{file}} in *; do echo ${{file}}; done`
- Create a menu from a Bash array:
`{{fruits}}=({{apple orange pear banana}}); select {{word}} in ${{{fruits[@]}}}; do echo ${{word}}; done`