coreutils commands: move pages to common/ folder (#2442)

This commit is contained in:
Felix Yan
2018-10-17 01:29:50 +08:00
committed by Starbeamrainbowlabs
parent 9ef7ec119a
commit 72b4f22ff9
36 changed files with 4 additions and 23 deletions

View File

@@ -1,19 +0,0 @@
# b2sum
> Calculate BLAKE2 cryptographic checksums.
- Calculate the BLAKE2 checksum for a file:
`b2sum {{filename1}}`
- Calculate BLAKE2 checksums for multiple files:
`b2sum {{filename1}} {{filename2}}`
- Read a file of BLAKE2 sums and filenames and verify all files have matching checksums:
`b2sum -c {{filename.b2}}`
- Calculate the BLAKE2 checksum from stdin:
`{{somecommand}} | shasum`

View File

@@ -1,11 +0,0 @@
# chroot
> Run command or interactive shell with special root directory.
- Run command as new root directory:
`chroot {{/path/to/new/root}} {{command}}`
- Specify user and group (ID or name) to use:
`chroot --userspec={{user:group}}`

View File

@@ -1,19 +0,0 @@
# date
> Set or display the system date.
- Display the current date using the default locale's format:
`date +"%c"`
- Display the current date in UTC and ISO 8601 format:
`date -u +"%Y-%m-%dT%H:%M:%SZ"`
- Display the current date as a Unix timestamp (seconds since the Unix epoch):
`date +%s`
- Display a specific date (represented as a Unix timestamp) using the default format:
`date -d @1473305798`

View File

@@ -1,23 +0,0 @@
# dd
> Convert and copy a file.
- Make a bootable usb drive from an isohybrid file (such like archlinux-xxx.iso) and show the progress:
`dd if={{file.iso}} of=/dev/{{usb_drive}} status=progress`
- Clone a drive to another drive with 4MB block, ignore error and show progress:
`dd if=/dev/{{source_drive}} of=/dev/{{dest_drive}} bs=4M conv=noerror status=progress`
- Generate a file of 100 random bytes by using kernel random driver:
`dd if=/dev/urandom of={{random_file}} bs=100 count=1`
- Benchmark the write performance of a disk:
`dd if=/dev/zero of={{file_1GB}} bs=1024 count=1000000`
- Check progress of an ongoing dd operation (Run this command from another shell):
`kill -USR1 $(pgrep ^dd)`

View File

@@ -1,23 +0,0 @@
# dircolors
> Output commands to set the LS_COLOR environment variable and style `ls`, `dir`, etc.
- Output commands to set LS_COLOR using default colors:
`dircolors`
- Output commands to set LS_COLOR using colors from a file:
`dircolors {{file}}`
- Output commands for Bourne shell:
`dircolors --bourne-shell`
- Output commands for C shell:
`dircolors --c-shell`
- View the default colors for file types and extensions:
`dircolors --print-data`

View File

@@ -1,15 +0,0 @@
# dirname
> Calculates the parent directory of a given file or directory path.
- Calculate the parent directory of a given path:
`dirname {{path/to/file_or_directory}}`
- Calculate the parent directory of multiple paths:
`dirname {{path/to/file_a}} {{path/to/directory_b}}`
- Delimit output with a NUL character instead of a newline (useful when combining with `xargs`):
`dirname --zero {{path/to/directory_a}} {{path/to/file_b}}`

View File

@@ -1,27 +0,0 @@
# du
> Disk usage: estimate and summarize file and folder space usage.
- List the sizes of a folder and any subfolders, in the given unit (B/KB/MB):
`du -{{b|k|m}} {{path/to/folder}}`
- List the sizes of a folder and any subfolders, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
`du -h {{path/to/folder}}`
- Show the size of a single folder, in human readable units:
`du -sh {{path/to/folder}}`
- List the human-readable sizes of a folder and of all the files and folders within it:
`du -ah {{path/to/folder}}`
- List the human-readable sizes of a folder and any subfolders, up to N levels deep:
`du -h --max-depth=N {{path/to/folder}}`
- List the human-readable size of all .jpg files in subfolders of the current folder, and show a cumulative total at the end:
`du -ch */*.jpg`

View File

@@ -1,23 +0,0 @@
# expand
> Convert tabs to spaces.
- Convert tabs in each file to spaces, writing to standard output:
`expand {{file}}`
- Convert tabs to spaces, reading from standard input:
`expand`
- Do not convert tabs after non blanks:
`expand -i {{file}}`
- Have tabs a certain number of characters apart, not 8:
`expand -t={{number}} {{file}}`
- Use comma separated list of explicit tab positions:
`expand -t={{list}}`

View File

@@ -1,23 +0,0 @@
# expr
> Evaluate expressions and manipulate strings.
- Get string length:
`expr length {{string}}`
- Evaluate logical or math expression with an operator ('+', '-', '*', '&', '|', etc.). Special symbols should be escaped:
`expr {{first_argument}} {{operator}} {{second_argument}}`
- Get position of the first character in 'string' that matches 'substring':
`echo $(expr index {{string}} {{substring}})`
- Extract part of the string:
`echo $(expr substr {{string}} {{position_to_start}} {{number_of_characters}}`
- Extract part of the string which matches a regular expression:
`echo $(expr {{string}} : '\({{regular_expression}}\)')`

View File

@@ -1,11 +0,0 @@
# factor
> Prints the prime factorization of a number.
- Display the prime-factorization of a number:
`factor {{number}}`
- Take the input from stdin if no argument is specified:
`echo {{number}} | factor`

View File

@@ -1,19 +0,0 @@
# head
> Output the first part of files.
- Output the first few lines of a file:
`head -n {{count_of_lines}} {{filename}}`
- Output the first few bytes of a file:
`head -c {{size_in_bytes}} {{filename}}`
- Output everything but the last few lines of a file:
`head -n -{{count_of_lines}} {{filename}}`
- Output everything but the last few bytes of a file:
`head -c -{{size_in_bytes}} {{filename}}`

View File

@@ -1,7 +0,0 @@
# hostid
> Prints the numeric identifier for the current host (not necessarily the IP address).
- Display the numeric identifier for the current host in hexadecimal:
`hostid`

View File

@@ -1,8 +0,0 @@
# link
> Create a hard link to an existing file.
> For more options, see the `ln` command.
- Create a hard link from a new file to an existing file:
`link {{path/to/existing_file}} {{path/to/new_file}}`

View File

@@ -1,7 +0,0 @@
# logname
> Shows the user's login name.
- Display the currently logged in user's name:
`logname`

View File

@@ -1,15 +0,0 @@
# md5sum
> Calculate MD5 cryptographic checksums.
- Calculate the MD5 checksum for a file:
`md5sum {{filename1}}`
- Calculate MD5 checksums for multiple files:
`md5sum {{filename1}} {{filename2}}`
- Read a file of MD5SUMs and verify all files have matching checksums:
`md5sum -c {{filename.md5}}`

View File

@@ -1,23 +0,0 @@
# nl
> A utility for numbering lines, either from a file, or from standard input.
- Number non-blank lines in a file:
`nl {{file}}`
- Read from standard output:
`cat {{file}} | nl {{options}} -`
- Number only the lines with printable text:
`nl -t {{file}}`
- Number all lines including blank lines:
`nl -b a {{file}}`
- Number only the body lines that match a basic regular expression (BRE) pattern:
`nl -b p'FooBar[0-9]' {{file}}`

View File

@@ -1,15 +0,0 @@
# nproc
> Print the number of processing units (normally CPUs) available.
- Display the number of available processing units:
`nproc`
- Display the number of installed processing units, including any inactive ones:
`nproc --all`
- If possible, subtract a given number of units from the returned value:
`nproc --ignore {{count}}`

View File

@@ -1,15 +0,0 @@
# numfmt
> Convert numbers to and from human-readable strings.
- Convert 1.5K (SI Units) to 1500:
`numfmt --from={{si}} {{1.5K}}`
- Convert 5th field (1-indexed) to IEC Units without converting header:
`ls -l | numfmt --header={{1}} --field={{5}} --to={{iec}}`
- Convert to IEC units, pad with 5 characters, left aligned:
`du -s * | numfmt --to={{iec}} --format={{"%-5f"}}`

View File

@@ -1,27 +0,0 @@
# pinky
> Print user information using the `finger` protocol.
- Display details about the current user:
`pinky`
- Display details for a specific user:
`pinky {{user}}`
- Display details in the long format:
`pinky {{user}} -l`
- Omit the user's home directory and shell in long format:
`pinky {{user}} -lb`
- Omit the user's project file in long format:
`pinky {{user}} -lh`
- Omit the column headings in short format:
`pinky {{user}} -f`

View File

@@ -1,15 +0,0 @@
# printenv
> Print values of all or specific environment variables.
- Display key-value pairs of all environment variables:
`printenv`
- Display the value of a specific variable:
`printenv {{HOME}}`
- Display the value of a variable and end with NUL instead of newline:
`printenv --null {{HOME}}`

View File

@@ -1,23 +0,0 @@
# realpath
> Display the resolved absolute path for a file or directory.
- Display the absolute path for a file or directory:
`realpath {{path/to/file_or_directory}}`
- Require all path components to exist:
`realpath --canonicalize-existing {{path/to/file_or_directory}}`
- Resolve ".." components before symlinks:
`realpath --logical {{path/to/file_or_directory}}`
- Disable symlink expansion:
`realpath --no-symlinks {{path/to/file_or_directory}}`
- Suppress error messages:
`realpath --quiet {{path/to/file_or_directory}}`

View File

@@ -1,15 +0,0 @@
# sha1sum
> Calculate SHA1 cryptographic checksums.
- Calculate the SHA1 checksum for a file:
`sha1sum {{filename1}}`
- Calculate SHA1 checksums for multiple files:
`sha1sum {{filename1}} {{filename2}}`
- Read a file of SHA1 sums and verify all files have matching checksums:
`sha1sum -c {{filename.sha1}}`

View File

@@ -1,15 +0,0 @@
# sha224sum
> Calculate SHA224 cryptographic checksums.
- Calculate the SHA224 checksum for a file:
`sha224sum {{filename1}}`
- Calculate SHA224 checksums for multiple files:
`sha224sum {{filename1}} {{filename2}}`
- Read a file of SHA224 sums and verify all files have matching checksums:
`sha224sum -c {{filename.sha224}}`

View File

@@ -1,15 +0,0 @@
# sha256sum
> Calculate SHA256 cryptographic checksums.
- Calculate the SHA256 checksum for a file:
`sha256sum {{filename1}}`
- Calculate SHA256 checksums for multiple files:
`sha256sum {{filename1}} {{filename2}}`
- Read a file of SHA256 sums and verify all files have matching checksums:
`sha256sum -c {{filename.sha256}}`

View File

@@ -1,15 +0,0 @@
# sha384sum
> Calculate SHA384 cryptographic checksums.
- Calculate the SHA384 checksum for a file:
`sha384sum {{filename1}}`
- Calculate SHA384 checksums for multiple files:
`sha384sum {{filename1}} {{filename2}}`
- Read a file of SHA384 sums and verify all files have matching checksums:
`sha384sum -c {{filename.sha384}}`

View File

@@ -1,15 +0,0 @@
# sha512sum
> Calculate SHA512 cryptographic checksums.
- Calculate the SHA512 checksum for a file:
`sha512sum {{filename1}}`
- Calculate SHA512 checksums for multiple files:
`sha512sum {{filename1}} {{filename2}}`
- Read a file of SHA512 sums and verify all files have matching checksums:
`sha512sum -c {{filename.sha512}}`

View File

@@ -1,19 +0,0 @@
# shuf
> Generate random permutations.
- Randomize the order of lines in a file and output the result:
`shuf {{filename}}`
- Only output the first 5 entries of the result:
`shuf -n {{5}} {{filename}}`
- Write the output to another file:
`shuf {{filename}} -o {{output_filename}}`
- Generate random numbers in range:
`shuf -i {{1-10}}`

View File

@@ -1,23 +0,0 @@
# sort
> Sort lines of text files.
- Sort a file in ascending order:
`sort {{filename}}`
- Sort a file in descending order:
`sort -r {{filename}}`
- Sort a file using numeric rather than alphabetic order:
`sort -n {{filename}}`
- Sort the passwd file by the 3rd field, numerically:
`sort -t: -k 3n /etc/passwd`
- Sort human-readable numbers (in this case the 5th field of `ls -lh`):
`ls -lh | sort -h -k 5`

View File

@@ -1,27 +0,0 @@
# stat
> Display file and filesystem information.
- Show file properties such as size, permissions, creation and access dates among others:
`stat {{file}}`
- Same as above but in a more concise way:
`stat -t {{file}}`
- Show filesystem information:
`stat -f {{file}}`
- Show only octal file permissions:
`stat -c "%a %n" {{file}}`
- Show owner and group of the file:
`stat -c "%U %G" {{file}}`
- Show the size of the file in bytes:
`stat -c "%s %n" {{file}}`

View File

@@ -1,23 +0,0 @@
# stty
> Set options for a terminal device interface.
- Display all settings for the current terminal:
`stty -a`
- Set the number of rows:
`stty rows {{rows}}`
- Set the number of columns:
`stty cols {{cols}}`
- Get the actual transfer speed of a device:
`stty -f {{path/to/device_file}} speed`
- Reset all modes to reasonable values for the current terminal:
`stty sane`

View File

@@ -1,11 +0,0 @@
# timeout
> Run a command with a time limit.
- Run `sleep 10` and kill it, if it's running after 3 seconds:
`timeout {{3s}} {{sleep 10}}`
- Specify the signal to be sent to the command after the time limit expires. (By default, TERM is sent):
`timeout --signal {{INT}} {{5s}} {{sleep 10}}`

View File

@@ -1,15 +0,0 @@
# truncate
> Shrink or extend the size of a file to the specified size.
- Set a size of 10 GB to an exsting file, or create a new file with the specified size:
`truncate -s {{10G}} {{filename}}`
- Extend the file size by 50M, fill with holes (which reads as zero bytes):
`truncate -s +{{50M}} {{filename}}`
- Shrink the file by 2GiB, by removing data from the end of file:
`truncate -s -{{2G}} {{filename}`

View File

@@ -1,20 +0,0 @@
# uname
> Print details about the current machine and the operating system running on it.
> Note: for additional information about the operating system, try the `lsb_release` command.
- Print hardware-related information: machine and processor:
`uname -mp`
- Print software-related information: operating system, release number, and version:
`uname -srv`
- Print the nodename (hostname) of the system:
`uname -n`
- Print all available system information (hardware, software, nodename):
`uname -a`

View File

@@ -1,23 +0,0 @@
# unexpand
> Convert spaces to tabs.
- Convert blanks in each file to tabs, writing to standard output:
`unexpand {{file}}`
- Convert blanks to tabs, reading from standard output:
`unexpand`
- Convert all blanks, instead of just initial blanks:
`unexpand -a {{file}}`
- Convert only leading sequences of blanks (overrides -a):
`unexpand --first-only {{file}}`
- Have tabs a certain number of characters apart, not 8 (enables -a):
`unexpand -t {{number}} {{file}}`

View File

@@ -1,11 +0,0 @@
# users
> Display a list of logged in users.
- Display a list of logged in users:
`users`
- Display a list of logged in users according to a specific file:
`users {{/var/log/wmtp}}`