restructure

This commit is contained in:
JMARyA 2024-01-17 09:00:45 +01:00
parent ef7661245b
commit 598a10bc28
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
182 changed files with 342 additions and 336 deletions

View file

@ -0,0 +1,629 @@
---
obj: application
website: https://www.gnu.org/software/coreutils/
repo: https://git.savannah.gnu.org/git/coreutils.git
wiki: https://en.wikipedia.org/wiki/GNU_Core_Utilities
---
# GNU Core Utils
The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems.
## base64
[base64](../../../files/Base64.md) encode/decode data and print to standard output
Usage: `base64 [OPTION]... [FILE]`
### Flags
| Flag | Description |
| ---------------------- | --------------------------------------------- |
| `-d, --decode` | Decode Input |
| `-i, --ignore-garbage` | when decoding, ignore non-alphabet characters |
## basename
strip directory and suffix from filenames
Usage: `basename NAME`
## cat
concatenate files and print on the standard output
Usage: `cat [OPTION]... [FILE]...`
### Flags
| Flag | Description |
| ----------------------- | -------------------------------------------- |
| `-b, --number-nonblank` | number nonempty output lines, overrides `-n` |
| `-n, --number` | number all output lines |
## chmod
change file mode (permissions) bits
Usage: `chmod [OPTION]... OCTAL-MODE FILE...`
### Options
| Option | Description |
| ----------------------- | ----------------------------------------------------------------------------------------------------- |
| `-c, --changes` | like verbose but report only when a change is made |
| `-f, --silent, --quiet` | suppress most error messages |
| `-v, --verbose` | output a diagnostic for every file processed |
| `--reference=RFILE` | use RFILE's mode instead of specifying MODE values. RFILE is always dereferenced if a symbolic link. |
| `-R, --recursive` | change files and directories recursively | |
## chown
change file owner and group
Usage: `chown [OPTION]... [OWNER][:[GROUP]] FILE...`
### Options
| Option | Description |
| ----------------------- | ----------------------------------------------------------------------------------------------------- |
| `-c, --changes` | like verbose but report only when a change is made |
| `-f, --silent, --quiet` | suppress most error messages |
| `-v, --verbose` | output a diagnostic for every file processed |
| `--reference=RFILE` | use RFILE's owner and group rather than specifying OWNER:GROUP values. RFILE is always dereferenced. |
| `-R, --recursive` | operate on files and directories recursively |
## chroot
run command or interactive shell with special root directory
Usage: `chroot [OPTION] NEWROOT [COMMAND [ARG]...]`
## cksum
compute and verify file checksums
Usage: `cksum [OPTION]... [FILE]...`
### Options
| Option | Description |
| ---------------------- | ----------------------------- |
| `-a, --algorithm=TYPE` | select the digest type to use |
### Digests
- crc
- md5
- sha1
- sha224
- sha256
- sha384
- sha512
- blake2b
## cp
copy files and directories
Usage: `cp [OPTION]... SOURCE DEST`
### Options
| Option | Description |
| ---------------------------------- | --------------------------------------------------------------------------- |
| `-l, --link` | hard link files instead of copying |
| `-R, -r, --recursive` | copy directories recursively |
| `-s, --symbolic-link` | make symbolic links instead of copying |
| `-S, --suffix=SUFFIX` | override the usual backup suffix |
| `-t, --target-directory=DIRECTORY` | copy all SOURCE arguments into DIRECTORY |
| `--update[=UPDATE]` | control which existing files are updated; UPDATE={all,none,older(default)}. |
| `-u` | equivalent to `--update[=older]` |
| `-v, --verbose` | explain what is being done |
| `-x, --one-file-system` | stay on this file system |
| `-b` | Create a backup file if destination already exists |
## cut
remove sections from each line of files
Usage: `cut OPTION... [FILE]...`
### Options
| Option | Description |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `-d, --delimiter=DELIM` | use DELIM instead of TAB for field delimiter |
| `-f, --fields=LIST` | select only these fields; also print any line that contains no delimiter character, unless the `-s` option is specified |
| `-s, --only-delimited` | do not print lines not containing delimiters |
| `--output-delimiter=STRING` | use STRING as the output delimiter the default is to use the input delimiter |
## date
print or set the system date and time
Usage: `date [OPTION]... [+FORMAT]`
### Options
| Option | Description |
| ---------------------- | ------------------------------------------ |
| `-d, --date=STRING` | display time described by STRING |
| `-r, --reference=FILE` | display the last modification time of FILE |
| `-s, --set=STRING` | set time described by STRING |
## dd
convert and copy a file
Usage: `dd [OPERAND]...`
### Operands
| Operand | Description |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bs=BYTES` | read and write up to BYTES bytes at a time (default: 512) |
| `count=N` | copy only N input blocks |
| `if=FILE` | read from FILE instead of stdin |
| `of=FILE` | write to FILE instead of stdout |
| `status=LEVEL` | The LEVEL of information to print to stderr; 'none' suppresses everything but error messages, 'noxfer' suppresses the final transfer statistics, 'progress' shows periodic transfer statistics |
## df
report file system space usage
Usage: `df [OPTION]... [FILE]...`
### Options
| Option | Description |
| ---------------------- | ---------------------------------------------------- |
| `-a, --all` | include pseudo, duplicate, inaccessible file systems |
| `-h, --human-readable` | print sizes in powers of 1024 (e.g., 1023M) |
| `-H, --si` | print sizes in powers of 1000 (e.g., 1.1G) |
| `-i, --inodes` | list inode information instead of block usage |
## dirname
strip last component from file name
Usage: `dirname [OPTION] NAME...`
## du
estimate file space usage
Usage: `du [OPTION]... [FILE]...`
### Options
| Option | Description |
| ---------------------- | -------------------------------------- |
| `-h, --human-readable` | print sizes in human readable format |
| `-s, --summarize` | display only a total for each argument |
## echo
display a line of text
Usage: `echo [OPTION]... [STRING]...`
### Options
| Option | Description |
| ------ | ----------------------------------------------------- |
| `-n` | do not output the trailing newline |
| `-e` | enable interpretation of backslash escapes |
| `-E` | disable interpretation of backslash escapes (default) |
### Backslash Interpretations
| Sequence | Meaning |
| -------- | ----------------------------------------- |
| \\ | backslash |
| \a | alert (BEL) |
| \b | backspace |
| \c | produce no further output |
| \e | escape |
| \f | form feed |
| \n | new line |
| \r | carriage return |
| \t | horizontal tab |
| \v | vertical tab |
| \0NNN | byte with octal value NNN (1 to 3 digits) |
| \xHH | byte with hexadecimal value HH (1 to 2) |
## env
run a program in a modified environment
Print [Environment Variables](../../../linux/Environment%20Variables.md) with only `env`
Usage: `env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]`
### Options
| Option | Description |
| -------------------------- | -------------------------------------------------- |
| `-i, --ignore-environment` | start with an empty environment |
| `-u, --unset=NAME` | remove variable from the environment |
| `-C, --chdir=DIR` | change working directory to DIR |
| `--block-signal[=SIG]` | block delivery of SIG signal(s) to COMMAND |
| `--ignore-signal[=SIG]` | set handling of SIG signal(s) to do nothing |
| `-v, --debug` | print verbose information for each processing step |
## false
do nothing, unsuccessfully
Usage: `false`
## head
output the first part of files
Usage: `head [OPTION]... [FILE]...`
### Options
| Option | Description |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `-c, --bytes=[-]NUM` | print the first NUM bytes of each file; with the leading '-', print all but the last NUM bytes of each file |
| `-n, --lines=[-]NUM` | print the first NUM lines instead of the first 10; with the leading '-', print all but the last NUM lines of each file |
| `-q, --quiet, --silent` | never print headers giving file names |
## id
print real and effective user and group IDs
Usage: `id [OPTION]... [USER]...`
### Option
| Option | Description |
| -------------- | -------------------------------------------- |
| `-g, --group` | print only the effective group ID |
| `-G, --groups` | print all group IDs |
| `-n, --name` | print a name instead of a number, for `-ugG` |
| `-u, --user` | print only the effective user ID |
## install
copy files and set attributes
Usage: `install [OPTION]... SOURCE... DIRECTORY`
### Options
| Option | Description |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `-b` | make a backup of each existing destination file |
| `-S, --suffix=SUFFIX` | override the usual backup suffix |
| `-C, --compare` | compare  content of source and destination files, and if no change to content, ownership, and permissions, do not modify the destination at all |
| `-d, --directory` | treat all arguments as directory names; create all components of the specified directories |
| `-g, --group=GROUP` | set group ownership, instead of process' current group |
| `-m, --mode=MODE` | set permission mode (as in chmod), instead of rwxr-xr-x |
| `-o, --owner=OWNER` | set ownership (super-user only) |
| `-p, --preserve-timestamps` | apply access/modification times of SOURCE files to corresponding destination files |
| `-s, --strip` | strip symbol tables |
| `-t, --target-directory=DIRECTORY` | copy all SOURCE arguments into DIRECTORY |
| `-v, --verbose` | print the name of each created file or directory |
## kill
terminate a process
Usage: `kill [-signal|-s signal|-p] [-q value] [-a] [--timeout milliseconds signal] [--] pid|name...`
### Options
| Option | Description |
| --------------------- | -------------------------------------------------------------------------------- |
| `-s, --signal signal` | The signal to send. It may be given as a name or a number. |
| `-p, --pid` | Only print the process ID (PID) of the named processes, do not send any signals. |
| `--verbose` | Print PID(s) that will be signaled with kill along with the signal. |
## ln
make links between files
Usage: `ln [OPTION]... TARGET LINK_NAME`
### Options
| Option | Description |
| ---------------------------------- | -------------------------------------------------- |
| `-s, --symbolic` | make symbolic links instead of hard links |
| `-t, --target-directory=DIRECTORY` | specify the DIRECTORY in which to create the links |
| `-v, --verbose` | print name of each linked file |
## ls
list directory contents
Usage: `ls [OPTION]... [FILE]...`
### Options
| Option | Description |
| ---------------------- | --------------------------------------------------- |
| `-a, --all` | do not ignore entries starting with . |
| `-h, --human-readable` | with `-l` print sizes like 1K 234M 2G etc |
| `-I, --ignore=PATTERN` | do not list implied entries matching shell PATTERN |
| `-l` | use a long listing format |
| `-r, --reverse` | reverse order while sorting |
| `-R, --recursive` | list subdirectories recursively |
## mkdir
make directories
Usage: `mkdir [OPTION]... DIRECTORY...`
### Options
| Option | Description |
| ----------------- | ----------------------------------------------------------------------------------------------------------- |
| `-m, --mode=MODE` | set file mode (as in chmod), not a=rwx - umask |
| `-p, --parents` | no error if existing, make parent directories as needed, with their file modes unaffected by any -m option. |
| `-v, --verbose` | print a message for each created directory |
## mkfifo
make FIFOs (named pipes)
Usage: `mkfifo [OPTION]... NAME...`
## mv
move (rename) files
Usage: `mv [OPTION]... SOURCE... DIRECTORY`
### Options
| Option | Description |
| ---------------------------------- | ------------------------------------------------ |
| `-b` | make a backup of each existing destination file |
| `-S, --suffix=SUFFIX` | override the usual backup suffix |
| `-t, --target-directory=DIRECTORY` | copy all SOURCE arguments into DIRECTORY |
| `-v, --verbose` | print the name of each created file or directory |
## nl
number lines of files
Usage: `nl [FILE]...`
## nproc
print the number of processing units available
Usage: `nproc`
## pwd
print name of current/working directory
Usage: `pwd`
## readlink
print resolved symbolic links or canonical file names
Usage: `readlink [OPTION]... FILE...`
### Options
| Option | Description |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `-f, --canonicalize` | canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist |
| `-e, --canonicalize-existing` | canonicalize by following every symlink in every component of the given name recursively, all components must exist |
| `-m, --canonicalize-missing` | canonicalize by following every symlink in every component of the given name recursively, without requirements on components existence |
| `-n, --no-newline` | do not output the trailing delimiter |
## realpath
print the resolved path
Usage: `realpath [OPTION]... FILE...`
### Options
| Option | Description |
| ----------------------------- | ----------------------------------------------- |
| `-e, --canonicalize-existing` | all components of the path must exist |
| `-m, --canonicalize-missing` | no path components need exist or be a directory |
| `-L, --logical` | resolve '..' components before symlinks |
| `--relative-to=DIR` | print the resolved path relative to DIR |
| `--relative-base=DIR` | print absolute paths unless paths below DIR |
| `-s, --strip, --no-symlinks` | don't expand symlinks |
## rm
remove files or directories
Usage: `rm [OPTION]... [FILE]...`
### Options
| Option | Description |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-f, --force` | ignore nonexistent files and arguments, never prompt |
| `-i` | prompt before every removal |
| `--one-file-system` | when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument |
| `-r, -R, --recursive` | remove directories and their contents recursively |
| `-d, --dir` | remove empty directories |
| `-v, --verbose` | explain what is being done |
## rmdir
remove empty directories
Usage: `rmdir [OPTION]... DIRECTORY...`
### Options
| Option | Description |
| --------------- | ------------------------------------------------------------------------------------ |
| `-p, --parents` | remove DIRECTORY and its ancestors; e.g., 'rmdir -p a/b' is similar to 'rmdir a/b a' |
| `-v, --verbose` | output a diagnostic for every directory processed |
## seq
print a sequence of numbers
Usage:
- `seq [OPTION]... LAST`
- `seq [OPTION]... FIRST LAST`
- `seq [OPTION]... FIRST INCREMENT LAST`
### Options
| Option | Description |
| ------------------------ | --------------------------------------------- |
| `-f, --format=FORMAT` | use printf style floating-point FORMAT |
| `-s, --separator=STRING` | use STRING to separate numbers (default: \n) |
| `-w, --equal-width` | equalize width by padding with leading zeroes |
## shred
overwrite a file to hide its contents, and optionally delete it
Usage: `shred [OPTION]... FILE...`
### Options
| Option | Description |
| ---------------------- | ------------------------------------------------ |
| `-f, --force` | change permissions to allow writing if necessary |
| `-n, --iterations=N` | overwrite N times instead of the default (3) |
| `--random-source=FILE` | get random bytes from FILE |
## shuf
generate random permutations
Usage: `shuf [OPTION]... [FILE]`
### Options
| Option | Description |
| ------------------------- | ------------------------------------------------ |
| `-i, --input-range=LO-HI` | treat each number LO through HI as an input line |
| `-n, --head-count=COUNT` | output at most COUNT lines |
| `-o, --output=FILE` | write result to FILE instead of standard output |
| `--random-source=FILE` | get random bytes from FILE |
| `-r, --repeat` | output lines can be repeated |
## sleep
delay for a specified amount of time
Usage: `sleep NUMBER[SUFFIX]...`
## sort
sort lines of text files
Usage: `sort [OPTION]... [FILE]...`
### Options
| Option | Description |
| ----------------------------- | ------------------------------------------------ |
| `-b, --ignore-leading-blanks` | ignore leading blanks |
| `-d, --dictionary-order` | consider only blanks and alphanumeric characters |
| `-f, --ignore-case` | fold lower case to upper case characters |
| `-g, --general-numeric-sort` | compare according to general numerical value |
| `-i, --ignore-nonprinting` | consider only printable characters |
| `-M, --month-sort` | compare (unknown) < 'JAN' < ... < 'DEC' |
| `-h, --human-numeric-sort` | compare human readable numbers (e.g., 2K 1G) |
| `-n, --numeric-sort` | compare according to string numerical value |
| `-r, --reverse` | reverse the result of comparisons |
## split
split a file into pieces
Usage: `split [OPTION]... [FILE [PREFIX]]`
### Options
| Option | Description |
| ---------------------------- | --------------------------------------------------------- |
| `-a, --suffix-length=N` | generate suffixes of length N (default 2) |
| `--additional-suffix=SUFFIX` | append an additional SUFFIX to file names |
| `-b, --bytes=SIZE` | put SIZE bytes per output file |
| `-C, --line-bytes=SIZE` | put at most SIZE bytes of records per output file |
| `-d` | use numeric suffixes starting at 0, not alphabetic |
| `--numeric-suffixes[=FROM]` | same as `-d`, but allow setting the start value |
| `-x` | use hex suffixes starting at 0, not alphabetic |
| `--hex-suffixes[=FROM]` | same as `-x`, but allow setting the start value |
| `-l, --lines=NUMBER` | put NUMBER lines/records per output file |
| `-n, --number=CHUNKS` | generate CHUNKS output files; see explanation below |
| `--verbose` | print a diagnostic just before each output file is opened |
## stat
display file or file system status
Usage: `stat [OPTION]... FILE...`
### Options
| Option | Description |
| --------------------- | ------------------------------------------------------------------------------------------ |
| `-L, --dereference` | follow links |
| `-f, --file-system` | display file system status instead of file status |
| `-c --format=FORMAT` | use the specified FORMAT instead of the default; output a newline after each use of FORMAT |
### Format Modifiers
| Format | Description |
| ------ | ---------------------------------------------------------------------- |
| %a | permission bits in octal (note '#' and '0' printf flags) |
| %A | permission bits and file type in human readable form |
| %b | number of blocks allocated (see %B) |
| %B | the size in bytes of each block reported by %b |
| %C | SELinux security context string |
| %d | device number in decimal (st_dev) |
| %D | device number in hex (st_dev) |
| %Hd | major device number in decimal |
| %Ld | minor device number in decimal |
| %f | raw mode in hex |
| %F | file type |
| %g | group ID of owner |
| %G | group name of owner |
| %h | number of hard links |
| %i | inode number |
| %m | mount point |
| %n | file name |
| %N | quoted file name with dereference if symbolic link |
| %o | optimal I/O transfer size hint |
| %s | total size, in bytes |
| %r | device type in decimal (st_rdev) |
| %R | device type in hex (st_rdev) |
| %Hr | major device type in decimal, for character/block device special files |
| %Lr | minor device type in decimal, for character/block device special files |
| %t | major device type in hex, for character/block device special files |
| %T | minor device type in hex, for character/block device special files |
| %u | user ID of owner |
| %U | user name of owner |
| %w | time of file birth, human-readable; - if unknown |
| %W | time of file birth, seconds since Epoch; 0 if unknown |
| %x | time of last access, human-readable |
| %X | time of last access, seconds since Epoch |
| %y | time of last data modification, human-readable |
| %Y | time of last data modification, seconds since Epoch |
| %z | time of last status change, human-readable |
| %Z | time of last status change, seconds since Epoch |
| %a | free blocks available to non-superuser |
| %b | total data blocks in file system |
| %c | total file nodes in file system |
| %d | free file nodes in file system |
| %f | free blocks in file system |
| %i | file system ID in hex |
| %l | maximum length of filenames |
| %n | file name |
| %s | block size (for faster transfers) |
| %S | fundamental block size (for block counts) |
| %t | file system type in hex |
| %T | file system type in human readable form |
## tac
concatenate and print files in reverse
Usage: `tac [FILE]...`
## tail
output the last part of files
Usage: `tail [OPTION]... [FILE]...`
### Options
| Option | Description |
| -------------------- | ---------------------------------------------------------------------------------------------------- |
| `-c, --bytes=[+]NUM` | output the last NUM bytes; or use `-c` +NUM to output starting with byte NUM of each file |
| `-f` | output appended data as the file grows; |
| `-n, --lines=[+]NUM` | output the last NUM lines, instead of the last 10; or use `-n` +NUM to skip NUM-1 lines at the start |
| `--pid=PID` | with `-f`, terminate after process ID, PID dies |
## tee
read from standard input and write to standard output and files
Usage: `tee [OPTION]... [FILE]...`
### Options
| Option | Description |
| -------------- | ------------------------------------------- |
| `-a, --append` | append to the given FILEs, do not overwrite |
## touch
change file timestamps
Usage: `touch [OPTION]... FILE...`
### Options
| Option | Description |
| ---------------------- | ----------------------------------------------- |
| `-a` | change only the access time |
| `-c, --no-create` | do not create any files |
| `-d, --date=STRING` | parse STRING and use it instead of current time |
| `-r, --reference=FILE` | use this file's times instead of current time |
## tr
translate or delete characters
Usage: `tr [OPTION]... STRING1 [STRING2]`
### Options
| Option | Description |
| -------------- | ---------------------------------------------- |
| `-d, --delete` | delete characters in STRING1, do not translate |
## true
do nothing, successfully
Usage: `true`
## truncate
shrink or extend the size of a file to the specified size
Usage: `truncate OPTION... FILE...`
### Options
| Option | Description |
| ----------------------- | ----------------------------------------- |
| `-c, --no-create` | do not create any files |
| `-r, --reference=RFILE` | base size on RFILE |
| `-s, --size=SIZE` | set or adjust the file size by SIZE bytes |
## uname
print system information
Usage: `uname [OPTION]...`
### Options
| Option | Description |
| ---------------------- | ------------------------------- |
| `-a, --all` | print all information |
| `-s, --kernel-name` | print the kernel name |
| `-n, --nodename` | print the network node hostname |
| `-r, --kernel-release` | print the kernel release |
| `-v, --kernel-version` | print the kernel version |
| `-m, --machine` | print the machine hardware name |
## uniq
report or omit repeated lines
Usage: `uniq [OPTION]... [INPUT [OUTPUT]]`
### Options
| Option | Description |
| -------------------- | ---------------------------------------------- |
| `-c, --count` | prefix lines by the number of occurrences |
| `-d, --repeated` | only print duplicate lines, one for each group |
| `-i, --ignore-case` | ignore differences in case when comparing |
| `-s, --skip-chars=N` | avoid comparing the first N characters |
| `-u, --unique` | only print unique lines |
## uptime
Tell how long the system has been running
Usage: `uptime [options]`
### Options
| Option | Description |
| -------------- | ---------------------------------------------- |
| `-p, --pretty` | show uptime in pretty format |
| `-s, --since` | system up since, in yyyy-mm-dd HH:MM:SS format |
## wc
print newline, word, and byte counts for each file
Usage: `wc [OPTION]... [FILE]...`
### Options
| Option | Description |
| ------------- | -------------------------- |
| `-c, --bytes` | print the byte counts |
| `-m, --chars` | print the character counts |
| `-l, --lines` | print the newline counts |
| `-w, --words` | print the word counts |
## whoami
print effective user name
Usage: `whoami`

View file

@ -0,0 +1,31 @@
---
obj: application
repo: https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
---
# chattr
change file attributes on a Linux file system
Usage:
```shell
chattr +<Attribute> <FILE> # Add Attribute
chattr -<Attribute> <FILE> # Remove Attribute
chattr =<Attribute> <FILE> # Set Attribute
```
## Options
| Option | Description |
| ------ | ---------------------------------------------------------------- |
| `-R` | Recursively change attributes of directories and their contents. |
## Attributes
| Attribute | Description |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `a` | A file with the 'a' attribute set can only be opened in append mode for writing. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute. |
| `A` | When a file with the 'A' attribute set is accessed, its atime record is not modified. This avoids a certain amount of disk I/O for laptop systems. |
| `c` | A file with the 'c' attribute set is automatically compressed on the disk by the kernel. A read from this file returns uncompressed data. A write to this file compresses data before storing them on the disk. Note: please make sure to read the bugs and limitations section at the end of this document. (Note: For btrfs, If the 'c' flag is set, then the 'C' flag cannot be set. Also conflicts with btrfs mount option 'nodatasum') |
| `C` | A file with the 'C' attribute set will not be subject to copy-on-write updates. This flag is only supported on file systems which perform copy-on-write. (Note: For btrfs, the 'C' flag should be set on new or empty files. If it is set on a file which already has data blocks, it is undefined when the blocks assigned to the file will be fully stable. If the 'C' flag is set on a directory, it will have no effect on the directory, but new files created in that directory will have the No_COW attribute set. If the 'C' flag is set, then the 'c' flag cannot be set.) |
| `D` | When a directory with the 'D' attribute set is modified, the changes are written synchronously to the disk; this is equivalent to the 'dirsync' mount option applied to a subset of the files. |
| `i` | A file with the 'i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file, most of the file's metadata can not be modified, and the file can not be opened in write mode. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute. |
| `m` | A file with the 'm' attribute is excluded from compression on file systems that support per-file compression. |
| `S` | When a file with the 'S' attribute set is modified, the changes are written synchronously to the disk; this is equivalent to the 'sync' mount option applied to a subset of the files. |

View file

@ -0,0 +1,71 @@
---
obj: application
repo: https://github.com/Duncaen/OpenDoas
wiki: https://en.wikipedia.org/wiki/Doas
arch-wiki: https://wiki.archlinux.org/title/Doas
---
# doas
doas is a program to execute commands as another user. The system administrator can configure it to give specified users privileges to execute specified commands. It is free and open-source under the ISC license and available in Unix and Unix-like operating systems ([FreeBSD](../../../bsd/FreeBSD.md), [OpenBSD](../../../bsd/OpenBSD.md), [Linux](../../../linux/Linux.md)).
## Usage
To use doas, simply prefix a command and its arguments with doas and a space:
```shell
$ doas cmd
```
To get to an interactive shell with root prompt:
```shell
$ doas -s
```
### Options
| Option | Description |
| --------- | ------------------------------------------------- |
| `-s` | Execute the shell from `$SHELL` or `/etc/passwd`. |
| `-u user` | Execute the command as user. The default is root. |
## Configuration
The configuration for doas is stored at `/etc/doas.conf`.
The config file consist of rules with the following format:
`permit|deny [options] identity [as target] [cmd command [args ...]]`
Rules consist of the following parts:
- `permit|deny`: The action to be taken if this rule matches.
Options:
| Option | Description |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `nopass` | The user is not required to enter a password. |
| `nolog` | Do not log successful command execution to syslogd |
| `persist` | After the user successfully authenticates, do not ask for a password again for some time. |
| `keepenv` | Environment variables other than those listed in doas are retained when creating the environment for the new process. |
| `setenv {var=value}` | Keep or set the space-separated specified variables. Variables may also be removed with a leading - or set using the latter syntax. If the first character of value is a `$` then the value to be set is taken from the existing environment variable of the indicated name. This option is processed after the default environment has been created. |
- `identity`: The username to match. Groups may be specified by prepending a colon (:). Numeric IDs are also accepted.
- `as`: The target user the running user is allowed to run the command as. The default is all users.
- `cmd`: The command the user is allowed or denied to run. The default is all commands. Be advised that it is best to specify absolute paths. If a relative path is specified, only a restricted `PATH` will be searched.
- `args`: Arguments to command. The command arguments provided by the user need to match those specified. The keyword `args` alone means that command must be run without any arguments.
The last matching rule determines the action taken. If no rule matches, the action is denied.
Comments can be put anywhere in the file using a hash mark (#), and extend to the end of the current line.
The following quoting rules apply:
- The text between a pair of double quotes (") is taken as is.
- The backslash character (\) escapes the next character, including new line characters, outside comments; as a result, comments may not be extended over multiple lines.
- If quotes or backslashes are used in a word, it is not considered a keyword.
### Examples
```
permit persist setenv { PKG_CACHE PKG_PATH } aja cmd pkg_add
permit setenv { -ENV PS1=$DOAS_PS1 SSH_AUTH_SOCK } :wheel
permit nopass tedu as root cmd /usr/sbin/procmap
permit nopass keepenv setenv { PATH } root as root
```

View file

@ -0,0 +1,15 @@
---
obj: application
repo: https://github.com/file/file
wiki: https://en.wikipedia.org/wiki/File_(command)
website: https://darwinsys.com/file
---
# file
determine file / [MIME](../../../files/MIME.md) type
Usage: `file [OPTION] [FILE]...`
## Options
| Option | Description |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-b, --brief` | Do not prepend filenames to output lines (brief mode) |
| `-i, --mime` | Causes the file command to output mime type strings rather than the more traditional human readable ones. Thus it may say text/plain; charset=us-ascii rather than "ASCII text" |

View file

@ -0,0 +1,63 @@
---
obj: application
repo: git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
---
# losetup
set up and control [loop devices](../../../linux/Loop%20Device.md)
## Usage
Get info:
```shell
losetup [loopdev]
losetup -l [-a]
losetup -j file
```
Attach a loop device:
```shell
losetup -fP file
```
Detach a loop device:
```shell
losetup -d loopdev ...
```
Detach all associated loop devices:
```shell
losetup -D
```
## Options
| Option | Description |
| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-a, --all` | Show the status of all loop devices |
| `-d, --detach loopdev...` | Detach the file or device associated with the specified loop device(s) |
| `-D, --detach-all` | Detach all associated loop devices |
| `-f, --find [file]` | Find the first unused loop device. If a file argument is present, use the found device as loop device. Otherwise, just print its name |
| `--show` | Display the name of the assigned loop device if the `-f` option and a file argument are present |
| `-L, --nooverlap` | Check for conflicts between loop devices to avoid situation when the same backing file is shared between more loop devices. If the file is already used by another device then re-use the device rather than a new one. The option makes sense only with `--find` |
| `-j, --associated file` | Show the status of all loop devices associated with the given file |
| `-P, --partscan` | Force the kernel to scan the partition table on a newly created loop device. Note that the partition table parsing depends on sector sizes |
| `-r, --read-only` | Set up a read-only loop device |
| `-v, --verbose` | Verbose mode |
| `-l, --list` | If a loop device or the -a option is specified, print the default columns for either the specified loop device or all loop devices |
| `-O, --output column[,column]...` | Specify the columns that are to be printed for the `--list` output |
| `-J, --json` | Use JSON format for `--list` output |
## Output Columns
| Output | Description |
| ------------ | -------------------------------------- |
| NAME | loop device name |
| AUTOCLEAR | autoclear flag set |
| BACK-FILE | device backing file |
| BACK-INO | backing file inode number |
| BACK-MAJ:MIN | backing file major:minor device number |
| MAJ:MIN | loop device major:minor number |
| OFFSET | offset from the beginning |
| PARTSCAN | partscan flag set |
| RO | read-only device |
| SIZELIMIT | size limit of the file in bytes |
| DIO | access backing file with direct-io |
| LOG-SEC | logical sector size in bytes |

View file

@ -0,0 +1,92 @@
---
obj: application
repo: git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
---
# lsblk
List block devices
Usage: `lsblk [options] [device...]`
## Options
| Option | Description |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `-A, --noempty` | Dont print empty devices |
| `-a, --all` | Disable all built-in filters and list all empty devices and RAM disk devices too |
| `-f, --fs` | Output info about filesystems. This option is equivalent to `-o NAME,FSTYPE,FSVER,LABEL,UUID,FSAVAIL,FSUSE%,MOUNTPOINTS` |
| `-J, --json` | Use JSON output format |
| `-l, --list` | Produce output in the form of a list |
| `-N, --nvme` | Output info about NVMe devices only |
| `-o, --output list` | Specify which output columns to print |
| `-p, --paths` | Print full device paths |
## Output Columns
| Output | Description |
| ------------ | ------------------------------------------------- |
| ALIGNMENT | alignment offset |
| ID-LINK | the shortest udev /dev/disk/by-id link name |
| ID | udev ID (based on ID-LINK) |
| DISC-ALN | discard alignment offset |
| DAX | dax-capable device |
| DISC-GRAN | discard granularity |
| DISK-SEQ | disk sequence number |
| DISC-MAX | discard max bytes |
| DISC-ZERO | discard zeroes data |
| FSAVAIL | filesystem size available |
| FSROOTS | mounted filesystem roots |
| FSSIZE | filesystem size |
| FSTYPE | filesystem type |
| FSUSED | filesystem size used |
| FSUSE% | filesystem use percentage |
| FSVER | filesystem version |
| GROUP | group name |
| HCTL | Host:Channel:Target:Lun for SCSI |
| HOTPLUG | removable or hotplug device (usb, pcmcia, ...) |
| KNAME | internal kernel device name |
| LABEL | filesystem LABEL |
| LOG-SEC | logical sector size |
| MAJ:MIN | major:minor device number |
| MIN-IO | minimum I/O size |
| MODE | device node permissions |
| MODEL | device identifier |
| MQ | device queues |
| NAME | device name |
| OPT-IO | optimal I/O size |
| OWNER | user name |
| PARTFLAGS | partition flags |
| PARTLABEL | partition LABEL |
| PARTN | partition number as read from the partition table |
| PARTTYPE | partition type code or UUID |
| PARTTYPENAME | partition type name |
| PARTUUID | partition UUID |
| PATH | path to the device node |
| PHY-SEC | physical sector size |
| PKNAME | internal parent kernel device name |
| PTTYPE | partition table type |
| PTUUID | partition table identifier (usually UUID) |
| RA | read-ahead of the device |
| RAND | adds randomness |
| REV | device revision |
| RM | removable device |
| RO | read-only device |
| ROTA | rotational device |
| RQ-SIZE | request queue size |
| SCHED | I/O scheduler name |
| SERIAL | disk serial number |
| SIZE | size of the device |
| START | partition start offset |
| STATE | state of the device |
| SUBSYSTEMS | de-duplicated chain of subsystems |
| MOUNTPOINT | where the device is mounted |
| MOUNTPOINTS | all locations where device is mounted |
| TRAN | device transport type |
| TYPE | device type |
| UUID | filesystem UUID |
| VENDOR | device vendor |
| WSAME | write same max bytes |
| WWN | unique storage identifier |
| ZONED | zone model |
| ZONE-SZ | zone size |
| ZONE-WGRAN | zone write granularity |
| ZONE-APP | zone append max bytes |
| ZONE-NR | number of zones |
| ZONE-OMAX | maximum number of open zones |
| ZONE-AMAX | maximum number of active zones |

View file

@ -0,0 +1,17 @@
---
obj: application
arch-wiki: https://wiki.archlinux.org/title/man_page
wiki: https://en.wikipedia.org/wiki/Man_page
---
# man
A man page (short for manual page) is a form of software documentation usually found on a Unix or Unix-like operating system. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts. A user may invoke a man page by issuing the man command.
To read a man page, simply enter:
```shell
man page_name
```
## Online Man Pages
- [Arch Linux Man Pages](https://man.archlinux.org)
- [FreeBSD Man Pages](https://man.freebsd.org/cgi/man.cgi)
- [OpenBSD Man Pages](https://man.openbsd.org/)