mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-02 00:54:34 +00:00
Update cheatsheets
This commit is contained in:
@@ -14,11 +14,11 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Only get German HTTPS mirrors:
|
||||
|
||||
`reflector --country {{Germany}} --protocol {{https}}`
|
||||
`reflector {{[-c|--country]}} {{Germany}} {{[-p|--protocol]}} {{https}}`
|
||||
|
||||
- Only get the 10 recently sync'd mirrors:
|
||||
|
||||
`reflector --latest {{10}}`
|
||||
`reflector {{[-l|--latest]}} {{10}}`
|
||||
|
||||
- Use a configuration file to fetch mirrors:
|
||||
|
||||
|
||||
@@ -5,34 +5,38 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# sed
|
||||
|
||||
> Edit text in a scriptable manner.
|
||||
> GNU stream editor for filtering and transforming text.
|
||||
> See also: `awk`, `ed`.
|
||||
> More information: <https://www.gnu.org/software/sed/manual/sed.html>.
|
||||
|
||||
- Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in all input lines and print the result to `stdout`:
|
||||
- Replace `apple` with `mango` on all lines using basic regex, print to `stdout`:
|
||||
|
||||
`{{command}} | sed 's/apple/mango/g'`
|
||||
|
||||
- Replace all `apple` (extended regex) occurrences with `APPLE` (extended regex) in all input lines and print the result to `stdout`:
|
||||
- Replace `apple` with `APPLE` on all lines using extended regex, print to `stdout`:
|
||||
|
||||
`{{command}} | sed {{[-E|--regexp-extended]}} 's/(apple)/\U\1/g'`
|
||||
|
||||
- Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in a specific file and overwrite the original file in place:
|
||||
- Use basic regex to replace `apple` with `mango` and `orange` with `lime` in-place in a file (overwriting original file):
|
||||
|
||||
`sed {{[-i|--in-place]}} 's/apple/mango/g' {{path/to/file}}`
|
||||
`sed {{[-i|--in-place]}} -e 's/apple/mango/g' -e 's/orange/lime/g' {{path/to/file}}`
|
||||
|
||||
- Execute a specific script file and print the result to `stdout`:
|
||||
- Execute a specific `sed` script file and print the result to `stdout`:
|
||||
|
||||
`{{command}} | sed {{[-f|--file]}} {{path/to/script.sed}}`
|
||||
|
||||
- Print just the first line to `stdout`:
|
||||
- [p]rint only the first line to `stdout`:
|
||||
|
||||
`{{command}} | sed {{[-n|--quiet]}} '1p'`
|
||||
|
||||
- [d]elete the first line of a file:
|
||||
- [d]elete lines 1 to 5 of a file and back up the original file with a `.orig` extension:
|
||||
|
||||
`sed {{[-i|--in-place]}} 1d {{path/to/file}}`
|
||||
`sed {{[-i|--in-place=]}}{{.orig}} '1,5d' {{path/to/file}}`
|
||||
|
||||
- [i]nsert a new line at the first line of a file:
|
||||
- [i]nsert a new line at the beginning of a file, overwriting the original file in-place:
|
||||
|
||||
`sed {{[-i|--in-place]}} '1i\your new line text\' {{path/to/file}}`
|
||||
|
||||
- Delete blank lines (with or without spaces/tabs) from a file, overwriting the original file in-place:
|
||||
|
||||
`sed {{[-i|--in-place]}} '/^[[:space:]]*$/d' {{path/to/file}}`
|
||||
|
||||
18
tldr/linux/xdg-user-dir
Normal file
18
tldr/linux/xdg-user-dir
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# xdg-user-dir
|
||||
|
||||
> Retrieve XDG user directory locations.
|
||||
> See also: `xdg-user-dirs-update`.
|
||||
> More information: <https://manned.org/xdg-user-dir>.
|
||||
|
||||
- Display the home directory for the current user:
|
||||
|
||||
`xdg-user-dir`
|
||||
|
||||
- Display the location of a user directory:
|
||||
|
||||
`xdg-user-dir {{DESKTOP|DOWNLOAD|TEMPLATES|PUBLICSHARE|DOCUMENTS|MUSIC|PICTURES|VIDEOS}}`
|
||||
@@ -6,6 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
# xdg-user-dirs-update
|
||||
|
||||
> Update XDG user directories.
|
||||
> See also: `xdg-user-dir`.
|
||||
> More information: <https://manned.org/xdg-user-dirs-update>.
|
||||
|
||||
- Change XDG's DESKTOP directory to the specified directory (must be absolute):
|
||||
|
||||
Reference in New Issue
Block a user