From c8986586ce3ea4d6ae0f97cd728446a1c0c8f020 Mon Sep 17 00:00:00 2001 From: ivuorinen Date: Fri, 7 Feb 2025 00:17:34 +0000 Subject: [PATCH] Update cheatsheets --- tldr/aider | 33 +++++++++++++++++++++++++++++++++ tldr/cut | 2 +- tldr/dtrx | 21 +++++++++++++++++++++ tldr/img2sixel | 17 +++++++++++++++++ tldr/linux/bwrap | 17 +++++++++++++++++ tldr/linux/eglinfo | 21 +++++++++++++++++++++ tldr/linux/ifstatus | 13 +++++++++++++ tldr/linux/logread | 25 +++++++++++++++++++++++++ tldr/linux/trap | 6 +++++- tldr/rails | 12 ++++++++++++ tldr/snmpget | 17 +++++++++++++++++ tldr/snmpwalk | 29 +++++++++++++++++++++++++++++ tldr/vagrant-plugin | 34 ++++++++++++++++++++++++++++++++++ tldr/virt-sysprep | 12 ++++++++---- tldr/watch | 18 +++++++++++++----- tldr/windows/es | 42 ++++++++++++++++++++++++++++++++++++++++++ 16 files changed, 308 insertions(+), 11 deletions(-) create mode 100644 tldr/aider create mode 100644 tldr/dtrx create mode 100644 tldr/img2sixel create mode 100644 tldr/linux/bwrap create mode 100644 tldr/linux/eglinfo create mode 100644 tldr/linux/ifstatus create mode 100644 tldr/linux/logread create mode 100644 tldr/snmpget create mode 100644 tldr/snmpwalk create mode 100644 tldr/vagrant-plugin create mode 100644 tldr/windows/es diff --git a/tldr/aider b/tldr/aider new file mode 100644 index 00000000..2f42536c --- /dev/null +++ b/tldr/aider @@ -0,0 +1,33 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# aider + +> Pair program with the LLM of your choice. +> More information: . + +- Start a new project or work with an existing code base: + +`aider --model {{model_name}} --api-key {{your_api_key}}` + +- Add new features or test cases to specific files: + +`aider {{path/to/file1 path/to/file2 ...}}` + +- Describe a bug and let `aider` fix it: + +`aider {{path/to/file}} --describe "{{bug_description}}"` + +- Refactor code in a specific file: + +`aider {{path/to/file}} --refactor` + +- Update documentation: + +`aider {{path/to/file}} --update-docs` + +- Display help: + +`aider --help` diff --git a/tldr/cut b/tldr/cut index 6f462acd..c9b062d4 100644 --- a/tldr/cut +++ b/tldr/cut @@ -14,7 +14,7 @@ source: https://github.com/tldr-pages/tldr.git - Print a [f]ield range of each line with a specific [d]elimiter: -`{{command}} | cut --delimiter "{{,}}" --fields {{1}}` +`{{command}} | cut --delimiter "{{delimiter}}" --fields {{1|1,10|1-10|1-|-10}}` - Print a [c]haracter range of each line of the specific file: diff --git a/tldr/dtrx b/tldr/dtrx new file mode 100644 index 00000000..a2831c26 --- /dev/null +++ b/tldr/dtrx @@ -0,0 +1,21 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# dtrx + +> "Do The Right eXtraction" - extract any archive into new directory by guessing the tool from extension. +> More information: . + +- Extract archive, guessing the extraction tool from extension: + +`dtrx {{path/to/file}}` + +- Extract archive, overwrite any existing target output: + +`dtrx --overwrite {{path/to/file}}` + +- Extract archive, put everything into current directory: + +`dtrx --flat {{path/to/file}}` diff --git a/tldr/img2sixel b/tldr/img2sixel new file mode 100644 index 00000000..bab8152d --- /dev/null +++ b/tldr/img2sixel @@ -0,0 +1,17 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# img2sixel + +> Convert images to the Sixel format for displaying in a terminal. +> More information: . + +- Display an image in the terminal: + +`img2sixel {{path/to/image}}` + +- Resize the image to the specified width and height before displaying it: + +`img2sixel {{-w|--width}} {{number}} {{-h|--height}} {{number}} {{path/to/image}}` diff --git a/tldr/linux/bwrap b/tldr/linux/bwrap new file mode 100644 index 00000000..92ed5c9c --- /dev/null +++ b/tldr/linux/bwrap @@ -0,0 +1,17 @@ +--- +syntax: markdown +tags: [tldr, linux] +source: https://github.com/tldr-pages/tldr.git +--- +# bwrap + +> Run programs in a lightweight sandbox. +> More information: . + +- Run a program in a read-only environment: + +`bwrap --ro-bind / / {{/bin/bash}}` + +- Give the environment access to devices, process information and create a `tmpfs` for it: + +`bwrap --dev-bind /dev /dev --proc /proc --ro-bind / / --tmpfs /tmp {{/bin/bash}}` diff --git a/tldr/linux/eglinfo b/tldr/linux/eglinfo new file mode 100644 index 00000000..1850bc8f --- /dev/null +++ b/tldr/linux/eglinfo @@ -0,0 +1,21 @@ +--- +syntax: markdown +tags: [tldr, linux] +source: https://github.com/tldr-pages/tldr.git +--- +# eglinfo + +> Display platform EGL information. +> More information: . + +- Display full platform information: + +`eglinfo` + +- Display a brief version of platform information: + +`eglinfo -B` + +- Display help: + +`eglinfo -h` diff --git a/tldr/linux/ifstatus b/tldr/linux/ifstatus new file mode 100644 index 00000000..501db655 --- /dev/null +++ b/tldr/linux/ifstatus @@ -0,0 +1,13 @@ +--- +syntax: markdown +tags: [tldr, linux] +source: https://github.com/tldr-pages/tldr.git +--- +# ifstatus + +> Display OpenWRT interface status in JSON format. +> More information: . + +- Display interface status: + +`ifstatus {{interface_name}}` diff --git a/tldr/linux/logread b/tldr/linux/logread new file mode 100644 index 00000000..7ad82982 --- /dev/null +++ b/tldr/linux/logread @@ -0,0 +1,25 @@ +--- +syntax: markdown +tags: [tldr, linux] +source: https://github.com/tldr-pages/tldr.git +--- +# logread + +> Read the `logd` ring buffer log. +> More information: . + +- Print the log: + +`logread` + +- Print a specified number of messages: + +`logread -l {{N}}` + +- Filter messages by (Keyword/Regular Expression): + +`logread -e {{pattern}}` + +- Print log messages as they happen: + +`logread -f` diff --git a/tldr/linux/trap b/tldr/linux/trap index 82d2712d..dc724b35 100644 --- a/tldr/linux/trap +++ b/tldr/linux/trap @@ -14,7 +14,7 @@ source: https://github.com/tldr-pages/tldr.git - List the commands and the names of the expected events: -`trap -p` +`trap` - Execute a command when a signal is received: @@ -23,3 +23,7 @@ source: https://github.com/tldr-pages/tldr.git - Remove commands: `trap - {{SIGHUP}} {{SIGINT}}` + +- Ignore a signal: + +`trap '' {{SIGINT}}` diff --git a/tldr/rails b/tldr/rails index 57369618..880f6c95 100644 --- a/tldr/rails +++ b/tldr/rails @@ -13,6 +13,18 @@ source: https://github.com/tldr-pages/tldr.git `rails new "{{project_name}}"` +- Generate a scaffold for a model named Post, predefining the attributes title and body: + +`rails generate scaffold Post title:string body:text` + +- Run migrations: + +`rails db:migrate` + +- List all routes: + +`rails routes` + - Start local server for current project on port 3000: `rails server` diff --git a/tldr/snmpget b/tldr/snmpget new file mode 100644 index 00000000..cf678a68 --- /dev/null +++ b/tldr/snmpget @@ -0,0 +1,17 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# snmpget + +> Query using the SNMP protocol. +> More information: . + +- Request a single value from the SNMP agent: + +`snmpget -v {{version}} -c {{community}} {{ip}} {{oid}}` + +- Display the full Object Identifier (OID) path: + +`snmpget -v {{version}} -c {{community}} -O f {{ip}} {{oid}}` diff --git a/tldr/snmpwalk b/tldr/snmpwalk new file mode 100644 index 00000000..3df5f8ac --- /dev/null +++ b/tldr/snmpwalk @@ -0,0 +1,29 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# snmpwalk + +> SNMP query tool. +> More information: . + +- Query the system information of a remote host using SNMPv1 and a community string: + +`snmpwalk -v 1 -c {{community}} {{ip}}` + +- Query system information on a remote host by OID using SNMPv2 on a specified port: + +`snmpwalk -v 2c -c {{community}} {{ip}}:{{port}} {{oid}}` + +- Query system information on a remote host by OID using SNMPv3 and authentication without encryption: + +`snmpwalk -v 3 -l {{authNoPriv}} -u {{username}} -a {{MD5|SHA}} -A {{passphrase}} {{ip}} {{oid}}` + +- Query system information on a remote host by OID using SNMPv3, authentication, and encryption: + +`snmpwalk -v 3 -l {{authPriv}} -u {{username}} -a {{MD5|SHA}} -A {{auth_passphrase}} -x {{DES|AES}} -X {{enc_passphrase}} {{ip}} {{oid}}` + +- Query system information on a remote host by OID using SNMPv3 without authentication or encryption: + +`snmpwalk -v 3 -l {{noAuthNoPriv}} -u {{username}} {{ip}} {{oid}}` diff --git a/tldr/vagrant-plugin b/tldr/vagrant-plugin new file mode 100644 index 00000000..de7a8182 --- /dev/null +++ b/tldr/vagrant-plugin @@ -0,0 +1,34 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# vagrant plugin + +> Manage Vagrant plugins. +> See also: `vagrant`. +> More information: . + +- List all the plugins currently installed: + +`vagrant plugin list` + +- Install a plugin from remote repositories, usually RubyGems: + +`vagrant plugin install {{vagrant_vbguest}}` + +- Install a plugin from a local file source: + +`vagrant plugin install {{path/to/my_plugin.gem}}` + +- Update all installed plugins to their latest version: + +`vagrant plugin update` + +- Update a plugin to the latest version: + +`vagrant plugin update {{vagrant_vbguest}}` + +- Uninstall a specific plugin: + +`vagrant uninstall {{vagrant_vbguest}}` diff --git a/tldr/virt-sysprep b/tldr/virt-sysprep index 60d4ee8a..2d22e0ff 100644 --- a/tldr/virt-sysprep +++ b/tldr/virt-sysprep @@ -12,14 +12,18 @@ source: https://github.com/tldr-pages/tldr.git `virt-sysprep --list-operations` -- Run all enabled operations but don't actually apply the changes: +- Remove sensitive system data from a virtual machine image: -`virt-sysprep --domain {{vm_name}} --dry-run` +`sudo virt-sysprep --add {{path/to/image.qcow2}}` + +- Specify a virtual machine by its name and run all enabled operations but don't actually apply the changes: + +`sudo virt-sysprep --domain {{vm_name}} --dry-run` - Run only the specified operations: -`virt-sysprep --domain {{vm_name}} --operations {{operation1,operation2,...}}` +`sudo virt-sysprep --domain {{vm_name}} --operations {{operation1,operation2,...}}` - Generate a new `/etc/machine-id` file and enable customizations to be able to change the host name to avoid network conflicts: -`virt-sysprep --domain {{vm_name}} --enable {{customizations}} --hostname {{host_name}} --operation {{machine-id}}` +`sudo virt-sysprep --domain {{vm_name}} --enable {{customizations}} --hostname {{host_name}} --operation {{machine-id}}` diff --git a/tldr/watch b/tldr/watch index 6da8b309..9d0e9e6f 100644 --- a/tldr/watch +++ b/tldr/watch @@ -5,7 +5,7 @@ source: https://github.com/tldr-pages/tldr.git --- # watch -> Execute a program periodically, showing output fullscreen. +> Execute a program periodically and monitor the output in full-screen mode. > More information: . - Repeatedly run a command and show the result: @@ -14,12 +14,20 @@ source: https://github.com/tldr-pages/tldr.git - Re-run a command every 60 seconds: -`watch -n {{60}} {{command}}` +`watch --interval {{60}} {{command}}` -- Monitor the contents of a directory, highlighting differences as they appear: +- Monitor disk space, highlighting differences as they appear: -`watch -d {{ls -l}}` +`watch --differences {{df}}` - Repeatedly run a pipeline and show the result: -`watch '{{command_1}} | {{command_2}} | {{command_3}}'` +`watch "{{command_1}} | {{command_2}} | {{command_3}}"` + +- Exit `watch` if the visible output changes: + +`watch --chgexit {{lsblk}}` + +- Interpret terminal control characters: + +`watch --color {{ls --color=always}}` diff --git a/tldr/windows/es b/tldr/windows/es new file mode 100644 index 00000000..f542fd0f --- /dev/null +++ b/tldr/windows/es @@ -0,0 +1,42 @@ +--- +syntax: markdown +tags: [tldr, windows] +source: https://github.com/tldr-pages/tldr.git +--- +# es + +> Command-line interface for Everything, a fast file and folder search tool for Windows. +> Requires Everything to be installed and running in the background. +> More information: . + +- Search for a file or folder by name: + +`es {{search_term}}` + +- Search using a regular expression: + +`es -r {{regex_pattern}}` + +- Match whole words: + +`es -w {{search_term}}` + +- Limit the number of results shown: + +`es -n {{10}} {{search_term}}` + +- Search within a specific folder: + +`es -path {{folder_path}} {{search_term}}` + +- List folders only: + +`es /ad` + +- List files only: + +`es /a-d` + +- Sort results (e.g., by name): + +`es -sort {{name-ascending}}`