From 9f85bd373fd05bfe38599865127a88287f274b83 Mon Sep 17 00:00:00 2001 From: ivuorinen Date: Fri, 9 May 2025 00:19:52 +0000 Subject: [PATCH] Update cheatsheets --- tldr/case | 4 ++-- tldr/cmake | 16 ++++++++-------- tldr/kate | 12 ++++++------ tldr/linux/genfstab | 28 ++++++++++++++++------------ tldr/linux/linux-boot-prober | 13 +++++++++++++ tldr/linux/makepkg | 6 +++++- tldr/linux/nixos-rebuild | 4 ++++ tldr/linux/pacstrap | 18 +++++++++--------- 8 files changed, 63 insertions(+), 38 deletions(-) create mode 100644 tldr/linux/linux-boot-prober diff --git a/tldr/case b/tldr/case index 8d71728f..9be1574b 100644 --- a/tldr/case +++ b/tldr/case @@ -10,11 +10,11 @@ source: https://github.com/tldr-pages/tldr.git - Match a variable against string literals to decide which command to run: -`case {{$COUNTRULE}} in {{words}}) {{wc -w README}} ;; {{lines}}) {{wc -l README}} ;; esac` +`case {{$COUNTRULE}} in {{words}}) {{wc --words README}} ;; {{lines}}) {{wc --lines README}} ;; esac` - Combine patterns with |, use * as a fallback pattern: -`case {{$COUNTRULE}} in {{[wW]|words}}) {{wc -w README}} ;; {{[lL]|lines}}) {{wc -l README}} ;; *) {{echo "what?"}} ;; esac` +`case {{$COUNTRULE}} in {{[wW]|words}}) {{wc --words README}} ;; {{[lL]|lines}}) {{wc --lines README}} ;; *) {{echo "what?"}} ;; esac` - Allow matching multiple patterns: diff --git a/tldr/cmake b/tldr/cmake index a26312ed..e75ef601 100644 --- a/tldr/cmake +++ b/tldr/cmake @@ -12,14 +12,6 @@ source: https://github.com/tldr-pages/tldr.git `cmake {{path/to/project_directory}}` -- Generate a build recipe, with build type set to `Release` with CMake variable: - -`cmake {{path/to/project_directory}} -D {{CMAKE_BUILD_TYPE=Release}}` - -- Generate a build recipe using `generator_name` as the underlying build system: - -`cmake -G {{generator_name}} {{path/to/project_directory}}` - - Use a generated recipe in a given directory to build artifacts: `cmake --build {{path/to/build_directory}}` @@ -28,6 +20,14 @@ source: https://github.com/tldr-pages/tldr.git `cmake --install {{path/to/build_directory}} --strip` +- Generate a build recipe, with build type set to `Release` with CMake variable: + +`cmake {{path/to/project_directory}} -D {{CMAKE_BUILD_TYPE=Release}}` + +- Generate a build recipe using `generator_name` as the underlying build system: + +`cmake -G {{generator_name}} {{path/to/project_directory}}` + - Install the build artifacts using the custom prefix for paths: `cmake --install {{path/to/build_directory}} --strip --prefix {{path/to/directory}}` diff --git a/tldr/kate b/tldr/kate index dfe9acb6..2f3ce99c 100644 --- a/tldr/kate +++ b/tldr/kate @@ -6,7 +6,7 @@ source: https://github.com/tldr-pages/tldr.git # kate > KDE's advanced text editor. -> More information: . +> More information: . - Open specific files: @@ -18,20 +18,20 @@ source: https://github.com/tldr-pages/tldr.git - Create a new editor instance even if one is already open: -`kate --new` +`kate {{[-n|--new]}}` - Open a file with the cursor at the specific line: -`kate --line {{line_number}} {{path/to/file}}` +`kate {{[-l|--line]}} {{line_number}} {{path/to/file}}` - Open a file with the cursor at the specific line and column: -`kate --line {{line_number}} --column {{column_number}} {{path/to/file}}` +`kate {{[-l|--line]}} {{line_number}} {{[-c|--column]}} {{column_number}} {{path/to/file}}` - Create a file from `stdin`: -`cat {{path/to/file}} | kate --stdin` +`cat {{path/to/file}} | kate {{[-i|--stdin]}}` - Display help: -`kate --help` +`kate {{[-h|--help]}}` diff --git a/tldr/linux/genfstab b/tldr/linux/genfstab index 0974b30f..9f5e97d6 100644 --- a/tldr/linux/genfstab +++ b/tldr/linux/genfstab @@ -5,21 +5,25 @@ source: https://github.com/tldr-pages/tldr.git --- # genfstab -> Arch Linux install script to generate output suitable for addition to an fstab file. -> More information: . +> Generate output suitable for addition to the `/etc/fstab` file. +> More information: . -- Display an fstab compatible output based on a volume label: - -`genfstab -L {{path/to/mount_point}}` - -- Display an fstab compatible output based on a volume UUID: - -`genfstab -U {{path/to/mount_point}}` - -- A usual way to generate an fstab file, requires root permissions: +- Generate the `/etc/fstab` file using volume UUIDs during an Arch Linux installation (requires root permissions): `genfstab -U {{/mnt}} >> {{/mnt/etc/fstab}}` -- Append a volume into an fstab file to mount it automatically: +- Display fstab-compatible output based on volume labels: + +`genfstab -L {{path/to/mount_point}}` + +- Display fstab-compatible output based on volume UUIDs: + +`genfstab -U {{path/to/mount_point}}` + +- Display fstab-compatible output based on the specified identifier: + +`genfstab -t {{LABEL|UUID|PARTLABEL|PARTUUID}}` + +- Append a volume into the `/etc/fstab` file to mount it automatically: `genfstab -U {{path/to/mount_point}} | sudo tee -a /etc/fstab` diff --git a/tldr/linux/linux-boot-prober b/tldr/linux/linux-boot-prober new file mode 100644 index 00000000..5562ebc4 --- /dev/null +++ b/tldr/linux/linux-boot-prober @@ -0,0 +1,13 @@ +--- +syntax: markdown +tags: [tldr, linux] +source: https://github.com/tldr-pages/tldr.git +--- +# linux-boot-prober + +> Probe a partition for bootable operating systems. +> More information: . + +- Probe a partition: + +`sudo linux-boot-prober {{/dev/sdXY}}` diff --git a/tldr/linux/makepkg b/tldr/linux/makepkg index 2f89648d..e25aeedf 100644 --- a/tldr/linux/makepkg +++ b/tldr/linux/makepkg @@ -19,7 +19,7 @@ source: https://github.com/tldr-pages/tldr.git - Make a package, install its dependencies then install it to the system: -`makepkg {{[-s|--syncdeps]}} {{[-i|--install]}}` +`makepkg {{[-si|--syncdeps --install]}}` - Make a package, but skip checking the source's hashes: @@ -36,3 +36,7 @@ source: https://github.com/tldr-pages/tldr.git - Generate and save the source information into `.SRCINFO`: `makepkg --printsrcinfo > .SRCINFO` + +- Download the source and install only the build dependencies for a program: + +`makepkg {{[-so|--syncdeps --nobuild]}}` diff --git a/tldr/linux/nixos-rebuild b/tldr/linux/nixos-rebuild index bc9b875c..c410042a 100644 --- a/tldr/linux/nixos-rebuild +++ b/tldr/linux/nixos-rebuild @@ -35,3 +35,7 @@ source: https://github.com/tldr-pages/tldr.git - Build the configuration and open it in a virtual machine: `sudo nixos-rebuild build-vm` + +- List available generations similar to the boot loader menu: + +`nixos-rebuild list-generations` diff --git a/tldr/linux/pacstrap b/tldr/linux/pacstrap index cbf1f72e..7bb8e40a 100644 --- a/tldr/linux/pacstrap +++ b/tldr/linux/pacstrap @@ -5,18 +5,22 @@ source: https://github.com/tldr-pages/tldr.git --- # pacstrap -> Arch Linux install script to install packages to the specified new root directory. -> More information: . +> Install Arch Linux packages in the specified new root directory. +> More information: . -- Install the `base` package, Linux kernel and firmware for common hardware: +- Install the `base` package, the Linux kernel and firmware for common hardware: `pacstrap {{path/to/new/root}} {{base}} {{linux}} {{linux-firmware}}` -- Install the `base` package, Linux LTS kernel and `base-devel` build tools: +- Install the `base` package, the Linux LTS kernel and `base-devel` build tools: `pacstrap {{path/to/new/root}} {{base}} {{base-devel}} {{linux-lts}}` -- Install packages without copy the host's mirrorlist to the target: +- Install packages and copy the host's Pacman config to the target: + +`pacstrap -P {{path/to/new/root}} {{packages}}` + +- Install packages without copying the host's mirrorlist to the target: `pacstrap -M {{path/to/new/root}} {{packages}}` @@ -35,7 +39,3 @@ source: https://github.com/tldr-pages/tldr.git - Install packages in interactive mode (prompts for confirmation): `pacstrap -i {{path/to/new/root}} {{packages}}` - -- Install packages using package files: - -`pacstrap -U {{path/to/new/root}} {{path/to/package1}} {{path/to/package2}}`