mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-07-23 08:35:31 +02:00
*: add option placeholders (#15921)
This commit is contained in:
parent
4a52fa4338
commit
6d3ae965a1
42 changed files with 165 additions and 157 deletions
|
@ -5,7 +5,7 @@
|
|||
|
||||
- Scan the current local network:
|
||||
|
||||
`arp-scan --localnet`
|
||||
`arp-scan {{[-l|--localnet]}}`
|
||||
|
||||
- Scan an IP network with a custom bitmask:
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
- Recursively change the owner group of a directory and its contents:
|
||||
|
||||
`chgrp -R {{group}} {{path/to/directory}}`
|
||||
`chgrp {{[-R|--recursive]}} {{group}} {{path/to/directory}}`
|
||||
|
||||
- Change the owner group of a symbolic link:
|
||||
|
||||
`chgrp -h {{group}} {{path/to/symlink}}`
|
||||
`chgrp {{[-h|--no-dereference]}} {{group}} {{path/to/symlink}}`
|
||||
|
||||
- Change the owner group of a file/directory to match a reference file:
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
|
||||
- Change permissions recursively giving [g]roup and [o]thers the ability to [w]rite:
|
||||
|
||||
`chmod -R g+w,o+w {{path/to/directory}}`
|
||||
`chmod {{[-R|--recursive]}} g+w,o+w {{path/to/directory}}`
|
||||
|
||||
- Recursively give [a]ll users [r]ead permissions to files and e[X]ecute permissions to sub-directories within a directory:
|
||||
|
||||
`chmod -R a+rX {{path/to/directory}}`
|
||||
`chmod {{[-R|--recursive]}} a+rX {{path/to/directory}}`
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
- Recursively change the owner of a directory and its contents:
|
||||
|
||||
`chown -R {{user}} {{path/to/directory}}`
|
||||
`chown {{[-R|--recursive]}} {{user}} {{path/to/directory}}`
|
||||
|
||||
- Change the owner of a symbolic link:
|
||||
|
||||
`chown -h {{user}} {{path/to/symlink}}`
|
||||
`chown {{[-h|--no-dereference]}} {{user}} {{path/to/symlink}}`
|
||||
|
||||
- Change the owner of a file/directory to match a reference file:
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
- Output info of the first difference: char, line number, bytes, and values:
|
||||
|
||||
`cmp --print-bytes {{path/to/file1}} {{path/to/file2}}`
|
||||
`cmp {{[-b|--print-bytes]}} {{path/to/file1}} {{path/to/file2}}`
|
||||
|
||||
- Output the byte numbers and values of every difference:
|
||||
|
||||
`cmp --verbose {{path/to/file1}} {{path/to/file2}}`
|
||||
`cmp {{[-v|--verbose]}} {{path/to/file1}} {{path/to/file2}}`
|
||||
|
||||
- Compare files but output nothing, yield only the exit status:
|
||||
|
||||
`cmp --quiet {{path/to/file1}} {{path/to/file2}}`
|
||||
`cmp {{[-s|--quiet]}} {{path/to/file1}} {{path/to/file2}}`
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
|
||||
- Format the output of a command for a 30 characters wide display:
|
||||
|
||||
`printf "header1 header2\nbar foo\n" | column --output-width {{30}}`
|
||||
`printf "header1 header2\nbar foo\n" | column {{[-c|--output-width]}} {{30}}`
|
||||
|
||||
- Split columns automatically and auto-align them in a tabular format:
|
||||
|
||||
`printf "header1 header2\nbar foo\n" | column --table`
|
||||
`printf "header1 header2\nbar foo\n" | column {{[-t|--table]}}`
|
||||
|
||||
- Specify the column delimiter character for the `--table` option (e.g. "," for CSV) (defaults to whitespace):
|
||||
|
||||
`printf "header1,header2\nbar,foo\n" | column --table --separator {{,}}`
|
||||
`printf "header1,header2\nbar,foo\n" | column {{[-t|--table]}} {{[-s|--separator]}} {{,}}`
|
||||
|
||||
- Fill rows before filling columns:
|
||||
|
||||
`printf "header1\nbar\nfoobar\n" | column --output-width {{30}} --fillrows`
|
||||
`printf "header1\nbar\nfoobar\n" | column {{[-c|{{[-c|--output-width]}}]}} {{30}} {{[-x|--fillrows]}}`
|
||||
|
|
|
@ -9,24 +9,24 @@
|
|||
|
||||
- List the sizes of a directory and any subdirectories, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
|
||||
|
||||
`du -h {{path/to/directory}}`
|
||||
`du {{[-h|--human-readable]}} {{path/to/directory}}`
|
||||
|
||||
- Show the size of a single directory, in human-readable units:
|
||||
|
||||
`du -sh {{path/to/directory}}`
|
||||
`du {{[-sh|--summarize --human-readable]}} {{path/to/directory}}`
|
||||
|
||||
- List the human-readable sizes of a directory and of all the files and directories within it:
|
||||
|
||||
`du -ah {{path/to/directory}}`
|
||||
`du {{[-ah|--all --human-readable]}} {{path/to/directory}}`
|
||||
|
||||
- List the human-readable sizes of a directory and any subdirectories, up to N levels deep:
|
||||
|
||||
`du -h --max-depth=N {{path/to/directory}}`
|
||||
`du {{[-h|--human-readable]}} {{[-d|--max-depth]}} N {{path/to/directory}}`
|
||||
|
||||
- List the human-readable size of all `.jpg` files in current directory, and show a cumulative total at the end:
|
||||
|
||||
`du -ch {{./*.jpg}}`
|
||||
`du {{[-ch|--total --human-readable]}} {{./*.jpg}}`
|
||||
|
||||
- List all files and directories (including hidden ones) above a certain [t]hreshold size (useful for investigating what is actually taking up the space):
|
||||
- List all files and directories (including hidden ones) above a certain threshold size (useful for investigating what is actually taking up the space):
|
||||
|
||||
`du --all --human-readable --threshold {{1G|1024M|1048576K}} .[^.]* *`
|
||||
`du {{[-ah|--all --human-readable]}} {{[-t|--threshold]}} {{1G|1024M|1048576K}} .[^.]* *`
|
||||
|
|
|
@ -10,19 +10,19 @@
|
|||
|
||||
- Start an interactive editor session with an empty document and a specific prompt:
|
||||
|
||||
`ed --prompt='> '`
|
||||
`ed {{[-p|--prompt]}} '{{> }}'`
|
||||
|
||||
- Start an interactive editor session with user-friendly errors:
|
||||
|
||||
`ed --verbose`
|
||||
`ed {{[-v|--verbose]}}`
|
||||
|
||||
- Start an interactive editor session with an empty document and without diagnostics, byte counts and '!' prompt:
|
||||
|
||||
`ed --quiet`
|
||||
`ed {{[-q|--quiet]}}`
|
||||
|
||||
- Start an interactive editor session without exit status change when command fails:
|
||||
|
||||
`ed --loose-exit-status`
|
||||
`ed {{[-l|--loose-exit-status]}}`
|
||||
|
||||
- Edit a specific file (this shows the byte count of the loaded file):
|
||||
|
||||
|
@ -30,4 +30,8 @@
|
|||
|
||||
- Replace a string with a specific replacement for all lines:
|
||||
|
||||
`,s/{{regular_expression}}/{{replacement}}/g`
|
||||
`,s/{{regular_expression}}/{{replacement}}/g<Enter>`
|
||||
|
||||
- Exit ed:
|
||||
|
||||
`q<Enter>`
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
- Start Emacs in console mode (without an X window):
|
||||
|
||||
`emacs --no-window-system`
|
||||
`emacs {{[-nw|--no-window-system]}}`
|
||||
|
||||
- Start an Emacs server in the background (accessible via `emacsclient`):
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
- Save a video as GIF, scaling the height to 1000px and setting framerate to 15:
|
||||
|
||||
`ffmpeg -i {{path/to/video.mp4}} -vf 'scale=-1:{{1000}}' -r {{15}} {{path/to/output.gif}}`
|
||||
`ffmpeg -i {{path/to/video.mp4}} {{[-vf|-filter:v]}} 'scale=-1:{{1000}}' -r {{15}} {{path/to/output.gif}}`
|
||||
|
||||
- Combine numbered images (`frame_1.jpg`, `frame_2.jpg`, etc) into a video or GIF:
|
||||
|
||||
|
@ -21,16 +21,16 @@
|
|||
|
||||
- Trim a video from a given start time mm:ss to an end time mm2:ss2 (omit the -to flag to trim till the end):
|
||||
|
||||
`ffmpeg -i {{path/to/input_video.mp4}} -ss {{mm:ss}} -to {{mm2:ss2}} -codec copy {{path/to/output_video.mp4}}`
|
||||
`ffmpeg -i {{path/to/input_video.mp4}} -ss {{mm:ss}} -to {{mm2:ss2}} {{[-c|-codec]}} copy {{path/to/output_video.mp4}}`
|
||||
|
||||
- Convert AVI video to MP4. AAC Audio @ 128kbit, h264 Video @ CRF 23:
|
||||
|
||||
`ffmpeg -i {{path/to/input_video}}.avi -codec:a aac -b:a 128k -codec:v libx264 -crf 23 {{path/to/output_video}}.mp4`
|
||||
`ffmpeg -i {{path/to/input_video}}.avi {{[-c|-codec]}}:a aac -b:a 128k {{[-c|-codec]}}:v libx264 -crf 23 {{path/to/output_video}}.mp4`
|
||||
|
||||
- Remux MKV video to MP4 without re-encoding audio or video streams:
|
||||
|
||||
`ffmpeg -i {{path/to/input_video}}.mkv -codec copy {{path/to/output_video}}.mp4`
|
||||
`ffmpeg -i {{path/to/input_video}}.mkv {{[-c|-codec]}} copy {{path/to/output_video}}.mp4`
|
||||
|
||||
- Convert MP4 video to VP9 codec. For the best quality, use a CRF value (recommended range 15-35) and -b:v MUST be 0:
|
||||
|
||||
`ffmpeg -i {{path/to/input_video}}.mp4 -codec:v libvpx-vp9 -crf {{30}} -b:v 0 -codec:a libopus -vbr on -threads {{number_of_threads}} {{path/to/output_video}}.webm`
|
||||
`ffmpeg -i {{path/to/input_video}}.mp4 {{[-c|-codec]}}:v libvpx-vp9 -crf {{30}} -b:v 0 {{[-c|-codec]}}:a libopus -vbr on -threads {{number_of_threads}} {{path/to/output_video}}.webm`
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
- Create a symbolic link to a file or directory:
|
||||
|
||||
`ln -s {{/path/to/file_or_directory}} {{path/to/symlink}}`
|
||||
`ln {{[-s|--symbolic]}} {{/path/to/file_or_directory}} {{path/to/symlink}}`
|
||||
|
||||
- Overwrite an existing symbolic link to point to a different file:
|
||||
|
||||
`ln -sf {{/path/to/new_file}} {{path/to/symlink}}`
|
||||
`ln {{[-sf|--symbolic --force]}} {{/path/to/new_file}} {{path/to/symlink}}`
|
||||
|
||||
- Create a hard link to a file:
|
||||
|
||||
|
|
|
@ -7,30 +7,30 @@
|
|||
|
||||
`ls -1`
|
||||
|
||||
- List [a]ll files, including hidden files:
|
||||
- List all files, including hidden files:
|
||||
|
||||
`ls -a`
|
||||
`ls {{[-a|--all]}}`
|
||||
|
||||
- List files with a trailing symbol to indicate file type (directory/, symbolic_link@, executable*, ...):
|
||||
|
||||
`ls -F`
|
||||
`ls {{[-F|--classify]}}`
|
||||
|
||||
- List [a]ll files in [l]ong format (permissions, ownership, size, and modification date):
|
||||
- List all files in [l]ong format (permissions, ownership, size, and modification date):
|
||||
|
||||
`ls -la`
|
||||
`ls {{[-la|--all -l]}}`
|
||||
|
||||
- List files in [l]ong format with size displayed using [h]uman-readable units (KiB, MiB, GiB):
|
||||
- List files in [l]ong format with size displayed using human-readable units (KiB, MiB, GiB):
|
||||
|
||||
`ls -lh`
|
||||
`ls {{[-lh|-l --human-readable]}}`
|
||||
|
||||
- List files in [l]ong format, sorted by [S]ize (descending) [R]ecursively:
|
||||
- List files in [l]ong format, sorted by [S]ize (descending) recursively:
|
||||
|
||||
`ls -lSR`
|
||||
`ls {{-lSR|-lS --recursive}}`
|
||||
|
||||
- List files in [l]ong format, sorted by [t]ime the file was modified and in [r]everse order (oldest first):
|
||||
- List files in [l]ong format, sorted by [t]ime the file was modified and in reverse order (oldest first):
|
||||
|
||||
`ls -ltr`
|
||||
`ls {{[-ltr|-lt --reverse]}}`
|
||||
|
||||
- Only list [d]irectories:
|
||||
- Only list directories:
|
||||
|
||||
`ls -d */`
|
||||
`ls {{[-d|--directory]}} */`
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
- Start the editor without using configuration files:
|
||||
|
||||
`nano --ignorercfiles`
|
||||
`nano {{[-I|--ignorercfiles]}}`
|
||||
|
||||
- Open specific files, moving to the next file when closing the previous one:
|
||||
|
||||
|
@ -21,12 +21,16 @@
|
|||
|
||||
- Open a file and enable soft wrapping:
|
||||
|
||||
`nano --softwrap {{path/to/file}}`
|
||||
`nano {{[-S|--softwrap]}} {{path/to/file}}`
|
||||
|
||||
- Open a file and indent new lines to the previous line's indentation:
|
||||
|
||||
`nano --autoindent {{path/to/file}}`
|
||||
`nano {{[-i|--autoindent]}} {{path/to/file}}`
|
||||
|
||||
- Open a file and create a backup file (`path/to/file~`) on save:
|
||||
|
||||
`nano --backup {{path/to/file}}`
|
||||
`nano {{[-B|--backup]}} {{path/to/file}}`
|
||||
|
||||
- Exit nano:
|
||||
|
||||
`<Ctrl x>`
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
- Search for processes including their command-line options:
|
||||
|
||||
`pgrep --full "{{process_name}} {{parameter}}"`
|
||||
`pgrep {{[-f|--full]}} "{{process_name}} {{parameter}}"`
|
||||
|
||||
- Search for processes run by a specific user:
|
||||
|
||||
`pgrep --euid root {{process_name}}`
|
||||
`pgrep {{[-u|--euid]}} root {{process_name}}`
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
- Kill all processes which match their full command instead of just the process name:
|
||||
|
||||
`pkill -f "{{command_name}}"`
|
||||
`pkill {{[-f|--full]}} "{{command_name}}"`
|
||||
|
||||
- Force kill matching processes (can't be blocked):
|
||||
|
||||
|
@ -22,4 +22,4 @@
|
|||
|
||||
- Kill the main `firefox` process to close the browser:
|
||||
|
||||
`pkill --oldest "{{firefox}}"`
|
||||
`pkill {{[-o|--oldest]}} "{{firefox}}"`
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
|
||||
- Print the current directory, and resolve all symlinks (i.e. show the "physical" path):
|
||||
|
||||
`pwd -P`
|
||||
`pwd {{[-P|--physical]}}`
|
||||
|
|
|
@ -9,28 +9,28 @@
|
|||
|
||||
- Sort a file in descending order:
|
||||
|
||||
`sort --reverse {{path/to/file}}`
|
||||
`sort {{[-r|--reverse]}} {{path/to/file}}`
|
||||
|
||||
- Sort a file in case-insensitive way:
|
||||
|
||||
`sort --ignore-case {{path/to/file}}`
|
||||
`sort {{-f|--ignore-case}} {{path/to/file}}`
|
||||
|
||||
- Sort a file using numeric rather than alphabetic order:
|
||||
|
||||
`sort --numeric-sort {{path/to/file}}`
|
||||
`sort {{[-n|--numeric-sort]}} {{path/to/file}}`
|
||||
|
||||
- Sort `/etc/passwd` by the 3rd field of each line numerically, using ":" as a field separator:
|
||||
|
||||
`sort --field-separator={{:}} --key={{3n}} {{/etc/passwd}}`
|
||||
`sort {{[-t|--field-separator]}} {{:}} {{[-k|--key]}} {{3n}} {{/etc/passwd}}`
|
||||
|
||||
- As above, but when items in the 3rd field are equal, sort by the 4th field by numbers with exponents:
|
||||
|
||||
`sort -t {{:}} -k {{3,3n}} -k {{4,4g}} {{/etc/passwd}}`
|
||||
`sort {{[-t|--field-separator]}} {{:}} {{[-k|--key]}} {{3,3n}} {{[-k|--key]}} {{4,4g}} {{/etc/passwd}}`
|
||||
|
||||
- Sort a file preserving only unique lines:
|
||||
|
||||
`sort --unique {{path/to/file}}`
|
||||
`sort {{[-u|--unique]}} {{path/to/file}}`
|
||||
|
||||
- Sort a file, printing the output to the specified output file (can be used to sort a file in-place):
|
||||
|
||||
`sort --output={{path/to/file}} {{path/to/file}}`
|
||||
`sort {{[-o|--output]}} {{path/to/file}} {{path/to/file}}`
|
||||
|
|
|
@ -6,24 +6,24 @@
|
|||
|
||||
- Show last 'count' lines in file:
|
||||
|
||||
`tail --lines {{count}} {{path/to/file}}`
|
||||
`tail {{[-n|--lines]}} {{count}} {{path/to/file}}`
|
||||
|
||||
- Print a file from a specific line number:
|
||||
|
||||
`tail --lines +{{count}} {{path/to/file}}`
|
||||
`tail {{[-n|--lines]}} +{{count}} {{path/to/file}}`
|
||||
|
||||
- Print a specific count of bytes from the end of a given file:
|
||||
|
||||
`tail --bytes {{count}} {{path/to/file}}`
|
||||
`tail {{[-c|--bytes]}} {{count}} {{path/to/file}}`
|
||||
|
||||
- Print the last lines of a given file and keep reading it until `<Ctrl c>`:
|
||||
|
||||
`tail --follow {{path/to/file}}`
|
||||
`tail {{[-f|--follow]}} {{path/to/file}}`
|
||||
|
||||
- Keep reading file until `<Ctrl c>`, even if the file is inaccessible:
|
||||
|
||||
`tail --retry --follow {{path/to/file}}`
|
||||
`tail --retry {{[-f|--follow]}} {{path/to/file}}`
|
||||
|
||||
- Show last 'num' lines in 'file' and refresh every 'n' seconds:
|
||||
|
||||
`tail --lines {{count}} --sleep-interval {{seconds}} --follow {{path/to/file}}`
|
||||
`tail {{[-n|--lines]}} {{count}} {{[-s|--sleep-interval]}} {{seconds}} {{[-f|--follow]}} {{path/to/file}}`
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
- Append to the given files, do not overwrite:
|
||||
|
||||
`echo "example" | tee -a {{path/to/file}}`
|
||||
`echo "example" | tee {{[-a|--append]}} {{path/to/file}}`
|
||||
|
||||
- Print `stdin` to the terminal, and also pipe it into another program for further processing:
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
|
||||
`touch {{path/to/file1 path/to/file2 ...}}`
|
||||
|
||||
- Set the file [a]ccess or [m]odification times to the current one and don't [c]reate file if it doesn't exist:
|
||||
- Set the file [a]ccess or [m]odification times to the current one and don't create file if it doesn't exist:
|
||||
|
||||
`touch -c -{{a|m}} {{path/to/file1 path/to/file2 ...}}`
|
||||
`touch {{[-c|--no-create]}} -{{a|m}} {{path/to/file1 path/to/file2 ...}}`
|
||||
|
||||
- Set the file [t]ime to a specific value and don't [c]reate file if it doesn't exist:
|
||||
- Set the file [t]ime to a specific value and don't create file if it doesn't exist:
|
||||
|
||||
`touch -c -t {{YYYYMMDDHHMM.SS}} {{path/to/file1 path/to/file2 ...}}`
|
||||
`touch {{[-c|--no-create]}} -t {{YYYYMMDDHHMM.SS}} {{path/to/file1 path/to/file2 ...}}`
|
||||
|
||||
- Set the files' timestamp to the [r]eference file's timestamp, and do not [c]reate the file if it does not exist:
|
||||
- Set the files' timestamp to the reference file's timestamp, and do not create the file if it does not exist:
|
||||
|
||||
`touch -c -r {{path/to/reference_file}} {{path/to/file1 path/to/file2 ...}}`
|
||||
`touch {{[-c|--no-create]}} {{[-r|--reference]}} {{path/to/reference_file}} {{path/to/file1 path/to/file2 ...}}`
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
- Show only the amount of time the system has been booted for:
|
||||
|
||||
`uptime --pretty`
|
||||
`uptime {{[-p|--pretty]}}`
|
||||
|
||||
- Print the date and time the system booted up at:
|
||||
|
||||
`uptime --since`
|
||||
`uptime {{[-s|--since]}}`
|
||||
|
||||
- Display version:
|
||||
|
||||
`uptime --version`
|
||||
`uptime {{[-V|--version]}}`
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
- Re-run a command every 60 seconds:
|
||||
|
||||
`watch --interval {{60}} {{command}}`
|
||||
`watch {{[-n|--interval]}} {{60}} {{command}}`
|
||||
|
||||
- Monitor disk space, highlighting differences as they appear:
|
||||
|
||||
`watch --differences {{df}}`
|
||||
`watch {{[-d|--differences]}} {{df}}`
|
||||
|
||||
- Repeatedly run a pipeline and show the result:
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
|||
|
||||
- Exit `watch` if the visible output changes:
|
||||
|
||||
`watch --chgexit {{lsblk}}`
|
||||
`watch {{[-g|--chgexit]}} {{lsblk}}`
|
||||
|
||||
- Interpret terminal control characters:
|
||||
|
||||
`watch --color {{ls --color=always}}`
|
||||
`watch {{[-c|--color]}} {{ls --color=always}}`
|
||||
|
|
|
@ -10,28 +10,28 @@
|
|||
|
||||
- Download the contents of a URL to a file (named "bar" in this case):
|
||||
|
||||
`wget --output-document {{bar}} {{https://example.com/foo}}`
|
||||
`wget {{[-O|--output-document]}} {{bar}} {{https://example.com/foo}}`
|
||||
|
||||
- Download a single web page and all its resources with 3-second intervals between requests (scripts, stylesheets, images, etc.):
|
||||
|
||||
`wget --page-requisites --convert-links --wait=3 {{https://example.com/somepage.html}}`
|
||||
`wget {{[-p|--page-requisites]}} {{[-k|--convert-links]}} {{[-w|--wait]}} 3 {{https://example.com/somepage.html}}`
|
||||
|
||||
- Download all listed files within a directory and its sub-directories (does not download embedded page elements):
|
||||
|
||||
`wget --mirror --no-parent {{https://example.com/somepath/}}`
|
||||
`wget {{[-m|--mirror]}} {{[-np|--no-parent]}} {{https://example.com/somepath/}}`
|
||||
|
||||
- Limit the download speed and the number of connection retries:
|
||||
|
||||
`wget --limit-rate={{300k}} --tries={{100}} {{https://example.com/somepath/}}`
|
||||
`wget --limit-rate {{300k}} {{[-t|--tries]}} {{100}} {{https://example.com/somepath/}}`
|
||||
|
||||
- Download a file from an HTTP server using Basic Auth (also works for FTP):
|
||||
|
||||
`wget --user={{username}} --password={{password}} {{https://example.com}}`
|
||||
`wget --user {{username}} --password {{password}} {{https://example.com}}`
|
||||
|
||||
- Continue an incomplete download:
|
||||
|
||||
`wget --continue {{https://example.com}}`
|
||||
`wget {{[-c|--continue]}} {{https://example.com}}`
|
||||
|
||||
- Download all URLs stored in a text file to a specific directory:
|
||||
|
||||
`wget --directory-prefix {{path/to/directory}} --input-file {{URLs.txt}}`
|
||||
`wget {{[-P|--directory-prefix]}} {{path/to/directory}} {{[-i|--input-file]}} {{URLs.txt}}`
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
- Display all available information:
|
||||
|
||||
`who -a`
|
||||
`who {{[-a|--all]}}`
|
||||
|
||||
- Display all available information with table headers:
|
||||
|
||||
`who -a -H`
|
||||
`who {{[-aH|--all --heading]}}`
|
||||
|
|
|
@ -13,23 +13,23 @@
|
|||
|
||||
- Recursively copy a directory's contents to another location (if the destination exists, the directory is copied inside it):
|
||||
|
||||
`cp -r {{path/to/source_directory}} {{path/to/target_directory}}`
|
||||
`cp {{[-r|--recursive]}} {{path/to/source_directory}} {{path/to/target_directory}}`
|
||||
|
||||
- Copy a directory recursively, in verbose mode (shows files as they are copied):
|
||||
|
||||
`cp -vr {{path/to/source_directory}} {{path/to/target_directory}}`
|
||||
`cp {{[-vr|--verbose --recursive]}} {{path/to/source_directory}} {{path/to/target_directory}}`
|
||||
|
||||
- Copy multiple files at once to a directory:
|
||||
|
||||
`cp -t {{path/to/destination_directory}} {{path/to/file1 path/to/file2 ...}}`
|
||||
`cp {{[-t|--target-directory]}} {{path/to/destination_directory}} {{path/to/file1 path/to/file2 ...}}`
|
||||
|
||||
- Copy all files with a specific extension to another location, in interactive mode (prompts user before overwriting):
|
||||
|
||||
`cp -i {{*.ext}} {{path/to/target_directory}}`
|
||||
`cp {{[-i|--interactive]}} {{*.ext}} {{path/to/target_directory}}`
|
||||
|
||||
- Follow symbolic links before copying:
|
||||
|
||||
`cp -L {{link}} {{path/to/target_directory}}`
|
||||
`cp {{[-L|--dereference]}} {{link}} {{path/to/target_directory}}`
|
||||
|
||||
- Use the full path of source files, creating any missing intermediate directories when copying:
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
- List all files, including hidden files:
|
||||
|
||||
`dir --all`
|
||||
`dir {{[-a|--all]}}`
|
||||
|
||||
- List files including their author (`-l` is required):
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
|||
|
||||
- List files excluding those that match a specified blob pattern:
|
||||
|
||||
`dir --hide={{pattern}}`
|
||||
`dir --hide {{pattern}}`
|
||||
|
||||
- List subdirectories recursively:
|
||||
|
||||
`dir --recursive`
|
||||
`dir {{[-R|--recursive]}}`
|
||||
|
||||
- Display help:
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
- Display memory in human-readable units:
|
||||
|
||||
`free -h`
|
||||
`free {{[-h|--human]}}`
|
||||
|
||||
- Refresh the output every 2 seconds:
|
||||
|
||||
`free -s {{2}}`
|
||||
`free {{[-s|--seconds]}} {{2}}`
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
- Define group administrators:
|
||||
|
||||
`sudo gpasswd -A {{user1,user2}} {{group}}`
|
||||
`sudo gpasswd {{[-A|--administrators]}} {{user1,user2}} {{group}}`
|
||||
|
||||
- Set the list of group members:
|
||||
|
||||
`sudo gpasswd -M {{user1,user2}} {{group}}`
|
||||
`sudo gpasswd {{[-M|--members]}} {{user1,user2}} {{group}}`
|
||||
|
||||
- Create a password for the named group:
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
|||
|
||||
- Add a user to the named group:
|
||||
|
||||
`gpasswd -a {{user}} {{group}}`
|
||||
`gpasswd {{[-a|--add]}} {{user}} {{group}}`
|
||||
|
||||
- Remove a user from the named group:
|
||||
|
||||
`gpasswd -d {{user}} {{group}}`
|
||||
`gpasswd {{[-d|--delete]}} {{user}} {{group}}`
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
- Create a new system group:
|
||||
|
||||
`sudo groupadd --system {{group_name}}`
|
||||
`sudo groupadd {{[-r|--system]}} {{group_name}}`
|
||||
|
||||
- Create a new group with the specific groupid:
|
||||
|
||||
`sudo groupadd --gid {{id}} {{group_name}}`
|
||||
`sudo groupadd {{[-g|--gid]}} {{id}} {{group_name}}`
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
- Change the group name:
|
||||
|
||||
`sudo groupmod --new-name {{new_group}} {{group_name}}`
|
||||
`sudo groupmod {{[-n|--new-name]}} {{new_group}} {{group_name}}`
|
||||
|
||||
- Change the group ID:
|
||||
|
||||
`sudo groupmod --gid {{new_id}} {{group_name}}`
|
||||
`sudo groupmod {{[-g|--gid]}} {{new_id}} {{group_name}}`
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
|
||||
- Output the first few lines of a file:
|
||||
|
||||
`head --lines {{count}} {{path/to/file}}`
|
||||
`head {{[-n|--lines]}} {{count}} {{path/to/file}}`
|
||||
|
||||
- Output the first few bytes of a file:
|
||||
|
||||
`head --bytes {{count}} {{path/to/file}}`
|
||||
`head {{[-c|--bytes]}} {{count}} {{path/to/file}}`
|
||||
|
||||
- Output everything but the last few lines of a file:
|
||||
|
||||
`head --lines -{{count}} {{path/to/file}}`
|
||||
`head {{[-n|--lines]}} -{{count}} {{path/to/file}}`
|
||||
|
||||
- Output everything but the last few bytes of a file:
|
||||
|
||||
`head --bytes -{{count}} {{path/to/file}}`
|
||||
`head {{[-c|--bytes]}} -{{count}} {{path/to/file}}`
|
||||
|
|
|
@ -9,28 +9,28 @@
|
|||
|
||||
- Also list empty devices:
|
||||
|
||||
`lsblk -a`
|
||||
`lsblk {{[-a|--all]}}`
|
||||
|
||||
- Print the SIZE column in bytes rather than in a human-readable format:
|
||||
|
||||
`lsblk -b`
|
||||
`lsblk {{[-b|--bytes]}}`
|
||||
|
||||
- Output info about filesystems:
|
||||
|
||||
`lsblk -f`
|
||||
`lsblk {{[-f|--fs]}}`
|
||||
|
||||
- Use ASCII characters for tree formatting:
|
||||
|
||||
`lsblk -i`
|
||||
`lsblk {{[-i|--ascii]}}`
|
||||
|
||||
- Output info about block-device topology:
|
||||
|
||||
`lsblk -t`
|
||||
`lsblk {{[-t|--topology]}}`
|
||||
|
||||
- Exclude the devices specified by the comma-separated list of major device numbers:
|
||||
|
||||
`lsblk -e {{1,7,...}}`
|
||||
`lsblk {{[-e|--exclude]}} {{1,7,...}}`
|
||||
|
||||
- Display a customized summary using a comma-separated list of columns:
|
||||
|
||||
`lsblk --output {{NAME,SERIAL,MODEL,TRAN,TYPE,SIZE,FSTYPE,MOUNTPOINT,...}}`
|
||||
`lsblk {{[-o|--output]}} {{NAME,SERIAL,MODEL,TRAN,TYPE,SIZE,FSTYPE,MOUNTPOINT,...}}`
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
- Display information in a table:
|
||||
|
||||
`lscpu --extended`
|
||||
`lscpu {{[-e|--extended]}}`
|
||||
|
||||
- Display only information about offline CPUs in a table:
|
||||
|
||||
`lscpu --extended --offline`
|
||||
`lscpu {{[-e|--extended]}} {{[-c|--offline]}}`
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
|
||||
- List the USB hierarchy as a tree:
|
||||
|
||||
`lsusb -t`
|
||||
`lsusb {{[-t|--tree]}}`
|
||||
|
||||
- List verbose information about USB devices:
|
||||
|
||||
`lsusb --verbose`
|
||||
`lsusb {{[-V|--verbose]}}`
|
||||
|
||||
- List detailed information about a USB device:
|
||||
|
||||
`lsusb --verbose -s {{bus}}:{{device number}}`
|
||||
`lsusb {{[-V|--verbose]}} -s {{bus}}:{{device number}}`
|
||||
|
||||
- List devices with a specified vendor and product ID only:
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
|
||||
- Create a container interactively in `/var/lib/lxc/`:
|
||||
|
||||
`sudo lxc-create --name {{container}} --template download`
|
||||
`sudo lxc-create {{[-n|--name]}} {{container}} {{[-t|--template]}} download`
|
||||
|
||||
- Create a container in a target directory:
|
||||
|
||||
`sudo lxc-create --lxcpath {{/path/to/directory/}} --name {{container}} --template download`
|
||||
`sudo lxc-create {{[-P|--lxcpath]}} {{/path/to/directory/}} {{[-n|--name]}} {{container}} {{[-t|--template]}} download`
|
||||
|
||||
- Create a container passing options to a template:
|
||||
|
||||
`sudo lxc-create --name {{name}} --template download -- --dist {{distro-name}} --release {{release-version}} --arch {{arch}}`
|
||||
`sudo lxc-create {{[-n|--name]}} {{name}} {{[-t|--template]}} download -- {{[-d|--dist]}} {{distro-name}} {{[-r|--release]}} {{release-version}} {{[-a|--arch]}} {{arch}}`
|
||||
|
|
|
@ -21,4 +21,4 @@
|
|||
|
||||
- List containers in a fancy, column-based output:
|
||||
|
||||
`sudo lxc-ls --fancy`
|
||||
`sudo lxc-ls {{[-f|--fancy]}}`
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
- Shut down immediately without contacting the system manager:
|
||||
|
||||
`poweroff --force`
|
||||
`poweroff {{[-f|--force]}}`
|
||||
|
||||
- Write the wtmp shutdown entry without shutting down the system:
|
||||
|
||||
`poweroff --wtmp-only`
|
||||
`poweroff {{[-w|--wtmp-only]}}`
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
|
||||
- Dry-run - display which renames would occur without performing them:
|
||||
|
||||
`rename -vn {{foo}} {{bar}} {{*}}`
|
||||
`rename {{[-vn|--verbose --no-act]}} {{foo}} {{bar}} {{*}}`
|
||||
|
||||
- Do not overwrite existing files:
|
||||
|
||||
`rename -o {{foo}} {{bar}} {{*}}`
|
||||
`rename {{[-o|--no-overwrite]}} {{foo}} {{bar}} {{*}}`
|
||||
|
||||
- Change file extensions:
|
||||
|
||||
|
|
|
@ -10,24 +10,24 @@
|
|||
|
||||
- Replace all `apple` (extended regex) occurrences with `APPLE` (extended regex) in all input lines and print the result to `stdout`:
|
||||
|
||||
`{{command}} | sed -E 's/(apple)/\U\1/g'`
|
||||
`{{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:
|
||||
|
||||
`sed -i 's/apple/mango/g' {{path/to/file}}`
|
||||
`sed {{[-i|--in-place]}} 's/apple/mango/g' {{path/to/file}}`
|
||||
|
||||
- Execute a specific script [f]ile and print the result to `stdout`:
|
||||
- Execute a specific script file and print the result to `stdout`:
|
||||
|
||||
`{{command}} | sed -f {{path/to/script.sed}}`
|
||||
`{{command}} | sed {{-f|--file}} {{path/to/script.sed}}`
|
||||
|
||||
- Print just the first line to `stdout`:
|
||||
|
||||
`{{command}} | sed -n '1p'`
|
||||
`{{command}} | sed {{[-n|--quiet]}} '1p'`
|
||||
|
||||
- [d]elete the first line of a file:
|
||||
|
||||
`sed -i 1d {{path/to/file}}`
|
||||
`sed {{[-i|--in-place]}} 1d {{path/to/file}}`
|
||||
|
||||
- [i]nsert a new line at the first line of a file:
|
||||
|
||||
`sed -i '1i\your new line text\' {{path/to/file}}`
|
||||
`sed {{[-i|--in-place]}} '1i\your new line text\' {{path/to/file}}`
|
||||
|
|
|
@ -9,23 +9,23 @@
|
|||
|
||||
- Do not show any idle or zombie processes:
|
||||
|
||||
`top -i`
|
||||
`top {{[-i|--idle-toggle]}}`
|
||||
|
||||
- Show only processes owned by given user:
|
||||
|
||||
`top -u {{username}}`
|
||||
`top {{[-u|--filter-only-euser]}} {{username}}`
|
||||
|
||||
- Sort processes by a field:
|
||||
|
||||
`top -o {{field_name}}`
|
||||
`top {{[-o|--sort-override]}} {{field_name}}`
|
||||
|
||||
- Show the individual threads of a given process:
|
||||
|
||||
`top -Hp {{process_id}}`
|
||||
`top {{[-Hp|--threads-show --pid]}} {{process_id}}`
|
||||
|
||||
- Show only the processes with the given PID(s), passed as a comma-separated list. (Normally you wouldn't know PIDs off hand. This example picks the PIDs from the process name):
|
||||
|
||||
`top -p $(pgrep -d ',' {{process_name}})`
|
||||
`top {{[-p|--pid]}} $(pgrep {{[-d|--delimiter]}} ',' {{process_name}})`
|
||||
|
||||
- Display help about interactive commands:
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
|
||||
- When an unmount fails, try to remount the filesystem read-only:
|
||||
|
||||
`umount --read-only {{path/to/mounted_directory}}`
|
||||
`umount {{[-r|--read-only]}} {{path/to/mounted_directory}}`
|
||||
|
||||
- Recursively unmount each specified directory:
|
||||
|
||||
`umount --recursive {{path/to/mounted_directory}}`
|
||||
`umount {{[-R|--recursive]}} {{path/to/mounted_directory}}`
|
||||
|
||||
- Unmount all mounted filesystems (except the `proc` filesystem):
|
||||
|
||||
`umount -a`
|
||||
`umount {{[-a|--all]}}`
|
||||
|
|
|
@ -6,28 +6,28 @@
|
|||
|
||||
- Add files/directories to a specific archive:
|
||||
|
||||
`zip -r {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
`zip {{[-r|--recurse-paths}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
|
||||
- Remove files/directories from a specific archive:
|
||||
|
||||
`zip --delete {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
`zip {{[-d|--delete]}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
|
||||
- Archive files/directories e[x]cluding specified ones:
|
||||
- Archive files/directories excluding specified ones:
|
||||
|
||||
`zip {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}} --exclude {{path/to/excluded_files_or_directories}}`
|
||||
`zip {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}} {{-x|--exclude}} {{path/to/excluded_files_or_directories}}`
|
||||
|
||||
- Archive files/directories with a specific compression level (`0` - the lowest, `9` - the highest):
|
||||
|
||||
`zip -r -{{0..9}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
`zip {{[-r|--recurse-paths]}} -{{0..9}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
|
||||
- Create an encrypted archive with a specific password:
|
||||
|
||||
`zip -r --encrypt {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
`zip {{[-r|--recurse-paths]}} {{[-e|--encrypt]}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
|
||||
- Archive files/directories to a multi-part [s]plit Zip archive (e.g. 3 GB parts):
|
||||
|
||||
`zip -r -s {{3g}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
`zip {{[-r|--recurse-paths]}} {{[-s|--split-size]}} {{3g}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
||||
|
||||
- Print a specific archive contents:
|
||||
|
||||
`zip -sf {{path/to/compressed.zip}}`
|
||||
`zip {{[-sf|--split-size --freshen]}} {{path/to/compressed.zip}}`
|
||||
|
|
Loading…
Add table
Reference in a new issue