Update cheatsheets

This commit is contained in:
ivuorinen
2024-11-27 00:18:24 +00:00
parent f717d6776b
commit ead6469b35
6 changed files with 85 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
# dnf
> Package management utility for RHEL, Fedora, and CentOS (replaces yum).
> Some subcommands such as `group` and `config-manager` have their own usage documentation.
> For equivalent commands in other package managers, see <https://wiki.archlinux.org/title/Pacman/Rosetta>.
> More information: <https://dnf.readthedocs.io>.

29
tldr/linux/dnf-group Normal file
View File

@@ -0,0 +1,29 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# dnf group
> Manage virtual collections of packages on Fedora-based systems.
> More information: <https://manned.org/man/dnf-group>.
- List DNF groups, showing installed and uninstalled status in a table:
`dnf group list`
- Show DNF group info, including repository and optional packages:
`dnf group info {{group_name}}`
- Install DNF group:
`dnf group install {{group_name}}`
- Remove DNF group:
`dnf group remove {{group_name}}`
- Upgrade DNF group:
`dnf group upgrade {{group_name}}`

13
tldr/linux/dnf5-group Normal file
View File

@@ -0,0 +1,13 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# dnf5 group
> This command is an alias of `dnf group`.
> Note: from Fedora 37 to 40 (inclusive), `dnf` runs DNF v4 while `dnf5` runs DNF v5.
- View documentation for the original command:
`tldr dnf group`

View File

@@ -7,7 +7,7 @@ source: https://github.com/tldr-pages/tldr.git
> Shell builtin for viewing information about processes spawned by the current shell.
> Options other than `-l` and `-p` are exclusive to `bash`.
> More information: <https://manned.org/jobs>.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-jobs>.
- View jobs spawned by the current shell:

View File

@@ -15,3 +15,7 @@ source: https://github.com/tldr-pages/tldr.git
- Print the current directory, and resolve all symlinks (i.e. show the "physical" path):
`pwd -P`
- Print the current logical directory:
`pwd -L`

37
tldr/trdsql Normal file
View File

@@ -0,0 +1,37 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# trdsql
> Execute SQL on CSV, LTSV, JSON, YAML, and TBLN files.
> More information: <https://noborus.github.io/trdsql/>.
- Convert object data from multiple JSON files to a CSV file with header (`-oh`) and double quote:
`trdsql -ocsv -oh "SELECT * FROM {{path/to/file/*.json}}" | sed 's/\([^,]*\)/"&"/g' > {{path/to/file.csv}}`
- Interpret JSON list as a table and put objects inside as columns (path/to/file.json: `{"list":[{"age":"26","name":"Tanaka"}]}`):
`trdsql "SELECT * FROM {{path/to/file.json}}::.list`
- Manipulate complex SQL query with data from multiple CSV files with first line is header (`-ih`):
`trdsql -icsv -ih "SELECT {{column1,column2}} FROM {{path/to/file*.csv}} WHERE column2 != '' ORDER BY column1 GROUP BY column1"`
- Merge content of 2 CSV files to one CSV file:
`trdsql "SELECT {{column1,colum2}} FROM {{path/to/file1.csv}} UNION SELECT {{column1,column2}} FROM {{path/to/file2.csv}}"`
- Connect to PostgreSQL database:
`trdsql -driver postgres -dsn "host={{hostname}} port={{5433}} dbname={{database_name}}" "SELECT 1"`
- Create table data to MySQL database from CSV file:
`trdsql -driver mysql -dsn "{{username}}:{{password}}@{{hostname}}/{{database}}" -ih "CREATE TABLE {{table}} ({{column1}} int, {{colum2}} varchar(20)) AS SELECT {{column3}} AS {{column1}},{{column2}} FROM {{path/to/header_file.csv}}"`
- Show data from compress log files:
`trdsql -iltsv "SELECT * FROM {{path/to/access.log.gz}}"`