toybox 4 Android

Toybox 0.8.11 command help


toybox

:
[
acpi
arch
ascii
base32
base64
basename
blkdiscard
blkid
blockdev
bunzip2
bzcat
cal
cat
chattr
chgrp
chmod
chown
chroot
chrt
chvt
cksum
clear
cmp
comm
count
cp
cpio
crc32
cut
date
dd
deallocvt
devmem
df
dirname
dmesg
dnsdomainname
dos2unix
du
echo
egrep
eject
env
expand
factor
fallocate
false
fgrep
file
find
flock
fmt
fold
free
freeramdisk
fsfreeze
fstype
fsync
ftpget
ftpput
getconf
getopt
gpiodetect
gpiofind
gpioget
gpioinfo
gpioset
grep
groups
gunzip
halt
head
help
hexedit
host
hostname
httpd
hwclock
i2cdetect
i2cdump
i2cget
i2cset
i2ctransfer
iconv
id
ifconfig
inotifyd
insmod
install
ionice
iorenice
iotop
kill
killall
killall5
link
linux32
ln
logger
login
logname
losetup
ls
lsattr
lsmod
lspci
lsusb
makedevs
mcookie
md5sum
memeater
microcom
mix
mkdir
mkfifo
mknod
mkpasswd
mkswap
mktemp
modinfo
mount
mountpoint
mv
nbd-client
nbd-server
nc
netcat
netstat
nice
nl
nohup
nproc
nsenter
od
oneit
openvt
partprobe
paste
patch
pgrep
pidof
ping
ping6
pivot_root
pkill
pmap
poweroff
printenv
printf
prlimit
ps
pwd
pwdx
pwgen
readahead
readelf
readlink
realpath
reboot
renice
reset
rev
rfkill
rm
rmdir
rmmod
rtcwake
sed
seq
setfattr
setsid
sha1sum
sha224sum
sha256sum
sha384sum
sha3sum
sha512sum
shred
shuf
sleep
sntp
sort
split
stat
strings
su
swapoff
swapon
switch_root
sync
sysctl
tac
tail
tar
taskset
tee
test
time
timeout
top
touch
true
truncate
ts
tsort
tty
tunctl
uclampset
ulimit
umount
uname
unicode
uniq
unix2dos
unlink
unshare
uptime
usleep
uudecode
uuencode
uuidgen
vconfig
vmstat
w
watch
watchdog
wc
wget
which
who
whoami
xargs
xxd
yes
zcat


toybox

usage: toybox [--long | --help | --version | [COMMAND] [ARGUMENTS...]]

With no arguments, "toybox" shows available COMMAND names. Add --long
to include suggested install path for each command, see
 for details.

First argument is name of a COMMAND to run, followed by any ARGUMENTS
to that command. Most toybox commands also understand:

--help		Show command help (only)
--version	Show toybox version (only)

The filename "-" means stdin/stdout, and "--" stops argument parsing.

Numerical arguments accept a single letter suffix for
kilo, mega, giga, tera, peta, and exabytes, plus an additional
"d" to indicate decimal 1000's instead of 1024.

Durations can be decimal fractions and accept minute ("m"), hour ("h"),
or day ("d") suffixes (so 0.1m = 6s).

:

See true

[

See test

acpi

usage: acpi [-abctV]

Show status of power sources and thermal devices.

-a	Show power adapters
-b	Show batteries
-c	Show cooling device state
-t	Show temperatures
-V	Show everything

arch

usage: arch

Print machine (hardware) name, same as uname -m.

ascii

usage: ascii

Display ascii character set.

base32

usage: base32 [-di] [-w COLUMNS] [FILE...]

Encode or decode in base32.

-d	Decode
-i	Ignore non-alphabetic characters
-w	Wrap output at COLUMNS (default 76 or 0 for no wrap)

base64

usage: base64 [-di] [-w COLUMNS] [FILE...]

Encode or decode in base64.

-d	Decode
-i	Ignore non-alphabetic characters
-w	Wrap output at COLUMNS (default 76 or 0 for no wrap)

basename

usage: basename [-a] [-s SUFFIX] NAME... | NAME [SUFFIX]

Return non-directory portion of a pathname removing suffix.

-a		All arguments are names
-s SUFFIX	Remove suffix (implies -a)

blkdiscard

usage: blkdiscard [-szf] [-o OFFSET] [-l LENGTH] DEVICE

Discard device sectors (permanetly deleting data). Free space can improve
flash performance and lifetime by wear leveling and collating data.
(Some filesystem/driver combinations can do this automatically.)

-o	Start at OFFSET (--offset, default 0)
-l	LENGTH to discard (--length, default all)
-s	Overwrite discarded data (--secure)
-z	Zero-fill rather than discard (--zeroout)
-f	Disable check for mounted filesystem (--force)

OFFSET and LENGTH must be aligned to the device sector size. Default
without -o/-l discards the entire device. (You have been warned.)

blkid

usage: blkid [-o TYPE] [-s TAG] [-UL] DEV...

Print type, label and UUID of filesystem on a block device or image.

-U	Show UUID only (or device with that UUID)
-L	Show LABEL only (or device with that LABEL)
-o TYPE	Output format (full, value, export)
-s TAG	Only show matching tags (default all)

blockdev

usage: blockdev --OPTION... BLOCKDEV...

Call ioctl(s) on each listed block device

--setro		Set read only
--setrw		Set read write
--getro		Get read only
--getss		Get sector size
--getbsz	Get block size
--setbsz BYTES	Set block size
--getsz		Get device size in 512-byte sectors
--getsize	Get device size in sectors (deprecated)
--getsize64	Get device size in bytes
--getra		Get readahead in 512-byte sectors
--setra SECTORS	Set readahead
--flushbufs	Flush buffers
--rereadpt	Reread partition table

bunzip2

usage: bunzip2 [-cftkv] [FILE...]

Decompress listed files (file.bz becomes file) deleting archive file(s).
Read from stdin if no files listed.

-c	Force output to stdout
-f	Force decompression (if FILE doesn't end in .bz, replace original)
-k	Keep input files (-c and -t imply this)
-t	Test integrity
-v	Verbose

bzcat

usage: bzcat [FILE...]

Decompress listed files to stdout. Use stdin if no files listed.

cal

usage: cal [-h] [[[DAY] MONTH] YEAR]

Print a calendar.

With one argument, prints all months of the specified year.
With two arguments, prints calendar for month and year.
With three arguments, highlights day within month and year.

-h	Don't highlight today

cat

usage: cat [-etuv] [FILE...]

Copy (concatenate) files to stdout.  If no files listed, copy from stdin.
Filename "-" is a synonym for stdin.

-e	Mark each newline with $
-t	Show tabs as ^I
-u	Copy one byte at a time (slow)
-v	Display nonprinting characters as escape sequences with M-x for
	high ascii characters (>127), and ^x for other nonprinting chars

chattr

usage: chattr [-R] [-+=AacDdijsStTu] [-p PROJID] [-v VERSION] [FILE...]

Change file attributes on a Linux file system.

-R	Recurse
-p	Set the file's project number
-v	Set the file's version/generation number

Operators:
  '-' Remove attributes
  '+' Add attributes
  '=' Set attributes

Attributes:
  A  No atime                     a  Append only
  C  No COW                       c  Compression
  D  Synchronous dir updates      d  No dump
  E  Encrypted                    e  Extents
  F  Case-insensitive (casefold)
  I  Indexed directory            i  Immutable
  j  Journal data
  N  Inline data in inode
  P  Project hierarchy
  S  Synchronous file updates     s  Secure delete
  T  Top of dir hierarchy         t  No tail-merging
  u  Allow undelete
  V  Verity

chgrp

usage: chgrp/chown [-RHLP] [-fvh] GROUP FILE...

Change group of one or more files.

-f	Suppress most error messages
-h	Change symlinks instead of what they point to
-R	Recurse into subdirectories (implies -h)
-H	With -R change target of symlink, follow command line symlinks
-L	With -R change target of symlink, follow all symlinks
-P	With -R change symlink, do not follow symlinks (default)
-v	Verbose

chmod

usage: chmod [-R] MODE FILE...

Change mode of listed file[s] (recursively with -R).

MODE can be (comma-separated) stanzas: [ugoa][+-=][rwxstXugo]

Stanzas are applied in order: For each category (u = user,
g = group, o = other, a = all three, if none specified default is a),
set (+), clear (-), or copy (=), r = read, w = write, x = execute.
s = u+s = suid, g+s = sgid, +t = sticky. (o+s ignored so a+s doesn't set +t)
suid/sgid: execute as the user/group who owns the file.
sticky: can't delete files you don't own out of this directory
X = x for directories or if any category already has x set.

Or MODE can be an octal value up to 7777	ug uuugggooo	top +
bit 1 = o+x, bit 1<<8 = u+w, 1<<11 = g+1	sstrwxrwxrwx	bottom

Examples:
chmod u+w file - allow owner of "file" to write to it.
chmod 744 file - user can read/write/execute, everyone else read only

chown

See chgrp

chroot

usage: chroot NEWROOT [COMMAND [ARG...]]

Run command within a new root directory. If no command, run /bin/sh.

chrt

usage: chrt [-Rmofrbi] {-p PID [PRIORITY] | [PRIORITY COMMAND...]}

Get/set a process' real-time scheduling policy and priority.

-p	Set/query given pid (instead of running COMMAND)
-R	Set SCHED_RESET_ON_FORK
-m	Show min/max priorities available

Set policy (default -r):

  -o  SCHED_OTHER    -f  SCHED_FIFO    -r  SCHED_RR
  -b  SCHED_BATCH    -i  SCHED_IDLE

chvt

usage: chvt NUM

Change to virtual terminal number NUM. (This only works in text mode.)

Virtual terminals are the Linux VGA text mode (or framebuffer) displays,
switched between via alt-F1, alt-F2, etc. Use ctrl-alt-F1 to switch
from X11 to a virtual terminal, and alt-F6 (or F7, or F8) to get back.

cksum

usage: cksum [-HIPLN] [FILE...]

For each file, output crc32 checksum value, length and name of file.
If no files listed, copy from stdin.  Filename "-" is a synonym for stdin.

-H	Hexadecimal checksum (defaults to decimal)
-I	Skip post-inversion
-P	Pre-inversion
-L	Little endian (defaults to big endian)
-N	Do not include length in CRC calculation (or output)

clear

Clear the screen.

cmp

usage: cmp [-ls] [-n LEN] FILE1 [FILE2 [SKIP1 [SKIP2]]]

Compare the contents of files (vs stdin if only one given), optionally
skipping bytes at start.

-l	Show all differing bytes
-n LEN	Compare at most LEN bytes
-s	Silent

comm

usage: comm [-123] FILE1 FILE2

Read FILE1 and FILE2, which should be ordered, and produce three text
columns as output: lines only in FILE1; lines only in FILE2; and lines
in both files. Filename "-" is a synonym for stdin.

-1	Suppress the output column of lines unique to FILE1
-2	Suppress the output column of lines unique to FILE2
-3	Suppress the output column of lines duplicated in FILE1 and FILE2

count

usage: count [-l]

-l	Long output (total bytes, human readable, transfer rate, elapsed time)

Copy stdin to stdout, displaying simple progress indicator to stderr.

cp

usage: cp [-aDdFfHiLlnPpRrsTuv] [--preserve=motcxa] [-t TARGET] SOURCE... [DEST]

Copy files from SOURCE to DEST.  If more than one SOURCE, DEST must
be a directory.

-a	Same as -dpr
-D	Create leading dirs under DEST (--parents)
-d	Don't dereference symlinks
-F	Delete any existing DEST first (--remove-destination)
-f	Delete destination files we can't write to
-H	Follow symlinks listed on command line
-i	Interactive, prompt before overwriting existing DEST
-L	Follow all symlinks
-l	Hard link instead of copy
-n	No clobber (don't overwrite DEST)
-P	Do not follow symlinks
-p	Preserve timestamps, ownership, and mode
-R	Recurse into subdirectories (DEST must be a directory)
-r	Synonym for -R
-s	Symlink instead of copy
-T	DEST always treated as file, max 2 arguments
-t	Copy to TARGET dir (no DEST)
-u	Update (keep newest mtime)
-v	Verbose

Arguments to --preserve are the first letter(s) of:

        mode - permissions (ignore umask for rwx, copy suid and sticky bit)
   ownership - user and group
  timestamps - file creation, modification, and access times.
     context - security context
       xattr - extended attributes
         all - all of the above

cpio

usage: cpio -{o|t|i|p DEST} [-dLtuv] [--verbose] [-F FILE] [-R [USER][:GROUP] [--no-preserve-owner]

Copy files into and out of a "newc" format cpio archive.

-d	Create directories if needed
-F FILE	Use archive FILE instead of stdin/stdout
-i	Extract from archive into file system (stdin=archive)
-L	Follow symlinks
-o	Create archive (stdin=list of files, stdout=archive)
-p DEST	Copy-pass mode, copy stdin file list to directory DEST
-R USER	Replace owner with USER[:GROUP]
-t	Test files (list only, stdin=archive, stdout=list of files)
-u	Unlink existing files when extracting
-v	Verbose
--no-preserve-owner     Don't set ownership during extract

crc32

usage: crc32 [file...]

Output crc32 checksum for each file.

cut

usage: cut [-Ds] [-bcCfF LIST] [-dO DELIM] [FILE...]

Print selected parts of lines from each FILE to standard output.

Each selection LIST is comma separated, either numbers (counting from 1)
or dash separated ranges (inclusive, with X- meaning to end of line and -X
from start). By default selection ranges are sorted and collated, use -D
to prevent that.

-b	Select bytes (with -n round start/end down to start of utf8 char)
-c	Select UTF-8 characters
-C	Select unicode columns
-d	Input delimiter (default is TAB for -f, run of whitespace for -F)
-D	Don't sort/collate selections or match -fF lines without delimiter
-f	Select fields (words) separated by single DELIM character
-F	Select fields separated by DELIM regex
-O	Output separator (default one space for -F, input delim for -f)
-s	Skip lines without delimiters

date

usage: date [-u] [-I RES] [-r FILE] [-d DATE] [+DISPLAY_FORMAT] [-D SET_FORMAT] [SET]

Set/get the current date/time. With no SET shows the current date.

-d	Show DATE instead of current time (convert date format)
-D	+FORMAT for SET or -d (instead of MMDDhhmm[[CC]YY][.ss])
-I RES	ISO 8601 with RESolution d=date/h=hours/m=minutes/s=seconds/n=ns
-r	Use modification time of FILE instead of current date
-s DATE	Set the system clock to DATE.
-u	Use UTC instead of current timezone

Supported input formats:

MMDDhhmm[[CC]YY][.ss]     POSIX
@UNIXTIME[.FRACTION]      seconds since midnight 1970-01-01
YYYY-MM-DD [hh:mm[:ss]]   ISO 8601
hh:mm[:ss]                24-hour time today

All input formats can be followed by fractional seconds, and/or a UTC
offset such as -0800.

All input formats can be preceded by TZ="id" to set the input time zone
separately from the output time zone. Otherwise $TZ sets both.

+FORMAT specifies display format string using strftime(3) syntax:

%% literal %             %n newline              %t tab
%S seconds (00-60)       %M minute (00-59)       %m month (01-12)
%H hour (0-23)           %I hour (01-12)         %p AM/PM
%y short year (00-99)    %Y year                 %C century
%a short weekday name    %A weekday name         %u day of week (1-7, 1=mon)
%b short month name      %B month name           %Z timezone name
%j day of year (001-366) %d day of month (01-31) %e day of month ( 1-31)
%N nanosec (output only)

%U Week of year (0-53 start Sunday)   %W Week of year (0-53 start Monday)
%V Week of year (1-53 start Monday, week < 4 days not part of this year)

%F "%Y-%m-%d"   %R "%H:%M"        %T "%H:%M:%S"        %z  timezone (-0800)
%D "%m/%d/%y"   %r "%I:%M:%S %p"  %h "%b"              %:z timezone (-08:00)
%x locale date  %X locale time    %c locale date/time  %s  unix epoch time

dd

usage: dd [if|of=FILE] [ibs|obs|bs|count|seek|skip=N] [conv|status|iflag|oflag=FLAG[,FLAG...]]

Copy/convert blocks of data from input to output, with the following
keyword=value modifiers (and their default values):

if=FILE  Read FILE (stdin)          of=FILE  Write to FILE (stdout)
   bs=N  Block size in bytes (512)  count=N  Stop after copying N blocks (all)
  ibs=N  Input block size (bs=)       obs=N  Output block size (bs=)
 skip=N  Skip N input blocks (0)     seek=N  Skip N output blocks (0)

Each =N value accepts the normal unit suffixes (see toybox --help).

These modifiers take a comma separated list of potential options:

iflag=count_bytes,skip_bytes   count=N or skip=N is in bytes not blocks
oflag=seek_bytes,append        seek=N is in bytes, append output to file
status=noxfer,none             don't show transfer rate, no summary info
conv=
  notrunc  Don't truncate output    noerror  Continue after read errors
  sync     Zero pad short reads     fsync    Flush output to disk at end
  sparse   Seek past zeroed output  excl     Fail if output file exists
  nocreat  Fail if of=FILE missing

deallocvt

usage: deallocvt [NUM]

Deallocate unused virtual terminals, either a specific /dev/ttyNUM, or all.

devmem

usage: devmem ADDR [WIDTH [DATA]]

Read/write physical address. WIDTH is 1, 2, 4, or 8 bytes (default 4).
Prefix ADDR with 0x for hexadecimal, output is in same base as address.

df

usage: df [-aHhikP] [-t TYPE] [FILE...]

The "disk free" command shows total/used/available disk space for
each filesystem listed on the command line, or all currently mounted
filesystems.

-a	Show all (including /proc and friends)
-H	Human readable (k=1000)
-h	Human readable (K=1024)
-i	Show inodes instead of blocks
-k	Sets units back to 1024 bytes (the default without -P)
-P	The SUSv3 "Pedantic" option (512 byte blocks)
-t TYPE	Display only filesystems of this type

Pedantic provides a slightly less useful output format dictated by POSIX,
and sets the units to 512 bytes instead of the default 1024 bytes.

dirname

usage: dirname PATH...

Show directory portion of path.

dmesg

usage: dmesg [-Cc] [-r|-t|-T] [-n LEVEL] [-s SIZE] [-w]

Print or control the kernel ring buffer.

-C	Clear ring buffer without printing
-c	Clear ring buffer after printing
-n	Set kernel logging LEVEL (1-8)
-r	Raw output (with )
-S	Use syslog(2) rather than /dev/kmsg
-s	Show the last SIZE many bytes
-T	Human readable timestamps
-t	Don't print timestamps
-w	Keep waiting for more output (aka --follow)

dnsdomainname

usage: dnsdomainname

Show domain this system belongs to (same as hostname -d).

dos2unix

usage: dos2unix [FILE...]

Convert newline format from dos "\r\n" to unix "\n".
If no files listed copy from stdin, "-" is a synonym for stdin.

du

usage: du [-d N] [-abcHKkLlmsx] [FILE...]

Show disk usage, space consumed by files and directories.

Size in:
-b	Apparent bytes (directory listing size, not space used)
-h	Human readable (e.g., 1K 243M 2G)
-k	1024 byte blocks (default)
-K	512 byte blocks (posix)
-m	Megabytes

What to show:
-a	All files, not just directories
-c	Cumulative total
-d N	Only depth < N
-H	Follow symlinks on cmdline
-L	Follow all symlinks
-l	Disable hardlink filter
-s	Only total size of each argument
-x	Don't leave this filesystem

echo

usage: echo [-Een] [ARG...]

Write each argument to stdout, one space between each, followed by a newline.

-E	Print escape sequences literally (default)
-e	Process the following escape sequences:
	\\  Backslash		\0NNN Octal (1-3 digit)	\xHH Hex (1-2 digit)
	\a  Alert (beep/flash)	\b  Backspace		\c  Stop here (no \n)
	\f  Form feed		\n  Newline		\r  Carriage return
	\t  Horizontal tab	\v  Vertical tab
-n	No trailing newline

egrep

See grep

eject

usage: eject [-stT] [DEVICE]

Eject DEVICE or default /dev/cdrom

-s	SCSI device
-t	Close tray
-T	Open/close tray (toggle)

env

usage: env [-0i] [-e FILE] [-u NAME] [NAME=VALUE...] [COMMAND...]

Set the environment for command invocation, or list environment variables.

-e	Execute FILE instead of argv[0] in COMMAND list
-i	Clear existing environment
-u NAME	Remove NAME from the environment
-0	Use null instead of newline in output

expand

usage: expand [-t TABLIST] [FILE...]

Expand tabs to spaces according to tabstops.

-t	TABLIST

Specify tab stops, either a single number instead of the default 8,
or a comma separated list of increasing numbers representing tabstop
positions (absolute, not increments) with each additional tab beyond
that becoming one space.

factor

usage: factor [-hx] NUMBER...

Factor integers.

-h	Human readable: show repeated factors as x^n
-x	Hexadecimal output

fallocate

usage: fallocate [-o OFFSET] -l SIZE FILE

Tell the filesystem to allocate space for a range in a file.

-l	Number of bytes in range
-o	Start offset of range (default 0)

false

usage: false

Return nonzero.

fgrep

See grep

file

usage: file [-bhLs] [FILE...]

Examine the given files and describe their content types.

-b	Brief (no filename)
-h	Don't follow symlinks (default)
-L	Follow symlinks
-s	Show block/char device contents

find

usage: find [-HL] [DIR...] []

Search directories for matching files.
Default: search ".", match all, -print matches.

-H  Follow command line symlinks         -L  Follow all symlinks

Match filters:
-name  PATTERN   filename with wildcards   -iname      ignore case -name
-path  PATTERN   path name with wildcards  -ipath      ignore case -path
-user  UNAME     belongs to user UNAME     -nouser     user ID not known
-group GROUP     belongs to group GROUP    -nogroup    group ID not known
-perm  [-/]MODE  permissions (-=min /=any) -prune      ignore dir contents
-size  N[c]      512 byte blocks (c=bytes) -xdev       only this filesystem
-links N         hardlink count            -empty      empty files and dirs
-atime N[u]      accessed N units ago      -true       always true
-ctime N[u]      created N units ago       -false      always false
-mtime N[u]      modified N units ago      -executable access(X_OK) perm+ACL
-inum  N         inode number N            -readable   access(R_OK) perm+ACL
-context PATTERN security context          -depth      contents before dir
-samefile FILE   hardlink to FILE          -maxdepth N at most N dirs down
-newer    FILE   newer mtime than FILE     -mindepth N at least N dirs down
-newerXY  FILE   X=acm time > FILE's Y=acm time (Y=t: FILE is literal time)
-type [bcdflps]  type is (block, char, dir, file, symlink, pipe, socket)

Numbers N may be prefixed by - (less than) or + (greater than). Units for
-[acm]time are d (days, default), h (hours), m (minutes), or s (seconds).

Combine matches with:
!, -a, -o, ( )    not, and, or, group expressions

Actions:
-print  Print match with newline  -print0        Print match with null
-exec   Run command with path     -execdir       Run command in file's dir
-ok     Ask before exec           -okdir         Ask before execdir
-delete Remove matching file/dir  -printf FORMAT Print using format string
-quit   Exit immediately

Commands substitute "{}" with matched file. End with ";" to run each file,
or "+" (next argument after "{}") to collect and run with multiple files.

-printf FORMAT characters are \ escapes and:
%b  512 byte blocks used
%f  basename            %g  textual gid          %G  numeric gid
%i  decimal inode       %l  target of symlink    %m  octal mode
%M  ls format type/mode %p  path to file         %P  path to file minus DIR
%s  size in bytes       %T@ mod time as unixtime
%u  username            %U  numeric uid          %Z  security context

flock

usage: flock [-sxun] fd

Manage advisory file locks.

-s	Shared lock
-x	Exclusive lock (default)
-u	Unlock
-n	Non-blocking: fail rather than wait for the lock

fmt

usage: fmt [-w WIDTH] [FILE...]

Reformat input to wordwrap at a given line length, preserving existing
indentation level, writing to stdout.

-w WIDTH	Maximum characters per line (default 75)

fold

usage: fold [-bs] [-w WIDTH] [FILE...]

Break long lines by inserting newlines.

-b	Count bytes instead of utf-8 unicode columns
-s	Wrap at whitespace when possible
-w	Break at WIDTH columns (default 80)

free

usage: free [-bkmgt]

Display the total, free and used amount of physical memory and swap space.

-bkmg	Output units (default is bytes)
-h	Human readable (K=1024)

freeramdisk

usage: freeramdisk [RAM device]

Free all memory allocated to specified ramdisk

fsfreeze

usage: fsfreeze {-f | -u} MOUNTPOINT

Freeze or unfreeze a filesystem.

-f	Freeze
-u	Unfreeze

fstype

usage: fstype DEV...

Print type of filesystem on a block device or image.

fsync

usage: fsync [-d] [FILE...]

Flush disk cache for FILE(s), writing cached data to storage device.

-d	Skip directory info (sync file contents only).

ftpget

usage: ftpget [-cvgslLmMdD] [-P PORT] [-p PASSWORD] [-u USER] HOST [LOCAL] REMOTE

Talk to ftp server. By default get REMOTE file via passive anonymous
transfer, optionally saving under a LOCAL name. Can also send, list, etc.

-c	Continue partial transfer
-p	Use PORT instead of "21"
-P	Use PASSWORD instead of "ftpget@"
-u	Use USER instead of "anonymous"
-v	Verbose

Ways to interact with FTP server:
-d	Delete file
-D	Remove directory
-g	Get file (default)
-l	List directory
-L	List (filenames only)
-m	Move file on server from LOCAL to REMOTE
-M	mkdir
-s	Send file

ftpput

See ftpget

getconf

usage: getconf -a [PATH] | -l | NAME [PATH]

Get system configuration values. Values from pathconf(3) require a path.

-a	Show all (defaults to "/" if no path given)
-l	List available value names (grouped by source)

getopt

usage: getopt [-aTu] [-lo OPTIONS] [-n NAME] [OPTIONS] ARG...

Outputs command line with recognized OPTIONS character arguments moved to
front, then "--", then non-option arguments. Returns 1 if unknown options.
OPTIONS followed by : take an argument, or :: for optional arguments (which
must be attached, ala -xblah or --long=blah).

-a	Allow long options starting with a single -
-l	Long OPTIONS (repeated or comma separated)
-n	Command NAME for error messages
-o	Short OPTIONS (instead of using first argument)
-T	Test whether this is a modern getopt
-u	Unquoted output (default if no other options set)

Example:
  $ getopt -l long:,arg:: abc command --long -b there --arg
  --long '-b' --arg '' -- 'command' 'there'

gpiodetect

usage: gpiodetect

Show all gpio chips' names, labels, and number of lines.

gpiofind

usage: gpiofind NAME

Show the chip and line number for the given line name.

gpioget

usage: gpioget [-l] CHIP LINE...

Gets the values of the given lines on CHIP. Use gpiofind to convert line
names to numbers.

-l	Active low

gpioinfo

usage: gpioinfo [CHIP...]

Show gpio chips' lines.

gpioset

usage: gpioset [-l] CHIP LINE=VALUE...

Set the lines on CHIP to the given values. Use gpiofind to convert line
names to numbers.

-l	Active low

grep

usage: grep [-abcEFHhIiLlnoqrsvwxZz] [-ABC NUM] [-m MAX] [-e REGEX]... [-MS PATTERN]... [-f REGFILE]... [FILE]...

Show lines matching regular expressions. If no -e, first argument is
regular expression to match. With no files (or "-" filename) read stdin.
Returns 0 if matched, 1 if no match found, 2 for command errors.

-e  Regex(es) to match.       -f  File(s) of regexes to match (1 per line).

file search:
-r  Recurse into subdirs     -R  Recurse following symlinks
-M  Match files (--include)  -S  Skip files (--exclude)
-I  Ignore binary files      --exclude-dir=PATTERN  Skip directories

match type:
-A  Show NUM lines after     -B  Show NUM lines before match
-C  NUM lines context (A+B)  -E  extended regex syntax
-F  fixed (literal match)    -a  always text (not binary)
-i  case insensitive         -m  match MAX many lines
-v  invert match             -w  whole word (implies -E)
-x  whole line               -z  input NUL terminated

display modes: (default: matched line)
-L  filenames with no match  -Z  output is NUL terminated
-c  count of matching lines  -l  filenames with a match
-o  only matching part       -q  quiet (errors only)
-s  silent (no error msg)

output prefix (default: filename if checking more than 1 file)
-H  force filename           -b  byte offset of match
-h  hide filename            -n  line number of match

groups

usage: groups [user]

Print the groups a user is in.

gunzip

usage: gunzip [-cfkt] [FILE...]

Decompress files. With no files, decompresses stdin to stdout.
On success, the input files are removed and replaced by new
files without the .gz suffix.

-c	Output to stdout (act as zcat)
-f	Force: allow read from tty
-k	Keep input files (default is to remove)
-t	Test integrity

halt

See reboot

head

usage: head [-cn NUM] [-qv] [FILE...]

Copy first lines from files to stdout. If no files listed, copy from
stdin. Filename "-" is a synonym for stdin.

-n	Number of lines to copy
-c	Number of bytes to copy
-q	Never print headers
-v	Always print headers

help

usage: help [-ahu] [COMMAND]

-a	All commands
-u	Usage only
-h	HTML output

Show usage information for toybox commands.
Run "toybox" with no arguments for a list of available commands.

hexedit

usage: hexedit [-r] FILE

Hexadecimal file editor/viewer. All changes are written to disk immediately.

-r	Read only (display but don't edit)

Keys:
Arrows         Move left/right/up/down by one line/column
PgUp/PgDn      Move up/down by one page
Home/End       Start/end of line (start/end of file with ctrl)
0-9, a-f       Change current half-byte to hexadecimal value
^J or :        Jump (+/- for relative offset, otherwise absolute address)
^F or /        Find string (^G/n: next, ^D/p: previous match)
u              Undo
x              Toggle bw/color display
q/^C/^Q/Esc    Quit

host

usage: host [-v] [-t TYPE] NAME [SERVER]

Look up DNS records for NAME, either domain name or IPv4/IPv6 address to
reverse lookup, from SERVER or default DNS server(s).

-a	All records
-t TYPE	Record TYPE (number or ANY A AAAA CNAME MX NS PTR SOA SRV TXT)
-v	Verbose

hostname

usage: hostname [-bdsf] [-F FILENAME] [newname]

Get/set the current hostname.

-b	Set hostname to 'localhost' if otherwise unset
-d	Show DNS domain name (no host)
-f	Show fully-qualified name (host+domain, FQDN)
-F	Set hostname to contents of FILENAME
-s	Show short host name (no domain)

httpd

usage: httpd [-de STR] [-v] [DIR]

Serve contents of directory as static web pages.

-e	Escape STR as URL, printing result and exiting.
-d	Decode escaped STR, printing result and exiting.
-v	Verbose

hwclock

usage: hwclock [-rswtluf]

Get/set the hardware clock.

-f FILE	Use specified device file instead of /dev/rtc0 (--rtc)
-l	Hardware clock uses localtime (--localtime)
-r	Show hardware clock time (--show)
-s	Set system time from hardware clock (--hctosys)
-t	Set the system time based on the current timezone (--systz)
-u	Hardware clock uses UTC (--utc)
-w	Set hardware clock from system time (--systohc)

i2cdetect

usage: i2cdetect [-aqry] BUS [FIRST LAST]
usage: i2cdetect -F BUS
usage: i2cdetect -l

Detect i2c devices.

-a	All addresses (0x00-0x7f rather than 0x03-0x77 or FIRST-LAST)
-F	Show functionality
-l	List available buses
-q	Probe with SMBus Quick Write (default)
-r	Probe with SMBus Read Byte
-y	Skip confirmation prompts (yes to all)

i2cdump

usage: i2cdump [-fy] BUS CHIP

Dump i2c registers.

-f	Force access to busy devices
-y	Skip confirmation prompts (yes to all)

i2cget

usage: i2cget [-fy] BUS CHIP [ADDR]

Read an i2c register.

-f	Force access to busy devices
-y	Skip confirmation prompts (yes to all)

i2cset

usage: i2cset [-fy] BUS CHIP ADDR VALUE... MODE

Write an i2c register. MODE is b for byte, w for 16-bit word, i for I2C block.

-f	Force access to busy devices
-y	Skip confirmation prompts (yes to all)

i2ctransfer

usage: i2ctransfer [-fy] BUS DESC [DATA...]...

Make i2c transfers. DESC is 'r' for read or 'w' for write, followed by
the number of bytes to read or write, followed by '@' and a 7-bit address.
For any message after the first, the '@' and address can be omitted to
reuse the previous address. A 'w' DESC must be followed by the number of
DATA bytes that was specified in the DESC.

-f	Force access to busy devices
-v	Verbose (show messages sent, not just received)
-y	Skip confirmation prompts (yes to all)

iconv

usage: iconv [-f FROM] [-t TO] [FILE...]

Convert character encoding of files.

-c	Omit invalid chars
-f	Convert from (default UTF-8)
-t	Convert to   (default UTF-8)

id

usage: id [-Ggnru] [USER...]

Print user and group ID.

-G	Show all group IDs
-g	Show only the effective group ID
-n	Print names instead of numeric IDs (to be used with -Ggu)
-r	Show real ID instead of effective ID
-u	Show only the effective user ID

ifconfig

usage: ifconfig [-aS] [INTERFACE [ACTION...]]

Display or configure network interface.

With no arguments, display active interfaces. First argument is interface
to operate on, one argument by itself displays that interface.

-a	All interfaces displayed, not just active ones
-S	Short view, one line per interface

Standard ACTIONs to perform on an INTERFACE:

ADDR[/MASK]        - set IPv4 address (1.2.3.4/5) and activate interface
add|del ADDR[/LEN] - add/remove IPv6 address (1111::8888/128)
up|down            - activate or deactivate interface

Advanced ACTIONs (default values usually suffice):

default          - remove IPv4 address
netmask ADDR     - set IPv4 netmask via 255.255.255.0 instead of /24
txqueuelen LEN   - number of buffered packets before output blocks
mtu LEN          - size of outgoing packets (Maximum Transmission Unit)
broadcast ADDR   - Set broadcast address
pointopoint ADDR - PPP and PPPOE use this instead of "route add default gw"
hw TYPE ADDR     - set hardware (mac) address (type = ether|infiniband)
rename NEWNAME   - rename interface

Flags you can set on an interface (or -remove by prefixing with -):

arp       - don't use Address Resolution Protocol to map LAN routes
promisc   - don't discard packets that aren't to this LAN hardware address
multicast - force interface into multicast mode if the driver doesn't
allmulti  - promisc for multicast packets

inotifyd

usage: inotifyd PROG FILE[:MASK] ...

When a filesystem event matching MASK occurs to a FILE, run PROG as:

  PROG EVENTS FILE [DIRFILE]

If PROG is "-" events are sent to stdout.

This file is:
  a  accessed    c  modified    e  metadata change  w  closed (writable)
  r  opened      D  deleted     M  moved            0  closed (unwritable)
  u  unmounted   o  overflow    x  unwatchable

A file in this directory is:
  m  moved in    y  moved out   n  created          d  deleted

When x event happens for all FILEs, inotifyd exits (after waiting for PROG).

insmod

usage: insmod MODULE [OPTION...]

Load the module named MODULE passing options if given.

install

usage: install [-dDpsv] [-o USER] [-g GROUP] [-m MODE] [-t TARGET] [SOURCE...] [DEST]

Copy files and set attributes.

-d	Act like mkdir -p
-D	Create leading directories for DEST
-g	Make copy belong to GROUP
-m	Set permissions to MODE
-o	Make copy belong to USER
-p	Preserve timestamps
-s	Call "strip -p"
-t	Copy files to TARGET dir (no DEST)
-v	Verbose

ionice

usage: ionice [-t] [-c CLASS] [-n LEVEL] [COMMAND...|-p PID]

Change the I/O scheduling priority of a process. With no arguments
(or just -p), display process' existing I/O class/priority.

-c	CLASS = 1-3: 1(realtime), 2(best-effort, default), 3(when-idle)
-n	LEVEL = 0-7: (0 is highest priority, default = 5)
-p	Affect existing PID instead of spawning new child
-t	Ignore failure to set I/O priority

System default iopriority is generally -c 2 -n 4.

iorenice

usage: iorenice PID [CLASS] [PRIORITY]

Display or change I/O priority of existing process. CLASS can be
"rt" for realtime, "be" for best effort, "idle" for only when idle, or
"none" to leave it alone. PRIORITY can be 0-7 (0 is highest, default 4).

iotop

usage: iotop [-AaKObq] [-n NUMBER] [-d SECONDS] [-p PID,] [-u USER,]

Rank processes by I/O.

-A	All I/O, not just disk
-a	Accumulated I/O (not percentage)
-H	Show threads
-K	Kilobytes
-k	Fallback sort FIELDS (default -[D]IO,-ETIME,-PID)
-m	Maximum number of tasks to show
-O	Only show processes doing I/O
-o	Show FIELDS (default PID,PR,USER,[D]READ,[D]WRITE,SWAP,[D]IO,COMM)
-s	Sort by field number (0-X, default 6)
-b	Batch mode (no tty)
-d	Delay SECONDS between each cycle (default 3)
-n	Exit after NUMBER iterations
-p	Show these PIDs
-u	Show these USERs
-q	Quiet (no header lines)

Cursor LEFT/RIGHT to change sort, UP/DOWN move list, space to force
update, R to reverse sort, Q to exit.

kill

usage: kill [-l [SIGNAL] | -s SIGNAL | -SIGNAL] PID...

Send signal to process(es).

-l	List signal name(s) and number(s)
-s	Send SIGNAL (default SIGTERM)

killall

usage: killall [-l] [-iqv] [-SIGNAL|-s SIGNAL] PROCESS_NAME...

Send a signal (default: TERM) to all processes with the given names.

-i	Ask for confirmation before killing
-l	Print list of all available signals
-q	Don't print any warnings or error messages
-s	Send SIGNAL instead of SIGTERM
-v	Report if the signal was successfully sent
-w	Wait until all signaled processes are dead

killall5

usage: killall5 [-l [SIGNAL]] [-SIGNAL|-s SIGNAL] [-o PID]...

Send a signal to all processes outside current session.

-l	List signal name(s) and number(s)
-o PID	Omit PID
-s	Send SIGNAL (default SIGTERM)

link

usage: link FILE NEWLINK

Create hardlink to a file.

linux32

usage: linux32 [COMMAND...]

Tell uname -m to lie to autoconf (to build 32 bit binaries on 64 bit kernel).

ln

usage: ln [-fnrsTv] [-t DIR] [FROM...] TO

Create a link between FROM and TO.
One/two/many arguments work like "mv" or "cp".

-f	Force the creation of the link, even if TO already exists
-n	Symlink at TO treated as file
-r	Create relative symlink from -> to
-s	Create a symbolic link
-t	Create links in DIR
-T	TO always treated as file, max 2 arguments
-v	Verbose

logger

usage: logger [-s] [-t TAG] [-p [FACILITY.]PRIORITY] [MESSAGE...]

Log message (or stdin) to syslog.

-s	Also write message to stderr
-t	Use TAG instead of username to identify message source
-p	Specify PRIORITY with optional FACILITY. Default is "user.notice"

login

usage: login [-p] [-h host] [-f USERNAME] [USERNAME]

Log in as a user, prompting for username and password if necessary.

-p	Preserve environment
-h	The name of the remote host for this login
-f	login as USERNAME without authentication

logname

usage: logname

Print the current user name.

losetup

usage: losetup [-cdrs] [-o OFFSET] [-S SIZE] {-d DEVICE...|-j FILE|-af|{DEVICE FILE}}

Associate a loopback device with a file, or show current file (if any)
associated with a loop device.

Instead of a device:
-a	Iterate through all loopback devices
-f	Find first unused loop device (may create one)
-j FILE	Iterate through all loopback devices associated with FILE

existing:
-c	Check capacity (file size changed)
-d DEV	Detach loopback device
-D	Detach all loopback devices

new:
-s	Show device name (alias --show)
-o OFF	Start association at offset OFF into FILE
-r	Read only
-S SIZE	Limit SIZE of loopback association (alias --sizelimit)

ls

usage: ls [-1ACFHLNRSUXZabcdfghilmnopqrstuwx] [--color[=auto]] [FILE...]

List files

what to show:
-A  all files except . and ..      -a  all files including .hidden
-b  escape nongraphic chars        -d  directory, not contents
-F  append /dir *exe @sym |FIFO    -f  files (no sort/filter/format)
-H  follow command line symlinks   -i  inode number
-L  follow symlinks                -N  no escaping, even on tty
-p  put '/' after dir names        -q  unprintable chars as '?'
-R  recursively list in subdirs    -s  storage used (in --block-size)
-Z  security context

output formats:
-1  list one file per line         -C  columns (sorted vertically)
-g  like -l but no owner           -h  human readable sizes
-k  reset --block-size to default  -l  long (show full details)
-m  comma separated                -ll long with nanoseconds (--full-time)
-n  long with numeric uid/gid      -o  long without group column
-r  reverse order                  -w  set column width
-x  columns (horizontal sort)

sort by:  (also --sort=longname,longname... ends with alphabetical)
-c  ctime      -r  reverse    -S  size     -t  time    -u  atime    -U  none
-X  extension  -!  dirfirst   -~  nocase

--block-size N	block size (default 1024, -k resets to 1024)
--color  =always (default)  =auto (when stdout is tty) =never
    exe=green  suid=red  suidfile=redback  stickydir=greenback
    device=yellow  symlink=turquoise/red  dir=blue  socket=purple

Long output uses -cu for display, use -ltc/-ltu to also sort by ctime/atime.

lsattr

usage: lsattr [-Radlpv] [FILE...]

List file attributes on a Linux file system.
Flag letters are defined in chattr help.

-R	Recursively list attributes of directories and their contents
-a	List all files in directories, including files that start with '.'
-d	List directories like other files, rather than listing their contents
-l	List long flag names
-p	List the file's project number
-v	List the file's version/generation number

lsmod

usage: lsmod

Display the currently loaded modules, their sizes and their dependencies.

lspci

usage: lspci [-ekmn] [-i FILE]

List PCI devices.

-e	Extended (6 digit) class
-i	ID database (default /etc/pci.ids[.gz])
-k	Show kernel driver
-m	Machine readable
-n	Numeric output (-nn for both)
-x	Hex dump of config space (64 bytes; -xxx for 256, -xxxx for 4096)

lsusb

usage: lsusb [-i]

List USB hosts/devices.

-i	ID database (default /etc/usb.ids[.gz])

makedevs

usage: makedevs [-d device_table] rootdir

Create a range of special files as specified in a device table.

-d	File containing device table (default reads from stdin)

Each line of the device table has the fields:
         
Where name is the file name, and type is one of the following:

b	Block device
c	Character device
d	Directory
f	Regular file
p	Named pipe (fifo)

Other fields specify permissions, user and group id owning the file,
and additional fields for device special files. Use '-' for blank entries,
unspecified fields are treated as '-'.

mcookie

usage: mcookie [-vV]

Generate a 128-bit strong random number.

-v  show entropy source (verbose)
-V  show version

md5sum

usage: ???sum [-bcs] [FILE]...

Calculate hash for each input file, reading from stdin if none, writing
hexadecimal digits to stdout for each input file (md5=32 hex digits,
sha1=40, sha224=56, sha256=64, sha384=96, sha512=128) followed by filename.

-b	Brief (hash only, no filename)
-c	Check each line of each FILE is the same hash+filename we'd output
-s	No output, exit status 0 if all hashes match, 1 otherwise

memeater

usage: memeater [-M] BYTES

Consume the specified amount of memory and wait to be killed.

-M	Don't mlock() the memory (let it swap out).

microcom

usage: microcom [-s SPEED] [-X] DEVICE

Simple serial console. Hit CTRL-] for menu.

-s	Set baud rate to SPEED (default 115200)
-X	Ignore ^] menu escape

mix

usage: mix [-d DEV] [-c CHANNEL] [-l VOL] [-r RIGHT]

List OSS sound channels (module snd-mixer-oss), or set volume(s).

-c CHANNEL	Set/show volume of CHANNEL (default first channel found)
-d DEV		Device node (default /dev/mixer)
-l VOL		Volume level
-r RIGHT	Volume of right stereo channel (with -r, -l sets left volume)

mkdir

usage: mkdir [-vp] [-m MODE] [DIR...]

Create one or more directories.

-m	Set permissions of directory to mode
-p	Make parent directories as needed
-v	Verbose

mkfifo

usage: mkfifo [NAME...]

Create FIFOs (named pipes).

mknod

usage: mknod [-m MODE] NAME TYPE [MAJOR MINOR]

Create a special file NAME with a given type. TYPE is b for block device,
c or u for character device, p for named pipe (which ignores MAJOR/MINOR).

-m	Mode (file permissions) of new device, in octal or u+x format

mkpasswd

usage: mkpasswd [-P FD] [-m TYPE] [-S SALT] [PASSWORD] [SALT]

Encrypt PASSWORD using crypt(3), with either random or provided SALT.

-P FD	Read password from file descriptor FD
-m TYPE	Encryption method (des, md5, sha256, or sha512; default is des)

mkswap

usage: mkswap [-L LABEL] DEVICE

Set up a Linux swap area on a device or file.

mktemp

usage: mktemp [-dqtu] [-p DIR] [TEMPLATE]

Safely create a new file "DIR/TEMPLATE" and print its name.

-d	Create directory instead of file (--directory)
-p	Put new file in DIR (--tmpdir)
-q	Quiet, no error messages
-t	Prefer $TMPDIR > DIR > /tmp (default DIR > $TMPDIR > /tmp)
-u	Don't create anything, just print what would be created

Each X in TEMPLATE is replaced with a random printable character. The
default TEMPLATE is tmp.XXXXXXXXXX.

modinfo

usage: modinfo [-0] [-b basedir] [-k kernel] [-F field] [module|file...]

Display module fields for modules specified by name or .ko path.

-F  Only show the given field
-0  Separate fields with NUL rather than newline
-b  Use  as root for /lib/modules/
-k  Look in given directory under /lib/modules/

mount

usage: mount [-afFrsvw] [-t TYPE] [-o OPTION,] [[DEVICE] DIR]

Mount new filesystem(s) on directories. With no arguments, display existing
mounts.

-a	Mount all entries in /etc/fstab (with -t, only entries of that TYPE)
-O	Only mount -a entries that have this option
-f	Fake it (don't actually mount)
-r	Read only (same as -o ro)
-w	Read/write (default, same as -o rw)
-t	Specify filesystem type
-v	Verbose

OPTIONS is a comma separated list of options, which can also be supplied
as --longopts.

Autodetects loopback mounts (a file on a directory) and bind mounts (file
on file, directory on directory), so you don't need to say --bind or --loop.
You can also "mount -a /path" to mount everything in /etc/fstab under /path,
even if it's noauto. DEVICE starting with UUID= is identified by blkid -U.

mountpoint

usage: mountpoint [-qd] DIR
       mountpoint [-qx] DEVICE

Check whether the directory or device is a mountpoint.

-q	Be quiet, return zero if directory is a mountpoint
-d	Print major/minor device number of the directory
-x	Print major/minor device number of the block device

mv

usage: mv [-FfinTvx] [-t TARGET] SOURCE... [DEST]

-F	Delete any existing DEST first (--remove-destination)
-f	Force copy by deleting destination file
-i	Interactive, prompt before overwriting existing DEST
-n	No clobber (don't overwrite DEST)
-t	Move to TARGET dir (no DEST)
-T	DEST always treated as file, max 2 arguments
-v	Verbose
-x	Atomically exchange source/dest (--swap)

nbd-client

usage: nbd-client [-ns] [-b BLKSZ] HOST PORT DEVICE

-b	Block size (default 4096)
-n	Do not daemonize
-s	nbd swap support (lock server into memory)

nbd-server

usage: nbd-server [-r] FILE

Serve a Network Block Device from FILE on stdin/out (ala inetd).

-r	Read only export

nc

See netcat

netcat

usage: netcat [-46ELlntUu] [-pqWw #] [-s addr] {IPADDR PORTNUM|-f FILENAME|COMMAND...}

Forward stdin/stdout to a file or network connection.

-4	Force IPv4
-6	Force IPv6
-E	Forward stderr
-f	Use FILENAME (ala /dev/ttyS0) instead of network
-L	Listen and background each incoming connection (server mode)
-l	Listen for one incoming connection, then exit
-n	No DNS lookup
-p	Local port number
-q	Quit SECONDS after EOF on stdin, even if stdout hasn't closed yet
-s	Local source address
-t	Allocate tty
-v	Verbose
-u	Use UDP
-U	Use a UNIX domain socket
-W	SECONDS timeout for more data on an idle connection
-w	SECONDS timeout to establish connection
-z	zero-I/O mode [used for scanning]

When listening the COMMAND line is executed as a child process to handle
an incoming connection. With no COMMAND -l forwards the connection
to stdin/stdout. If no -p specified, -l prints the port it bound to and
backgrounds itself (returning immediately).

For a quick-and-dirty server, try something like:
netcat -s 127.0.0.1 -p 1234 -tL sh -l

Or use "stty 115200 -F /dev/ttyS0 && stty raw -echo -ctlecho" with
netcat -f to connect to a serial port.

netstat

usage: netstat [-pWrxwutneal]

Display networking information. Default is netstat -tuwx

-r	Routing table
-a	All sockets (not just connected)
-l	Listening server sockets
-t	TCP sockets
-u	UDP sockets
-w	Raw sockets
-x	Unix sockets
-e	Extended info
-n	Don't resolve names
-W	Wide display
-p	Show PID/program name of sockets

nice

usage: nice [-n PRIORITY] COMMAND...

Run a command line at an increased or decreased scheduling priority.

Higher numbers make a program yield more CPU time, from -20 (highest
priority) to 19 (lowest).  By default processes inherit their parent's
niceness (usually 0).  By default this command adds 10 to the parent's
priority.  Only root can set a negative niceness level.

-n	Add given adjustment to priority (default 10)

nl

usage: nl [-E] [-l #] [-b MODE] [-n STYLE] [-s SEPARATOR] [-v #] [-w WIDTH] [FILE...]

Number lines of input.

-E	Use extended regex syntax (when doing -b pREGEX)
-b	Which lines to number: a (all) t (non-empty, default) pREGEX (pattern)
-l	Only count last of this many consecutive blank lines
-n	Number STYLE: ln (left justified) rn (right justified) rz (zero pad)
-s	Separator to use between number and line (instead of TAB)
-v	Starting line number for each section (default 1)
-w	Width of line numbers (default 6)

nohup

usage: nohup COMMAND...

Run a command that survives the end of its terminal.

Redirect tty on stdin to /dev/null, tty on stdout to "nohup.out".

nproc

usage: nproc [--all]

Print number of processors.

--all	Show all processors, not just ones this task can run on

nsenter

usage: nsenter [-t pid] [-F] [-i] [-m] [-n] [-p] [-u] [-U] COMMAND...

Run COMMAND in an existing (set of) namespace(s).

-a	Enter all supported namespaces (--all)
-F	don't fork, even if -p is used (--no-fork)
-t	PID to take namespaces from    (--target)

The namespaces to switch are:

-C	Control groups (--cgroup)
-i	SysV IPC: message queues, semaphores, shared memory (--ipc)
-m	Mount/unmount tree (--mount)
-n	Network address, sockets, routing, iptables (--net)
-p	Process IDs and init, will fork unless -F is used (--pid)
-u	Host and domain names (--uts)
-U	UIDs, GIDs, capabilities (--user)

If -t isn't specified, each namespace argument must provide a path
to a namespace file, ala "-i=/proc/$PID/ns/ipc"

od

usage: od [-bcdosxv] [-j #] [-N #] [-w #] [-A doxn] [-t acdfoux[#]]

Dump data in octal/hex.

-A	Address base (decimal, octal, hexadecimal, none)
-j	Skip this many bytes of input
-N	Stop dumping after this many bytes
-t	Output type a(scii) c(har) d(ecimal) f(loat) o(ctal) u(nsigned) (he)x
	plus optional size in bytes
	aliases: -b=-t o1, -c=-t c, -d=-t u2, -o=-t o2, -s=-t d2, -x=-t x2
-v	Don't collapse repeated lines together
-w	Total line width in bytes (default 16)

oneit

usage: oneit [-prn3] [-c CONSOLE] [COMMAND...]

Simple init program that runs a single supplied command line with a
controlling tty (so CTRL-C can kill it).

-c	Which console device to use (/dev/console doesn't do CTRL-C, etc)
-p	Power off instead of rebooting when command exits
-r	Restart child when it exits
-n	No reboot, just relaunch command line
-3	Write 32 bit PID of each exiting reparented process to fd 3 of child
	(Blocking writes, child must read to avoid eventual deadlock.)

Spawns a single child process (because PID 1 has signals blocked)
in its own session, reaps zombies until the child exits, then
reboots the system (or powers off with -p, or restarts the child with -r).

Responds to SIGUSR1 by halting the system, SIGUSR2 by powering off,
and SIGTERM or SIGINT reboot.

openvt

usage: openvt [-c NUM] [-sw] COMMAND...

Run COMMAND on a new virtual terminal.

-c NUM  Use VT NUM
-s    Switch to the new VT
-w    Wait for command to exit (with -s, deallocates VT on exit)

partprobe

usage: partprobe DEVICE...

Tell the kernel about partition table changes

Ask the kernel to re-read the partition table on the specified devices.

paste

usage: paste [-s] [-d DELIMITERS] [FILE...]

Merge corresponding lines from each input file.

-d	List of delimiter characters to separate fields with (default is \t)
-s	Sequential mode: turn each input file into one line of output

patch

usage: patch [-Rlsuv] [-d DIR] [-i FILE] [-p DEPTH] [-F FUZZ] [--dry-run] [FILE [PATCH]]

Apply a unified diff to one or more files.

-d	Modify files in DIR
-F	Fuzz factor (number of non-matching context lines allowed per hunk)
-i	Input patch from FILE (default=stdin)
-l	Loose match (ignore whitespace)
-p	Number of '/' to strip from start of file paths (default=all)
-R	Reverse patch
-s	Silent except for errors
-v	Verbose (-vv to see decisions)
--dry-run Don't change files, just confirm patch applies

Only handles "unified" diff format (-u is assumed and ignored). Only
modifies files when all hunks to that file apply. Prints failed hunks
to stderr, and exits with nonzero status if any hunks fail.

Files compared against /dev/null (or with a date <= the unix epoch) are
created/deleted as appropriate. Default -F value is the number of
leading/trailing context lines minus one (usually 2).

pgrep

usage: pgrep [-clfnovx] [-d DELIM] [-L SIGNAL] [PATTERN] [-G GID,] [-g PGRP,] [-P PPID,] [-s SID,] [-t TERM,] [-U UID,] [-u EUID,]

Search for process(es). PATTERN is an extended regular expression checked
against command names.

-c	Show only count of matches
-d	Use DELIM instead of newline
-L	Send SIGNAL instead of printing name
-l	Show command name
-f	Check full command line for PATTERN
-G	Match real Group ID(s)
-g	Match Process Group(s) (0 is current user)
-n	Newest match only
-o	Oldest match only
-P	Match Parent Process ID(s)
-s	Match Session ID(s) (0 for current)
-t	Match Terminal(s)
-U	Match real User ID(s)
-u	Match effective User ID(s)
-v	Negate the match
-x	Match whole command (not substring)

pidof

usage: pidof [-s] [-o omitpid[,omitpid...]] [NAME...]

Print the PIDs of all processes with the given names.

-o	Omit PID(s)
-s	Single shot, only return one pid
-x	Match shell scripts too

ping

usage: ping [OPTIONS] HOST

Check network connectivity by sending packets to a host and reporting
its response.

Send ICMP ECHO_REQUEST packets to ipv4 or ipv6 addresses and prints each
echo it receives back, with round trip time. Returns true if host alive.

Options:
-4, -6		Force IPv4 or IPv6
-c CNT		Send CNT many packets (default 3, 0 = infinite)
-f		Flood (print . and \b to show drops, default -c 15 -i 0.2)
-i TIME		Interval between packets (default 1, need root for < .2)
-I IFACE/IP	Source interface or address
-m MARK		Tag outgoing packets using SO_MARK
-q		Quiet (stops after one returns true if host is alive)
-s SIZE		Data SIZE in bytes (default 56)
-t TTL		Set Time To Live (number of hops)
-W SEC		Seconds to wait for response after last -c packet (default 3)
-w SEC		Exit after this many seconds

ping6

See ping

pivot_root

usage: pivot_root OLD NEW

Swap OLD and NEW filesystems (as if by simultaneous mount --move), and
move all processes with chdir or chroot under OLD into NEW (including
kernel threads) so OLD may be unmounted.

The directory NEW must exist under OLD. This doesn't work on initramfs,
which can't be moved (about the same way PID 1 can't be killed; see
switch_root instead).

pkill

usage: pkill [-fnovx] [-SIGNAL|-l SIGNAL] [PATTERN] [-G GID,] [-g PGRP,] [-P PPID,] [-s SID,] [-t TERM,] [-U UID,] [-u EUID,]

-l	Send SIGNAL (default SIGTERM)
-V	Verbose
-f	Check full command line for PATTERN
-G	Match real Group ID(s)
-g	Match Process Group(s) (0 is current user)
-n	Newest match only
-o	Oldest match only
-P	Match Parent Process ID(s)
-s	Match Session ID(s) (0 for current)
-t	Match Terminal(s)
-U	Match real User ID(s)
-u	Match effective User ID(s)
-v	Negate the match
-x	Match whole command (not substring)

pmap

usage: pmap [-pqx] PID...

Report the memory map of a process or processes.

-p	Show full paths
-q	Do not show header or footer
-x	Show the extended format

poweroff

See reboot

printenv

usage: printenv [-0] [env_var...]

Print environment variables.

-0	Use \0 as delimiter instead of \n

printf

usage: printf FORMAT [ARGUMENT...]

Format and print ARGUMENT(s) according to FORMAT, using C printf syntax
(% escapes for cdeEfgGiosuxX, \ escapes for abefnrtv0 or \OCTAL or \xHEX).

prlimit

See ulimit

ps

usage: ps [-AadefLlnwZ] [-gG GROUP,] [-k FIELD,] [-o FIELD,] [-p PID,] [-t TTY,] [-uU USER,]

List processes.

Which processes to show (-gGuUpPt selections may be comma separated lists):

-A  All					-a  Has terminal not session leader
-d  All but session leaders		-e  Synonym for -A
-g  In GROUPs				-G  In real GROUPs (before sgid)
-p  PIDs (--pid)			-P  Parent PIDs (--ppid)
-s  In session IDs			-t  Attached to selected TTYs
-T  Show threads also			-u  Owned by selected USERs
-U  Real USERs (before suid)

Output modifiers:

-k  Sort FIELDs (-FIELD to reverse)	-M  Measure/pad future field widths
-n  Show numeric USER and GROUP		-w  Wide output (don't truncate fields)

Which FIELDs to show. (-o HELP for list, default = -o PID,TTY,TIME,CMD)

-f  Full listing (-o USER:12=UID,PID,PPID,C,STIME,TTY,TIME,ARGS=CMD)
-l  Long listing (-o F,S,UID,PID,PPID,C,PRI,NI,ADDR,SZ,WCHAN,TTY,TIME,CMD)
-o  Output FIELDs instead of defaults, each with optional :size and =title
-O  Add FIELDS to defaults
-Z  Include LABEL

pwd

usage: pwd [-L|-P]

Print working (current) directory.

-L	Use shell's path from $PWD (when applicable)
-P	Print canonical absolute path

pwdx

usage: pwdx PID...

Print working directory of processes listed on command line.

pwgen

usage: pwgen [-cAn0yrsBC1v] [-r CHARS] [LENGTH] [COUNT]

Generate human-readable random passwords. Default output to tty fills screen
with passwords to defeat shoulder surfing (pick one and clear the screen).

-0	No numbers (--no-numerals)
-1	Output one per line
-A	No capital letters (--no-capitalize)
-B	Avoid ambiguous characters like 0O and 1lI (--ambiguous)
-C	Output in columns
-c	Add capital letters (--capitalize)
-n	Add numbers (--numerals)
-r	Don't include the given CHARS (--remove)
-v	No vowels.
-y	Add punctuation (--symbols)

readahead

usage: readahead FILE...

Preload files into disk cache.

readelf

usage: readelf [-AadehlnSs] [-p SECTION] [-x SECTION] [file...]

Displays information about ELF files.

-A	Show architecture-specific info
-a	Equivalent to -AdhlnSs
-d	Show dynamic section
-e	Headers (equivalent to -hlS)
-h	Show ELF header
-l	Show program headers
-n	Show notes
-p S	Dump strings found in named/numbered section
-S	Show section headers
-s	Show symbol tables (.dynsym and .symtab)
-x S	Hex dump of named/numbered section

--dyn-syms	Show just .dynsym symbol table

readlink

usage: readlink [-efmnqz] FILE...

With no options, show what symlink points to, return error if not symlink.

Options for producing canonical paths (all symlinks/./.. resolved):

-e	Canonical path to existing entry (fail if missing)
-f	Full path (fail if directory missing)
-m	Ignore missing entries, show where it would be
-n	No trailing newline
-q	Quiet (no error messages)
-z	NUL instead of newline

realpath

usage: realpath [-LPemqsz] [--relative-base DIR] [-R DIR] FILE...

Display the canonical absolute pathname

-R Show ../path relative to DIR (--relative-to)
-L Logical path (resolve .. before symlinks)
-P Physical path (default)
-e Canonical path to existing entry (fail if missing)
-m Ignore missing entries, show where it would be
-q Quiet (no error messages)
-s Don't expand symlinks
-z NUL instead of newline
--relative-base  If path under DIR trim off prefix

reboot

usage: reboot/halt/poweroff [-fn] [-d DELAY]

Restart, halt, or power off the system.

-d	Wait DELAY before proceeding (in seconds or m/h/d suffix: -d 1.5m = 90s)
-f	Force reboot (don't signal init, reboot directly)
-n	Don't sync filesystems before reboot

renice

usage: renice [-gpu] -n INCREMENT ID...

-g	Group ids
-p	Process ids (default)
-u	User ids

reset

usage: reset

Reset the terminal.

rev

usage: rev [FILE...]

Output each line reversed, when no files are given stdin is used.

rfkill

usage: rfkill COMMAND [DEVICE]

Enable/disable wireless devices.

Commands:
list [DEVICE]   List current state
block DEVICE    Disable device
unblock DEVICE  Enable device

DEVICE is an index number, or one of:
all, wlan(wifi), bluetooth, uwb(ultrawideband), wimax, wwan, gps, fm.

rm

usage: rm [-fiRrv] FILE...

Remove each argument from the filesystem.

-f	Force: remove without confirmation, no error if it doesn't exist
-i	Interactive: prompt for confirmation
-rR	Recursive: remove directory contents
-v	Verbose

rmdir

usage: rmdir [-p] [DIR...]

Remove one or more directories.

-p	Remove path
--ignore-fail-on-non-empty	Ignore failures caused by non-empty directories

rmmod

usage: rmmod [-wf] MODULE...

Unload the given kernel modules.

-f	Force unload of a module
-w	Wait until the module is no longer used

rtcwake

usage: rtcwake [-aluv] [-d FILE] [-m MODE] [-s SECS] [-t UNIX]

Enter the given sleep state until the given time.

-a	RTC uses time specified in /etc/adjtime
-d FILE	Device to use (default /dev/rtc)
-l	RTC uses local time
-m	Mode (--list-modes to see those supported by your kernel):
	  standby  S1: default              mem     S3: suspend to RAM
	  disk     S4: suspend to disk      off     S5: power off
	  disable  Cancel current alarm     freeze  stop processes/processors
	  no       just set wakeup time     on      just poll RTC for alarm
	  show     just show current alarm
-s SECS	Wake SECS seconds from now
-t UNIX	Wake UNIX seconds from epoch
-u	RTC uses UTC
-v	Verbose

sed

usage: sed [-inrszE] [-e SCRIPT]...|SCRIPT [-f SCRIPT_FILE]... [FILE...]

Stream editor. Apply editing SCRIPTs to lines of input.

-e	Add SCRIPT to list
-f	Add contents of SCRIPT_FILE to list
-i	Edit each file in place (-iEXT keeps backup file with extension EXT)
-n	No default output (use the p command to output matched lines)
-r	Use extended regular expression syntax
-E	POSIX alias for -r
-s	Treat input files separately (implied by -i)
-z	Use \0 rather than \n as input line separator

A SCRIPT is one or more COMMANDs separated by newlines or semicolons.
All -e SCRIPTs and -f SCRIPT_FILE contents are combined in order as if
separated by newlines. If no -e or -f then first argument is the SCRIPT.

COMMANDs apply to every line unless prefixed with an ADDRESS of the form:

  [ADDRESS[,ADDRESS]][!]COMMAND

ADDRESS is a line number (starting at 1), a /REGULAR EXPRESSION/, or $ for
last line (-s or -i makes it last line of each file). One address matches one
line, ADDRESS,ADDRESS matches from first to second inclusive. Two regexes can
match multiple ranges. ADDRESS,+N ends N lines later. ! inverts the match.

REGULAR EXPRESSIONS start and end with the same character (anything but
backslash or newline). To use the delimiter in the regex escape it with a
backslash, and printf escapes (\abcefnrtv and octal, hex, and unicode) work.
An empty regex repeats the previous one. ADDRESS regexes require any
first delimiter except / to be \escaped to distinguish it from COMMANDs.

Sed reads each line of input, processes it, and writes it out or discards it
before reading the next. Sed can remember one additional line in a separate
buffer (the h, H, g, G, and x commands), and can read the next line of input
early (the n and N commands), but otherwise operates on individual lines.

Each COMMAND starts with a single character. Commands with no arguments are:

  !  Run this command when the ADDRESS _didn't_ match.
  {  Start new command block, continuing until a corresponding "}".
     Command blocks nest and can have ADDRESSes applying to the whole block.
  }  End command block (this COMMAND cannot have an address)
  d  Delete this line and move on to the next one
     (ignores remaining COMMANDs)
  D  Delete one line of input and restart command SCRIPT (same as "d"
     unless you've glued lines together with "N" or similar)
  g  Get remembered line (overwriting current line)
  G  Get remembered line (appending to current line)
  h  Remember this line (overwriting remembered line)
  H  Remember this line (appending to remembered line, if any)
  l  Print line escaping \abfrtvn, octal escape other nonprintng chars,
     wrap lines to terminal width with \, append $ to end of line.
  n  Print default output and read next line over current line (quit at EOF)
  N  Append \n and next line of input to this line. Quit at EOF without
     default output. Advances line counter for ADDRESS and "=".
  p  Print this line
  P  Print this line up to first newline (from "N")
  q  Quit (print default output, no more commands processed or lines read)
  x  Exchange this line with remembered line (overwrite in both directions)
  =  Print the current line number (plus newline)
  #  Comment, ignores rest of this line of SCRIPT (until newline)

Commands that take an argument:

  : LABEL    Target for jump commands
  a TEXT     Append text to output before reading next line
  b LABEL    Branch, jumps to :LABEL (with no LABEL to end of SCRIPT)
  c TEXT     Delete matching ADDRESS range and output TEXT instead
  i TEXT     Insert text (output immediately)
  r FILE     Append contents of FILE to output before reading next line.
  s/S/R/F    Search for regex S replace match with R using flags F. Delimiter
             is anything but \n or \, escape with \ to use in S or R. Printf
             escapes work. Unescaped & in R becomes full matched text, \1
             through \9 = parenthetical subexpression from S. \ at end of
             line appends next line of SCRIPT. The flags in F are:
             [0-9]    A number N, substitute only Nth match
             g        Global, substitute all matches
             i/I      Ignore case when matching
             p        Print resulting line when match found and replaced
             w [file] Write (append) line to file when match replaced
  t LABEL    Test, jump if s/// command matched this line since last test
  T LABEL    Test false, jump to :LABEL only if no s/// found a match
  w FILE     Write (append) line to file
  y/old/new/ Change each character in 'old' to corresponding character
             in 'new' (with standard backslash escapes, delimiter can be
             any repeated character except \ or \n)

The TEXT arguments (to a c i) may end with an unescaped "\" to append
the next line (leading whitespace is not skipped), and treat ";" as a
literal character (use "\;" instead).

seq

usage: seq [-w|-f fmt_str] [-s sep_str] [first] [increment] last

Count from first to last, by increment. Omitted arguments default
to 1. Two arguments are used as first and last. Arguments can be
negative or floating point.

-f	Use fmt_str as a printf-style floating point format string
-s	Use sep_str as separator, default is a newline character
-w	Pad to equal width with leading zeroes

setfattr

usage: setfattr [-h] [-x|-n NAME] [-v VALUE] FILE...

Write POSIX extended attributes.

-h	Do not dereference symlink
-n	Set given attribute
-x	Remove given attribute
-v	Set value for attribute -n (default is empty)

setsid

usage: setsid [-cdw] command [args...]

Run process in a new session.

-d	Detach from tty
-c	Control tty (repeat to steal)
-w	Wait for child (and exit with its status)

sha1sum

See md5sum

sha224sum

See md5sum

sha256sum

See md5sum

sha384sum

See md5sum

sha3sum

usage: sha3sum [-bS] [-a BITS] [FILE...]

Hash function du jour.

-a	Produce a hash BITS long (default 224)
-b	Brief (hash only, no filename)
-S	Use SHAKE termination byte instead of SHA3 (ask FIPS why)

sha512sum

See md5sum

shred

usage: shred [-fuxz] [-n COUNT] [-o OFFSET] [-s SIZE] FILE...

Securely delete a file by overwriting its contents with random data.

-f		Force (chmod if necessary)
-n COUNT	Random overwrite iterations (default 1)
-o OFFSET	Start at OFFSET
-s SIZE		Use SIZE instead of detecting file size
-u		Unlink (actually delete file when done)
-x		Use exact size (default without -s rounds up to next 4k)
-z		Zero at end

Note: data journaling filesystems render this command useless, you must
overwrite all free space (fill up disk) to erase old data on those.

shuf

usage: shuf [-ze] [-n COUNT] [FILE...]

Write lines of input to output in random order.

-z	Input/output lines are NUL terminated.
-n	Stop after COUNT many output lines.
-e	Echo mode: arguments are inputs to shuffle, not files to read.

sleep

usage: sleep DURATION...

Wait before exiting.

DURATION can be a decimal fraction. An optional suffix can be "m"
(minutes), "h" (hours), "d" (days), or "s" (seconds, the default).

sntp

usage: sntp [-saSdDq] [-r SHIFT] [-mM[ADDRESS]] [-p PORT] [SERVER]

Simple Network Time Protocol client. Query SERVER and display time.

-p	Use PORT (default 123)
-s	Set system clock suddenly
-a	Adjust system clock gradually
-S	Serve time instead of querying (bind to SERVER address if specified)
-m	Wait for updates from multicast ADDRESS (RFC 4330 suggests 224.0.1.1)
-M	Multicast server on ADDRESS (RFC 4330 suggests 224.0.1.1)
-t	TTL (multicast only, default 1)
-d	Daemonize (run in background re-querying)
-D	Daemonize but stay in foreground: re-query time every 1000 seconds
-r	Retry shift (every 1<<SHIFT seconds)
-q	Quiet (don't display time)

sort

usage: sort [-CMVbcdfginrsuxz] [FILE...] [-k#[,#[x]] [-t X]] [-o FILE]

Sort all lines of text from input files (or stdin) to stdout.
-g	General numeric sort (double precision with nan and inf)
-n	Numeric order (instead of alphabetical)
-r	Reverse
-u	Unique lines only

-b	Ignore leading blanks (or trailing blanks in second part of key)
-C	Check whether input is sorted
-c	Warn if input is unsorted
-d	Dictionary order (use alphanumeric and whitespace chars only)
-f	Force uppercase (case insensitive sort)
-i	Ignore nonprinting characters
-k	Sort by "key" (see below)
-M	Month sort (jan, feb, etc)
-o	Output to FILE instead of stdout
-s	Skip fallback sort (only sort with keys)
-t	Use a key separator other than whitespace
-x	Hexadecimal numerical sort
-V	Version numbers (name-1.234-rc6.5b.tgz)
-z	Zero (null) terminated lines

Sorting by key looks at a subset of the words on each line. -k2 uses the
second word to the end of the line, -k2,2 looks at only the second word,
-k2,4 looks from the start of the second to the end of the fourth word.
-k2.4,5 starts from the fourth character of the second word, to the end
of the fifth word. Negative values count from the end. Specifying multiple
keys uses the later keys as tie breakers, in order. A type specifier
appended to a sort key (such as -2,2n) applies only to sorting that key.

split

usage: split [-a SUFFIX_LEN] [-b BYTES] [-l LINES] [-n PARTS] [INPUT [OUTPUT]]

Copy INPUT (or stdin) data to a series of OUTPUT (or "x") files with
alphabetically increasing suffix (aa, ab, ac... az, ba, bb...).

-a	Suffix length (default 2)
-b	BYTES/file (10, 10k, 10m, 10g...)
-l	LINES/file (default 1000)
-n	PARTS many equal length files

stat

usage: stat [-tfL] [-c FORMAT] FILE...

Display status of files or filesystems.

-c	Output specified FORMAT string instead of default
-f	Display filesystem status instead of file status
-L	Follow symlinks
-t	terse (-c "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o")
	      (with -f = -c "%n %i %l %t %s %S %b %f %a %c %d")

The valid format escape sequences for files:
%a  Access bits (octal) |%A  Access bits (flags)|%b  Size/512
%B  Bytes per %b (512)  |%C  Security context   |%d  Device ID (dec)
%D  Device ID (hex)     |%f  All mode bits (hex)|%F  File type
%g  Group ID            |%G  Group name         |%h  Hard links
%i  Inode               |%m  Mount point        |%n  Filename
%N  Long filename       |%o  I/O block size     |%s  Size (bytes)
%t  Devtype major (hex) |%T  Devtype minor (hex)|%u  User ID
%U  User name           |%x  Access time        |%X  Access unix time
%y  Modification time   |%Y  Mod unix time      |%z  Creation time
%Z  Creation unix time

The valid format escape sequences for filesystems:
%a  Available blocks    |%b  Total blocks       |%c  Total inodes
%d  Free inodes         |%f  Free blocks        |%i  File system ID
%l  Max filename length |%n  File name          |%s  Best transfer size
%S  Actual block size   |%t  FS type (hex)      |%T  FS type (driver name)

strings

usage: strings [-fo] [-t oxd] [-n LEN] [FILE...]

Display printable strings in a binary file

-f	Show filename
-n	At least LEN characters form a string (default 4)
-o	Show offset (ala -t d)
-t	Show offset type (o=octal, d=decimal, x=hexadecimal)

su

usage: su [-lp] [-u UID] [-g GID,...] [-s SHELL] [-c CMD] [USER [COMMAND...]]

Switch user, prompting for password of new user when not run as root.

With one argument, switch to USER and run user's shell from /etc/passwd.
With no arguments, USER is root. If COMMAND line provided after USER,
exec() it as new USER (bypassing shell). If -u or -g specified, first
argument (if any) isn't USER (it's COMMAND).

first argument is USER name to switch to (which must exist).
Non-root users are prompted for new user's password.

-s	Shell to use (default is user's shell from /etc/passwd)
-c	Command line to pass to -s shell (ala sh -c "CMD")
-l	Reset environment as if new login.
-u	Switch to UID instead of USER
-g	Switch to GID (only root allowed, can be comma separated list)
-p	Preserve environment (except for $PATH and $IFS)

swapoff

usage: swapoff FILE

Disable swapping on a device or file.

swapon

usage: swapon [-d] [-p priority] filename

Enable swapping on a given device/file.

-d	Discard freed SSD pages
-p	Priority (highest priority areas allocated first)

switch_root

usage: switch_root [-c /dev/console] NEW_ROOT NEW_INIT...

Use from PID 1 under initramfs to free initramfs, chroot to NEW_ROOT,
and exec NEW_INIT.

-c	Redirect console to device in NEW_ROOT
-h	Hang instead of exiting on failure (avoids kernel panic)

sync

usage: sync

Write pending cached data to disk (synchronize), blocking until done.

sysctl

usage: sysctl [-aAeNnqw] [-p [FILE] | KEY[=VALUE]...]

Read/write system control data (under /proc/sys).

-a,A	Show all values
-e	Don't warn about unknown keys
-N	Don't print key values
-n	Don't print key names
-p	Read values from FILE (default /etc/sysctl.conf)
-q	Don't show value after write
-w	Only write values (object to reading)

tac

usage: tac [FILE...]

Output lines in reverse order.

tail

usage: tail [-n|c NUMBER] [-f|F] [-s SECONDS] [FILE...]

Copy last lines from files to stdout. If no files listed, copy from
stdin. Filename "-" is a synonym for stdin.

-n	Output the last NUMBER lines (default 10), +X counts from start
-c	Output the last NUMBER bytes, +NUMBER counts from start
-f	Follow FILE(s) by descriptor, waiting for more data to be appended
-F	Follow FILE(s) by filename, waiting for more data, and retrying
-s	Used with -F, sleep SECONDS between retries (default 1)

tar

usage: tar [-cxt] [-fvohmjkOS] [-XTCf NAME] [--selinux] [FILE...]

Create, extract, or list files in a .tar (or compressed t?z) file.

Options:
c  Create                x  Extract               t  Test (list)
f  tar FILE (default -)  C  Change to DIR first   v  Verbose display
J  xz compression        j  bzip2 compression     z  gzip compression
o  Ignore owner          h  Follow symlinks       m  Ignore mtime
O  Extract to stdout     X  exclude names in FILE T  include names in FILE
s  Sort dirs (--sort)

--exclude        FILENAME to exclude  --full-time         Show seconds with -tv
--mode MODE      Adjust permissions   --owner NAME[:UID]  Set file ownership
--mtime TIME     Override timestamps  --group NAME[:GID]  Set file group
--sparse         Record sparse files  --selinux           Save/restore labels
--restrict       All under one dir    --no-recursion      Skip dir contents
--numeric-owner  Use numeric uid/gid, not user/group names
--null           Filenames in -T FILE are null-separated, not newline
--strip-components NUM  Ignore first NUM directory components when extracting
--xform=SED      Modify filenames via SED expression (ala s/find/replace/g)
-I PROG          Filter through PROG to compress or PROG -d to decompress

Filename filter types. Create command line args aren't filtered, extract
defaults to --anchored, --exclude defaults to --wildcards-match-slash,
use no- prefix to disable:

--anchored  Match name not path       --ignore-case       Case insensitive
--wildcards Expand *?[] like shell    --wildcards-match-slash

taskset

usage: taskset [-ap] [mask] [PID | cmd [args...]]

Launch a new task which may only run on certain processors, or change
the processor affinity of an existing PID.

Mask is a hex string where each bit represents a processor the process
is allowed to run on. PID without a mask displays existing affinity.

-p	Set/get the affinity of given PID instead of a new command
-a	Set/get the affinity of all threads of the PID

tee

usage: tee [-ai] [FILE...]

Copy stdin to each listed file, and also to stdout.
Filename "-" is a synonym for stdout.

-a	Append to files
-i	Ignore SIGINT

test

usage: test [-bcdefghkLprSsuwx PATH] [-nz STRING] [-t FD] [X ?? Y]

Return true or false by performing tests. No arguments is false, one argument
is true if not empty string.

--- Tests with a single argument (after the option):
PATH is/has:
  -b  block device   -f  regular file   -p  fifo           -u  setuid bit
  -c  char device    -g  setgid         -r  readable       -w  writable
  -d  directory      -h  symlink        -S  socket         -x  executable
  -e  exists         -L  symlink        -s  nonzero size   -k  sticky bit
STRING is:
  -n  nonzero size   -z  zero size
FD (integer file descriptor) is:
  -t  a TTY

--- Tests with one argument on each side of an operator:
Two strings:
  =  are identical   !=  differ         =~  string matches regex
Alphabetical sort:
     first higher
Two integers:
  -eq  equal         -gt  first > second    -lt  first = second   -le  first <= second

--- Modify or combine tests:
  ! EXPR     not (swap true/false)   EXPR -a EXPR    and (are both true)
  ( EXPR )   evaluate this first     EXPR -o EXPR    or (is either true)

time

usage: time [-pv] COMMAND...

Run command line and report real, user, and system time elapsed in seconds.
(real = clock on the wall, user = cpu used by command's code,
system = cpu used by OS on behalf of command.)

-p	POSIX format output
-v	Verbose

timeout

usage: timeout [-iv] [-k DURATION] [-s SIGNAL] DURATION COMMAND...

Run command line as a child process, sending child a signal if the
command doesn't exit soon enough.

DURATION can be a decimal fraction. An optional suffix can be "m"
(minutes), "h" (hours), "d" (days), or "s" (seconds, the default).

-i	Only kill for inactivity (restart timeout when command produces output)
-k	Send KILL signal if child still running this long after first signal
-s	Send specified signal (default TERM)
-v	Verbose
--foreground       Don't create new process group
--preserve-status  Exit with the child's exit status

top

usage: top [-Hhbq] [-k FIELD,] [-o FIELD,] [-s SORT] [-n NUMBER] [-m LINES] [-d SECONDS] [-p PID,] [-u USER,]

Show process activity in real time.

-H	Show threads
-h	Usage graphs instead of text
-k	Fallback sort FIELDS (default -S,-%CPU,-ETIME,-PID)
-o	Show FIELDS (def PID,USER,PR,NI,VIRT,RES,SHR,S,%CPU,%MEM,TIME+,CMDLINE)
-O	Add FIELDS (replacing PR,NI,VIRT,RES,SHR,S from default)
-s	Sort by field number (1-X, default 9)
-b	Batch mode (no tty)
-d	Delay SECONDS between each cycle (default 3)
-m	Maximum number of tasks to show
-n	Exit after NUMBER iterations
-p	Show these PIDs
-u	Show these USERs
-q	Quiet (no header lines)

Cursor UP/DOWN or LEFT/RIGHT to move list, SHIFT LEFT/RIGHT to change sort,
space to force update, R to reverse sort, Q to exit.

touch

usage: touch [-amch] [-d DATE] [-t TIME] [-r FILE] FILE...

Update the access and modification times of each FILE to the current time.

-a	Change access time
-m	Change modification time
-c	Don't create file
-h	Change symlink
-d	Set time to DATE (in YYYY-MM-DDThh:mm:SS[.frac][tz] format)
-t	Set time to TIME (in [[CC]YY]MMDDhhmm[.ss][frac] format)
-r	Set time same as reference FILE

true

usage: true

Return zero.

truncate

usage: truncate [-c] -s SIZE file...

Set length of file(s), extending sparsely if necessary.

-c	Don't create file if it doesn't exist
-s	New size (with optional prefix and suffix)

SIZE prefix: + add, - subtract,  expand to,
             / multiple rounding down, % multiple rounding up
SIZE suffix: k=1024, m=1024^2, g=1024^3, t=1024^4, p=1024^5, e=1024^6

ts

usage: ts [-is] [FORMAT]

Add timestamps to each line in pipeline. Default format without options
"%b %d %H:%M:%S", with -i or -s "%H:%M:%S".

-i	Incremental (since previous line)
-m	Add milliseconds
-s	Since start

tsort

usage: tsort [FILE]

Topological sort dependency resolver.

Read pairs of input strings indicating before/after dependency relationships
and find an ordering that respects all dependencies. On success output each
string once to stdout, on failure print error and output cycle pairs.

tty

usage: tty [-s]

Show filename of terminal connected to stdin. If none print "not a tty"
and exit with nonzero status.

-s	Silent, exit code only

tunctl

usage: tunctl [-dtT] [-u USER] NAME

Create and delete tun/tap virtual ethernet devices.

-T	Use tap (ethernet frames) instead of tun (ip packets)
-d	Delete tun/tap device
-t	Create tun/tap device
-u	Set owner (user who can read/write device without root access)

uclampset

usage: uclampset [-m MIN] [-M MAX] {-p PID | COMMAND...}

Set or query process utilization limits ranging from 0 to 1024, or -1 to
reset to system default. With no arguments, prints current values.

-m MIN      Reserve at least this much CPU utilization for task
-M MAX      Limit task to at most this much CPU utilization
-p PID	Apply to PID rather than new COMMAND
-R	Reset child processes to default values on fork
-a	Apply to all threads for the given PID

ulimit

usage: ulimit [-P PID] [-SHRacdefilmnpqrstuv] [LIMIT]

Print or set resource limits for process number PID. If no LIMIT specified
(or read-only -ap selected) display current value (sizes in bytes).
Default is ulimit -P $PPID -Sf" (show soft filesize of your shell).

-P  PID to affect (default $PPID)  -a  Show all limits
-S  Set/show soft limit            -H  Set/show hard (maximum) limit

-c  Core file size (blocks)        -d  Process data segment (KiB)
-e  Max scheduling priority        -f  File size (KiB)
-i  Pending signal count           -l  Locked memory (KiB)
-m  Resident Set Size (KiB)        -n  Number of open files
-p  Pipe buffer (512 bytes)        -q  POSIX message queues
-r  Max realtime priority          -R  Realtime latency (us)
-s  Stack size (KiB)               -t  Total CPU time (s)
-u  Maximum processes (this UID)   -v  Virtual memory size (KiB)

umount

usage: umount [-a [-t TYPE[,TYPE...]]] [-vrfD] [DIR...]

Unmount the listed filesystems.

-a	Unmount all mounts in /proc/mounts instead of command line list
-D	Don't free loopback device(s)
-f	Force unmount
-l	Lazy unmount (detach from filesystem now, close when last user does)
-n	Don't use /proc/mounts
-r	Remount read only if unmounting fails
-t	Restrict "all" to mounts of TYPE (or use "noTYPE" to skip)
-v	Verbose

uname

usage: uname [-asnrvmo]

Print system information.

-s	System name
-n	Network (domain) name
-r	Kernel Release number
-v	Kernel Version
-m	Machine (hardware) name
-a	All of the above (in order)

-o	Userspace type

unicode

usage: unicode CODE[-END]...

Convert between Unicode code points and UTF-8, in both directions.
CODE can be one or more characters (show U+XXXX), hex numbers
(show character), or dash separated range.

uniq

usage: uniq [-cduiz] [-w MAXCHARS] [-f FIELDS] [-s CHAR] [INFILE [OUTFILE]]

Report or filter out repeated lines in a file

-c	Show counts before each line
-d	Show only lines that are repeated
-u	Show only lines that are unique
-i	Ignore case when comparing lines
-z	Lines end with \0 not \n
-w	Compare maximum X chars per line
-f	Ignore first X fields
-s	Ignore first X chars

unix2dos

usage: unix2dos [FILE...]

Convert newline format from unix "\n" to dos "\r\n".
If no files listed copy from stdin, "-" is a synonym for stdin.

unlink

usage: unlink FILE

Delete one file.

unshare

usage: unshare [-imnpuUr] COMMAND...

Create new container namespace(s) for this process and its children, allowing
the new set of processes to have a different view of the system than the
parent process.

-a	Unshare all supported namespaces
-f	Fork command in the background (--fork)
-r	Become root (map current euid/egid to 0/0, implies -U) (--map-root-user)

Available namespaces:
-C	Control groups (--cgroup)
-i	SysV IPC (message queues, semaphores, shared memory) (--ipc)
-m	Mount/unmount tree (--mount)
-n	Network address, sockets, routing, iptables (--net)
-p	Process IDs and init (--pid)
-u	Host and domain names (--uts)
-U	UIDs, GIDs, capabilities (--user)

Each namespace can take an optional argument, a persistent mountpoint usable
by the nsenter command to add new processes to that the namespace. (Specify
multiple namespaces to unshare separately, ala -c -i -m because -cim is -c
with persistent mount "im".)

uptime

usage: uptime [-ps]

Tell the current time, how long the system has been running, the number
of users, and the system load averages for the past 1, 5 and 15 minutes.

-p	Pretty (human readable) uptime
-s	Since when has the system been up?

usleep

usage: usleep MICROSECONDS

Pause for MICROSECONDS microseconds.

uudecode

usage: uudecode [-o OUTFILE] [INFILE]

Decode file from stdin (or INFILE).

-o	Write to OUTFILE instead of filename in header

uuencode

usage: uuencode [-m] [INFILE] ENCODE_FILENAME

Uuencode stdin (or INFILE) to stdout, with ENCODE_FILENAME in the output.

-m	Base64

uuidgen

usage: uuidgen

Create and print a new RFC4122 random UUID.

vconfig

usage: vconfig COMMAND [OPTIONS]

Create and remove virtual ethernet devices

add             [interface-name] [vlan_id]
rem             [vlan-name]
set_flag        [interface-name] [flag-num]       [0 | 1]
set_egress_map  [vlan-name]      [skb_priority]   [vlan_qos]
set_ingress_map [vlan-name]      [skb_priority]   [vlan_qos]
set_name_type   [name-type]

vmstat

usage: vmstat [-n] [DELAY [COUNT]]

Print virtual memory statistics, repeating each DELAY seconds, COUNT times.
(With no DELAY, prints one line. With no COUNT, repeats until killed.)

Show processes running and blocked, kilobytes swapped, free, buffered, and
cached, kilobytes swapped in and out per second, file disk blocks input and
output per second, interrupts and context switches per second, percent
of CPU time spent running user code, system code, idle, and awaiting I/O.
First line is since system started, later lines are since last line.

-n	Display the header only once

w

usage: w

Show who is logged on and since how long they logged in.

watch

usage: watch [-tebx] [-n SEC] COMMAND...

Run COMMAND every -n seconds, showing output that fits terminal, q to quit.

-n	Number of seconds between repeats (default 2.0)
-t	Don't print header
-e	Exit on error
-b	Beep on command error
-x	Exec command directly (without "sh -c")

watchdog

usage: watchdog [-F] [-t UPDATE] [-T DEADLINE] DEV

Start the watchdog timer at DEV with optional timeout parameters.

-F	run in the foreground (do not daemonize)
-t	poke watchdog every UPDATE seconds (default 4)
-T	reboot if not poked for DEADLINE seconds (default 60)

wc

usage: wc [-Llwcm] [FILE...]

Count lines, words, and characters in input.

-L	Show max line length
-l	Show lines
-w	Show words
-c	Show bytes
-m	Show characters

By default outputs lines, words, bytes, and filename for each
argument (or from stdin if none). Displays only either bytes
or characters.

wget

usage: wget [OPTIONS]... [URL]
    --max-redirect          maximum redirections allowed
-d, --debug                 print lots of debugging information
-O, --output-document=FILE  specify output filename
-p, --post-data=DATA        send data in body of POST request

examples:
  wget 

which

usage: which [-a] filename ...

Search $PATH for executable files matching filename(s).

-a	Show all matches

who

usage: who

Print information about logged in users.

whoami

See logname

xargs

usage: xargs [-0Pprt] [-snE STR] COMMAND...

Run command line one or more times, appending arguments from stdin.

If COMMAND exits with 255, don't launch another even if arguments remain.

-0	Each argument is NULL terminated, no whitespace or quote processing
-E	Stop at line matching string
-n	Max number of arguments per command
-o	Open tty for COMMAND's stdin (default /dev/null)
-P	Parallel processes (default 1)
-p	Prompt for y/n from tty before running each command
-r	Don't run with empty input (otherwise always run command once)
-s	Size in bytes per command line
-t	Trace, print command line to stderr

xxd

usage: xxd [-eipr] [-cglos N] [file]

Hexdump a file to stdout. If no file is listed, copy from stdin.
Filename "-" is a synonym for stdin.

-c N	Show N bytes per line (default 16)
-e	Little-endian
-g N	Group bytes by adding a ' ' every N bytes (default 2)
-i	Output include file (CSV hex bytes, plus C header/footer if not stdin)
-l N	Limit of N bytes before stopping (default is no limit)
-o N	Add N to display offset
-p	Plain hexdump (30 bytes/line, no grouping. With -c 0 no wrap/group)
-r	Reverse operation: turn a hexdump into a binary file
-s N	Skip to offset N

yes

usage: yes [args...]

Repeatedly output line until killed. If no args, output 'y'.

zcat

usage: zcat [-f] [FILE...]

Decompress files to stdout. Like `gzip -dc`.

-f	Force: allow read from tty

Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.