diff --git a/tldr/btop b/tldr/btop index 7bc442b6..2701cbbd 100644 --- a/tldr/btop +++ b/tldr/btop @@ -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` diff --git a/tldr/dd b/tldr/dd index 34476033..0a517d67 100644 --- a/tldr/dd +++ b/tldr/dd @@ -6,28 +6,24 @@ source: https://github.com/tldr-pages/tldr.git # dd > Convert and copy a file. -> More information: . +> More information: . -- 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}}` diff --git a/tldr/linux/dd b/tldr/linux/dd index 199e688a..6f088c5f 100644 --- a/tldr/linux/dd +++ b/tldr/linux/dd @@ -8,29 +8,25 @@ source: https://github.com/tldr-pages/tldr.git > Convert and copy a file. > More information: . -- 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): diff --git a/tldr/linux/pwn b/tldr/linux/pwn index ef710fa4..d3fdce0a 100644 --- a/tldr/linux/pwn +++ b/tldr/linux/pwn @@ -8,7 +8,7 @@ source: https://github.com/tldr-pages/tldr.git > Exploit Development Library designed for rapid prototyping. > More information: . -- Convert the given assembly code to `bytes`: +- Convert the given assembly code to `bytes`: `pwn asm "{{xor edi, edi}}"` diff --git a/tldr/mise b/tldr/mise new file mode 100644 index 00000000..ee4ed3e9 --- /dev/null +++ b/tldr/mise @@ -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: . + +- 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}}` diff --git a/tldr/nmap b/tldr/nmap index df531c75..c454d88f 100644 --- a/tldr/nmap +++ b/tldr/nmap @@ -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: . +> Some features (e.g. SYN scan) activate only when `nmap` is run with root privileges. +> More information: . -- 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}}` diff --git a/tldr/pnpm-audit b/tldr/pnpm-audit new file mode 100644 index 00000000..9df687be --- /dev/null +++ b/tldr/pnpm-audit @@ -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: . + +- 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}}` diff --git a/tldr/pnpm-outdated b/tldr/pnpm-outdated new file mode 100644 index 00000000..5a07a674 --- /dev/null +++ b/tldr/pnpm-outdated @@ -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: . + +- 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` diff --git a/tldr/printf b/tldr/printf index 2e253b2a..9db90e6e 100644 --- a/tldr/printf +++ b/tldr/printf @@ -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}}` diff --git a/tldr/select b/tldr/select new file mode 100644 index 00000000..e686ffcc --- /dev/null +++ b/tldr/select @@ -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: . + +- 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`