neulab/tldr huggingface dataset:
$ createdb -T template0 newdb $ pg_restore -d newdb db.dump
Notice we don't use -C, and instead connect directly to the database to be restored into. Also note that we clone the new database from template0 not template1, to ensure it is initially empty.
To reorder database items, it is first necessary to dump the table of contents of the archive:
$ pg_restore -l db.dump > db.list
The listing file consists of a header and one line for each item, e.g.:
; ; Archive created at Mon Sep 14 13:55:39 2009 ;     dbname: DBDEMOS ;     TOC Entries: 81 ;     Compression: 9 ;     Dump Version: 1.10-0 ;     Format: CUSTOM ;     Integer: 4 bytes ;     Offset: 8 bytes ;     Dumped from database version: 8.3.5 ;     Dumped by pg_dump version: 8.3.8 ; ; ; Selected TOC Entries: ; 3; 2615 2200 SCHEMA - public pasha 1861; 0 0 COMMENT - SCHEMA public pasha 1862; 0 0 ACL - public pasha 317; 1247 17715 TYPE public composite pasha 319; 1247 25899 DOMAIN public domain0 pasha
Semicolons start a comment, and the numbers at the start of lines refer to the internal archive ID assigned to each item.
Lines in the file can be commented out, deleted, and reordered. For example:
10; 145433 TABLE map_resolutions postgres ;2; 145344 TABLE species postgres ;4; 145359 TABLE nt_header postgres 6; 145402 TABLE species_records postgres ;8; 145416 TABLE ss_old postgres
could be used as input to pg_restore and would only restore items 10 and 6, in that order:
$ pg_restore -L db.list db.dump
pg_dump(1), pg_dumpall(1), psql(1)
UUDECODE(1P)                POSIX Programmer's Manual               UUDECODE(1P)
uudecode — decode a binary file
uudecode [-o outfile] [file]
The uudecode utility shall read a file, or standard input if no file is specified, that includes data created by the uuencode utility. The uudecode utility shall scan the input file, searching for data compatible with one of the formats specified in uuencode, and attempt to create or overwrite the file described by the data (or overridden by the -o option). The pathname shall be contained in the data or specified by the -o option. The file access permission bits and contents for the file to be produced shall be contained in that data. The mode bits of the created file (other than standard output) shall be set from the file access permission bits contained in the data; that is, other attributes of the mode, including the file mode creation mask (see umask), shall not affect the file being produced. If either of the op characters '+' and '-' (see chmod) are specified in symbolic mode, the initial mode on which those operations are based is unspecified.
If the pathname of the file resolves to an existing file and the user does not have write permission on that file, uudecode shall terminate with an error. If the pathname of the file resolves to an existing file and the user has write permission on that file, the existing file shall be overwritten and, if possible, the mode bits of the file (other than standard output) shall be set as described above; if the mode bits cannot be set, uudecode shall not treat this as an error.
If the input data was produced by uuencode on a system with a different number of bits per byte than on the target system, the results of uudecode are unspecified.
The uudecode utility shall conform to the Base Definitions volume of POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
The following option shall be supported by the implementation:
-o outfile A pathname of a file that shall be used instead of any pathname contained in the input data. Specifying an outfile option- argument of /dev/stdout shall indicate standard output.
file      The pathname of a file containing the output of uuencode.
The input files shall be files containing the output of uuencode.
The following environment variables shall affect the execution of uudecode:
If the file data header encoded by uuencode is - or /dev/stdout, or the -o /dev/stdout option overrides the file data, the standard output shall be in the same format as the file originally encoded by uuencode. Otherwise, the standard output shall not be used.
The output file shall be in the same format as the file originally encoded by uuencode.
The user who is invoking uudecode must have write permission on any file being created.
The output of uuencode is essentially an encoded bit stream that is not cognizant of byte boundaries. It is possible that a 9-bit byte target machine can process input from an 8-bit source, if it is aware of the requirement, but the reverse is unlikely to be satisfying. Of course, the only data that is meaningful for such a transfer between architectures is generally character data.
Input files are not necessarily text files, as stated by an early proposal. Although the uuencode output is a text file, that output could have been wrapped within another file or mail message that is not a text file.
The -o option is not historical practice, but was added at the request of WG15 so that the user could override the target pathname without having to edit the input data itself.
In early drafts, the [-o outfile] option-argument allowed the use of - to mean standard output. The symbol - has only been used previously in POSIX.1‐2008 as a standard input indicator.  The standard developers did not wish to overload the meaning of - in this manner. The /dev/stdout concept exists on most modern systems. The /dev/stdout syntax does not refer to a new special file. It is just a magic cookie to specify standard output.
chmod, umask, uuencode
UUENCODE(1P)                POSIX Programmer's Manual               UUENCODE(1P)
uuencode — encode a binary file
uuencode [-m] [file] decode_pathname
The uuencode utility shall write an encoded version of the named input file, or standard input if no file is specified, to standard output. The output shall be encoded using one of the algorithms described in the STDOUT section and shall include the file access permission bits (in chmod octal or symbolic notation) of the input file and the decode_pathname, for re-creation of the file on another system that conforms to this volume of POSIX.1‐2017.
The uuencode utility shall conform to the Base Definitions volume of POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
-m        Encode the output using the MIME Base64 algorithm described in STDOUT.  If -m is not specified, the historical algorithm described in STDOUT shall be used.
decode_pathname The pathname of the file into which the uudecode utility shall place the decoded file. Specifying a decode_pathname operand of /dev/stdout shall indicate that uudecode is to use standard output. If there are characters in decode_pathname that are not in the portable filename character set the results are unspecified.
file      A pathname of the file to be encoded.
Input files can be files of any type.
The following environment variables shall affect the execution of uuencode:
uuencode Base64 Algorithm The standard output shall be a text file (encoded in the character set of the current locale) that begins with the line:
"begin-base64 %s %s\n", <mode>, <decode_pathname>
and ends with the line:
"====\n"
In both cases, the lines shall have no preceding or trailing <blank> characters.
The encoding process represents 24-bit groups of input bits as output strings of four encoded characters. Proceeding from left to right, a 24-bit input group shall be formed by concatenating three 8-bit input groups. Each 24-bit input group then shall be treated as four concatenated 6-bit groups, each of which shall be translated into a single digit in the Base64 alphabet. When encoding a bit stream via the Base64 encoding, the bit stream shall be presumed to be ordered with the most-significant bit first. That is, the first bit in the stream shall be the high-order bit in the first byte, and the eighth bit shall be the low-order bit in the first byte, and so on. Each 6-bit group is used as an index into an array of 64 printable characters, as shown in Table 4-22, uuencode Base64 Values.
Table 4-22: uuencode Base64 Values
┌──────┬──────────┬┬──────┬──────────┬┬──────┬──────────┬┬──────┬──────────┐ │Value │ Encoding ││Value │ Encoding ││Value │ Encoding ││Value │ Encoding │ ├──────┼──────────┼┼──────┼──────────┼┼──────┼──────────┼┼──────┼──────────┤ │  0   │    A     ││ 17   │    R     ││ 34   │    i     ││ 51   │    z     │ │  1   │    B     ││ 18   │    S     ││ 35   │    j     ││ 52   │    0     │ │  2   │    C     ││ 19   │    T     ││ 36   │    k     ││ 53   │    1     │ │  3   │    D     ││ 20   │    U     ││ 37   │    l     ││ 54   │    2     │ │  4   │    E     ││ 21   │    V     ││ 38   │    m     ││ 55   │    3     │ │  5   │    F     ││ 22   │    W     ││ 39   │    n     ││ 56   │    4     │ │  6   │    G     ││ 23   │    X     ││ 40   │    o     ││ 57   │    5     │ │  7   │    H     ││ 24   │    Y     ││ 41   │    p     ││ 58   │    6     │ │  8   │    I     ││ 25   │    Z     ││ 42   │    q     ││ 59   │    7     │ │  9   │    J     ││ 26   │    a     ││ 43   │    r     ││ 60   │    8     │ │ 10   │    K     ││ 27   │    b     ││ 44   │    s     ││ 61   │    9     │ │ 11   │    L     ││ 28   │    c     ││ 45   │    t     ││ 62   │    +     │ │ 12   │    M     ││ 29   │    d     ││ 46   │    u     ││ 63   │    /     │ │ 13   │    N     ││ 30   │    e     ││ 47   │    v     ││      │          │ │ 14   │    O     ││ 31   │    f     ││ 48   │    w     ││(pad) │    =     │ │ 15   │    P     ││ 32   │    g     ││ 49   │    x     ││      │          │ │ 16   │    Q     ││ 33   │    h     ││ 50   │    y     ││      │          │ └──────┴──────────┴┴──────┴──────────┴┴──────┴──────────┴┴──────┴──────────┘ The character referenced by the index shall be placed in the output string.
The output stream (encoded bytes) shall be represented in lines of no more than 76 characters each. All line breaks or other characters not found in the table shall be ignored by decoding software (see uudecode).
Special processing shall be performed if fewer than 24 bits are available at the end of a message or encapsulated part of a message. A full encoding quantum shall always be completed at the end of a message. When fewer than 24 input bits are available in an input group, zero bits shall be added (on the right) to form an integral number of 6-bit groups. Output character positions that are not required to represent actual input data shall be set to the character '='.  Since all Base64 input is an integral number of octets, only the following cases can arise:
1. The final quantum of encoding input is an integral multiple of 24 bits; here, the final unit of encoded output shall be an integral multiple of 4 characters with no '=' padding.
2. The final quantum of encoding input is exactly 16 bits; here, the final unit of encoded output shall be three characters followed by one '=' padding character.
3. The final quantum of encoding input is exactly 8 bits; here, the final unit of encoded output shall be two characters followed by two '=' padding characters.
A terminating "====" evaluates to nothing and denotes the end of the encoded data.
uuencode Historical Algorithm The standard output shall be a text file (encoded in the character set of the current locale) that begins with the line:
"begin %s %s\n" <mode>, <decode_pathname>
"end\n"
The algorithm that shall be used for lines in between begin and end takes three octets as input and writes four characters of output by splitting the input at six-bit intervals into four octets, containing data in the lower six bits only. These octets shall be converted to characters by adding a value of 0x20 to each octet, so that each octet is in the range [0x20,0x5f], and then it shall be assumed to represent a printable character in the ISO/IEC 646:1991 standard encoded character set. It then shall be translated into the corresponding character codes for the codeset in use in the current locale. (For example, the octet 0x41, representing 'A', would be translated to 'A' in the current codeset, such as 0xc1 if it were EBCDIC.)
Where the bits of two octets are combined, the least significant bits of the first octet shall be shifted left and combined with the most significant bits of the second octet shifted right. Thus the three octets A, B, C shall be converted into the four octets:
0x20 + (( A >> 2                    ) & 0x3F) 0x20 + (((A << 4) | ((B >> 4) & 0xF)) & 0x3F) 0x20 + (((B << 2) | ((C >> 6) & 0x3)) & 0x3F) 0x20 + (( C                         ) & 0x3F)
These octets then shall be translated into the local character set.
Each encoded line contains a length character, equal to the number of characters to be decoded plus 0x20 translated to the local character set as described above, followed by the encoded characters. The maximum number of octets to be encoded on each line shall be 45.
The file is expanded by 35 percent (each three octets become four, plus control information) causing it to take longer to transmit.
Since this utility is intended to create files to be used for data interchange between systems with possibly different codesets, and to represent binary data as a text file, the ISO/IEC 646:1991 standard was chosen for a midpoint in the algorithm as a known reference point. The output from uuencode is a text file on the local system. If the output were in the ISO/IEC 646:1991 standard codeset, it might not be a text file (at least because the <newline> characters might not match), and the goal of creating a text file would be defeated. If this text file was then carried to another machine with the same codeset, it would be perfectly compatible with that system's uudecode.  If it was transmitted over a mail system or sent to a machine with a different codeset, it is assumed that, as for every other text file, some translation mechanism would convert it (by the time it reached a user on the other system) into an appropriate codeset. This translation only makes sense from the local codeset, not if the file has been put into a ISO/IEC 646:1991 standard representation first. Similarly, files processed by uuencode can be placed in pax archives, intermixed with other text files in the same codeset.
A new algorithm was added at the request of the international community to parallel work in RFC 2045 (MIME). As with the historical uuencode format, the Base64 Content-Transfer-Encoding is designed to represent arbitrary sequences of octets in a form that is not humanly readable. A 65-character subset of the ISO/IEC 646:1991 standard is used, enabling 6 bits to be represented per printable character. (The extra 65th character, '=', is used to signify a special processing function.)
This subset has the important property that it is represented identically in all versions of the ISO/IEC 646:1991 standard, including US ASCII, and all characters in the subset are also represented identically in all versions of EBCDIC. The historical uuencode algorithm does not share this property, which is the reason that a second algorithm was added to the ISO POSIX‐2 standard.
The string "====" was used for the termination instead of the end used in the original format because the latter is a string that could be valid encoded input.
In an early draft, the -m option was named -b (for Base64), but it was renamed to reflect its relationship to the RFC 2045. A -u was also present to invoke the default algorithm, but since this was not historical practice, it was omitted as being unnecessary.
See the RATIONALE section in uudecode for the derivation of the /dev/stdout symbol.
chmod, mailx, uudecode
NETSTAT(8)             Linux System Administrator's Manual            NETSTAT(8)
netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
netstat [address_family_options] [--tcp|-t] [--udp|-u] [--udplite|-U] [--sctp|-S] [--raw|-w] [--l2cap|-2] [--rfcomm|-f] [--listening|-l] [--all|-a] [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--symbolic|-N] [--extend|-e[--extend|-e]] [--timers|-o] [--program|-p] [--verbose|-v] [--continuous|-c] [--wide|-W]
netstat {--route|-r} [address_family_options] [--extend|-e[--extend|-e]] [--verbose|-v] [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--continuous|-c]
netstat {--interfaces|-i} [--all|-a] [--extend|-e[--extend|-e]] [--verbose|-v] [--program|-p] [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--continuous|-c]
netstat {--groups|-g} [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--continuous|-c]
netstat {--masquerade|-M} [--extend|-e] [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--continuous|-c]
netstat {--statistics|-s} [--tcp|-t] [--udp|-u] [--udplite|-U] [--sctp|-S] [--raw|-w]
netstat {--version|-V}
netstat {--help|-h}
address_family_options:
[-4|--inet] [-6|--inet6] [--protocol={inet,inet6,unix,ipx,ax25,netrom,ddp,bluetooth, ... } ] [--unix|-x] [--inet|--ip|--tcpip] [--ax25] [--x25] [--rose] [--ash] [--bluetooth] [--ipx] [--netrom] [--ddp|--appletalk] [--econet|--ec]
This program is mostly obsolete.  Replacement for netstat is ss. Replacement for netstat -r is ip route.  Replacement for netstat -i is ip -s link.  Replacement for netstat -g is ip maddr.
Netstat prints information about the Linux networking subsystem.  The type of information printed is controlled by the first argument, as follows:
(none) By default, netstat displays a list of open sockets.  If you don't specify any address families, then the active sockets of all configured address families will be printed.
--route, -r Display the kernel routing tables. See the description in route(8) for details.  netstat -r and route -e produce the same output.
--groups, -g Display multicast group membership information for IPv4 and IPv6.
--interfaces, -i Display a table of all network interfaces.
--masquerade, -M Display a list of masqueraded connections.
--statistics, -s Display summary statistics for each protocol.
--verbose, -v Tell the user what is going on by being verbose. Especially print some useful information about unconfigured address families.
--wide, -W Do not truncate IP addresses by using output as wide as needed. This is optional for now to not break existing scripts.
--numeric, -n Show numerical addresses instead of trying to determine symbolic host, port or user names.
--numeric-hosts shows numerical host addresses but does not affect the resolution of port or user names.
--numeric-ports shows numerical port numbers but does not affect the resolution of host or user names.
--numeric-users shows numerical user IDs but does not affect the resolution of host or port names.
--protocol=family, -A Specifies the address families (perhaps better described as low level protocols) for which connections are to be shown.  family is a comma (',') separated list of address family keywords like inet, inet6, unix, ipx, ax25, netrom, econet, ddp, and bluetooth.  This has the same effect as using the --inet|-4, --inet6|-6, --unix|-x, --ipx, --ax25, --netrom, --ddp, and --bluetooth options.
The address family inet (Iv4) includes raw, udp, udplite and tcp protocol sockets.
The address family bluetooth (Iv4) includes l2cap and rfcomm protocol sockets.
-c, --continuous This will cause netstat to print the selected information every second continuously.
-e, --extend Display additional information.  Use this option twice for maximum detail.
-o, --timers Include information related to networking timers.
-p, --program Show the PID and name of the program to which each socket belongs.  A hyphen is shown if the socket belongs to the kernel (e.g. a kernel service, or the process has exited but the socket hasn't finished closing yet).
-l, --listening Show only listening sockets.  (These are omitted by default.)
-a, --all Show both listening and non-listening sockets.  With the --interfaces option, show interfaces that are not up
-F Print routing information from the FIB.  (This is the default.)
-C Print routing information from the route cache.
Active Internet connections (TCP, UDP, UDPLite, raw) Proto The protocol (tcp, udp, udpl, raw) used by the socket.
Recv-Q Established: The count of bytes not copied by the user program connected to this socket.  Listening: Since Kernel 2.6.18 this column contains the current syn backlog.
Send-Q Established: The count of bytes not acknowledged by the remote host. Listening: Since Kernel 2.6.18 this column contains the maximum size of the syn backlog.
Local Address Address and port number of the local end of the socket.  Unless the --numeric (-n) option is specified, the socket address is resolved to its canonical host name (FQDN), and the port number is translated into the corresponding service name.
Foreign Address Address and port number of the remote end of the socket.  Analogous to "Local Address".
State The state of the socket. Since there are no states in raw mode and usually no states used in UDP and UDPLite, this column may be left blank. Normally this can be one of several values:
ESTABLISHED The socket has an established connection.
SYN_SENT The socket is actively attempting to establish a connection.
SYN_RECV A connection request has been received from the network.
FIN_WAIT1 The socket is closed, and the connection is shutting down.
FIN_WAIT2 Connection is closed, and the socket is waiting for a shutdown from the remote end.
TIME_WAIT The socket is waiting after close to handle packets still in the network.
CLOSE  The socket is not being used.
CLOSE_WAIT The remote end has shut down, waiting for the socket to close.
LAST_ACK The remote end has shut down, and the socket is closed. Waiting for acknowledgement.
LISTEN The socket is listening for incoming connections.  Such sockets are not included in the output unless you specify the --listening (-l) or --all (-a) option.
CLOSING Both sockets are shut down but we still don't have all our data sent.
UNKNOWN The state of the socket is unknown.
User The username or the user id (UID) of the owner of the socket.
PID/Program name Slash-separated pair of the process id (PID) and process name of the process that owns the socket.  --program causes this column to be included.  You will also need superuser privileges to see this information on sockets you don't own.  This identification information is not yet available for IPX sockets.
Timer TCP timer associated with this socket. The format is timer(a/b/c).  The timer is one of the following values:
off    There is no timer set for this socket.
on     The retransmission timer is active for the socket.
keepalive The keepalive timer is active for the socket.
timewait The connection is closing and the timewait timer is active for the socket.
The values in the brackets:
a      Timer value.
b      Number of retransmissions sent.
c      Number of keepalives sent.
Active UNIX domain Sockets Proto The protocol (usually unix) used by the socket.
RefCnt The reference count (i.e. attached processes via this socket).
Flags The flags displayed is SO_ACCEPTON (displayed as ACC), SO_WAITDATA (W) or SO_NOSPACE (N).  SO_ACCECPTON is used on unconnected sockets if their corresponding processes are waiting for a connect request. The other flags are not of normal interest.
Type There are several types of socket access:
SOCK_DGRAM The socket is used in Datagram (connectionless) mode.
SOCK_STREAM This is a stream (connection) socket.
SOCK_RAW The socket is used as a raw socket.
SOCK_RDM This one serves reliably-delivered messages.
SOCK_SEQPACKET This is a sequential packet socket.
SOCK_PACKET Raw interface access socket.
UNKNOWN Who ever knows what the future will bring us - just fill in here :-)
State This field will contain one of the following Keywords:
FREE   The socket is not allocated
LISTENING The socket is listening for a connection request.  Such sockets are only included in the output if you specify the --listening (-l) or --all (-a) option.
CONNECTING The socket is about to establish a connection.
CONNECTED The socket is connected.
DISCONNECTING The socket is disconnecting.
(empty) The socket is not connected to another one.
UNKNOWN This state should never happen.
PID/Program name Process ID (PID) and process name of the process that has the socket open.  More info available in Active Internet connections section written above.
Path This is the path name as which the corresponding processes attached to the socket.
Active IPX sockets (this needs to be done by somebody who knows it)
Active NET/ROM sockets (this needs to be done by somebody who knows it)
Active AX.25 sockets (this needs to be done by somebody who knows it)
/etc/services -- The services translation file
/proc -- Mount point for the proc filesystem, which gives access to kernel status information via the following files.
/proc/net/dev -- device information
/proc/net/raw -- raw socket information
/proc/net/tcp -- TCP socket information
/proc/net/udp -- UDP socket information
/proc/net/udplite -- UDPLite socket information
/proc/net/igmp -- IGMP multicast information
/proc/net/unix -- Unix domain socket information
/proc/net/ipx -- IPX socket information
/proc/net/ax25 -- AX25 socket information
/proc/net/appletalk -- DDP (appletalk) socket information
/proc/net/nr -- NET/ROM socket information
/proc/net/route -- IP routing information
/proc/net/ax25_route -- AX25 routing information
/proc/net/ipx_route -- IPX routing information
/proc/net/nr_nodes -- NET/ROM nodelist
/proc/net/nr_neigh -- NET/ROM neighbours
/proc/net/ip_masquerade -- masqueraded connections
/sys/kernel/debug/bluetooth/l2cap -- Bluetooth L2CAP information
/sys/kernel/debug/bluetooth/rfcomm -- Bluetooth serial connections
/proc/net/snmp -- statistics
route(8), ifconfig(8), iptables(8), proc(5), ss(8), ip(8)
Occasionally strange information may appear if a socket changes as it is viewed. This is unlikely to occur.
The netstat user interface was written by Fred Baumgarten <dc6iq@insu1.etec.uni-karlsruhe.de>, the man page basically by Matt Welsh <mdw@tc.cornell.edu>. It was updated by Alan Cox <Alan.Cox@linux.org>, updated again by Tuan Hoang <tqhoang@bigfoot.com>. The man page and the command included in the net-tools package is totally rewritten by Bernd Eckenfels <ecki@linux.de>.  UDPLite options were added by Brian Micek <bmicek@gmail.com>
WHICH(1)                     General Commands Manual                    WHICH(1)
which - shows the full path of (shell) commands.
which [options] [--] programname [...]
Which takes one or more arguments. For each of its arguments it prints to stdout the full path of the executables that would have been executed when this argument had been entered at the shell prompt. It does this by searching for an executable or script in the directories listed in the environment variable PATH using the same algorithm as bash(1).
This man page is generated from the file which.texinfo.
--all, -a Print all matching executables in PATH, not just the first.
--read-alias, -i Read aliases from stdin, reporting matching ones on stdout. This is useful in combination with using an alias for which itself. For example alias which=´alias | which -i´.
--skip-alias Ignore option `--read-alias´, if any. This is useful to explicity search for normal binaries, while using the `--read-alias´ option in an alias or function for which.
--read-functions Read shell function definitions from stdin, reporting matching ones on stdout. This is useful in combination with using a shell function for which itself.  For example: which() { declare -f | which --read-functions $@ } export -f which
--skip-functions Ignore option `--read-functions´, if any. This is useful to explicity search for normal binaries, while using the `--read-functions´ option in an alias or function for which.
--skip-dot Skip directories in PATH that start with a dot.
--skip-tilde Skip directories in PATH that start with a tilde and executables which reside in the HOME directory.
--show-dot If a directory in PATH starts with a dot and a matching executable was found for that path, then print "./programname" rather than the full path.
--show-tilde Output a tilde when a directory matches the HOME directory. This option is ignored when which is invoked as root.
--tty-only Stop processing options on the right if not on tty.
--version,-v,-V Print version information on standard output then exit successfully.
--help Print usage information on standard output then exit successfully.
Which returns the number of failed arguments, or -1 when no `programname´ was given.
The recommended way to use this utility is by adding an alias (C shell) or shell function (Bourne shell) for which like the following:
[ba]sh:
which () { (alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ } export -f which
[t]csh:
alias which ´alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde´
This will print the readable ~/ and ./ when starting which from your prompt, while still printing the full path when used from a script:
> which q2 ~/bin/q2 > echo `which q2` /home/carlo/bin/q2
The HOME directory is determined by looking for the HOME environment variable, which aborts when this variable doesn´t exist.  Which will consider two equivalent directories to be different when one of them contains a path with a symbolic link.
Carlo Wood <carlo@gnu.org>
Clamd client(1)                  Clam AntiVirus                  Clamd client(1)
clamdscan - scan files and directories for viruses using Clam AntiVirus Daemon
clamdscan [options] [file/directory]
clamdscan is a clamd client which may be used as a clamscan replacement. It accepts all the options implemented in clamscan but most of them will be ignored because its scanning abilities only depend on clamd.
--quiet Be quiet - only output error messages.
--config-file=FILE Read clamd settings from FILE.
-l FILE, --log=FILE Save the scan report to FILE.
-p A[:I], --ping A[:I] Ping clamd up to [A] times at optional interval [I] until it responds.
-w, --wait Wait up to 30 seconds for clamd to start. Optionally use alongside ping to set attempts [A] and interval [I] to check clamd.
-m, --multiscan In the multiscan mode clamd will attempt to scan the directory contents in parallel using available threads. This option is especially useful on multiprocessor and multi-core systems. If you pass more than one file or directory in the command line, they are put in a queue and sent to clamd individually. This means, that single files are always scanned by a single thread. Similarly, clamdscan will wait for clamd to finish a directory scan (performed in multiscan mode) before sending request to scan another directory. This option can be combined with --fdpass (see below).
--remove Remove infected files. Be careful.
--move=DIRECTORY Move infected files into DIRECTORY.
--copy=DIRECTORY Copy infected files into DIRECTORY.
--reload Request clamd to reload virus database.
--allmatch Continue scanning within file after finding a match.
--fdpass Pass the file descriptor permissions to clamd. This is useful if clamd is running as a different user as it is faster than streaming the file to clamd.  Only available if connected to clamd via local(unix) socket.
--stream Forces file streaming to clamd. This is generally not needed as clamdscan detects automatically if streaming is required. This option only exists for debugging and testing purposes, in all other cases --fdpass is preferred.
(0) To scan a one file:
clamdscan file
(1) To scan a current working directory:
clamdscan
(2) To scan all files in /home:
clamdscan /home
(3) To scan a file when clamd is running as a different user:
clamdscan --fdpass ~/downloads
(4) To scan from standard input:
clamdscan - < file_to_scan
cat file_to_scan | clamdscan -
2 : An error occurred.
Tomasz Kojm <tkojm@clamav.net>
clamd(8), clamd.conf(5), clamscan(1)
VGDISPLAY(8)                 System Manager's Manual                VGDISPLAY(8)
vgdisplay â€” Display volume group information
vgdisplay [ option_args ] [ position_args ]
vgdisplay shows the attributes of VGs, and the associated PVs and LVs.
vgs(8) is a preferred alternative that shows the same information and more, using a more compact and configurable output format.
vgdisplay [ -A|--activevolumegroups ] [ -c|--colon ] [ -C|--columns ] [ -o|--options String ] [ -S|--select String ] [ -s|--short ] [ -O|--sort String ] [    --aligned ] [    --binary ] [    --configreport log|vg|lv|pv|pvseg|seg ] [    --foreign ] [    --ignorelockingfailure ] [    --logonly ] [    --noheadings ] [    --nosuffix ] [    --readonly ] [    --reportformat basic|json ] [    --shared ] [    --separator String ] [    --unbuffered ] [    --units [Number]r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] [ COMMON_OPTIONS ] [ VG|Tag ... ]
-A|--activevolumegroups Only select active VGs. The VG is considered active if at least one of its LVs is active.
-s|--short Give a short listing showing the existence of VGs.
AT(1P)                      POSIX Programmer's Manual                     AT(1P)
at — execute commands at a later time
at [-m] [-f file] [-q queuename] -t time_arg
at [-m] [-f file] [-q queuename] timespec...
at -r at_job_id...
at -l -q queuename
at -l [at_job_id...]
The at utility shall read commands from standard input and group them together as an at-job, to be executed at a later time.
The at-job shall be executed in a separate invocation of the shell, running in a separate process group with no controlling terminal, except that the environment variables, current working directory, file creation mask, and other implementation-defined execution-time attributes in effect when the at utility is executed shall be retained and used when the at-job is executed.
When the at-job is submitted, the at_job_id and scheduled time shall be written to standard error. The at_job_id is an identifier that shall be a string consisting solely of alphanumeric characters and the <period> character. The at_job_id shall be assigned by the system when the job is scheduled such that it uniquely identifies a particular job.
User notification and the processing of the job's standard output and standard error are described under the -m option.
Users shall be permitted to use at if their name appears in the file at.allow which is located in an implementation-defined directory.  If that file does not exist, the file at.deny, which is located in an implementation-defined directory, shall be checked to determine whether the user shall be denied access to at.  If neither file exists, only a process with appropriate privileges shall be allowed to submit a job. If only at.deny exists and is empty, global usage shall be permitted. The at.allow and at.deny files shall consist of one user name per line.
The at utility shall conform to the Base Definitions volume of POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
-f file   Specify the pathname of a file to be used as the source of the at-job, instead of standard input.
-l        (The letter ell.) Report all jobs scheduled for the invoking user if no at_job_id operands are specified. If at_job_ids are specified, report only information for these jobs. The output shall be written to standard output.
-m        Send mail to the invoking user after the at-job has run, announcing its completion. Standard output and standard error produced by the at-job shall be mailed to the user as well, unless redirected elsewhere. Mail shall be sent even if the job produces no output.
If -m is not used, the job's standard output and standard error shall be provided to the user by means of mail, unless they are redirected elsewhere; if there is no such output to provide, the implementation need not notify the user of the job's completion.
-q queuename Specify in which queue to schedule a job for submission. When used with the -l option, limit the search to that particular queue. By default, at-jobs shall be scheduled in queue a.  In contrast, queue b shall be reserved for batch jobs; see batch. The meanings of all other queuenames are implementation- defined. If -q is specified along with either of the -t time_arg or timespec arguments, the results are unspecified.
-r        Remove the jobs with the specified at_job_id operands that were previously scheduled by the at utility.
-t time_arg Submit the job to be run at the time specified by the time option-argument, which the application shall ensure has the format as specified by the touch -t time utility.
at_job_id The name reported by a previous invocation of the at utility at the time the job was scheduled.
timespec  Submit the job to be run at the date and time specified. All of the timespec operands are interpreted as if they were separated by <space> characters and concatenated, and shall be parsed as described in the grammar at the end of this section. The date and time shall be interpreted as being in the timezone of the user (as determined by the TZ variable), unless a timezone name appears as part of time, below.
In the POSIX locale, the following describes the three parts of the time specification string. All of the values from the LC_TIME categories in the POSIX locale shall be recognized in a case-insensitive manner.
time      The time can be specified as one, two, or four digits. One-digit and two-digit numbers shall be taken to be hours; four-digit numbers to be hours and minutes. The time can alternatively be specified as two numbers separated by a <colon>, meaning hour:minute. An AM/PM indication (one of the values from the am_pm keywords in the LC_TIME locale category) can follow the time; otherwise, a 24-hour clock time shall be understood. A timezone name can also follow to further qualify the time. The acceptable timezone names are implementation-defined, except that they shall be case-insensitive and the string utc is supported to indicate the time is in Coordinated Universal Time.  In the POSIX locale, the time field can also be one of the following tokens:
midnight  Indicates the time 12:00 am (00:00).
noon      Indicates the time 12:00 pm.
now       Indicates the current day and time. Invoking at <now> shall submit an at-job for potentially immediate execution (that is, subject only to unspecified scheduling delays).
date      An optional date can be specified as either a month name (one of the values from the mon or abmon keywords in the LC_TIME locale category) followed by a day number (and possibly year number preceded by a comma), or a day of the week (one of the values from the day or abday keywords in the LC_TIME locale category). In the POSIX locale, two special days shall be recognized:
today     Indicates the current day.
tomorrow  Indicates the day following the current day.
If no date is given, today shall be assumed if the given time is greater than the current time, and tomorrow shall be assumed if it is less. If the given month is less than the current month (and no year is given), next year shall be assumed.
increment The optional increment shall be a number preceded by a <plus-sign> ('+') and suffixed by one of the following: minutes, hours, days, weeks, months, or years.  (The singular forms shall also be accepted.) The keyword next shall be equivalent to an increment number of +1. For example, the following are equivalent commands:
at 2pm + 1 week at 2pm next week
The following grammar describes the precise format of timespec in the POSIX locale. The general conventions for this style of grammar are described in Section 1.3, Grammar Conventions.  This formal syntax shall take precedence over the preceding text syntax description. The longest possible token or delimiter shall be recognized at a given point. When used in a timespec, white space shall also delimit tokens.
%token hr24clock_hr_min %token hr24clock_hour /* An hr24clock_hr_min is a one, two, or four-digit number. A one-digit or two-digit number constitutes an hr24clock_hour. An hr24clock_hour may be any of the single digits [0,9], or may be double digits, ranging from [00,23]. If an hr24clock_hr_min is a four-digit number, the first two digits shall be a valid hr24clock_hour, while the last two represent the number of minutes, from [00,59]. */
%token wallclock_hr_min %token wallclock_hour /* A wallclock_hr_min is a one, two-digit, or four-digit number. A one-digit or two-digit number constitutes a wallclock_hour. A wallclock_hour may be any of the single digits [1,9], or may be double digits, ranging from [01,12]. If a wallclock_hr_min is a four-digit number, the first two digits shall be a valid wallclock_hour, while the last two represent the number of minutes, from [00,59]. */
%token minute /* A minute is a one or two-digit number whose value can be [0,9] or [00,59]. */
%token day_number /* A day_number is a number in the range appropriate for the particular month and year specified by month_name and year_number, respectively. If no year_number is given, the current year is assumed if the given date and time are later this year. If no year_number is given and the date and time have already occurred this year and the month is not the current month, next year is the assumed year. */
%token year_number /* A year_number is a four-digit number representing the year A.D., in which the at_job is to be run. */
%token inc_number /* The inc_number is the number of times the succeeding increment period is to be added to the specified date and time. */
%token timezone_name /* The name of an optional timezone suffix to the time field, in an implementation-defined format. */
%token month_name /* One of the values from the mon or abmon keywords in the LC_TIME locale category. */
%token day_of_week /* One of the values from the day or abday keywords in the LC_TIME locale category. */
%token am_pm /* One of the values from the am_pm keyword in the LC_TIME locale category. */
%start timespec %% timespec    : time | time date | time increment | time date increment | nowspec ;
nowspec     : "now" | "now" increment ;
time        : hr24clock_hr_min | hr24clock_hr_min timezone_name | hr24clock_hour ":" minute | hr24clock_hour ":" minute timezone_name | wallclock_hr_min am_pm | wallclock_hr_min am_pm timezone_name | wallclock_hour ":" minute am_pm | wallclock_hour ":" minute am_pm timezone_name | "noon" | "midnight" ;
date        : month_name day_number | month_name day_number "," year_number | day_of_week | "today" | "tomorrow" ;
increment   : "+" inc_number inc_period | "next" inc_period ;
inc_period  : "minute" | "minutes" | "hour" | "hours" | "day" | "days" | "week" | "weeks" | "month" | "months" | "year" | "years" ;
The standard input shall be a text file consisting of commands acceptable to the shell command language described in Chapter 2, Shell Command Language.  The standard input shall only be used if no -f file option is specified.
See the STDIN section.
The text files at.allow and at.deny, which are located in an implementation-defined directory, shall contain zero or more user names, one per line, of users who are, respectively, authorized or denied access to the at and batch utilities.
The following environment variables shall affect the execution of at:
LC_TIME   Determine the format and contents for date and time strings written and accepted by at.
SHELL     Determine a name of a command interpreter to be used to invoke the at-job. If the variable is unset or null, sh shall be used. If it is set to a value other than a name for sh, the implementation shall do one of the following: use that shell; use sh; use the login shell from the user database; or any of the preceding accompanied by a warning diagnostic about which was chosen.
TZ        Determine the timezone. The job shall be submitted for execution at the time specified by timespec or -t time relative to the timezone specified by the TZ variable. If timespec specifies a timezone, it shall override TZ.  If timespec does not specify a timezone and TZ is unset or null, an unspecified default timezone shall be used.
When standard input is a terminal, prompts of unspecified format for each line of the user input described in the STDIN section may be written to standard output.
In the POSIX locale, the following shall be written to the standard output for each job when jobs are listed in response to the -l option:
"%s\t%s\n", at_job_id, <date>
where date shall be equivalent in format to the output of:
date +"%a %b %e %T %Y"
The date and time written shall be adjusted so that they appear in the timezone of the user (as determined by the TZ variable).
In the POSIX locale, the following shall be written to standard error when a job has been successfully submitted:
"job %s at %s\n", at_job_id, <date>
where date has the same format as that described in the STDOUT section. Neither this, nor warning messages concerning the selection of the command interpreter, shall be considered a diagnostic that changes the exit status.
Diagnostic messages, if any, shall be written to standard error.
0    The at utility successfully submitted, removed, or listed a job or jobs.
The job shall not be scheduled, removed, or listed.
The format of the at command line shown here is guaranteed only for the POSIX locale. Other cultures may be supported with substantially different interfaces, although implementations are encouraged to provide comparable levels of functionality.
Since the commands run in a separate shell invocation, running in a separate process group with no controlling terminal, open file descriptors, traps, and priority inherited from the invoking environment are lost.
Some implementations do not allow substitution of different shells using SHELL.  System V systems, for example, have used the login shell value for the user in /etc/passwd.  To select reliably another command interpreter, the user must include it as part of the script, such as:
$ at 1800 myshell myscript EOT job ... at ... $
1. This sequence can be used at a terminal:
at -m 0730 tomorrow sort < file >outfile EOT
2. This sequence, which demonstrates redirecting standard error to a pipe, is useful in a command procedure (the sequence of output redirection specifications is significant):
at now + 1 hour <<! diff file1 file2 2>&1 >outfile | mailx mygroup !
3. To have a job reschedule itself, at can be invoked from within the at-job. For example, this daily processing script named my.daily runs every day (although crontab is a more appropriate vehicle for such work):
# my.daily runs every day daily processing at now tomorrow < my.daily
4. The spacing of the three portions of the POSIX locale timespec is quite flexible as long as there are no ambiguities. Examples of various times and operand presentation include:
at 0815am Jan 24 at 8 :15amjan24 at now "+ 1day" at 5 pm FRIday at '17 utc+ 30minutes'
The at utility reads from standard input the commands to be executed at a later time. It may be useful to redirect standard output and standard error within the specified commands.
The -t time option was added as a new capability to support an internationalized way of specifying a time for execution of the submitted job.
Early proposals added a ``jobname'' concept as a way of giving submitted jobs names that are meaningful to the user submitting them.  The historical, system-specified at_job_id gives no indication of what the job is. Upon further reflection, it was decided that the benefit of this was not worth the change in historical interface. The at functionality is useful in simple environments, but in large or complex situations, the functionality provided by the Batch Services option is more suitable.
The -q option historically has been an undocumented option, used mainly by the batch utility.
The System V -m option was added to provide a method for informing users that an at-job had completed. Otherwise, users are only informed when output to standard error or standard output are not redirected.
The behavior of at <now> was changed in an early proposal from being unspecified to submitting a job for potentially immediate execution. Historical BSD at implementations support this. Historical System V implementations give an error in that case, but a change to the System V versions should have no backwards-compatibility ramifications.
On BSD-based systems, a -u user option has allowed those with appropriate privileges to access the work of other users. Since this is primarily a system administration feature and is not universally implemented, it has been omitted. Similarly, a specification for the output format for a user with appropriate privileges viewing the queues of other users has been omitted.
The -f file option from System V is used instead of the BSD method of using the last operand as the pathname. The BSD method is ambiguous—does:
at 1200 friday
mean the same thing if there is a file named friday in the current directory?