From d120c828b4328ba8fc058df424db37953541c620 Mon Sep 17 00:00:00 2001 From: ivuorinen Date: Mon, 7 Apr 2025 00:19:47 +0000 Subject: [PATCH] Update cheatsheets --- tldr/linux/emerge | 2 +- tldr/linux/rnm | 41 +++++++++++++++++++++++++++++++++++++++++ tldr/pandoc | 14 +++++++++++--- tldr/tqdm | 16 ++++++++++++++-- 4 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 tldr/linux/rnm diff --git a/tldr/linux/emerge b/tldr/linux/emerge index ff40ab2f..26293408 100644 --- a/tldr/linux/emerge +++ b/tldr/linux/emerge @@ -17,7 +17,7 @@ source: https://github.com/tldr-pages/tldr.git `sudo emerge {{[-avuDN|--ask --verbose --update --deep --newuse]}} @world` -- Resume a failed updated, skipping the failing package: +- Resume a failed update, skipping the failing package: `sudo emerge --resume --skipfirst` diff --git a/tldr/linux/rnm b/tldr/linux/rnm new file mode 100644 index 00000000..4fd6df9f --- /dev/null +++ b/tldr/linux/rnm @@ -0,0 +1,41 @@ +--- +syntax: markdown +tags: [tldr, linux] +source: https://github.com/tldr-pages/tldr.git +--- +# rnm + +> Bulk Rename Utility. +> More information: . + +- Replace a search string with a replacement string in filenames: + +`rnm -ss {{old}} -rs {{new}} {{path/to/directory}}` + +- Use a fixed (literal) search and replace string instead of regex: + +`rnm -ssf {{old}} -rs {{new}} {{path/to/files}}` + +- Add an auto-incremented index to filenames starting from 1: + +`rnm -i 1 -inc 1 -rs {{_}} {{path/to/files}}` + +- Rename files using a list of new names from a text file: + +`rnm -ns/f {{path/to/names.txt}} {{path/to/files}}` + +- Rename only files (ignoring directories and links): + +`rnm -fo -ss {{pattern}} -rs {{replacement}} {{path/to/files}}` + +- Sort input files by modification time before renaming: + +`rnm -s/mt -ss {{pattern}} -rs {{replacement}} {{path/to/files}}` + +- Run a simulation without making actual changes: + +`rnm -sim -ss {{pattern}} -rs {{replacement}} {{path/to/files}}` + +- Undo the last renaming operation: + +`rnm -u` diff --git a/tldr/pandoc b/tldr/pandoc index 2d71c73d..38f5d2b5 100644 --- a/tldr/pandoc +++ b/tldr/pandoc @@ -8,17 +8,25 @@ source: https://github.com/tldr-pages/tldr.git > Convert documents between various formats. > More information: . -- Convert file to PDF (the output format is determined by file extension): +- Convert a Markdown file to PDF using `pdflatex` (the formats are determined by file extensions): `pandoc {{path/to/input.md}} {{[-o|--output]}} {{path/to/output.pdf}}` +- Convert a Markdown file to PDF using the specified PDF engine: + +`pandoc {{path/to/input.md}} --pdf-engine {{tectonic|weasyprint|typst|...}} {{[-o|--output]}} {{path/to/output.pdf}}` + - Convert to a standalone file with the appropriate headers/footers (for LaTeX, HTML, etc.): `pandoc {{path/to/input.md}} {{[-s|--standalone]}} {{[-o|--output]}} {{path/to/output.html}}` -- Manually specify format detection and conversion (overriding automatic format detection using filename extension or when filename extension is missing altogether): +- Manually specify formats (overriding automatic format detection using the filename extension, or when there is no extension): -`pandoc {{-f|-r|--from|--read}} {{docx|...}} {{path/to/input}} {{-t|-w|--to|--write}} {{pdf|...}} {{[-o|--output]}} {{path/to/output}}` +`pandoc {{[-f|--from]}} {{docx|...}} {{path/to/input}} {{[-t|--to]}} {{pdf|...}} {{[-o|--output]}} {{path/to/output}}` + +- Transform a document using a Lua script (see for more information): + +`pandoc {{path/to/input}} {{[-L|--lua-filter]}} {{path/to/filter.lua}} {{[-o|--output]}} {{path/to/output}}` - List all supported input formats: diff --git a/tldr/tqdm b/tldr/tqdm index cd10eb83..f52403e2 100644 --- a/tldr/tqdm +++ b/tldr/tqdm @@ -5,9 +5,21 @@ source: https://github.com/tldr-pages/tldr.git --- # tqdm -> Create a progress bar. +> Show progress over time of a command. > More information: . +- Show iterations per second and use `stdout` afterwards: + +`{{seq 10000000}} | tqdm | {{command}}` + - Create a progress bar: -`seq 10000000 | tqdm --total 10000000 --null` +`{{seq 10000000}} | tqdm --total {{10000000}} | {{command}}` + +- Create an archive out of a directory and use the file count of that directory to create a progress bar: + +`zip -r {{path/to/archive.zip}} {{path/to/directory}} | tqdm --total $(find {{path/to/directory}} | wc -l) --unit files --null` + +- Create an archive with tar and create a progress bar (system agnostic, GNU tar uses `stdout` while BSD tar uses `stderr`): + +`tar vzcf {{path/to/archive.tar.gz}} {{path/to/directory}} 2>&1 | tqdm --total $(find {{path/to/directory}} | wc -l) --unit files --null`