Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
|rw||[-afhPstvx] [-b block-size] [-c count] [-I input-offset] [-i input-file] [-O output-offset] [-o output-file] [-p period] [-r input-block-size] [-w output-block-size]|
- Magnitude of a byte (1 byte).
- K, KiB
- Magnitude of kibibytes (1,024 bytes).
- M, MiB
- Magnitude of mebibytes (1,048,576 bytes).
- G, GiB
- Magnitude of gibibytes (1,073,741,824 bytes).
- T, TiB
- Magnitude of tebibytes (1,099,511,627,776 bytes).
- P, PiB
- Magnitude of pebibytes (1,125,899,906,842,624 bytes).
- E, EiB
- Magnitude of exbibytes (1,152,921,504,606,846,976 bytes).
- Magnitude of input blocks (the default input block size when setting block sizes).
- Magnitude of output blocks (the default output block size when setting block sizes
- Magnitude of input and output blocks (if they have the same size) (the default block size when setting block sizes).
- In combination with -o, open the output file in append mode. This option must be used with -o and is incompatible with -t. The output offset is set to the size of the output file.
- -b block-size
- Set both the input and output block sizes to the byte quantity specified by block-size.
- -c count
- Stop after copying the byte quantity specified by count, in addition to stopping when the end of the input is reached. If the count starts with a leading ‘-’, stop that many bytes before the end of the input (only works if the input size is known).
- Continue as much as possible in the event of I/O errors and exit unsuccessfully afterwards. For each input failure, skip forward to the next input block or the next native-size input block or the end of the file (whichever comes first), write an error to the standard error, and replace the failed input with NUL bytes when writing it to the output. For each output failure, skip forward to the next output block or the next native-size output block (whichever comes first) and write an error to the standard error. The native-size input and output blocks are those defined by the preferred input/output size for the input and output. This option only works for the input if it is seekable and the input size is known. This option only works for the output if it is seekable (and -a is not set). Beware that the default preferred input/output sizes may be larger than the underlying storage sector sizes: If this option is used, the -r and -w options should be set to the appropriate input/output sector sizes, or more than just the bad sector may be skipped.
- Write statistics in the human readable format where byte amounts and time amounts are formatted according to their magnitude as described in the DIAGNOSTICS section.
- -I offset
- Skip past the first offset bytes in the input before the copying begins. If the offset starts with a leading ‘-’ it is interpreted as that many bytes before the end of the input (if the size is known), and if it starts with a leading ‘+’ it is interpreted as that many bytes after the end of the input (if the size is known). If the input is not seekable, the first offset bytes are read and discarded before the copying begins. If the offset is not a multiple of the input block size, the first input block is reduced in size such that it ends at an input-block-size-aligned position in the input.
- -i input-file
- Read the input from input-file instead of the standard input.
- -O offset
- Seek past the first offset bytes in the output before the copying begins. If the offset starts with a leading ‘-’ it is interpreted as that many bytes before the end of the output (if the size is known), and if it starts with a leading ‘+’ it is interpreted as that many bytes after the end of the output (if the size is known). If the output is not seekable, the number of NUL bytes specified in offset are written to the output before the copying begins. This option cannot be set to a non-zero value if -a is set. If the offset is not a multiple of the output block size, the first output block is reduced in size such that it ends at a output block size aligned position in the output.
- -o output-file
- Write the output to output-file instead of the standard output, creating the file if it doesn't exist. If output-file already exists, the existing data is not discarded. Use -t if you want to truncate the output afterwards.
- Pad the final output block with NUL bytes, such that the final output offset (counting the initial offset with -O) is a multiple of the output block size.
- -p period
- Write occasional statistics to the standard error during the transfer and on completion, or when being terminated by SIGINT. period specifies the period in whole seconds at which statistics are written out. Statistics are written for every read and write if the period is zero. The format is described in the DIAGNOSTICS section.
- -r input-block-size
- Set the input block size to the byte quantity specified by input-block-size.
- Sync the output on successful completion.
- Truncate the output to the final output position after the copy has completed. This option requires the output to be truncatable. This option is incompatible with -a.
- Write statistics to the standard error upon completion, or when being terminated by SIGINT. The format is described in the DIAGNOSTICS section.
- -w output-block-size
- Set the output block size to the byte quantity specified by output-block-size.
- In combination with -o, fail if the output file already exists.
- If -v or -p is set, abort the copy, write statistics to the standard error, and then exit as if killed by SIGINT.
- Write statistics to the standard error and continue the copy. If SIGUSR1 is not ignored, this handler is installed and this signal is unblocked. To use this signal without a race condition before the signal handler is installed (as SIGUSR1 is deadly by default), block the signal before loading this program. To disable the handling of this signal, ignore the signal before loading this program.
rw -c 256
rw -i foo -o bar
rw -i foo -o bar -t
rw -i foo -o /dev/bar -p 10 -h -s
rw -I 512 -c 1024 -o bar -a
rw -c 2K -i foo -I 768 -o bar -O 256M
rw -r 512 -i /dev/foo -I 32r -c 4r -o bar
rw -b 4096 -c 64x -I 32x -O 65536x
rw -f -i /dev/foo -r 512 -o bar -t -p 10 -h
rw -r 512 -w 8192 -c 16384r -I 65536r -O 1048576w
rw -c 512 -I -1024 -o bar -O +2048
rw -i foo -I 100 -c -200
SIGINT (if not ignored when the program was loaded) if -v is set; and upon SIGUSR1 (if not ignored when the program was loaded).The statistics are in this format:time-elapsed is the number of seconds since the copying began. done is the number of bytes copied so far. total is an estimate of how many bytes will be copied, or ‘?’ if not known. percent is how many percent complete the copy is, or ‘?’ if not known. speed is the average speed of copying so far in bytes per second, or ‘?’ if it is too early to tell. time-left is the number of seconds left, assuming the remaining data is copied at the current average speed, or ‘?’ is not known.For instance, the statistics could look like this:The statistics are printed with human readable byte units (B, KiB, MiB, GiB, TiB, PiB, EiB) and time units (s, m, h, d) if the -h option is set:
<time-elapsed> s <done> B / <total> B <percent>% <speed> B/s <time-left> s
7 s 714682368 B / 1238364160 B 57% 102097481 B/s 5 s
7 s 714.4 MiB / 1.1 GiB 60% 102.0 MiB/s 4 s
- The command line options use the conventional option format.
- The output file is not truncated by default. One has to use -t.
The input and output block sizes default to the preferred I/O block sizes instead of 512 bytes.
- Statistics are not written by default. One has to use -v or -p. The statistics contain more useful information and is machine readable as it contains no localized information. A human readable statistics format is available using -h. Statistics can occasionally be written out using -p.
- There is no support for converting ASCII to EBCDIC, converting ASCII to a different EBCDIC, EBCDIC to ASCII, swapping pairs of bytes, converting the bytes to lower-case or upper-case, converting line-delimited data into fixed-size blocks, or converting fixed-sized blocks into line-delimited data.
- Offsets can be specified relative to the end of the input/output.
- Input errors stop the copying immediately rather than writing out a partial output block.