Linux-Utility
stringlengths
1
30
Manual-Page
stringlengths
700
948k
TLDR-Summary
stringlengths
110
2.05k
ip-route
ip-route(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ip-route(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | NOTES | EXAMPLES | SEE ALSO | AUTHOR | COLOPHON IP-ROUTE(8) Linux IP-ROUTE(8) NAME top ip-route - routing table management SYNOPSIS top ip [ ip-OPTIONS ] route { COMMAND | help } ip route { show | flush } SELECTOR ip route save SELECTOR ip route restore ip route get ROUTE_GET_FLAGS ADDRESS [ from ADDRESS iif STRING ] [ oif STRING ] [ mark MARK ] [ tos TOS ] [ vrf NAME ] [ ipproto PROTOCOL ] [ sport NUMBER ] [ dport NUMBER ] ip route { add | del | change | append | replace } ROUTE SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ] [ table TABLE_ID ] [ vrf NAME ] [ proto RTPROTO ] [ type TYPE ] [ scope SCOPE ] ROUTE := NODE_SPEC [ INFO_SPEC ] NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ] [ table TABLE_ID ] [ proto RTPROTO ] [ scope SCOPE ] [ metric METRIC ] [ ttl- propagate { enabled | disabled } ] INFO_SPEC := { NH | nhid ID } OPTIONS FLAGS [ nexthop NH ] ... NH := [ encap ENCAP ] [ via [ FAMILY ] ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS FAMILY := [ inet | inet6 | mpls | bridge | link ] OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ as [ to ] ADDRESS ] rtt TIME ] [ rttvar TIME ] [ reordering NUMBER ] [ window NUMBER ] [ cwnd NUMBER ] [ ssthresh NUMBER ] [ realms REALM ] [ rto_min TIME ] [ initcwnd NUMBER ] [ initrwnd NUMBER ] [ features FEATURES ] [ quickack BOOL ] [ congctl NAME ] [ pref PREF ] [ expires TIME ] [ fastopen_no_cookie BOOL ] TYPE := [ unicast | local | broadcast | multicast | throw | unreachable | prohibit | blackhole | nat ] TABLE_ID := [ local| main | default | all | NUMBER ] SCOPE := [ host | link | global | NUMBER ] NHFLAGS := [ onlink | pervasive ] RTPROTO := [ kernel | boot | static | NUMBER ] FEATURES := [ ecn | ] PREF := [ low | medium | high ] ENCAP := [ ENCAP_MPLS | ENCAP_IP | ENCAP_BPF | ENCAP_SEG6 | ENCAP_SEG6LOCAL | ENCAP_IOAM6 ] ENCAP_MPLS := mpls [ LABEL ] [ ttl TTL ] ENCAP_IP := ip id TUNNEL_ID dst REMOTE_IP [ src SRC ] [ tos TOS ] [ ttl TTL ] ENCAP_BPF := bpf [ in PROG ] [ out PROG ] [ xmit PROG ] [ headroom SIZE ] ENCAP_SEG6 := seg6 mode [ encap | encap.red | inline | l2encap | l2encap.red ] segs SEGMENTS [ hmac KEYID ] ENCAP_SEG6LOCAL := seg6local action SEG6_ACTION [ SEG6_ACTION_PARAM ] [ count ] ENCAP_IOAM6 := ioam6 [ freq K/N ] mode [ inline | encap | auto ] [ tundst ADDRESS ] trace prealloc type IOAM6_TRACE_TYPE ns IOAM6_NAMESPACE size IOAM6_TRACE_SIZE ROUTE_GET_FLAGS := [ fibmatch ] DESCRIPTION top ip route is used to manipulate entries in the kernel routing tables. Route types: unicast - the route entry describes real paths to the destinations covered by the route prefix. unreachable - these destinations are unreachable. Packets are discarded and the ICMP message host unreachable is generated. The local senders get an EHOSTUNREACH error. blackhole - these destinations are unreachable. Packets are discarded silently. The local senders get an EINVAL error. prohibit - these destinations are unreachable. Packets are discarded and the ICMP message communication administratively prohibited is generated. The local senders get an EACCES error. local - the destinations are assigned to this host. The packets are looped back and delivered locally. broadcast - the destinations are broadcast addresses. The packets are sent as link broadcasts. throw - a special control route used together with policy rules. If such a route is selected, lookup in this table is terminated pretending that no route was found. Without policy routing it is equivalent to the absence of the route in the routing table. The packets are dropped and the ICMP message net unreachable is generated. The local senders get an ENETUNREACH error. nat - a special NAT route. Destinations covered by the prefix are considered to be dummy (or external) addresses which require translation to real (or internal) ones before forwarding. The addresses to translate to are selected with the attribute via. Warning: Route NAT is no longer supported in Linux 2.6. anycast - not implemented the destinations are anycast addresses assigned to this host. They are mainly equivalent to local with one difference: such addresses are invalid when used as the source address of any packet. multicast - a special type used for multicast routing. It is not present in normal routing tables. Route tables: Linux-2.x can pack routes into several routing tables identified by a number in the range from 1 to 2^32-1 or by name from /usr/lib/iproute2/rt_tables or /etc/iproute2/rt_tables (has precedence if exists). By default all normal routes are inserted into the main table (ID 254) and the kernel only uses this table when calculating routes. Values (0, 253, 254, and 255) are reserved for built-in use. Actually, one other table always exists, which is invisible but even more important. It is the local table (ID 255). This table consists of routes for local and broadcast addresses. The kernel maintains this table automatically and the administrator usually need not modify it or even look at it. The multiple routing tables enter the game when policy routing is used. ip route add add new route ip route change change route ip route replace change or add new one to TYPE PREFIX (default) the destination prefix of the route. If TYPE is omitted, ip assumes type unicast. Other values of TYPE are listed above. PREFIX is an IP or IPv6 address optionally followed by a slash and the prefix length. If the length of the prefix is missing, ip assumes a full-length host route. There is also a special PREFIX default - which is equivalent to IP 0/0 or to IPv6 ::/0. tos TOS dsfield TOS the Type Of Service (TOS) key. This key has no associated mask and the longest match is understood as: First, compare the TOS of the route and of the packet. If they are not equal, then the packet may still match a route with a zero TOS. TOS is either an 8 bit hexadecimal number or an identifier from /usr/lib/iproute2/rt_dsfieldor /etc/iproute2/rt_dsfield(hasprecedenceifexists). metric NUMBER preference NUMBER the preference value of the route. NUMBER is an arbitrary 32bit number, where routes with lower values are preferred. table TABLEID the table to add this route to. TABLEID may be a number or a string from /usr/lib/iproute2/rt_tablesor /etc/iproute2/rt_tables(hasprecedenceifexists). If this parameter is omitted, ip assumes the main table, with the exception of local, broadcast and nat routes, which are put into the local table by default. vrf NAME the vrf name to add this route to. Implicitly means the table associated with the VRF. dev NAME the output device name. via [ FAMILY ] ADDRESS the address of the nexthop router, in the address family FAMILY. Actually, the sense of this field depends on the route type. For normal unicast routes it is either the true next hop router or, if it is a direct route installed in BSD compatibility mode, it can be a local address of the interface. For NAT routes it is the first address of the block of translated IP destinations. src ADDRESS the source address to prefer when sending to the destinations covered by the route prefix. realm REALMID the realm to which this route is assigned. REALMID may be a number or a string from /usr/lib/iproute2/rt_realmsor /etc/iproute2/rt_realms(hasprecedenceifexists). mtu MTU mtu lock MTU the MTU along the path to the destination. If the modifier lock is not used, the MTU may be updated by the kernel due to Path MTU Discovery. If the modifier lock is used, no path MTU discovery will be tried, all packets will be sent without the DF bit in IPv4 case or fragmented to MTU for IPv6. window NUMBER the maximal window for TCP to advertise to these destinations, measured in bytes. It limits maximal data bursts that our TCP peers are allowed to send to us. rtt TIME the initial RTT ('Round Trip Time') estimate. If no suffix is specified the units are raw values passed directly to the routing code to maintain compatibility with previous releases. Otherwise if a suffix of s, sec or secs is used to specify seconds and ms, msec or msecs to specify milliseconds. rttvar TIME (Linux 2.3.15+ only) the initial RTT variance estimate. Values are specified as with rtt above. rto_min TIME (Linux 2.6.23+ only) the minimum TCP Retransmission TimeOut to use when communicating with this destination. Values are specified as with rtt above. ssthresh NUMBER (Linux 2.3.15+ only) an estimate for the initial slow start threshold. cwnd NUMBER (Linux 2.3.15+ only) the clamp for congestion window. It is ignored if the lock flag is not used. initcwnd NUMBER (Linux 2.5.70+ only) the initial congestion window size for connections to this destination. Actual window size is this value multiplied by the MSS (``Maximal Segment Size'') for same connection. The default is zero, meaning to use the values specified in RFC2414. initrwnd NUMBER (Linux 2.6.33+ only) the initial receive window size for connections to this destination. Actual window size is this value multiplied by the MSS of the connection. The default value is zero, meaning to use Slow Start value. features FEATURES (Linux3.18+only) Enable or disable per-route features. Only available feature at this time is ecn to enable explicit congestion notification when initiating connections to the given destination network. When responding to a connection request from the given network, ecn will also be used even if the net.ipv4.tcp_ecn sysctl is set to 0. quickack BOOL (Linux 3.11+ only) Enable or disable quick ack for connections to this destination. fastopen_no_cookie BOOL (Linux 4.15+ only) Enable TCP Fastopen without a cookie for connections to this destination. congctl NAME (Linux 3.20+ only) congctl lock NAME (Linux 3.20+ only) Sets a specific TCP congestion control algorithm only for a given destination. If not specified, Linux keeps the current global default TCP congestion control algorithm, or the one set from the application. If the modifier lock is not used, an application may nevertheless overwrite the suggested congestion control algorithm for that destination. If the modifier lock is used, then an application is not allowed to overwrite the specified congestion control algorithm for that destination, thus it will be enforced/guaranteed to use the proposed algorithm. advmss NUMBER (Linux 2.3.15+ only) the MSS ('Maximal Segment Size') to advertise to these destinations when establishing TCP connections. If it is not given, Linux uses a default value calculated from the first hop device MTU. (If the path to these destination is asymmetric, this guess may be wrong.) reordering NUMBER (Linux 2.3.15+ only) Maximal reordering on the path to this destination. If it is not given, Linux uses the value selected with sysctl variable net/ipv4/tcp_reordering. nexthop NEXTHOP the nexthop of a multipath route. NEXTHOP is a complex value with its own syntax similar to the top level argument lists: via [ FAMILY ] ADDRESS - is the nexthop router. dev NAME - is the output device. weight NUMBER - is a weight for this element of a multipath route reflecting its relative bandwidth or quality. The internal buffer used in iproute2 limits the maximum number of nexthops that may be specified in one go. If only ADDRESS is given, the current buffer size allows for 144 IPv6 nexthops and 253 IPv4 ones. For IPv4, this effectively limits the number of nexthops possible per route. With IPv6, further nexthops may be appended to the same route via ip route append command. scope SCOPE_VAL the scope of the destinations covered by the route prefix. SCOPE_VAL may be a number or a string from /usr/lib/iproute2/rt_scopesor /etc/iproute2/rt_scopes(hasprecedenceifexists). If this parameter is omitted, ip assumes scope global for all gatewayed unicast routes, scope link for direct unicast and broadcast routes and scope host for local routes. protocol RTPROTO the routing protocol identifier of this route. RTPROTO may be a number or a string from /etc/iproute2/rt_protosor /etc/iproute2/rt_protos(hasprecedenceifexists). If the routing protocol ID is not given, ip assumes protocol boot (i.e. it assumes the route was added by someone who doesn't understand what they are doing). Several protocol values have a fixed interpretation. Namely: redirect - the route was installed due to an ICMP redirect. kernel - the route was installed by the kernel during autoconfiguration. boot - the route was installed during the bootup sequence. If a routing daemon starts, it will purge all of them. static - the route was installed by the administrator to override dynamic routing. Routing daemon will respect them and, probably, even advertise them to its peers. ra - the route was installed by Router Discovery protocol. The rest of the values are not reserved and the administrator is free to assign (or not to assign) protocol tags. onlink pretend that the nexthop is directly attached to this link, even if it does not match any interface prefix. pref PREF the IPv6 route preference. PREF is a string specifying the route preference as defined in RFC4191 for Router Discovery messages. Namely: low - the route has a lowest priority medium - the route has a default priority high - the route has a highest priority nhid ID use nexthop object with given id as nexthop specification. encap ENCAPTYPE ENCAPHDR attach tunnel encapsulation attributes to this route. ENCAPTYPE is a string specifying the supported encapsulation type. Namely: mpls - encapsulation type MPLS ip - IP encapsulation (Geneve, GRE, VXLAN, ...) bpf - Execution of BPF program seg6 - encapsulation type IPv6 Segment Routing seg6local - local SRv6 segment processing ioam6 - encapsulation type IPv6 IOAM xfrm - encapsulation type XFRM ENCAPHDR is a set of encapsulation attributes specific to the ENCAPTYPE. mpls MPLSLABEL - mpls label stack with labels separated by / ttl TTL - TTL to use for MPLS header or 0 to inherit from IP header ip id TUNNEL_ID dst REMOTE_IP [ src SRC ] [ tos TOS ] [ ttl TTL ] [ key ] [ csum ] [ seq ] bpf in PROG - BPF program to execute for incoming packets out PROG - BPF program to execute for outgoing packets xmit PROG - BPF program to execute for transmitted packets headroom SIZE - Size of header BPF program will attach (xmit) seg6 mode inline - Directly insert Segment Routing Header after IPv6 header mode encap - Encapsulate packet in an outer IPv6 header with SRH mode encap.red - Encapsulate packet in an outer IPv6 header with SRH applying the reduced segment list. When there is only one segment and the HMAC is not present, the SRH is omitted. mode l2encap - Encapsulate ingress L2 frame within an outer IPv6 header and SRH mode l2encap.red - Encapsulate ingress L2 frame within an outer IPv6 header and SRH applying the reduced segment list. When there is only one segment and the HMAC is not present, the SRH is omitted. SEGMENTS - List of comma-separated IPv6 addresses KEYID - Numerical value in decimal representation. See ip-sr(8). seg6local SEG6_ACTION [ SEG6_ACTION_PARAM ] [ count ] - Operation to perform on matching packets. The optional count attribute is used to collect statistics on the processing of actions. Three counters are implemented: 1) packets correctly processed; 2) bytes correctly processed; 3) packets that cause a processing error (i.e., missing SID List, wrong SID List, etc). To retrieve the counters related to an action use the -s flag in the show command. The following actions are currently supported (Linux 4.14+ only). End [ flavors FLAVORS ] - Regular SRv6 processing as intermediate segment endpoint. This action only accepts packets with a non-zero Segments Left value. Other matching packets are dropped. The presence of flavors can change the regular processing of an End behavior according to the user-provided Flavor operations and information carried in the packet. See Flavors parameters section. End.X nh6 NEXTHOP [ flavors FLAVORS ] - Regular SRv6 processing as intermediate segment endpoint. Additionally, forward processed packets to given next-hop. This action only accepts packets with a non-zero Segments Left value. Other matching packets are dropped. The presence of flavors can change the regular processing of an End.X behavior according to the user- provided Flavor operations and information carried in the packet. See Flavors parameters section. End.DX6 nh6 NEXTHOP - Decapsulate inner IPv6 packet and forward it to the specified next-hop. If the argument is set to ::, then the next-hop is selected according to the local selection rules. This action only accepts packets with either a zero Segments Left value or no SRH at all, and an inner IPv6 packet. Other matching packets are dropped. End.DT6 { table | vrftable } TABLEID - Decapsulate the inner IPv6 packet and forward it according to the specified lookup table. TABLEID is either a number or a string from /usr/lib/iproute2/rt_tablesor /etc/iproute2/rt_tables(hasprecedenceifexists). If vrftable is used, the argument must be a VRF device associated with the table id. Moreover, the VRF table associated with the table id must be configured with the VRF strict mode turned on (net.vrf.strict_mode=1). This action only accepts packets with either a zero Segments Left value or no SRH at all, and an inner IPv6 packet. Other matching packets are dropped. End.DT4 vrftable TABLEID - Decapsulate the inner IPv4 packet and forward it according to the specified lookup table. TABLEID is either a number or a string from /usr/lib/iproute2/rt_tablesor /etc/iproute2/rt_tables(hasprecedenceifexists). The argument must be a VRF device associated with the table id. Moreover, the VRF table associated with the table id must be configured with the VRF strict mode turned on (net.vrf.strict_mode=1). This action only accepts packets with either a zero Segments Left value or no SRH at all, and an inner IPv4 packet. Other matching packets are dropped. End.DT46 vrftable TABLEID - Decapsulate the inner IPv4 or IPv6 packet and forward it according to the specified lookup table. TABLEID is either a number or a string from /usr/lib/iproute2/rt_tablesor /etc/iproute2/rt_tables(hasprecedenceifexists). The argument must be a VRF device associated with the table id. Moreover, the VRF table associated with the table id must be configured with the VRF strict mode turned on (net.vrf.strict_mode=1). This action only accepts packets with either a zero Segments Left value or no SRH at all, and an inner IPv4 or IPv6 packet. Other matching packets are dropped. End.B6 srh segs SEGMENTS [ hmac KEYID ] - Insert the specified SRH immediately after the IPv6 header, update the DA with the first segment of the newly inserted SRH, then forward the resulting packet. The original SRH is not modified. This action only accepts packets with a non-zero Segments Left value. Other matching packets are dropped. End.B6.Encaps srh segs SEGMENTS [ hmac KEYID ] - Regular SRv6 processing as intermediate segment endpoint. Additionally, encapsulate the matching packet within an outer IPv6 header followed by the specified SRH. The destination address of the outer IPv6 header is set to the first segment of the new SRH. The source address is set as described in ip-sr(8). Flavors parameters The flavors represent additional operations that can modify or extend a subset of the existing behaviors. flavors OPERATION[,OPERATION] [ATTRIBUTES] OPERATION := { psp | usp | usd | next-csid } ATTRIBUTES := { KEY VALUE } [ ATTRIBUTES ] KEY := { lblen | nflen } psp - The Penultimate Segment Pop (PSP) copies the last SID from the SID List (carried by the outermost SRH) into the IPv6 Destination Address (DA) and removes (i.e. pops) the SRH from the IPv6 header. The PSP operation takes place only at a penultimate SR Segment Endpoint node (e.g., the Segment Left must be one) and does not happen at non- penultimate endpoint nodes. This flavor is currently only supported by End behavior. usp - Ultimate Segment Pop of the SRH (not yet supported in kernel) usd - Ultimate Segment Decapsulation (not yet supported in kernel) next-csid - The NEXT-C-SID mechanism offers the possibility of encoding several SRv6 segments within a single 128 bit SID address. The NEXT-C-SID flavor can be configured to support user-provided Locator-Block and Locator-Node Function lengths. If Locator-Block and/or Locator-Node Function lengths are not provided by the user during configuration of an SRv6 End behavior instance with NEXT- C-SID flavor, the default value is 32-bit for Locator-Block and 16-bit for Locator-Node Function. lblen VALUE - defines the Locator- Block length for NEXT-C-SID flavor. The Locator-Block length must be greater than 0 and evenly divisible by 8. This attribute can be used only with NEXT-C-SID flavor. nflen VALUE - defines the Locator- Node Function length for NEXT-C-SID flavors. The Locator-Node Function length must be greater than 0 and evenly divisible by 8. This attribute can be used only with NEXT-C-SID flavor. ioam6 freq K/N - Inject IOAM in K packets every N packets (default is 1/1). mode inline - Directly insert IOAM after IPv6 header (default mode). mode encap - Encapsulate packet in an outer IPv6 header with IOAM. mode auto - Automatically use inline mode for local packets and encap mode for in-transit packets. tundst ADDRESS - IPv6 address of the tunnel destination (outer header), not used with inline mode. type IOAM6_TRACE_TYPE - List of IOAM data required in the trace, represented by a bitfield (24 bits). ns IOAM6_NAMESPACE - Numerical value to represent an IOAM namespace. See ip-ioam(8). size IOAM6_TRACE_SIZE - Size, in octets, of the pre-allocated trace data block. xfrm if_id IF_ID [ link_dev LINK_DEV ] expires TIME (Linux 4.4+ only) the route will be deleted after the expires time. Only support IPv6 at present. ttl-propagate { enabled | disabled } Control whether TTL should be propagated from any encap into the un-encapsulated packet, overriding any global configuration. Only supported for MPLS at present. ip route delete delete route ip route del has the same arguments as ip route add, but their semantics are a bit different. Key values (to, tos, preference and table) select the route to delete. If optional attributes are present, ip verifies that they coincide with the attributes of the route to delete. If no route with the given key and attributes was found, ip route del fails. ip route show list routes the command displays the contents of the routing tables or the route(s) selected by some criteria. to SELECTOR (default) only select routes from the given range of destinations. SELECTOR consists of an optional modifier (root, match or exact) and a prefix. root PREFIX selects routes with prefixes not shorter than PREFIX. F.e. root 0/0 selects the entire routing table. match PREFIX selects routes with prefixes not longer than PREFIX. F.e. match 10.0/16 selects 10.0/16, 10/8 and 0/0, but it does not select 10.1/16 and 10.0.0/24. And exact PREFIX (or just PREFIX) selects routes with this exact prefix. If neither of these options are present, ip assumes root 0/0 i.e. it lists the entire table. tos TOS dsfield TOS only select routes with the given TOS. table TABLEID show the routes from this table(s). The default setting is to show table main. TABLEID may either be the ID of a real table or one of the special values: all - list all of the tables. cache - dump the routing cache. vrf NAME show the routes for the table associated with the vrf name cloned cached list cloned routes i.e. routes which were dynamically forked from other routes because some route attribute (f.e. MTU) was updated. Actually, it is equivalent to table cache. from SELECTOR the same syntax as for to, but it binds the source address range rather than destinations. Note that the from option only works with cloned routes. protocol RTPROTO only list routes of this protocol. scope SCOPE_VAL only list routes with this scope. type TYPE only list routes of this type. dev NAME only list routes going via this device. via [ FAMILY ] PREFIX only list routes going via the nexthop routers selected by PREFIX. src PREFIX only list routes with preferred source addresses selected by PREFIX. realm REALMID realms FROMREALM/TOREALM only list routes with these realms. ip route flush flush routing tables this command flushes routes selected by some criteria. The arguments have the same syntax and semantics as the arguments of ip route show, but routing tables are not listed but purged. The only difference is the default action: show dumps all the IP main routing table but flush prints the helper page. With the -statistics option, the command becomes verbose. It prints out the number of deleted routes and the number of rounds made to flush the routing table. If the option is given twice, ip route flush also dumps all the deleted routes in the format described in the previous subsection. ip route get get a single route this command gets a single route to a destination and prints its contents exactly as the kernel sees it. fibmatch Return full fib lookup matched route. Default is to return the resolved dst entry to ADDRESS (default) the destination address. from ADDRESS the source address. tos TOS dsfield TOS the Type Of Service. iif NAME the device from which this packet is expected to arrive. oif NAME force the output device on which this packet will be routed. mark MARK the firewall mark (fwmark) vrf NAME force the vrf device on which this packet will be routed. ipproto PROTOCOL ip protocol as seen by the route lookup sport NUMBER source port as seen by the route lookup dport NUMBER destination port as seen by the route lookup connected if no source address (option from) was given, relookup the route with the source set to the preferred address received from the first lookup. If policy routing is used, it may be a different route. Note that this operation is not equivalent to ip route show. show shows existing routes. get resolves them and creates new clones if necessary. Essentially, get is equivalent to sending a packet along this path. If the iif argument is not given, the kernel creates a route to output packets towards the requested destination. This is equivalent to pinging the destination with a subsequent ip route ls cache, however, no packets are actually sent. With the iif argument, the kernel pretends that a packet arrived from this interface and searches for a path to forward the packet. ip route save save routing table information to stdout This command behaves like ip route show except that the output is raw data suitable for passing to ip route restore. ip route restore restore routing table information from stdin This command expects to read a data stream as returned from ip route save. It will attempt to restore the routing table information exactly as it was at the time of the save, so any translation of information in the stream (such as device indexes) must be done first. Any existing routes are left unchanged. Any routes specified in the data stream that already exist in the table will be ignored. NOTES top Starting with Linux kernel version 3.6, there is no routing cache for IPv4 anymore. Hence ip route show cached will never print any entries on systems with this or newer kernel versions. EXAMPLES top ip ro Show all route entries in the kernel. ip route add default via 192.168.1.1 dev eth0 Adds a default route (for all addresses) via the local gateway 192.168.1.1 that can be reached on device eth0. ip route add 10.1.1.0/30 encap mpls 200/300 via 10.1.1.1 dev eth0 Adds an ipv4 route with mpls encapsulation attributes attached to it. ip -6 route add 2001:db8:1::/64 encap seg6 mode encap segs 2001:db8:42::1,2001:db8:ffff::2 dev eth0 Adds an IPv6 route with SRv6 encapsulation and two segments attached. ip -6 route add 2001:db8:1::/64 encap seg6local action End.DT46 vrftable 100 dev vrf100 Adds an IPv6 route with SRv6 decapsulation and forward with lookup in VRF table. ip -6 route add 2001:db8:1::/64 encap seg6local action End flavors psp dev eth0 Adds an IPv6 route with SRv6 End behavior with psp flavor enabled. ip -6 route add 2001:db8:1::/64 encap seg6local action End flavors next-csid dev eth0 Adds an IPv6 route with SRv6 End behavior with next-csid flavor enabled. ip -6 route add 2001:db8:1::/64 encap seg6local action End flavors next-csid lblen 48 nflen 16 dev eth0 Adds an IPv6 route with SRv6 End behavior with next-csid flavor enabled and user-provided Locator-Block and Locator- Node Function lengths. ip -6 route add 2001:db8:1::/64 encap ioam6 freq 2/5 mode encap tundst 2001:db8:42::1 trace prealloc type 0x800000 ns 1 size 12 dev eth0 Adds an IPv6 route with an IOAM Pre-allocated Trace encapsulation (ip6ip6) that only includes the hop limit and the node id, configured for the IOAM namespace 1 and a pre- allocated data block of 12 octets (will be injected in 2 packets every 5 packets). ip route add 10.1.1.0/30 nhid 10 Adds an ipv4 route using nexthop object with id 10. SEE ALSO top ip(8) AUTHOR top Original Manpage by Michail Litvak <[email protected]> COLOPHON top This page is part of the iproute2 (utilities for controlling TCP/IP networking and traffic) project. Information about the project can be found at http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2. If you have a bug report for this manual page, send it to [email protected], [email protected]. This page was obtained from the project's upstream Git repository https://git.kernel.org/pub/scm/network/iproute2/iproute2.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-20.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] iproute2 13 Dec 2012 IP-ROUTE(8) Pages that refer to this page: ip(8), ip-ioam(8), ip-sr(8), ip-vrf(8), tc-route(8), wg(8), wg-quick(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ip route\n\n> IP Routing table management subcommand.\n> More information: <https://manned.org/ip-route>.\n\n- Display the routing table:\n\n`ip route {{show|list}}`\n\n- Add a default route using gateway forwarding:\n\n`sudo ip route add default via {{gateway_ip}}`\n\n- Add a default route using `eth0`:\n\n`sudo ip route add default dev {{eth0}}`\n\n- Add a static route:\n\n`sudo ip route add {{destination_ip}} via {{gateway_ip}} dev {{eth0}}`\n\n- Delete a static route:\n\n`sudo ip route del {{destination_ip}} dev {{eth0}}`\n\n- Change or replace a static route:\n\n`sudo ip route {{change|replace}} {{destination_ip}} via {{gateway_ip}} dev {{eth0}}`\n\n- Show which route will be used by the kernel to reach an IP address:\n\n`ip route get {{destination_ip}}`\n
ip-rule
ip-rule(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ip-rule(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | SEE ALSO | AUTHOR | COLOPHON IP-RULE(8) Linux IP-RULE(8) NAME top ip-rule - routing policy database management SYNOPSIS top ip [ OPTIONS ] rule { COMMAND | help } ip rule [ show [ SELECTOR ]] ip rule { add | del } SELECTOR ACTION ip rule { flush | save | restore } SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK[/MASK] ] [ iif STRING ] [ oif STRING ] [ priority PREFERENCE ] [ l3mdev ] [ uidrange NUMBER-NUMBER ] [ ipproto PROTOCOL ] [ sport [ NUMBER | NUMBER-NUMBER ] ] [ dport [ NUMBER | NUMBER-NUMBER ] ] [ tun_id TUN_ID ] ACTION := [ table TABLE_ID ] [ protocol PROTO ] [ nat ADDRESS ] [ realms [SRCREALM/]DSTREALM ] [ goto NUMBER ] SUPPRESSOR SUPPRESSOR := [ suppress_prefixlength NUMBER ] [ suppress_ifgroup GROUP ] TABLE_ID := [ local | main | default | NUMBER ] DESCRIPTION top ip rule manipulates rules in the routing policy database that controls the route selection algorithm. Classic routing algorithms used in the Internet make routing decisions based only on the destination address of packets (and in theory, but not in practice, on the TOS field). In some circumstances, we want to route packets differently depending not only on destination addresses but also on other packet fields: source address, IP protocol, transport protocol ports or even packet payload. This task is called 'policy routing'. To solve this task, the conventional destination based routing table, ordered according to the longest match rule, is replaced with a 'routing policy database' (or RPDB), which selects routes by executing some set of rules. Each policy routing rule consists of a selector and an action predicate. The RPDB is scanned in order of decreasing priority (note that a lower number means higher priority, see the description of PREFERENCE below). The selector of each rule is applied to {source address, destination address, incoming interface, tos, fwmark} and, if the selector matches the packet, the action is performed. The action predicate may return with success. In this case, it will either give a route or failure indication and the RPDB lookup is terminated. Otherwise, the RPDB program continues with the next rule. Semantically, the natural action is to select the nexthop and the output device. At startup time the kernel configures the default RPDB consisting of three rules: 1. Priority: 0, Selector: match anything, Action: lookup routing table local (ID 255). The local table is a special routing table containing high priority control routes for local and broadcast addresses. 2. Priority: 32766, Selector: match anything, Action: lookup routing table main (ID 254). The main table is the normal routing table containing all non-policy routes. This rule may be deleted and/or overridden with other ones by the administrator. 3. Priority: 32767, Selector: match anything, Action: lookup routing table default (ID 253). The default table is empty. It is reserved for some post-processing if no previous default rules selected the packet. This rule may also be deleted. Each RPDB entry has additional attributes. F.e. each rule has a pointer to some routing table. NAT and masquerading rules have an attribute to select new IP address to translate/masquerade. Besides that, rules have some optional attributes, which routes have, namely realms. These values do not override those contained in the routing tables. They are only used if the route did not select any attributes. The RPDB may contain rules of the following types: unicast - the rule returns the route found in the routing table referenced by the rule. blackhole - the rule causes a silent drop the packet. unreachable - the rule generates a 'Network is unreachable' error. prohibit - the rule generates 'Communication is administratively prohibited' error. nat - the rule translates the source address of the IP packet into some other value. ip rule add - insert a new rule ip rule delete - delete a rule type TYPE (default) the type of this rule. The list of valid types was given in the previous subsection. from PREFIX select the source prefix to match. to PREFIX select the destination prefix to match. iif NAME select the incoming device to match. If the interface is loopback, the rule only matches packets originating from this host. This means that you may create separate routing tables for forwarded and local packets and, hence, completely segregate them. oif NAME select the outgoing device to match. The outgoing interface is only available for packets originating from local sockets that are bound to a device. tos TOS dsfield TOS select the TOS value to match. fwmark MARK select the fwmark value to match. uidrange NUMBER-NUMBER select the uid value to match. ipproto PROTOCOL select the ip protocol value to match. sport NUMBER | NUMBER-NUMBER select the source port value to match. supports port range. dport NUMBER | NUMBER-NUMBER select the destination port value to match. supports port range. priority PREFERENCE the priority of this rule. PREFERENCE is an unsigned integer value, higher number means lower priority, and rules get processed in order of increasing number. Each rule should have an explicitly set unique priority value. The options preference and order are synonyms with priority. table TABLEID the routing table identifier to lookup if the rule selector matches. It is also possible to use lookup instead of table. protocol PROTO the routing protocol who installed the rule in question. As an example when zebra installs a rule it would get RTPROT_ZEBRA as the installing protocol. suppress_prefixlength NUMBER reject routing decisions that have a prefix length of NUMBER or less. suppress_ifgroup GROUP reject routing decisions that use a device belonging to the interface group GROUP. realms FROM/TO Realms to select if the rule matched and the routing table lookup succeeded. Realm TO is only used if the route did not select any realm. nat ADDRESS The base of the IP address block to translate (for source addresses). The ADDRESS may be either the start of the block of NAT addresses (selected by NAT routes) or a local host address (or even zero). In the last case the router does not translate the packets, but masquerades them to this address. Using map-to instead of nat means the same thing. Warning: Changes to the RPDB made with these commands do not become active immediately. It is assumed that after a script finishes a batch of updates, it flushes the routing cache with ip route flush cache. ip rule flush - also dumps all the deleted rules. protocol PROTO Select the originating protocol. ip rule show - list rules This command has no arguments. The options list or lst are synonyms with show. ip rule save protocol PROTO Select the originating protocol. save rules table information to stdout This command behaves like ip rule show except that the output is raw data suitable for passing to ip rule restore. ip rule restore restore rules table information from stdin This command expects to read a data stream as returned from ip rule save. It will attempt to restore the rules table information exactly as it was at the time of the save. Any rules already in the table are left unchanged, and duplicates are not ignored. SEE ALSO top ip(8) AUTHOR top Original Manpage by Michail Litvak <[email protected]> COLOPHON top This page is part of the iproute2 (utilities for controlling TCP/IP networking and traffic) project. Information about the project can be found at http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2. If you have a bug report for this manual page, send it to [email protected], [email protected]. This page was obtained from the project's upstream Git repository https://git.kernel.org/pub/scm/network/iproute2/iproute2.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-20.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] iproute2 20 Dec 2011 IP-RULE(8) Pages that refer to this page: ip(8), wg-quick(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ip rule\n\n> IP routing policy database management.\n> More information: <https://man7.org/linux/man-pages/man8/ip-rule.8.html>.\n\n- Display the routing policy:\n\n`ip rule {{show|list}}`\n\n- Add a new rule based on packet source addresses:\n\n`sudo ip rule add from {{192.168.178.2/32}}`\n\n- Add a new rule based on packet destination addresses:\n\n`sudo ip rule add to {{192.168.178.2/32}}`\n\n- Delete a rule based on packet source addresses:\n\n`sudo ip rule delete from {{192.168.178.2/32}}`\n\n- Delete a rule based on packet destination addresses:\n\n`sudo ip rule delete to {{192.168.178.2/32}}`\n\n- Flush all deleted rules:\n\n`ip rule flush`\n\n- Save all rules to a file:\n\n`ip rule save > {{path/to/ip_rules.dat}}`\n\n- Restore all rules from a file:\n\n`ip rule restore < {{path/to/ip_rules.dat}}`\n
ip6tables
iptables(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training iptables(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | TARGETS | TABLES | OPTIONS | LOCK FILE | MATCH AND TARGET EXTENSIONS | DIAGNOSTICS | BUGS | COMPATIBILITY WITH IPCHAINS | SEE ALSO | AUTHORS | VERSION | COLOPHON IPTABLES(8) iptables 1.8.10 IPTABLES(8) NAME top iptables/ip6tables administration tool for IPv4/IPv6 packet filtering and NAT SYNOPSIS top iptables [-t table] {-A|-C|-D|-V} chain rule-specification ip6tables [-t table] {-A|-C|-D|-V} chain rule-specification iptables [-t table] -I chain [rulenum] rule-specification iptables [-t table] -R chain rulenum rule-specification iptables [-t table] -D chain rulenum iptables [-t table] -S [chain [rulenum]] iptables [-t table] {-F|-L|-Z} [chain [rulenum]] [options...] iptables [-t table] -N chain iptables [-t table] -X [chain] iptables [-t table] -P chain policy iptables [-t table] -E old-chain-name new-chain-name rule-specification := [matches...] [target] match := -m matchname [per-match-options] target := -j targetname [per-target-options] DESCRIPTION top Iptables and ip6tables are used to set up, maintain, and inspect the tables of IPv4 and IPv6 packet filter rules in the Linux kernel. Several different tables may be defined. Each table contains a number of built-in chains and may also contain user- defined chains. Each chain is a list of rules which can match a set of packets. Each rule specifies what to do with a packet that matches. This is called a `target', which may be a jump to a user-defined chain in the same table. TARGETS top A firewall rule specifies criteria for a packet and a target. If the packet does not match, the next rule in the chain is examined; if it does match, then the next rule is specified by the value of the target, which can be the name of a user-defined chain, one of the targets described in iptables-extensions(8), or one of the special values ACCEPT, DROP or RETURN. ACCEPT means to let the packet through. DROP means to drop the packet on the floor. RETURN means stop traversing this chain and resume at the next rule in the previous (calling) chain. If the end of a built-in chain is reached or a rule in a built-in chain with target RETURN is matched, the target specified by the chain policy determines the fate of the packet. TABLES top There are currently five independent tables (which tables are present at any time depends on the kernel configuration options and which modules are present). -t, --table table This option specifies the packet matching table which the command should operate on. If the kernel is configured with automatic module loading, an attempt will be made to load the appropriate module for that table if it is not already there. The tables are as follows: filter: This is the default table (if no -t option is passed). It contains the built-in chains INPUT (for packets destined to local sockets), FORWARD (for packets being routed through the box), and OUTPUT (for locally- generated packets). nat: This table is consulted when a packet that creates a new connection is encountered. It consists of four built-ins: PREROUTING (for altering packets as soon as they come in), INPUT (for altering packets destined for local sockets), OUTPUT (for altering locally- generated packets before routing), and POSTROUTING (for altering packets as they are about to go out). IPv6 NAT support is available since kernel 3.7. mangle: This table is used for specialized packet alteration. Until kernel 2.4.17 it had two built-in chains: PREROUTING (for altering incoming packets before routing) and OUTPUT (for altering locally-generated packets before routing). Since kernel 2.4.18, three other built-in chains are also supported: INPUT (for packets coming into the box itself), FORWARD (for altering packets being routed through the box), and POSTROUTING (for altering packets as they are about to go out). raw: This table is used mainly for configuring exemptions from connection tracking in combination with the NOTRACK target. It registers at the netfilter hooks with higher priority and is thus called before ip_conntrack, or any other IP tables. It provides the following built-in chains: PREROUTING (for packets arriving via any network interface) and OUTPUT (for packets generated by local processes). security: This table is used for Mandatory Access Control (MAC) networking rules, such as those enabled by the SECMARK and CONNSECMARK targets. Mandatory Access Control is implemented by Linux Security Modules such as SELinux. The security table is called after the filter table, allowing any Discretionary Access Control (DAC) rules in the filter table to take effect before MAC rules. This table provides the following built-in chains: INPUT (for packets coming into the box itself), OUTPUT (for altering locally-generated packets before routing), and FORWARD (for altering packets being routed through the box). OPTIONS top The options that are recognized by iptables and ip6tables can be divided into several different groups. COMMANDS These options specify the desired action to perform. Only one of them can be specified on the command line unless otherwise stated below. For long versions of the command and option names, you need to use only enough letters to ensure that iptables can differentiate it from all other options. -A, --append chain rule-specification Append one or more rules to the end of the selected chain. When the source and/or destination names resolve to more than one address, a rule will be added for each possible address combination. -C, --check chain rule-specification Check whether a rule matching the specification does exist in the selected chain. This command uses the same logic as -D to find a matching entry, but does not alter the existing iptables configuration and uses its exit code to indicate success or failure. -D, --delete chain rule-specification -D, --delete chain rulenum Delete one or more rules from the selected chain. There are two versions of this command: the rule can be specified as a number in the chain (starting at 1 for the first rule) or a rule to match. -I, --insert chain [rulenum] rule-specification Insert one or more rules in the selected chain as the given rule number. So, if the rule number is 1, the rule or rules are inserted at the head of the chain. This is also the default if no rule number is specified. -R, --replace chain rulenum rule-specification Replace a rule in the selected chain. If the source and/or destination names resolve to multiple addresses, the command will fail. Rules are numbered starting at 1. -L, --list [chain] List all rules in the selected chain. If no chain is selected, all chains are listed. Like every other iptables command, it applies to the specified table (filter is the default), so NAT rules get listed by iptables -t nat -n -L Please note that it is often used with the -n option, in order to avoid long reverse DNS lookups. It is legal to specify the -Z (zero) option as well, in which case the chain(s) will be atomically listed and zeroed. The exact output is affected by the other arguments given. The exact rules are suppressed until you use iptables -L -v or iptables-save(8). -S, --list-rules [chain] Print all rules in the selected chain. If no chain is selected, all chains are printed like iptables-save. Like every other iptables command, it applies to the specified table (filter is the default). -F, --flush [chain] Flush the selected chain (all the chains in the table if none is given). This is equivalent to deleting all the rules one by one. -Z, --zero [chain [rulenum]] Zero the packet and byte counters in all chains, or only the given chain, or only the given rule in a chain. It is legal to specify the -L, --list (list) option as well, to see the counters immediately before they are cleared. (See above.) -N, --new-chain chain Create a new user-defined chain by the given name. There must be no target of that name already. -X, --delete-chain [chain] Delete the chain specified. There must be no references to the chain. If there are, you must delete or replace the referring rules before the chain can be deleted. The chain must be empty, i.e. not contain any rules. If no argument is given, it will delete all empty chains in the table. Empty builtin chains can only be deleted with iptables-nft. -P, --policy chain target Set the policy for the built-in (non-user-defined) chain to the given target. The policy target must be either ACCEPT or DROP. -E, --rename-chain old-chain new-chain Rename the user specified chain to the user supplied name. This is cosmetic, and has no effect on the structure of the table. -h Help. Give a (currently very brief) description of the command syntax. PARAMETERS The following parameters make up a rule specification (as used in the add, delete, insert, replace and append commands). -4, --ipv4 This option has no effect in iptables and iptables- restore. If a rule using the -4 option is inserted with (and only with) ip6tables-restore, it will be silently ignored. Any other uses will throw an error. This option allows IPv4 and IPv6 rules in a single rule file for use with both iptables-restore and ip6tables-restore. -6, --ipv6 If a rule using the -6 option is inserted with (and only with) iptables-restore, it will be silently ignored. Any other uses will throw an error. This option allows IPv4 and IPv6 rules in a single rule file for use with both iptables-restore and ip6tables-restore. This option has no effect in ip6tables and ip6tables-restore. [!] -p, --protocol protocol The protocol of the rule or of the packet to check. The specified protocol can be one of tcp, udp, udplite, icmp, icmpv6, esp, ah, sctp, mh or the special keyword "all", or it can be a numeric value, representing one of these protocols or a different one. A protocol name from /etc/protocols is also allowed. A "!" argument before the protocol inverts the test. The number zero is equivalent to all. "all" will match with all protocols and is taken as default when this option is omitted. Note that, in ip6tables, IPv6 extension headers except esp are not allowed. esp and ipv6-nonext can be used with Kernel version 2.6.11 or later. The number zero is equivalent to all, which means that you cannot test the protocol field for the value 0 directly. To match on a HBH header, even if it were the last, you cannot use -p 0, but always need -m hbh. [!] -s, --source address[/mask][,...] Source specification. Address can be either a network name, a hostname, a network IP address (with /mask), or a plain IP address. Hostnames will be resolved once only, before the rule is submitted to the kernel. Please note that specifying any name to be resolved with a remote query such as DNS is a really bad idea. The mask can be either an ipv4 network mask (for iptables) or a plain number, specifying the number of 1's at the left side of the network mask. Thus, an iptables mask of 24 is equivalent to 255.255.255.0. A "!" argument before the address specification inverts the sense of the address. The flag --src is an alias for this option. Multiple addresses can be specified, but this will expand to multiple rules (when adding with -A), or will cause multiple rules to be deleted (with -D). [!] -d, --destination address[/mask][,...] Destination specification. See the description of the -s (source) flag for a detailed description of the syntax. The flag --dst is an alias for this option. -m, --match match Specifies a match to use, that is, an extension module that tests for a specific property. The set of matches make up the condition under which a target is invoked. Matches are evaluated first to last as specified on the command line and work in short-circuit fashion, i.e. if one extension yields false, evaluation will stop. -j, --jump target This specifies the target of the rule; i.e., what to do if the packet matches it. The target can be a user-defined chain (other than the one this rule is in), one of the special builtin targets which decide the fate of the packet immediately, or an extension (see MATCH AND TARGET EXTENSIONS below). If this option is omitted in a rule (and -g is not used), then matching the rule will have no effect on the packet's fate, but the counters on the rule will be incremented. -g, --goto chain This specifies that the processing should continue in a user specified chain. Unlike with the --jump option, RETURN will not continue processing in this chain but instead in the chain that called us via --jump. [!] -i, --in-interface name Name of an interface via which a packet was received (only for packets entering the INPUT, FORWARD and PREROUTING chains). When the "!" argument is used before the interface name, the sense is inverted. If the interface name ends in a "+", then any interface which begins with this name will match. If this option is omitted, any interface name will match. [!] -o, --out-interface name Name of an interface via which a packet is going to be sent (for packets entering the FORWARD, OUTPUT and POSTROUTING chains). When the "!" argument is used before the interface name, the sense is inverted. If the interface name ends in a "+", then any interface which begins with this name will match. If this option is omitted, any interface name will match. [!] -f, --fragment This means that the rule only refers to second and further IPv4 fragments of fragmented packets. Since there is no way to tell the source or destination ports of such a packet (or ICMP type), such a packet will not match any rules which specify them. When the "!" argument precedes the "-f" flag, the rule will only match head fragments, or unfragmented packets. This option is IPv4 specific, it is not available in ip6tables. -c, --set-counters packets bytes This enables the administrator to initialize the packet and byte counters of a rule (during INSERT, APPEND, REPLACE operations). OTHER OPTIONS The following additional options can be specified: -v, --verbose Verbose output. This option makes the list command show the interface name, the rule options (if any), and the TOS masks. The packet and byte counters are also listed, with the suffix 'K', 'M' or 'G' for 1000, 1,000,000 and 1,000,000,000 multipliers respectively (but see the -x flag to change this). For appending, insertion, deletion and replacement, this causes detailed information on the rule or rules to be printed. -v may be specified multiple times to possibly emit more detailed debug statements: Specified twice, iptables-legacy will dump table info and entries in libiptc, iptables-nft dumps rules in netlink (VM code) presentation. Specified three times, iptables- nft will also dump any netlink messages sent to kernel. -V, --version Show program version and the kernel API used. -w, --wait [seconds] Wait for the xtables lock. To prevent multiple instances of the program from running concurrently, an attempt will be made to obtain an exclusive lock at launch. By default, the program will exit if the lock cannot be obtained. This option will make the program wait (indefinitely or for optional seconds) until the exclusive lock can be obtained. -n, --numeric Numeric output. IP addresses and port numbers will be printed in numeric format. By default, the program will try to display them as host names, network names, or services (whenever applicable). -x, --exact Expand numbers. Display the exact value of the packet and byte counters, instead of only the rounded number in K's (multiples of 1000), M's (multiples of 1000K) or G's (multiples of 1000M). This option is only relevant for the -L command. --line-numbers When listing rules, add line numbers to the beginning of each rule, corresponding to that rule's position in the chain. --modprobe=command When adding or inserting rules into a chain, use command to load any necessary modules (targets, match extensions, etc). LOCK FILE top iptables uses the /run/xtables.lock file to take an exclusive lock at launch. The XTABLES_LOCKFILE environment variable can be used to override the default setting. MATCH AND TARGET EXTENSIONS top iptables can use extended packet matching and target modules. A list of these is available in the iptables-extensions(8) manpage. DIAGNOSTICS top Various error messages are printed to standard error. The exit code is 0 for correct functioning. Errors which appear to be caused by invalid or abused command line parameters cause an exit code of 2. Errors which indicate an incompatibility between kernel and user space cause an exit code of 3. Errors which indicate a resource problem, such as a busy lock, failing memory allocation or error messages from kernel cause an exit code of 4. Finally, other errors cause an exit code of 1. BUGS top Bugs? What's this? ;-) Well, you might want to have a look at https://bugzilla.netfilter.org/ iptables will exit immediately with an error code of 111 if it finds that it was called as a setuid-to-root program. iptables cannot be used safely in this manner because it trusts the shared libraries (matches, targets) loaded at run time, the search path can be set using environment variables. COMPATIBILITY WITH IPCHAINS top This iptables is very similar to ipchains by Rusty Russell. The main difference is that the chains INPUT and OUTPUT are only traversed for packets coming into the local host and originating from the local host respectively. Hence every packet only passes through one of the three chains (except loopback traffic, which involves both INPUT and OUTPUT chains); previously a forwarded packet would pass through all three. The other main difference is that -i refers to the input interface; -o refers to the output interface, and both are available for packets entering the FORWARD chain. The various forms of NAT have been separated out; iptables is a pure packet filter when using the default `filter' table, with optional extension modules. This should avoid much of the confusion over the combination of IP masquerading and packet filtering seen previously. So the following options are handled differently: -j MASQ -M -S -M -L There are several other changes in iptables. SEE ALSO top iptables-apply(8), iptables-save(8), iptables-restore(8), iptables-extensions(8), The packet-filtering-HOWTO details iptables usage for packet filtering, the NAT-HOWTO details NAT, the netfilter-extensions- HOWTO details the extensions that are not in the standard distribution, and the netfilter-hacking-HOWTO details the netfilter internals. See https://www.netfilter.org/ . AUTHORS top Rusty Russell originally wrote iptables, in early consultation with Michael Neuling. Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet selection framework in iptables, then wrote the mangle table, the owner match, the mark stuff, and ran around doing cool stuff everywhere. James Morris wrote the TOS target, and tos match. Jozsef Kadlecsik wrote the REJECT target. Harald Welte wrote the ULOG and NFQUEUE target, the new libiptc, as well as the TTL, DSCP, ECN matches and targets. The Netfilter Core Team is: Jozsef Kadlecsik, Pablo Neira Ayuso, Eric Leblond, Florian Westphal and Arturo Borrero Gonzalez. Emeritus Core Team members are: Marc Boucher, Martin Josefsson, Yasuyuki Kozakai, James Morris, Harald Welte and Rusty Russell. Man page originally written by Herve Eychenne <[email protected]>. VERSION top This manual page applies to iptables/ip6tables 1.8.10. COLOPHON top This page is part of the iptables (administer and maintain packet filter rules) project. Information about the project can be found at http://www.netfilter.org/. If you have a bug report for this manual page, see http://bugzilla.netfilter.org/. This page was obtained from the project's upstream Git repository git://git.netfilter.org/iptables on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-21.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] iptables 1.8.10 IPTABLES(8) Pages that refer to this page: iptables-xml(1), proc(5), systemd.socket(5), cgroups(7), network_namespaces(7), arptables-nft(8), ebtables-nft(8), flowtop(8), ifconfig(8), ip-link(8), iptables-apply(8), iptables-restore(8), iptables-save(8), mountd(8), netstat(8), ovs-ctl(8), statd(8), tc-bpf(8), tc-fw(8), tc-mqprio(8), wg-quick(8), xtables-monitor(8), xtables-nft(8), xtables-translate(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ip6tables\n\n> This command is an alias of `iptables` for the IPv6 firewall.\n\n- View documentation for the original command:\n\n`tldr iptables`\n
ip6tables-restore
iptables-restore(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training iptables-restore(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | BUGS | AUTHORS | SEE ALSO | COLOPHON IPTABLES-RESTORE(8) iptables 1.8.10 IPTABLES-RESTORE(8) NAME top iptables-restore Restore IP Tables ip6tables-restore Restore IPv6 Tables SYNOPSIS top iptables-restore [-chntvV] [-w seconds] [-M modprobe] [-T name] [file] ip6tables-restore [-chntvV] [-w seconds] [-M modprobe] [-T name] [file] DESCRIPTION top iptables-restore and ip6tables-restore are used to restore IP and IPv6 Tables from data specified on STDIN or in file. Use I/O redirection provided by your shell to read from a file or specify file as an argument. -c, --counters Restore the values of all packet and byte counters. -h, --help Print a short option summary. -n, --noflush Don't flush the previous contents of the table. If not specified, both commands flush (delete) all previous contents of the respective table. -t, --test Only parse and construct the ruleset, but do not commit it. -v, --verbose Print additional debug info during ruleset processing. Specify multiple times to increase debug level. -V, --version Print the program version number. -w, --wait [seconds] Wait for the xtables lock. To prevent multiple instances of the program from running concurrently, an attempt will be made to obtain an exclusive lock at launch. By default, the program will exit if the lock cannot be obtained. This option will make the program wait (indefinitely or for optional seconds) until the exclusive lock can be obtained. -M, --modprobe modprobe Specify the path to the modprobe(8) program. By default, iptables-restore will inspect /proc/sys/kernel/modprobe to determine the executable's path. -T, --table name Restore only the named table even if the input stream contains other ones. BUGS top None known as of iptables-1.2.1 release AUTHORS top Harald Welte <[email protected]> wrote iptables-restore based on code from Rusty Russell. Andras Kis-Szabo <[email protected]> contributed ip6tables- restore. SEE ALSO top iptables-apply(8), iptables-save(8), iptables(8) The iptables-HOWTO, which details more iptables usage, the NAT- HOWTO, which details NAT, and the netfilter-hacking-HOWTO which details the internals. COLOPHON top This page is part of the iptables (administer and maintain packet filter rules) project. Information about the project can be found at http://www.netfilter.org/. If you have a bug report for this manual page, see http://bugzilla.netfilter.org/. This page was obtained from the project's upstream Git repository git://git.netfilter.org/iptables on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-21.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] iptables 1.8.10 IPTABLES-RESTORE(8) Pages that refer to this page: iptables-xml(1), iptables(8), iptables-apply(8), iptables-save(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ip6tables-restore\n\n> This command is an alias of `iptables-restore` for the IPv6 firewall.\n\n- View documentation for the original command:\n\n`tldr iptables-restore`\n
ip6tables-save
iptables-save(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training iptables-save(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | BUGS | AUTHORS | SEE ALSO | COLOPHON IPTABLES-SAVE(8) iptables 1.8.10 IPTABLES-SAVE(8) NAME top iptables-save dump iptables rules ip6tables-save dump iptables rules SYNOPSIS top iptables-save [-M modprobe] [-c] [-t table] [-f filename] ip6tables-save [-M modprobe] [-c] [-t table] [-f filename] DESCRIPTION top iptables-save and ip6tables-save are used to dump the contents of IP or IPv6 Table in easily parseable format either to STDOUT or to a specified file. -M, --modprobe modprobe Specify the path to the modprobe(8) program. By default, iptables-save will inspect /proc/sys/kernel/modprobe to determine the executable's path. -f, --file filename Specify a filename to log the output to. If not specified, iptables-save will log to STDOUT. -c, --counters Include the current values of all packet and byte counters in the output. -t, --table tablename Restrict output to only one table. If the kernel is configured with automatic module loading, an attempt will be made to load the appropriate module for that table if it is not already there. If not specified, output includes all available tables. No module loading takes place, so in order to include a specific table in the output, the respective module (something like iptable_mangle or ip6table_raw) must be loaded first. BUGS top None known as of iptables-1.2.1 release AUTHORS top Harald Welte <[email protected]> Rusty Russell <[email protected]> Andras Kis-Szabo <[email protected]> contributed ip6tables-save. SEE ALSO top iptables-apply(8), iptables-restore(8), iptables(8) The iptables-HOWTO, which details more iptables usage, the NAT- HOWTO, which details NAT, and the netfilter-hacking-HOWTO which details the internals. COLOPHON top This page is part of the iptables (administer and maintain packet filter rules) project. Information about the project can be found at http://www.netfilter.org/. If you have a bug report for this manual page, see http://bugzilla.netfilter.org/. This page was obtained from the project's upstream Git repository git://git.netfilter.org/iptables on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-21.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] iptables 1.8.10 IPTABLES-SAVE(8) Pages that refer to this page: iptables-xml(1), iptables(8), iptables-apply(8), iptables-restore(8), xtables-translate(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ip6tables-save\n\n> This command is an alias of `iptables-save` for the IPv6 firewall.\n\n- View documentation for the original command:\n\n`tldr iptables-save`\n
ipcmk
ipcmk(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ipcmk(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY IPCMK(1) User Commands IPCMK(1) NAME top ipcmk - make various IPC resources SYNOPSIS top ipcmk [options] DESCRIPTION top ipcmk allows you to create System V inter-process communication (IPC) objects: shared memory segments, message queues, and semaphore arrays. OPTIONS top Resources can be specified with these options: -M, --shmem size Create a shared memory segment of size bytes. The size argument may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, etc. (the "iB" is optional, e.g., "K" has the same meaning as "KiB") or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, etc. -Q, --queue Create a message queue. -S, --semaphore number Create a semaphore array with number of elements. Other options are: -p, --mode mode Access permissions for the resource. Default is 0644. -h, --help Display help text and exit. -V, --version Print version and exit. AUTHORS top Hayden A. James <[email protected]> SEE ALSO top ipcrm(1), ipcs(1), sysvipc(7) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The ipcmk command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 IPCMK(1) Pages that refer to this page: ipcrm(1), ipcs(1), lsipc(1), pcp-ipcs(1), sysvipc(7) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ipcmk\n\n> Create IPC (Inter-process Communication) resources.\n> More information: <https://manned.org/ipcmk>.\n\n- Create a shared memory segment:\n\n`ipcmk --shmem {{segment_size_in_bytes}}`\n\n- Create a semaphore:\n\n`ipcmk --semaphore {{element_size}}`\n\n- Create a message queue:\n\n`ipcmk --queue`\n\n- Create a shared memory segment with specific permissions (default is 0644):\n\n`ipcmk --shmem {{segment_size_in_bytes}} {{octal_permissions}}`\n
ipcrm
ipcrm(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ipcrm(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | NOTES | SEE ALSO | REPORTING BUGS | AVAILABILITY IPCRM(1) User Commands IPCRM(1) NAME top ipcrm - remove certain IPC resources SYNOPSIS top ipcrm [options] ipcrm [shm|msg|sem] ID ... DESCRIPTION top ipcrm removes System V inter-process communication (IPC) objects and associated data structures from the system. In order to delete such objects, you must be superuser, or the creator or owner of the object. System V IPC objects are of three types: shared memory, message queues, and semaphores. Deletion of a message queue or semaphore object is immediate (regardless of whether any process still holds an IPC identifier for the object). A shared memory object is only removed after all currently attached processes have detached (shmdt(2)) the object from their virtual address space. Two syntax styles are supported. The old Linux historical syntax specifies a three-letter keyword indicating which class of object is to be deleted, followed by one or more IPC identifiers for objects of this type. The SUS-compliant syntax allows the specification of zero or more objects of all three types in a single command line, with objects specified either by key or by identifier (see below). Both keys and identifiers may be specified in decimal, hexadecimal (specified with an initial '0x' or '0X'), or octal (specified with an initial '0'). The details of the removes are described in shmctl(2), msgctl(2), and semctl(2). The identifiers and keys can be found by using ipcs(1). OPTIONS top -a, --all [shm] [msg] [sem] Remove all resources. When an option argument is provided, the removal is performed only for the specified resource types. Warning! Do not use -a if you are unsure how the software using the resources might react to missing objects. Some programs create these resources at startup and may not have any code to deal with an unexpected disappearance. -M, --shmem-key shmkey Remove the shared memory segment created with shmkey after the last detach is performed. -m, --shmem-id shmid Remove the shared memory segment identified by shmid after the last detach is performed. -Q, --queue-key msgkey Remove the message queue created with msgkey. -q, --queue-id msgid Remove the message queue identified by msgid. -S, --semaphore-key semkey Remove the semaphore created with semkey. -s, --semaphore-id semid Remove the semaphore identified by semid. -h, --help Display help text and exit. -V, --version Print version and exit. NOTES top In its first Linux implementation, ipcrm used the deprecated syntax shown in the second line of the SYNOPSIS. Functionality present in other *nix implementations of ipcrm has since been added, namely the ability to delete resources by key (not just identifier), and to respect the same command-line syntax. For backward compatibility the previous syntax is still supported. SEE ALSO top ipcmk(1), ipcs(1), msgctl(2), msgget(2), semctl(2), semget(2), shmctl(2), shmdt(2), shmget(2), ftok(3), sysvipc(7) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The ipcrm command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 IPCRM(1) Pages that refer to this page: ipcmk(1), ipcs(1), lsipc(1), pcp-ipcs(1), sysvipc(7) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ipcrm\n\n> Delete IPC (Inter-process Communication) resources.\n> More information: <https://manned.org/ipcrm>.\n\n- Delete a shared memory segment by ID:\n\n`ipcrm --shmem-id {{shmem_id}}`\n\n- Delete a shared memory segment by key:\n\n`ipcrm --shmem-key {{shmem_key}}`\n\n- Delete an IPC queue by ID:\n\n`ipcrm --queue-id {{ipc_queue_id}}`\n\n- Delete an IPC queue by key:\n\n`ipcrm --queue-key {{ipc_queue_key}}`\n\n- Delete a semaphore by ID:\n\n`ipcrm --semaphore-id {{semaphore_id}}`\n\n- Delete a semaphore by key:\n\n`ipcrm --semaphore-key {{semaphore_key}}`\n\n- Delete all IPC resources:\n\n`ipcrm --all`\n
ipcs
ipcs(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ipcs(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | CONFORMING TO | NOTES | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY IPCS(1) User Commands IPCS(1) NAME top ipcs - show information on IPC facilities SYNOPSIS top ipcs [options] DESCRIPTION top ipcs shows information on System V inter-process communication facilities. By default it shows information about all three resources: shared memory segments, message queues, and semaphore arrays. OPTIONS top -i, --id id Show full details on just the one resource element identified by id. This option needs to be combined with one of the three resource options: -m, -q or -s. -h, --help Display help text and exit. -V, --version Print version and exit. Resource options -m, --shmems Write information about active shared memory segments. -q, --queues Write information about active message queues. -s, --semaphores Write information about active semaphore sets. -a, --all Write information about all three resources (default). Output formats Of these options only one takes effect: the last one specified. -c, --creator Show creator and owner. -l, --limits Show resource limits. -p, --pid Show PIDs of creator and last operator. -t, --time Write time information. The time of the last control operation that changed the access permissions for all facilities, the time of the last msgsnd(2) and msgrcv(2) operations on message queues, the time of the last shmat(2) and shmdt(2) operations on shared memory, and the time of the last semop(2) operation on semaphores. -u, --summary Show status summary. Representation These affect only the -l (--limits) option. -b, --bytes Print the sizes in bytes rather than in a human-readable format. By default, the unit, sizes are expressed in, is byte, and unit prefixes are in power of 2^10 (1024). Abbreviations of symbols are exhibited truncated in order to reach a better readability, by exhibiting alone the first letter of them; examples: "1 KiB" and "1 MiB" are respectively exhibited as "1 K" and "1 M", then omitting on purpose the mention "iB", which is part of these abbreviations. --human Print sizes in human-readable format. CONFORMING TO top The Linux ipcs utility is not fully compatible to the POSIX ipcs utility. The Linux version does not support the POSIX -a, -b and -o options, but does support the -l and -u options not defined by POSIX. A portable application shall not use the -a, -b, -o, -l, and -u options. NOTES top The current implementation of ipcs obtains information about available IPC resources by parsing the files in /proc/sysvipc. Before util-linux version v2.23, an alternate mechanism was used: the IPC_STAT command of msgctl(2), semctl(2), and shmctl(2). This mechanism is also used in later util-linux versions in the case where /proc is unavailable. A limitation of the IPC_STAT mechanism is that it can only be used to retrieve information about IPC resources for which the user has read permission. AUTHORS top Krishna Balasubramanian <[email protected]> SEE ALSO top ipcmk(1), ipcrm(1), msgrcv(2), msgsnd(2), semget(2), semop(2), shmat(2), shmdt(2), shmget(2), sysvipc(7) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The ipcs command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 IPCS(1) Pages that refer to this page: ipcmk(1), ipcrm(1), lsipc(1), msgctl(2), semctl(2), semget(2), shmctl(2), proc(5), sysvipc(7) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ipcs\n\n> Display information about resources used in IPC (Inter-process Communication).\n> More information: <https://manned.org/ipcs>.\n\n- Specific information about the Message Queue which has the ID 32768:\n\n`ipcs -qi 32768`\n\n- General information about all the IPC:\n\n`ipcs -a`\n
ippeveprinter
ippeveprinter(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ippeveprinter(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXIT STATUS | CONFORMING TO | ENVIRONMENT | COMMAND OUTPUT | EXAMPLES | SEE ALSO | COPYRIGHT | COLOPHON ippeveprinter(1) Apple Inc. ippeveprinter(1) NAME top ippeveprinter - an ipp everywhere printer application for cups SYNOPSIS top ippeveprinter [ --help ] [ --no-web-forms ] [ --pam-service service ] [ --version ] [ -2 ] [ -A ] [ -D device-uri ] [ -F output-type/subtype ] [ -K keypath ] [ -M manufacturer ] [ -P filename.ppd ] [ -V ipp-version ] [ -a filename.conf ] [ -c command ] [ -d spool-directory ] [ -f type/subtype[,...] ] [ -i iconfile.png ] [ -k ] [ -l location ] [ -m model ] [ -n hostname ] [ -p port ] [ -r subtype[,subtype] ] [ -s speed[,color-speed] ] [ -v[vvv] ] service-name DESCRIPTION top ippeveprinter is a simple Internet Printing Protocol (IPP) server conforming to the IPP Everywhere (PWG 5100.14) specification. It can be used to test client software or act as a very basic print server that runs a command for every job that is printed. OPTIONS top The following options are recognized by ippeveprinter: --help Show program usage. --no-web-forms Disable the web interface forms used to update the media and supply levels. --pam-service service Set the PAM service name. The default service is "cups". --version Show the CUPS version. -2 Report support for two-sided (duplex) printing. -A Enable authentication for the created printer. ippeveprinter uses PAM to authenticate HTTP Basic credentials. -D device-uri Set the device URI for print output. The URI can be a filename, directory, or a network socket URI of the form "socket://ADDRESS[:PORT]" (where the default port number is 9100). When specifying a directory, ippeveprinter will create an output file using the job ID and name. -F output-type/subtype[,...] Specifies the output MIME media type. The default is "application/postscript" when the -P option is specified. -M manufacturer Set the manufacturer of the printer. The default is "Example". -P filename.ppd Load printer attributes from the specified PPD file. This option is typically used in conjunction with the ippeveps(7) printer command ("-c ippeveps"). -V 1.1 -V 2.0 Specifies the maximum IPP version to report. 2.0 is the default. -c command Run the specified command for each document that is printed. If "command" is not an absolute path ("/path/to/command"), ippeveprinter looks for the command in the "command" subdirectory of the CUPS binary directory, typically /usr/lib/cups/command or /usr/libexec/cups/command. The cups-config(1) command can be used to discover the correct binary directory ("cups-config --serverbin"). In addition, the CUPS_SERVERBIN environment variable can be used to override the default location of this directory - see the cups(1) man page for more details. -d spool-directory Specifies the directory that will hold the print files. The default is a directory under the user's current temporary directory. -f type/subtype[,...] Specifies a list of MIME media types that the server will accept. The default depends on the type of printer created. -i iconfile.png Specifies the printer icon file for the server. The file must be a PNG format image. The default is an internally- provided PNG image. -k Keeps the print documents in the spool directory rather than deleting them. -l location Specifies the human-readable location string that is reported by the server. The default is the empty string. -m model Specifies the model name of the printer. The default is "Printer". -n hostname Specifies the hostname that is reported by the server. The default is the name returned by the hostname(1) command. -p port Specifies the port number to listen on. The default is a user-specific number from 8000 to 8999. -r off Turns off DNS-SD service advertisements entirely. -r subtype[,subtype] Specifies the DNS-SD subtype(s) to advertise. Separate multiple subtypes with a comma. The default is "_print". -s speed[,color-speed] Specifies the printer speed in pages per minute. If two numbers are specified and the second number is greater than zero, the server will report support for color printing. The default is "10,0". -v[vvv] Be (very) verbose when logging activity to standard error. EXIT STATUS top The ippeveprinter program returns 1 if it is unable to process the command-line arguments or register the IPP service. Otherwise ippeveprinter will run continuously until terminated. CONFORMING TO top The ippeveprinter program is unique to CUPS and conforms to the IPP Everywhere (PWG 5100.14) specification. ENVIRONMENT top ippeveprinter adds environment variables starting with "IPP_" for all IPP Job attributes in the print request. For example, when executing a command for an IPP Job containing the "media" Job Template attribute, the "IPP_MEDIA" environment variable will be set to the value of that attribute. In addition, all IPP "xxx-default" and "pwg-xxx" Printer Description attributes are added to the environment. For example, the "IPP_MEDIA_DEFAULT" environment variable will be set to the default value for the "media" Job Template attribute. Enumerated values are converted to their keyword equivalents. For example, a "print-quality" Job Template attribute with a enum value of 3 will become the "IPP_PRINT_QUALITY" environment variable with a value of "draft". This string conversion only happens for standard Job Template attributes, currently "finishings", "orientation-requested", and "print-quality". Finally, the "CONTENT_TYPE" environment variable contains the MIME media type of the document being printed, the "DEVICE_URI" environment variable contains the device URI as specified with the "-D" option, the "OUTPUT_FORMAT" environment variable contains the output MIME media type, and the "PPD" environment variable contains the PPD filename as specified with the "-P" option. COMMAND OUTPUT top Unless they communicate directly with a printer, print commands send printer-ready data to the standard output. Print commands can send messages back to ippeveprinter on the standard error with one of the following prefixes: ATTR: attribute=value[ attribute=value] Sets the named attribute(s) to the given values. Currently only the "job-impressions" and "job-impressions-completed" Job Status attributes and the "marker-xxx", "printer-alert", "printer-alert-description", "printer-supply", and "printer- supply-description" Printer Status attributes can be set. DEBUG: Debugging message Logs a debugging message if at least two -v's have been specified. ERROR: Error message Logs an error message and copies the message to the "job- state-message" attribute. INFO: Informational message Logs an informational/progress message if -v has been specified and copies the message to the "job-state-message" attribute unless an error has been reported. STATE: keyword[,keyword,...] Sets the printer's "printer-state-reasons" attribute to the listed keywords. STATE: -keyword[,keyword,...] Removes the listed keywords from the printer's "printer- state-reasons" attribute. STATE: +keyword[,keyword,...] Adds the listed keywords to the printer's "printer-state- reasons" attribute. EXAMPLES top Run ippeveprinter with a service name of My Cool Printer: ippeveprinter "My Cool Printer" Run the file(1) command whenever a job is sent to the server: ippeveprinter -c /usr/bin/file "My Cool Printer" SEE ALSO top ippevepcl(7), ippeveps(7), PWG Internet Printing Protocol Workgroup (http://www.pwg.org/ipp) COPYRIGHT top Copyright 2007-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 2 December 2019 CUPS ippeveprinter(1) Pages that refer to this page: cups(1), cupstestppd(1), ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), cups-snmp.conf(5), mime.convs(5), ppdcfile(5), backend(7), filter(7), ippevepcl(7), cupsd-helper(8), cupsfilter(8), lpadmin(8), lpinfo(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ippeveprinter\n\n> A simple IPP Everywhere printer server.\n> See also: `ippeveps`, `ippevepcl`.\n> More information: <https://openprinting.github.io/cups/doc/man-ippeveprinter.html>.\n\n- Run the server with a specific service name:\n\n`ippeveprinter "{{service_name}}"`\n\n- Load printer attributes from a PPD file:\n\n`ippeveprinter -P {{path/to/file.ppd}} "{{service_name}}"`\n\n- Run the `file` command whenever a job is sent to the server:\n\n`ippeveprinter -c {{/usr/bin/file}} "{{service_name}}"`\n\n- Specify the directory that will hold the print files (by default, a directory under the user's temporary directory):\n\n`ippeveprinter -d {{spool_directory}} "{{service_name}}"`\n\n- Keep the print documents in the spool directory rather than deleting them:\n\n`ippeveprinter -k "{{service_name}}"`\n\n- Specify the printer speed in pages/minute unit (10 by default):\n\n`ippeveprinter -s {{speed}} "{{service_name}}"`\n
ippfind
ippfind(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ippfind(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXIT STATUS | ENVIRONMENT | EXAMPLES | SEE ALSO | COPYRIGHT | COLOPHON ippfind(1) Apple Inc. ippfind(1) NAME top ippfind - find internet printing protocol printers SYNOPSIS top ippfind [ options ] regtype[,subtype][.domain.] ... [ expression ... ] ippfind [ options ] name[.regtype[.domain.]] ... [ expression ... ] ippfind --help ippfind --version DESCRIPTION top ippfind finds services registered with a DNS server or available through local devices. Its primary purpose is to find IPP printers and show their URIs, show their current status, or run commands. REGISTRATION TYPES ippfind supports the following registration types: _http._tcp HyperText Transport Protocol (HTTP, RFC 2616) _https._tcp Secure HyperText Transport Protocol (HTTPS, RFC 2818) _ipp._tcp Internet Printing Protocol (IPP, RFC 2911) _ipps._tcp Secure Internet Printing Protocol (IPPS, draft) _printer._tcp Line Printer Daemon (LPD, RFC 1179) EXPRESSIONS ippfind supports expressions much like the find(1) utility. However, unlike find(1), ippfind uses POSIX regular expressions instead of shell filename matching patterns. If --exec, -l, --ls, -p, --print, --print-name, -q, --quiet, -s, or -x is not specified, ippfind adds --print to print the service URI of anything it finds. The following expressions are supported: -d regex --domain regex True if the domain matches the given regular expression. --false Always false. -h regex --host regex True is the hostname matches the given regular expression. -l --ls Lists attributes returned by Get-Printer-Attributes for IPP printers and traditional find "-ls" output for HTTP URLs. The result is true if the URI is accessible, false otherwise. --local True if the service is local to this computer. -N name --literal-name name True if the service instance name matches the given name. -n regex --name regex True if the service instance name matches the given regular expression. --path regex True if the URI resource path matches the given regular expression. -P number[-number] --port number[-number] True if the port matches the given number or range. -p --print Prints the URI if the result of previous expressions is true. The result is always true. -q --quiet Quiet mode - just returns the exit codes below. -r --remote True if the service is not local to this computer. -s --print-name Prints the service instance name if the result of previous expressions is true. The result is always true. --true Always true. -t key --txt key True if the TXT record contains the named key. --txt-key regex True if the TXT record contains the named key and matches the given regular expression. -u regex --uri regex True if the URI matches the given regular expression. -x utility [ argument ... ] ; --exec utility [ argument ... ] ; Executes the specified program if the current result is true. "{foo}" arguments are replaced with the corresponding value - see SUBSTITUTIONS below. Expressions may also contain modifiers: ( expression ) Group the result of expressions. ! expression --not expression Unary NOT of the expression. expression expression expression --and expression Logical AND of expressions. expression --or expression Logical OR of expressions. SUBSTITUTIONS The substitutions for "{foo}" in -e and --exec are: {service_domain} Domain name, e.g., "example.com.", "local.", etc. {service_hostname} Fully-qualified domain name, e.g., "printer.example.com.", "printer.local.", etc. {service_name} Service instance name, e.g., "My Fine Printer". {service_port} Port number for server, typically 631 for IPP and 80 for HTTP. {service_regtype} DNS-SD registration type, e.g., "_ipp._tcp", "_http._tcp", etc. {service_scheme} URI scheme for DNS-SD registration type, e.g., "ipp", "http", etc. {} {service_uri} URI for service, e.g., "ipp://printer.local./ipp/print", "http://printer.local./", etc. {txt_key} Value of TXT record key (lowercase). OPTIONS top ippfind supports the following options: --help Show program help. --version Show program version. -4 Use IPv4 when listing. -6 Use IPv6 when listing. -T seconds Specify find timeout in seconds. If 1 or less, ippfind stops as soon as it thinks it has found everything. The default timeout is 1 second. -V version Specifies the IPP version when listing. Supported values are "1.1", "2.0", "2.1", and "2.2". EXIT STATUS top ippfind returns 0 if the result for all processed expressions is true, 1 if the result of any processed expression is false, 2 if browsing or any query or resolution failed, 3 if an undefined option or invalid expression was specified, and 4 if it ran out of memory. ENVIRONMENT top When executing a program, ippfind sets the following environment variables for the matching service registration: IPPFIND_SERVICE_DOMAIN Domain name, e.g., "example.com.", "local.", etc. IPPFIND_SERVICE_HOSTNAME Fully-qualified domain name, e.g., "printer.example.com.", "printer.local.", etc. IPPFIND_SERVICE_NAME Service instance name, e.g., "My Fine Printer". IPPFIND_SERVICE_PORT Port number for server, typically 631 for IPP and 80 for HTTP. IPPFIND_SERVICE_REGTYPE DNS-SD registration type, e.g., "_ipp._tcp", "_http._tcp", etc. IPPFIND_SERVICE_SCHEME URI scheme for DNS-SD registration type, e.g., "ipp", "http", etc. IPPFIND_SERVICE_URI URI for service, e.g., "ipp://printer.local./ipp/print", "http://printer.local./", etc. IPPFIND_TXT_KEY Values of TXT record KEY (uppercase). EXAMPLES top To show the status of all registered IPP printers on your network, run: ippfind --ls Similarly, to send a PostScript test page to every PostScript printer, run: ippfind --txt-pdl application/postscript --exec ipptool -f onepage-letter.ps '{}' print-job.test \; SEE ALSO top ipptool(1) COPYRIGHT top Copyright 2013-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 26 April 2019 ippsample ippfind(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ippfind\n\n> Find services registered with a DNS server or available through local devices.\n> See also: `ipptool`, `ippeveprinter`.\n> More information: <https://openprinting.github.io/cups/doc/man-ippfind.html>.\n\n- List IPP printers registered on the network with their status:\n\n`ippfind --ls`\n\n- Send a specific PostScript document to every PostScript printer on the network:\n\n`ippfind --txt-pdl application/postscript --exec ipptool -f {{path/to/document.ps}} '{}' print-job.test \;`\n\n- Send a PostScript test document to every PostScript printer on the network:\n\n`ippfind --txt-pdl application/postscript --exec ipptool -f onepage-letter.ps '{}' print-job.test \;`\n\n- Send a PostScript test document to every PostScript printer on the network, whose name matches a regular expression:\n\n`ippfind --txt-pdl application/postscript --host {{regex}} --exec ipptool -f onepage-letter.ps '{}' print-job.test\;`\n
ipptool
ipptool(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ipptool(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXIT STATUS | FILES | CONFORMING TO | EXAMPLES | SEE ALSO | COPYRIGHT | COLOPHON ipptool(1) Apple Inc. ipptool(1) NAME top ipptool - perform internet printing protocol requests SYNOPSIS top ipptool [ --help ] [ --ippserver filename ] [ --stop-after-include-error ] [ --version ] [ -4 ] [ -6 ] [ -C ] [ -E ] [ -I ] [ -L ] [ -P filename.plist ] [ -R ] [ -S ] [ -T seconds ] [ -V version ] [ -X ] [ -c ] [ -d name=value ] [ -f filename ] [ -h ] [ -i seconds ] [ -n repeat-count ] [ -q ] [ -t ] [ -v ] printer-uri testfile [ ... testfile ] DESCRIPTION top ipptool sends IPP requests to the specified printer-uri and tests and/or displays the results. Each named testfile defines one or more requests, including the expected response status, attributes, and values. Output is either a plain text, formatted text, CSV, or XML report on the standard output, with a non-zero exit status indicating that one or more tests have failed. The testfile format is described in ipptoolfile(5). OPTIONS top The following options are recognized by ipptool: --help Shows program help. --ippserver filename Specifies that the test results should be written to the named ippserver attributes file. --stop-after-include-error Tells ipptool to stop if an error occurs in an included file. Normally ipptool will continue with subsequent tests after the INCLUDE directive. --version Shows the version of ipptool being used. -4 Specifies that ipptool must connect to the printer or server using IPv4. -6 Specifies that ipptool must connect to the printer or server using IPv6. -C Specifies that requests should be sent using the HTTP/1.1 "Transfer-Encoding: chunked" header, which is required for conformance by all versions of IPP. The default is to use "Transfer-Encoding: chunked" for requests with attached files and "Content-Length:" for requests without attached files. -E Forces TLS encryption when connecting to the server using the HTTP "Upgrade" header. -I Specifies that ipptool will continue past errors. -L Specifies that requests should be sent using the HTTP/1.0 "Content-Length:" header, which is required for conformance by all versions of IPP. The default is to use "Transfer-Encoding: chunked" for requests with attached files and "Content-Length:" for requests without attached files. -P filename.plist Specifies that the test results should be written to the named XML (Apple plist) file in addition to the regular test report (-t). This option is incompatible with the -i (interval) and -n (repeat-count) options. -R Retries tests when the "server-error-busy" status code is returned. -S Forces (dedicated) TLS encryption when connecting to the server. -T seconds Specifies a timeout for IPP requests in seconds. -V version Specifies the default IPP version to use: 1.0, 1.1, 2.0, 2.1, or 2.2. If not specified, version 1.1 is used. -X Specifies that XML (Apple plist) output is desired instead of the plain text report. This option is incompatible with the -i (interval) and -n (repeat-count) options. -c Specifies that CSV (comma-separated values) output is desired instead of the plain text output. -d name=value Defines the named variable. -f filename Defines the default request filename for tests. -h Validate HTTP response headers. -i seconds Specifies that the (last) testfile should be repeated at the specified interval. This option is incompatible with the -X (XML plist output) option. -l Specifies that plain text output is desired. -n repeat-count Specifies that the (last) testfile should be repeated the specified number of times. This option is incompatible with the -X (XML plist output) option. -q Be quiet and produce no output. -t Specifies that CUPS test report output is desired instead of the plain text output. -v Specifies that all request and response attributes should be output in CUPS test mode (-t). This is the default for XML output. EXIT STATUS top The ipptool program returns 0 if all tests were successful and 1 otherwise. FILES top The following standard files are available: color.jpg create-printer-subscription.test document-a4.pdf document-a4.ps document-letter.pdf document-letter.ps get-completed-jobs.test get-jobs.test get-notifications.test get-printer-attributes.test get-subscriptions.test gray.jpg ipp-1.1.test ipp-2.0.test ipp-2.1.test ipp-2.2.test ipp-everywhere.test onepage-a4.pdf onepage-a4.ps onepage-letter.pdf onepage-letter.ps print-job.test print-job-deflate.test print-job-gzip.test testfile.jpg testfile.pcl testfile.pdf testfile.ps testfile.txt validate-job.test CONFORMING TO top The ipptool program is unique to CUPS and conforms to the Internet Printing Protocol up to version 2.2. EXAMPLES top Get a list of completed jobs for "myprinter": ipptool ipp://localhost/printers/myprinter get-completed-jobs.test Send email notifications to "[email protected]" when "myprinter" changes: ipptool -d recipient=mailto:[email protected] \ ipp://localhost/printers/myprinter create-printer-subscription.test SEE ALSO top ipptoolfile(5), IANA IPP Registry (http://www.iana.org/assignments/ipp-registrations), PWG Internet Printing Protocol Workgroup (http://www.pwg.org/ipp) RFC 8011 (http://tools.ietf.org/html/rfc8011), COPYRIGHT top Copyright 2007-2021 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 5 April 2021 CUPS ipptool(1) Pages that refer to this page: ippfind(1), ipptoolfile(5) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ipptool\n\n> Issue IPP requests and receive printer's/server's responses.\n> See also: `ippfind`, `ippeveprinter`.\n> More information: <https://openprinting.github.io/cups/doc/man-ipptool.html>.\n\n- Get all attributes and their values supported by a printer:\n\n`ipptool ipp://{{printer_uri}} get-completed-jobs.test`\n\n- Get the list of completed jobs of a printer:\n\n`ipptool ipp://{{printer_uri}} get-completed-jobs.test`\n\n- Send an email notification when a printer changes:\n\n`ipptool -d recipient=mailto:{{email}} ipp://{{printer_uri}} create-printer-subscription.test`\n
iptables
iptables(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training iptables(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | TARGETS | TABLES | OPTIONS | LOCK FILE | MATCH AND TARGET EXTENSIONS | DIAGNOSTICS | BUGS | COMPATIBILITY WITH IPCHAINS | SEE ALSO | AUTHORS | VERSION | COLOPHON IPTABLES(8) iptables 1.8.10 IPTABLES(8) NAME top iptables/ip6tables administration tool for IPv4/IPv6 packet filtering and NAT SYNOPSIS top iptables [-t table] {-A|-C|-D|-V} chain rule-specification ip6tables [-t table] {-A|-C|-D|-V} chain rule-specification iptables [-t table] -I chain [rulenum] rule-specification iptables [-t table] -R chain rulenum rule-specification iptables [-t table] -D chain rulenum iptables [-t table] -S [chain [rulenum]] iptables [-t table] {-F|-L|-Z} [chain [rulenum]] [options...] iptables [-t table] -N chain iptables [-t table] -X [chain] iptables [-t table] -P chain policy iptables [-t table] -E old-chain-name new-chain-name rule-specification := [matches...] [target] match := -m matchname [per-match-options] target := -j targetname [per-target-options] DESCRIPTION top Iptables and ip6tables are used to set up, maintain, and inspect the tables of IPv4 and IPv6 packet filter rules in the Linux kernel. Several different tables may be defined. Each table contains a number of built-in chains and may also contain user- defined chains. Each chain is a list of rules which can match a set of packets. Each rule specifies what to do with a packet that matches. This is called a `target', which may be a jump to a user-defined chain in the same table. TARGETS top A firewall rule specifies criteria for a packet and a target. If the packet does not match, the next rule in the chain is examined; if it does match, then the next rule is specified by the value of the target, which can be the name of a user-defined chain, one of the targets described in iptables-extensions(8), or one of the special values ACCEPT, DROP or RETURN. ACCEPT means to let the packet through. DROP means to drop the packet on the floor. RETURN means stop traversing this chain and resume at the next rule in the previous (calling) chain. If the end of a built-in chain is reached or a rule in a built-in chain with target RETURN is matched, the target specified by the chain policy determines the fate of the packet. TABLES top There are currently five independent tables (which tables are present at any time depends on the kernel configuration options and which modules are present). -t, --table table This option specifies the packet matching table which the command should operate on. If the kernel is configured with automatic module loading, an attempt will be made to load the appropriate module for that table if it is not already there. The tables are as follows: filter: This is the default table (if no -t option is passed). It contains the built-in chains INPUT (for packets destined to local sockets), FORWARD (for packets being routed through the box), and OUTPUT (for locally- generated packets). nat: This table is consulted when a packet that creates a new connection is encountered. It consists of four built-ins: PREROUTING (for altering packets as soon as they come in), INPUT (for altering packets destined for local sockets), OUTPUT (for altering locally- generated packets before routing), and POSTROUTING (for altering packets as they are about to go out). IPv6 NAT support is available since kernel 3.7. mangle: This table is used for specialized packet alteration. Until kernel 2.4.17 it had two built-in chains: PREROUTING (for altering incoming packets before routing) and OUTPUT (for altering locally-generated packets before routing). Since kernel 2.4.18, three other built-in chains are also supported: INPUT (for packets coming into the box itself), FORWARD (for altering packets being routed through the box), and POSTROUTING (for altering packets as they are about to go out). raw: This table is used mainly for configuring exemptions from connection tracking in combination with the NOTRACK target. It registers at the netfilter hooks with higher priority and is thus called before ip_conntrack, or any other IP tables. It provides the following built-in chains: PREROUTING (for packets arriving via any network interface) and OUTPUT (for packets generated by local processes). security: This table is used for Mandatory Access Control (MAC) networking rules, such as those enabled by the SECMARK and CONNSECMARK targets. Mandatory Access Control is implemented by Linux Security Modules such as SELinux. The security table is called after the filter table, allowing any Discretionary Access Control (DAC) rules in the filter table to take effect before MAC rules. This table provides the following built-in chains: INPUT (for packets coming into the box itself), OUTPUT (for altering locally-generated packets before routing), and FORWARD (for altering packets being routed through the box). OPTIONS top The options that are recognized by iptables and ip6tables can be divided into several different groups. COMMANDS These options specify the desired action to perform. Only one of them can be specified on the command line unless otherwise stated below. For long versions of the command and option names, you need to use only enough letters to ensure that iptables can differentiate it from all other options. -A, --append chain rule-specification Append one or more rules to the end of the selected chain. When the source and/or destination names resolve to more than one address, a rule will be added for each possible address combination. -C, --check chain rule-specification Check whether a rule matching the specification does exist in the selected chain. This command uses the same logic as -D to find a matching entry, but does not alter the existing iptables configuration and uses its exit code to indicate success or failure. -D, --delete chain rule-specification -D, --delete chain rulenum Delete one or more rules from the selected chain. There are two versions of this command: the rule can be specified as a number in the chain (starting at 1 for the first rule) or a rule to match. -I, --insert chain [rulenum] rule-specification Insert one or more rules in the selected chain as the given rule number. So, if the rule number is 1, the rule or rules are inserted at the head of the chain. This is also the default if no rule number is specified. -R, --replace chain rulenum rule-specification Replace a rule in the selected chain. If the source and/or destination names resolve to multiple addresses, the command will fail. Rules are numbered starting at 1. -L, --list [chain] List all rules in the selected chain. If no chain is selected, all chains are listed. Like every other iptables command, it applies to the specified table (filter is the default), so NAT rules get listed by iptables -t nat -n -L Please note that it is often used with the -n option, in order to avoid long reverse DNS lookups. It is legal to specify the -Z (zero) option as well, in which case the chain(s) will be atomically listed and zeroed. The exact output is affected by the other arguments given. The exact rules are suppressed until you use iptables -L -v or iptables-save(8). -S, --list-rules [chain] Print all rules in the selected chain. If no chain is selected, all chains are printed like iptables-save. Like every other iptables command, it applies to the specified table (filter is the default). -F, --flush [chain] Flush the selected chain (all the chains in the table if none is given). This is equivalent to deleting all the rules one by one. -Z, --zero [chain [rulenum]] Zero the packet and byte counters in all chains, or only the given chain, or only the given rule in a chain. It is legal to specify the -L, --list (list) option as well, to see the counters immediately before they are cleared. (See above.) -N, --new-chain chain Create a new user-defined chain by the given name. There must be no target of that name already. -X, --delete-chain [chain] Delete the chain specified. There must be no references to the chain. If there are, you must delete or replace the referring rules before the chain can be deleted. The chain must be empty, i.e. not contain any rules. If no argument is given, it will delete all empty chains in the table. Empty builtin chains can only be deleted with iptables-nft. -P, --policy chain target Set the policy for the built-in (non-user-defined) chain to the given target. The policy target must be either ACCEPT or DROP. -E, --rename-chain old-chain new-chain Rename the user specified chain to the user supplied name. This is cosmetic, and has no effect on the structure of the table. -h Help. Give a (currently very brief) description of the command syntax. PARAMETERS The following parameters make up a rule specification (as used in the add, delete, insert, replace and append commands). -4, --ipv4 This option has no effect in iptables and iptables- restore. If a rule using the -4 option is inserted with (and only with) ip6tables-restore, it will be silently ignored. Any other uses will throw an error. This option allows IPv4 and IPv6 rules in a single rule file for use with both iptables-restore and ip6tables-restore. -6, --ipv6 If a rule using the -6 option is inserted with (and only with) iptables-restore, it will be silently ignored. Any other uses will throw an error. This option allows IPv4 and IPv6 rules in a single rule file for use with both iptables-restore and ip6tables-restore. This option has no effect in ip6tables and ip6tables-restore. [!] -p, --protocol protocol The protocol of the rule or of the packet to check. The specified protocol can be one of tcp, udp, udplite, icmp, icmpv6, esp, ah, sctp, mh or the special keyword "all", or it can be a numeric value, representing one of these protocols or a different one. A protocol name from /etc/protocols is also allowed. A "!" argument before the protocol inverts the test. The number zero is equivalent to all. "all" will match with all protocols and is taken as default when this option is omitted. Note that, in ip6tables, IPv6 extension headers except esp are not allowed. esp and ipv6-nonext can be used with Kernel version 2.6.11 or later. The number zero is equivalent to all, which means that you cannot test the protocol field for the value 0 directly. To match on a HBH header, even if it were the last, you cannot use -p 0, but always need -m hbh. [!] -s, --source address[/mask][,...] Source specification. Address can be either a network name, a hostname, a network IP address (with /mask), or a plain IP address. Hostnames will be resolved once only, before the rule is submitted to the kernel. Please note that specifying any name to be resolved with a remote query such as DNS is a really bad idea. The mask can be either an ipv4 network mask (for iptables) or a plain number, specifying the number of 1's at the left side of the network mask. Thus, an iptables mask of 24 is equivalent to 255.255.255.0. A "!" argument before the address specification inverts the sense of the address. The flag --src is an alias for this option. Multiple addresses can be specified, but this will expand to multiple rules (when adding with -A), or will cause multiple rules to be deleted (with -D). [!] -d, --destination address[/mask][,...] Destination specification. See the description of the -s (source) flag for a detailed description of the syntax. The flag --dst is an alias for this option. -m, --match match Specifies a match to use, that is, an extension module that tests for a specific property. The set of matches make up the condition under which a target is invoked. Matches are evaluated first to last as specified on the command line and work in short-circuit fashion, i.e. if one extension yields false, evaluation will stop. -j, --jump target This specifies the target of the rule; i.e., what to do if the packet matches it. The target can be a user-defined chain (other than the one this rule is in), one of the special builtin targets which decide the fate of the packet immediately, or an extension (see MATCH AND TARGET EXTENSIONS below). If this option is omitted in a rule (and -g is not used), then matching the rule will have no effect on the packet's fate, but the counters on the rule will be incremented. -g, --goto chain This specifies that the processing should continue in a user specified chain. Unlike with the --jump option, RETURN will not continue processing in this chain but instead in the chain that called us via --jump. [!] -i, --in-interface name Name of an interface via which a packet was received (only for packets entering the INPUT, FORWARD and PREROUTING chains). When the "!" argument is used before the interface name, the sense is inverted. If the interface name ends in a "+", then any interface which begins with this name will match. If this option is omitted, any interface name will match. [!] -o, --out-interface name Name of an interface via which a packet is going to be sent (for packets entering the FORWARD, OUTPUT and POSTROUTING chains). When the "!" argument is used before the interface name, the sense is inverted. If the interface name ends in a "+", then any interface which begins with this name will match. If this option is omitted, any interface name will match. [!] -f, --fragment This means that the rule only refers to second and further IPv4 fragments of fragmented packets. Since there is no way to tell the source or destination ports of such a packet (or ICMP type), such a packet will not match any rules which specify them. When the "!" argument precedes the "-f" flag, the rule will only match head fragments, or unfragmented packets. This option is IPv4 specific, it is not available in ip6tables. -c, --set-counters packets bytes This enables the administrator to initialize the packet and byte counters of a rule (during INSERT, APPEND, REPLACE operations). OTHER OPTIONS The following additional options can be specified: -v, --verbose Verbose output. This option makes the list command show the interface name, the rule options (if any), and the TOS masks. The packet and byte counters are also listed, with the suffix 'K', 'M' or 'G' for 1000, 1,000,000 and 1,000,000,000 multipliers respectively (but see the -x flag to change this). For appending, insertion, deletion and replacement, this causes detailed information on the rule or rules to be printed. -v may be specified multiple times to possibly emit more detailed debug statements: Specified twice, iptables-legacy will dump table info and entries in libiptc, iptables-nft dumps rules in netlink (VM code) presentation. Specified three times, iptables- nft will also dump any netlink messages sent to kernel. -V, --version Show program version and the kernel API used. -w, --wait [seconds] Wait for the xtables lock. To prevent multiple instances of the program from running concurrently, an attempt will be made to obtain an exclusive lock at launch. By default, the program will exit if the lock cannot be obtained. This option will make the program wait (indefinitely or for optional seconds) until the exclusive lock can be obtained. -n, --numeric Numeric output. IP addresses and port numbers will be printed in numeric format. By default, the program will try to display them as host names, network names, or services (whenever applicable). -x, --exact Expand numbers. Display the exact value of the packet and byte counters, instead of only the rounded number in K's (multiples of 1000), M's (multiples of 1000K) or G's (multiples of 1000M). This option is only relevant for the -L command. --line-numbers When listing rules, add line numbers to the beginning of each rule, corresponding to that rule's position in the chain. --modprobe=command When adding or inserting rules into a chain, use command to load any necessary modules (targets, match extensions, etc). LOCK FILE top iptables uses the /run/xtables.lock file to take an exclusive lock at launch. The XTABLES_LOCKFILE environment variable can be used to override the default setting. MATCH AND TARGET EXTENSIONS top iptables can use extended packet matching and target modules. A list of these is available in the iptables-extensions(8) manpage. DIAGNOSTICS top Various error messages are printed to standard error. The exit code is 0 for correct functioning. Errors which appear to be caused by invalid or abused command line parameters cause an exit code of 2. Errors which indicate an incompatibility between kernel and user space cause an exit code of 3. Errors which indicate a resource problem, such as a busy lock, failing memory allocation or error messages from kernel cause an exit code of 4. Finally, other errors cause an exit code of 1. BUGS top Bugs? What's this? ;-) Well, you might want to have a look at https://bugzilla.netfilter.org/ iptables will exit immediately with an error code of 111 if it finds that it was called as a setuid-to-root program. iptables cannot be used safely in this manner because it trusts the shared libraries (matches, targets) loaded at run time, the search path can be set using environment variables. COMPATIBILITY WITH IPCHAINS top This iptables is very similar to ipchains by Rusty Russell. The main difference is that the chains INPUT and OUTPUT are only traversed for packets coming into the local host and originating from the local host respectively. Hence every packet only passes through one of the three chains (except loopback traffic, which involves both INPUT and OUTPUT chains); previously a forwarded packet would pass through all three. The other main difference is that -i refers to the input interface; -o refers to the output interface, and both are available for packets entering the FORWARD chain. The various forms of NAT have been separated out; iptables is a pure packet filter when using the default `filter' table, with optional extension modules. This should avoid much of the confusion over the combination of IP masquerading and packet filtering seen previously. So the following options are handled differently: -j MASQ -M -S -M -L There are several other changes in iptables. SEE ALSO top iptables-apply(8), iptables-save(8), iptables-restore(8), iptables-extensions(8), The packet-filtering-HOWTO details iptables usage for packet filtering, the NAT-HOWTO details NAT, the netfilter-extensions- HOWTO details the extensions that are not in the standard distribution, and the netfilter-hacking-HOWTO details the netfilter internals. See https://www.netfilter.org/ . AUTHORS top Rusty Russell originally wrote iptables, in early consultation with Michael Neuling. Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet selection framework in iptables, then wrote the mangle table, the owner match, the mark stuff, and ran around doing cool stuff everywhere. James Morris wrote the TOS target, and tos match. Jozsef Kadlecsik wrote the REJECT target. Harald Welte wrote the ULOG and NFQUEUE target, the new libiptc, as well as the TTL, DSCP, ECN matches and targets. The Netfilter Core Team is: Jozsef Kadlecsik, Pablo Neira Ayuso, Eric Leblond, Florian Westphal and Arturo Borrero Gonzalez. Emeritus Core Team members are: Marc Boucher, Martin Josefsson, Yasuyuki Kozakai, James Morris, Harald Welte and Rusty Russell. Man page originally written by Herve Eychenne <[email protected]>. VERSION top This manual page applies to iptables/ip6tables 1.8.10. COLOPHON top This page is part of the iptables (administer and maintain packet filter rules) project. Information about the project can be found at http://www.netfilter.org/. If you have a bug report for this manual page, see http://bugzilla.netfilter.org/. This page was obtained from the project's upstream Git repository git://git.netfilter.org/iptables on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-21.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] iptables 1.8.10 IPTABLES(8) Pages that refer to this page: iptables-xml(1), proc(5), systemd.socket(5), cgroups(7), network_namespaces(7), arptables-nft(8), ebtables-nft(8), flowtop(8), ifconfig(8), ip-link(8), iptables-apply(8), iptables-restore(8), iptables-save(8), mountd(8), netstat(8), ovs-ctl(8), statd(8), tc-bpf(8), tc-fw(8), tc-mqprio(8), wg-quick(8), xtables-monitor(8), xtables-nft(8), xtables-translate(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# iptables\n\n> Configure tables, chains and rules of the Linux kernel IPv4 firewall.\n> Use `ip6tables` to set rules for IPv6 traffic. See also: `iptables-save`, `iptables-restore`.\n> More information: <https://manned.org/iptables>.\n\n- View chains, rules, packet/byte counters and line numbers for the filter table:\n\n`sudo iptables --verbose --numeric --list --line-numbers`\n\n- Set chain [P]olicy rule:\n\n`sudo iptables --policy {{chain}} {{rule}}`\n\n- [A]ppend rule to chain policy for IP:\n\n`sudo iptables --append {{chain}} --source {{ip}} --jump {{rule}}`\n\n- [A]ppend rule to chain policy for IP considering [p]rotocol and port:\n\n`sudo iptables --append {{chain}} --source {{ip}} --protocol {{tcp|udp|icmp|...}} --dport {{port}} --jump {{rule}}`\n\n- Add a NAT rule to translate all traffic from the `192.168.0.0/24` subnet to the host's public IP:\n\n`sudo iptables --table {{nat}} --append {{POSTROUTING}} --source {{192.168.0.0/24}} --jump {{MASQUERADE}}`\n\n- [D]elete chain rule:\n\n`sudo iptables --delete {{chain}} {{rule_line_number}}`\n
iptables-restore
iptables-restore(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training iptables-restore(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | BUGS | AUTHORS | SEE ALSO | COLOPHON IPTABLES-RESTORE(8) iptables 1.8.10 IPTABLES-RESTORE(8) NAME top iptables-restore Restore IP Tables ip6tables-restore Restore IPv6 Tables SYNOPSIS top iptables-restore [-chntvV] [-w seconds] [-M modprobe] [-T name] [file] ip6tables-restore [-chntvV] [-w seconds] [-M modprobe] [-T name] [file] DESCRIPTION top iptables-restore and ip6tables-restore are used to restore IP and IPv6 Tables from data specified on STDIN or in file. Use I/O redirection provided by your shell to read from a file or specify file as an argument. -c, --counters Restore the values of all packet and byte counters. -h, --help Print a short option summary. -n, --noflush Don't flush the previous contents of the table. If not specified, both commands flush (delete) all previous contents of the respective table. -t, --test Only parse and construct the ruleset, but do not commit it. -v, --verbose Print additional debug info during ruleset processing. Specify multiple times to increase debug level. -V, --version Print the program version number. -w, --wait [seconds] Wait for the xtables lock. To prevent multiple instances of the program from running concurrently, an attempt will be made to obtain an exclusive lock at launch. By default, the program will exit if the lock cannot be obtained. This option will make the program wait (indefinitely or for optional seconds) until the exclusive lock can be obtained. -M, --modprobe modprobe Specify the path to the modprobe(8) program. By default, iptables-restore will inspect /proc/sys/kernel/modprobe to determine the executable's path. -T, --table name Restore only the named table even if the input stream contains other ones. BUGS top None known as of iptables-1.2.1 release AUTHORS top Harald Welte <[email protected]> wrote iptables-restore based on code from Rusty Russell. Andras Kis-Szabo <[email protected]> contributed ip6tables- restore. SEE ALSO top iptables-apply(8), iptables-save(8), iptables(8) The iptables-HOWTO, which details more iptables usage, the NAT- HOWTO, which details NAT, and the netfilter-hacking-HOWTO which details the internals. COLOPHON top This page is part of the iptables (administer and maintain packet filter rules) project. Information about the project can be found at http://www.netfilter.org/. If you have a bug report for this manual page, see http://bugzilla.netfilter.org/. This page was obtained from the project's upstream Git repository git://git.netfilter.org/iptables on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-21.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] iptables 1.8.10 IPTABLES-RESTORE(8) Pages that refer to this page: iptables-xml(1), iptables(8), iptables-apply(8), iptables-save(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# iptables-restore\n\n> Restore the `iptables` IPv4 configuration.\n> Use `ip6tables-restore` to do the same for IPv6.\n> More information: <https://manned.org/iptables-restore>.\n\n- Restore the `iptables` configuration from a file:\n\n`sudo iptables-restore {{path/to/file}}`\n
iptables-save
iptables-save(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training iptables-save(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | BUGS | AUTHORS | SEE ALSO | COLOPHON IPTABLES-SAVE(8) iptables 1.8.10 IPTABLES-SAVE(8) NAME top iptables-save dump iptables rules ip6tables-save dump iptables rules SYNOPSIS top iptables-save [-M modprobe] [-c] [-t table] [-f filename] ip6tables-save [-M modprobe] [-c] [-t table] [-f filename] DESCRIPTION top iptables-save and ip6tables-save are used to dump the contents of IP or IPv6 Table in easily parseable format either to STDOUT or to a specified file. -M, --modprobe modprobe Specify the path to the modprobe(8) program. By default, iptables-save will inspect /proc/sys/kernel/modprobe to determine the executable's path. -f, --file filename Specify a filename to log the output to. If not specified, iptables-save will log to STDOUT. -c, --counters Include the current values of all packet and byte counters in the output. -t, --table tablename Restrict output to only one table. If the kernel is configured with automatic module loading, an attempt will be made to load the appropriate module for that table if it is not already there. If not specified, output includes all available tables. No module loading takes place, so in order to include a specific table in the output, the respective module (something like iptable_mangle or ip6table_raw) must be loaded first. BUGS top None known as of iptables-1.2.1 release AUTHORS top Harald Welte <[email protected]> Rusty Russell <[email protected]> Andras Kis-Szabo <[email protected]> contributed ip6tables-save. SEE ALSO top iptables-apply(8), iptables-restore(8), iptables(8) The iptables-HOWTO, which details more iptables usage, the NAT- HOWTO, which details NAT, and the netfilter-hacking-HOWTO which details the internals. COLOPHON top This page is part of the iptables (administer and maintain packet filter rules) project. Information about the project can be found at http://www.netfilter.org/. If you have a bug report for this manual page, see http://bugzilla.netfilter.org/. This page was obtained from the project's upstream Git repository git://git.netfilter.org/iptables on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-21.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] iptables 1.8.10 IPTABLES-SAVE(8) Pages that refer to this page: iptables-xml(1), iptables(8), iptables-apply(8), iptables-restore(8), xtables-translate(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# iptables-save\n\n> Save the `iptables` IPv4 configuration.\n> Use `ip6tables-save` to do the same for IPv6.\n> More information: <https://manned.org/iptables-save>.\n\n- Print the `iptables` configuration:\n\n`sudo iptables-save`\n\n- Print the `iptables` configuration of a specific [t]able:\n\n`sudo iptables-save --table {{table}}`\n\n- Save the `iptables` configuration to a [f]ile:\n\n`sudo iptables-save --file {{path/to/file}}`\n
isosize
isosize(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training isosize(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXIT STATUS | REPORTING BUGS | AVAILABILITY ISOSIZE(8) System Administration ISOSIZE(8) NAME top isosize - output the length of an iso9660 filesystem SYNOPSIS top isosize [options] iso9660_image_file DESCRIPTION top This command outputs the length of an iso9660 filesystem that is contained in the specified file. This file may be a normal file or a block device (e.g. /dev/hdd or /dev/sr0). In the absence of any options (and errors), it will output the size of the iso9660 filesystem in bytes. This can now be a large number (>> 4 GB). OPTIONS top -x, --sectors Show the block count and block size in human-readable form. The output uses the term "sectors" for "blocks". -d, --divisor number Only has an effect when -x is not given. The value shown (if no errors) is the iso9660 file size in bytes divided by number. So if number is the block size then the shown value will be the block count. The size of the file (or block device) holding an iso9660 filesystem can be marginally larger than the actual size of the iso9660 filesystem. One reason for this is that cd writers are allowed to add "run out" sectors at the end of an iso9660 image. -h, --help Display help text and exit. -V, --version Print version and exit. EXIT STATUS top 0 success 1 generic failure, such as invalid usage 32 all failed 64 some failed REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The isosize command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 ISOSIZE(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# isosize\n\n> Display the size of an ISO file.\n> More information: <https://manned.org/isosize>.\n\n- Display the size of an ISO file:\n\n`isosize {{path/to/file.iso}}`\n\n- Display the block count and block size of an ISO file:\n\n`isosize --sectors {{path/to/file.iso}}`\n\n- Display the size of an ISO file divided by a given number (only usable when --sectors is not given):\n\n`isosize --divisor={{number}} {{path/to/file.iso}}`\n
jobs
jobs(1p) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training jobs(1p) Linux manual page PROLOG | NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OPERANDS | STDIN | INPUT FILES | ENVIRONMENT VARIABLES | ASYNCHRONOUS EVENTS | STDOUT | STDERR | OUTPUT FILES | EXTENDED DESCRIPTION | EXIT STATUS | CONSEQUENCES OF ERRORS | APPLICATION USAGE | EXAMPLES | RATIONALE | FUTURE DIRECTIONS | SEE ALSO | COPYRIGHT JOBS(1P) POSIX Programmer's Manual JOBS(1P) PROLOG top This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME top jobs display status of jobs in the current session SYNOPSIS top jobs [-l|-p] [job_id...] DESCRIPTION top The jobs utility shall display the status of jobs that were started in the current shell environment; see Section 2.12, Shell Execution Environment. When jobs reports the termination status of a job, the shell shall remove its process ID from the list of those ``known in the current shell execution environment''; see Section 2.9.3.1, Examples. OPTIONS top The jobs utility shall conform to the Base Definitions volume of POSIX.12017, Section 12.2, Utility Syntax Guidelines. The following options shall be supported: -l (The letter ell.) Provide more information about each job listed. This information shall include the job number, current job, process group ID, state, and the command that formed the job. -p Display only the process IDs for the process group leaders of the selected jobs. By default, the jobs utility shall display the status of all stopped jobs, running background jobs and all jobs whose status has changed and have not been reported by the shell. OPERANDS top The following operand shall be supported: job_id Specifies the jobs for which the status is to be displayed. If no job_id is given, the status information for all jobs shall be displayed. The format of job_id is described in the Base Definitions volume of POSIX.12017, Section 3.204, Job Control Job ID. STDIN top Not used. INPUT FILES top None. ENVIRONMENT VARIABLES top The following environment variables shall affect the execution of jobs: LANG Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.12017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments). LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES. ASYNCHRONOUS EVENTS top Default. STDOUT top If the -p option is specified, the output shall consist of one line for each process ID: "%d\n", <process ID> Otherwise, if the -l option is not specified, the output shall be a series of lines of the form: "[%d] %c %s %s\n", <job-number>, <current>, <state>, <command> where the fields shall be as follows: <current> The character '+' identifies the job that would be used as a default for the fg or bg utilities; this job can also be specified using the job_id %+ or "%%". The character '-' identifies the job that would become the default if the current default job were to exit; this job can also be specified using the job_id %-. For other jobs, this field is a <space>. At most one job can be identified with '+' and at most one job can be identified with '-'. If there is any suspended job, then the current job shall be a suspended job. If there are at least two suspended jobs, then the previous job also shall be a suspended job. <job-number> A number that can be used to identify the process group to the wait, fg, bg, and kill utilities. Using these utilities, the job can be identified by prefixing the job number with '%'. <state> One of the following strings (in the POSIX locale): Running Indicates that the job has not been suspended by a signal and has not exited. Done Indicates that the job completed and returned exit status zero. Done(code) Indicates that the job completed normally and that it exited with the specified non-zero exit status, code, expressed as a decimal number. Stopped Indicates that the job was suspended by the SIGTSTP signal. Stopped (SIGTSTP) Indicates that the job was suspended by the SIGTSTP signal. Stopped (SIGSTOP) Indicates that the job was suspended by the SIGSTOP signal. Stopped (SIGTTIN) Indicates that the job was suspended by the SIGTTIN signal. Stopped (SIGTTOU) Indicates that the job was suspended by the SIGTTOU signal. The implementation may substitute the string Suspended in place of Stopped. If the job was terminated by a signal, the format of <state> is unspecified, but it shall be visibly distinct from all of the other <state> formats shown here and shall indicate the name or description of the signal causing the termination. <command> The associated command that was given to the shell. If the -l option is specified, a field containing the process group ID shall be inserted before the <state> field. Also, more processes in a process group may be output on separate lines, using only the process ID and <command> fields. STDERR top The standard error shall be used only for diagnostic messages. OUTPUT FILES top None. EXTENDED DESCRIPTION top None. EXIT STATUS top The following exit values shall be returned: 0 Successful completion. >0 An error occurred. CONSEQUENCES OF ERRORS top Default. The following sections are informative. APPLICATION USAGE top The -p option is the only portable way to find out the process group of a job because different implementations have different strategies for defining the process group of the job. Usage such as $(jobs -p) provides a way of referring to the process group of the job in an implementation-independent way. The jobs utility does not work as expected when it is operating in its own utility execution environment because that environment has no applicable jobs to manipulate. See the APPLICATION USAGE section for bg(1p). For this reason, jobs is generally implemented as a shell regular built-in. EXAMPLES top None. RATIONALE top Both "%%" and "%+" are used to refer to the current job. Both forms are of equal validitythe "%%" mirroring "$$" and "%+" mirroring the output of jobs. Both forms reflect historical practice of the KornShell and the C shell with job control. The job control features provided by bg, fg, and jobs are based on the KornShell. The standard developers examined the characteristics of the C shell versions of these utilities and found that differences exist. Despite widespread use of the C shell, the KornShell versions were selected for this volume of POSIX.12017 to maintain a degree of uniformity with the rest of the KornShell features selected (such as the very popular command line editing features). The jobs utility is not dependent on the job control option, as are the seemingly related bg and fg utilities because jobs is useful for examining background jobs, regardless of the condition of job control. When the user has invoked a set +m command and job control has been turned off, jobs can still be used to examine the background jobs associated with that current session. Similarly, kill can then be used to kill background jobs with kill %<background job number>. The output for terminated jobs is left unspecified to accommodate various historical systems. The following formats have been witnessed: 1. Killed(signal name) 2. signal name 3. signal name(coredump) 4. signal description- core dumped Most users should be able to understand these formats, although it means that applications have trouble parsing them. The calculation of job IDs was not described since this would suggest an implementation, which may impose unnecessary restrictions. In an early proposal, a -n option was included to ``Display the status of jobs that have changed, exited, or stopped since the last status report''. It was removed because the shell always writes any changed status of jobs before each prompt. FUTURE DIRECTIONS top None. SEE ALSO top Section 2.12, Shell Execution Environment, bg(1p), fg(1p), kill(1p), wait(1p) The Base Definitions volume of POSIX.12017, Section 3.204, Job Control Job ID, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines COPYRIGHT top Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE/The Open Group 2017 JOBS(1P) Pages that refer to this page: bg(1p), fg(1p) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# jobs\n\n> Shell builtin for viewing information about processes spawned by the current shell.\n> Options other than `-l` and `-p` are exclusive to `bash`.\n> More information: <https://manned.org/jobs>.\n\n- View jobs spawned by the current shell:\n\n`jobs`\n\n- List jobs and their process IDs:\n\n`jobs -l`\n\n- Display information about jobs with changed status:\n\n`jobs -n`\n\n- Display only process IDs:\n\n`jobs -p`\n\n- Display running processes:\n\n`jobs -r`\n\n- Display stopped processes:\n\n`jobs -s`\n
join
join(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training join(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | AUTHOR | REPORTING BUGS | COPYRIGHT | SEE ALSO | COLOPHON JOIN(1) User Commands JOIN(1) NAME top join - join lines of two files on a common field SYNOPSIS top join [OPTION]... FILE1 FILE2 DESCRIPTION top For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by blanks. When FILE1 or FILE2 (not both) is -, read standard input. -a FILENUM also print unpairable lines from file FILENUM, where FILENUM is 1 or 2, corresponding to FILE1 or FILE2 -e STRING replace missing (empty) input fields with STRING; I.e., missing fields specified with '-12jo' options -i, --ignore-case ignore differences in case when comparing fields -j FIELD equivalent to '-1 FIELD -2 FIELD' -o FORMAT obey FORMAT while constructing output line -t CHAR use CHAR as input and output field separator -v FILENUM like -a FILENUM, but suppress joined output lines -1 FIELD join on this FIELD of file 1 -2 FIELD join on this FIELD of file 2 --check-order check that the input is correctly sorted, even if all input lines are pairable --nocheck-order do not check that the input is correctly sorted --header treat the first line in each file as field headers, print them without trying to pair them -z, --zero-terminated line delimiter is NUL, not newline --help display this help and exit --version output version information and exit Unless -t CHAR is given, leading blanks separate fields and are ignored, else fields are separated by CHAR. Any FIELD is a field number counted from 1. FORMAT is one or more comma or blank separated specifications, each being 'FILENUM.FIELD' or '0'. Default FORMAT outputs the join field, the remaining fields from FILE1, the remaining fields from FILE2, all separated by CHAR. If FORMAT is the keyword 'auto', then the first line of each file determines the number of fields output for each line. Important: FILE1 and FILE2 must be sorted on the join fields. E.g., use "sort -k 1b,1" if 'join' has no options, or use "join -t ''" if 'sort' has no options. Note, comparisons honor the rules specified by 'LC_COLLATE'. If the input is not sorted and some lines cannot be joined, a warning message will be given. AUTHOR top Written by Mike Haertel. REPORTING BUGS top GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT top Copyright 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO top comm(1), uniq(1) Full documentation <https://www.gnu.org/software/coreutils/join> or available locally via: info '(coreutils) join invocation' COLOPHON top This page is part of the coreutils (basic file, shell and text manipulation utilities) project. Information about the project can be found at http://www.gnu.org/software/coreutils/. If you have a bug report for this manual page, see http://www.gnu.org/software/coreutils/. This page was obtained from the tarball coreutils-9.4.tar.xz fetched from http://ftp.gnu.org/gnu/coreutils/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] GNU coreutils 9.4 August 2023 JOIN(1) Pages that refer to this page: comm(1), uniq(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# join\n\n> Join lines of two sorted files on a common field.\n> More information: <https://www.gnu.org/software/coreutils/join>.\n\n- Join two files on the first (default) field:\n\n`join {{path/to/file1}} {{path/to/file2}}`\n\n- Join two files using a comma (instead of a space) as the field separator:\n\n`join -t {{','}} {{path/to/file1}} {{path/to/file2}}`\n\n- Join field3 of file1 with field1 of file2:\n\n`join -1 {{3}} -2 {{1}} {{path/to/file1}} {{path/to/file2}}`\n\n- Produce a line for each unpairable line for file1:\n\n`join -a {{1}} {{path/to/file1}} {{path/to/file2}}`\n\n- Join a file from `stdin`:\n\n`cat {{path/to/file1}} | join - {{path/to/file2}}`\n
journalctl
journalctl(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training journalctl(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | SOURCE OPTIONS | FILTERING OPTIONS | OUTPUT OPTIONS | PAGER CONTROL OPTIONS | FORWARD SECURE SEALING (FSS) OPTIONS | COMMANDS | EXIT STATUS | ENVIRONMENT | EXAMPLES | SEE ALSO | NOTES | COLOPHON JOURNALCTL(1) journalctl JOURNALCTL(1) NAME top journalctl - Print log entries from the systemd journal SYNOPSIS top journalctl [OPTIONS...] [MATCHES...] DESCRIPTION top journalctl is used to print the log entries stored in the journal by systemd-journald.service(8) and systemd-journal-remote.service(8). If called without parameters, it will show the contents of the journal accessible to the calling user, starting with the oldest entry collected. If one or more match arguments are passed, the output is filtered accordingly. A match is in the format "FIELD=VALUE", e.g. "_SYSTEMD_UNIT=httpd.service", referring to the components of a structured journal entry. See systemd.journal-fields(7) for a list of well-known fields. If multiple matches are specified matching different fields, the log entries are filtered by both, i.e. the resulting output will show only entries matching all the specified matches of this kind. If two matches apply to the same field, then they are automatically matched as alternatives, i.e. the resulting output will show entries matching any of the specified matches for the same field. Finally, the character "+" may appear as a separate word between other terms on the command line. This causes all matches before and after to be combined in a disjunction (i.e. logical OR). It is also possible to filter the entries by specifying an absolute file path as an argument. The file path may be a file or a symbolic link and the file must exist at the time of the query. If a file path refers to an executable binary, an "_EXE=" match for the canonicalized binary path is added to the query. If a file path refers to an executable script, a "_COMM=" match for the script name is added to the query. If a file path refers to a device node, "_KERNEL_DEVICE=" matches for the kernel name of the device and for each of its ancestor devices is added to the query. Symbolic links are dereferenced, kernel names are synthesized, and parent devices are identified from the environment at the time of the query. In general, a device node is the best proxy for an actual device, as log entries do not usually contain fields that identify an actual device. For the resulting log entries to be correct for the actual device, the relevant parts of the environment at the time the entry was logged, in particular the actual device corresponding to the device node, must have been the same as those at the time of the query. Because device nodes generally change their corresponding devices across reboots, specifying a device node path causes the resulting entries to be restricted to those from the current boot. Additional constraints may be added using options --boot, --unit=, etc., to further limit what entries will be shown (logical AND). Output is interleaved from all accessible journal files, whether they are rotated or currently being written, and regardless of whether they belong to the system itself or are accessible user journals. The --header option can be used to identify which files are being shown. The set of journal files which will be used can be modified using the --user, --system, --directory=, and --file= options, see below. All users are granted access to their private per-user journals. However, by default, only root and users who are members of a few special groups are granted access to the system journal and the journals of other users. Members of the groups "systemd-journal", "adm", and "wheel" can read all journal files. Note that the two latter groups traditionally have additional privileges specified by the distribution. Members of the "wheel" group can often perform administrative tasks. The output is paged through less by default, and long lines are "truncated" to screen width. The hidden part can be viewed by using the left-arrow and right-arrow keys. Paging can be disabled; see the --no-pager option and the "Environment" section below. When outputting to a tty, lines are colored according to priority: lines of level ERROR and higher are colored red; lines of level WARNING are colored yellow; lines of level NOTICE are highlighted; lines of level INFO are displayed normally; lines of level DEBUG are colored grey. To write entries to the journal, a few methods may be used. In general, output from systemd units is automatically connected to the journal, see systemd-journald.service(8). In addition, systemd-cat(1) may be used to send messages to the journal directly. SOURCE OPTIONS top The following options control where to read journal records from: --system, --user Show messages from system services and the kernel (with --system). Show messages from service of current user (with --user). If neither is specified, show all messages that the user can see. The --user option affects how --unit= arguments are treated. See --unit=. Note that --user only works if persistent logging is enabled, via the Storage= setting in journald.conf(5). Added in version 205. -M, --machine= Show messages from a running, local container. Specify a container name to connect to. Added in version 209. -m, --merge Show entries interleaved from all available journals, including remote ones. Added in version 190. -D DIR, --directory=DIR Takes a directory path as argument. If specified, journalctl will operate on the specified journal directory DIR instead of the default runtime and system journal paths. Added in version 187. -i GLOB, --file=GLOB Takes a file glob as an argument. If specified, journalctl will operate on the specified journal files matching GLOB instead of the default runtime and system journal paths. May be specified multiple times, in which case files will be suitably interleaved. Added in version 205. --root=ROOT Takes a directory path as an argument. If specified, journalctl will operate on journal directories and catalog file hierarchy underneath the specified directory instead of the root directory (e.g. --update-catalog will create ROOT/var/lib/systemd/catalog/database, and journal files under ROOT/run/journal/ or ROOT/var/log/journal/ will be displayed). Added in version 201. --image=IMAGE Takes a path to a disk image file or block device node. If specified, journalctl will operate on the file system in the indicated disk image. This option is similar to --root=, but operates on file systems stored in disk images or block devices, thus providing an easy way to extract log data from disk images. The disk image should either contain just a file system or a set of file systems within a GPT partition table, following the Discoverable Partitions Specification[1]. For further information on supported disk images, see systemd-nspawn(1)'s switch of the same name. Added in version 247. --image-policy=policy Takes an image policy string as argument, as per systemd.image-policy(7). The policy is enforced when operating on the disk image specified via --image=, see above. If not specified defaults to the "*" policy, i.e. all recognized file systems in the image are used. --namespace=NAMESPACE Takes a journal namespace identifier string as argument. If not specified the data collected by the default namespace is shown. If specified shows the log data of the specified namespace instead. If the namespace is specified as "*" data from all namespaces is shown, interleaved. If the namespace identifier is prefixed with "+" data from the specified namespace and the default namespace is shown, interleaved, but no other. For details about journal namespaces see systemd-journald.service(8). Added in version 245. FILTERING OPTIONS top The following options control how to filter journal records: -S, --since=, -U, --until= Start showing entries on or newer than the specified date, or on or older than the specified date, respectively. Date specifications should be of the format "2012-10-30 18:17:16". If the time part is omitted, "00:00:00" is assumed. If only the seconds component is omitted, ":00" is assumed. If the date component is omitted, the current day is assumed. Alternatively the strings "yesterday", "today", "tomorrow" are understood, which refer to 00:00:00 of the day before the current day, the current day, or the day after the current day, respectively. "now" refers to the current time. Finally, relative times may be specified, prefixed with "-" or "+", referring to times before or after the current time, respectively. For complete time and date specification, see systemd.time(7). Note that --output=short-full prints timestamps that follow precisely this format. Added in version 195. -c, --cursor= Start showing entries from the location in the journal specified by the passed cursor. Added in version 193. --after-cursor= Start showing entries from the location in the journal after the location specified by the passed cursor. The cursor is shown when the --show-cursor option is used. Added in version 206. --cursor-file=FILE If FILE exists and contains a cursor, start showing entries after this location. Otherwise show entries according to the other given options. At the end, write the cursor of the last entry to FILE. Use this option to continually read the journal by sequentially calling journalctl. Added in version 242. -b [[ID][offset]|all], --boot[=[ID][offset]|all] Show messages from a specific boot. This will add a match for "_BOOT_ID=". The argument may be empty, in which case logs for the current boot will be shown. If the boot ID is omitted, a positive offset will look up the boots starting from the beginning of the journal, and an equal-or-less-than zero offset will look up boots starting from the end of the journal. Thus, 1 means the first boot found in the journal in chronological order, 2 the second and so on; while -0 is the last boot, -1 the boot before last, and so on. An empty offset is equivalent to specifying -0, except when the current boot is not the last boot (e.g. because --directory= was specified to look at logs from a different machine). If the 32-character ID is specified, it may optionally be followed by offset which identifies the boot relative to the one given by boot ID. Negative values mean earlier boots and positive values mean later boots. If offset is not specified, a value of zero is assumed, and the logs for the boot given by ID are shown. The special argument all can be used to negate the effect of an earlier use of -b. Added in version 186. -u, --unit=UNIT|PATTERN Show messages for the specified systemd unit UNIT (such as a service unit), or for any of the units matched by PATTERN. If a pattern is specified, a list of unit names found in the journal is compared with the specified pattern and all that match are used. For each unit name, a match is added for messages from the unit ("_SYSTEMD_UNIT=UNIT"), along with additional matches for messages from systemd and messages about coredumps for the specified unit. A match is also added for "_SYSTEMD_SLICE=UNIT", such that if the provided UNIT is a systemd.slice(5) unit, all logs of children of the slice will be shown. With --user, all --unit= arguments will be converted to match user messages as if specified with --user-unit=. This parameter can be specified multiple times. Added in version 195. --user-unit= Show messages for the specified user session unit. This will add a match for messages from the unit ("_SYSTEMD_USER_UNIT=" and "_UID=") and additional matches for messages from session systemd and messages about coredumps for the specified unit. A match is also added for "_SYSTEMD_USER_SLICE=UNIT", such that if the provided UNIT is a systemd.slice(5) unit, all logs of children of the unit will be shown. This parameter can be specified multiple times. Added in version 198. -t, --identifier=SYSLOG_IDENTIFIER Show messages for the specified syslog identifier SYSLOG_IDENTIFIER. This parameter can be specified multiple times. Added in version 217. -p, --priority= Filter output by message priorities or priority ranges. Takes either a single numeric or textual log level (i.e. between 0/"emerg" and 7/"debug"), or a range of numeric/text log levels in the form FROM..TO. The log levels are the usual syslog log levels as documented in syslog(3), i.e. "emerg" (0), "alert" (1), "crit" (2), "err" (3), "warning" (4), "notice" (5), "info" (6), "debug" (7). If a single log level is specified, all messages with this log level or a lower (hence more important) log level are shown. If a range is specified, all messages within the range are shown, including both the start and the end value of the range. This will add "PRIORITY=" matches for the specified priorities. Added in version 188. --facility= Filter output by syslog facility. Takes a comma-separated list of numbers or facility names. The names are the usual syslog facilities as documented in syslog(3). --facility=help may be used to display a list of known facility names and exit. Added in version 245. -g, --grep= Filter output to entries where the MESSAGE= field matches the specified regular expression. PERL-compatible regular expressions are used, see pcre2pattern(3) for a detailed description of the syntax. If the pattern is all lowercase, matching is case insensitive. Otherwise, matching is case sensitive. This can be overridden with the --case-sensitive option, see below. When used with --lines= (not prefixed with "+"), --reverse is implied. Added in version 237. --case-sensitive[=BOOLEAN] Make pattern matching case sensitive or case insensitive. Added in version 237. -k, --dmesg Show only kernel messages. This implies -b and adds the match "_TRANSPORT=kernel". Added in version 205. OUTPUT OPTIONS top The following options control how journal records are printed: -o, --output= Controls the formatting of the journal entries that are shown. Takes one of the following options: short is the default and generates an output that is mostly identical to the formatting of classic syslog files, showing one line per journal entry. Added in version 206. short-full is very similar, but shows timestamps in the format the --since= and --until= options accept. Unlike the timestamp information shown in short output mode this mode includes weekday, year and timezone information in the output, and is locale-independent. Added in version 232. short-iso is very similar, but shows timestamps in the RFC 3339[2] profile of ISO 8601. Added in version 206. short-iso-precise as for short-iso but includes full microsecond precision. Added in version 234. short-precise is very similar, but shows classic syslog timestamps with full microsecond precision. Added in version 207. short-monotonic is very similar, but shows monotonic timestamps instead of wallclock timestamps. Added in version 206. short-delta as for short-monotonic but includes the time difference to the previous entry. Maybe unreliable time differences are marked by a "*". Added in version 252. short-unix is very similar, but shows seconds passed since January 1st 1970 UTC instead of wallclock timestamps ("UNIX time"). The time is shown with microsecond accuracy. Added in version 230. verbose shows the full-structured entry items with all fields. Added in version 206. export serializes the journal into a binary (but mostly text-based) stream suitable for backups and network transfer (see Journal Export Format[3] for more information). To import the binary stream back into native journald format use systemd-journal-remote(8). Added in version 206. json formats entries as JSON objects, separated by newline characters (see Journal JSON Format[4] for more information). Field values are generally encoded as JSON strings, with three exceptions: 1. Fields larger than 4096 bytes are encoded as null values. (This may be turned off by passing --all, but be aware that this may allocate overly long JSON objects.) 2. Journal entries permit non-unique fields within the same log entry. JSON does not allow non-unique fields within objects. Due to this, if a non-unique field is encountered a JSON array is used as field value, listing all field values as elements. 3. Fields containing non-printable or non-UTF8 bytes are encoded as arrays containing the raw bytes individually formatted as unsigned numbers. Note that this encoding is reversible (with the exception of the size limit). Added in version 206. json-pretty formats entries as JSON data structures, but formats them in multiple lines in order to make them more readable by humans. Added in version 206. json-sse formats entries as JSON data structures, but wraps them in a format suitable for Server-Sent Events[5]. Added in version 206. json-seq formats entries as JSON data structures, but prefixes them with an ASCII Record Separator character (0x1E) and suffixes them with an ASCII Line Feed character (0x0A), in accordance with JavaScript Object Notation (JSON) Text Sequences[6] ("application/json-seq"). Added in version 240. cat generates a very terse output, only showing the actual message of each journal entry with no metadata, not even a timestamp. If combined with the --output-fields= option will output the listed fields for each log record, instead of the message. Added in version 206. with-unit similar to short-full, but prefixes the unit and user unit names instead of the traditional syslog identifier. Useful when using templated instances, as it will include the arguments in the unit names. Added in version 239. --truncate-newline Truncate each log message at the first newline character on output, so that only the first line of each message is displayed. Added in version 254. --output-fields= A comma separated list of the fields which should be included in the output. This has an effect only for the output modes which would normally show all fields (verbose, export, json, json-pretty, json-sse and json-seq), as well as on cat. For the former, the "__CURSOR", "__REALTIME_TIMESTAMP", "__MONOTONIC_TIMESTAMP", and "_BOOT_ID" fields are always printed. Added in version 236. -n, --lines= Show the most recent journal events and limit the number of events shown. The argument is a positive integer or "all" to disable the limit. Additionally, if the number is prefixed with "+", the oldest journal events are used instead. The default value is 10 if no argument is given. If --follow is used, this option is implied. When not prefixed with "+" and used with --grep=, --reverse is implied. -r, --reverse Reverse output so that the newest entries are displayed first. Added in version 198. --show-cursor The cursor is shown after the last entry after two dashes: -- cursor: s=0639... The format of the cursor is private and subject to change. Added in version 209. --utc Express time in Coordinated Universal Time (UTC). Added in version 217. -x, --catalog Augment log lines with explanation texts from the message catalog. This will add explanatory help texts to log messages in the output where this is available. These short help texts will explain the context of an error or log event, possible solutions, as well as pointers to support forums, developer documentation, and any other relevant manuals. Note that help texts are not available for all messages, but only for selected ones. For more information on the message catalog, please refer to the Message Catalog Developer Documentation[7]. Note: when attaching journalctl output to bug reports, please do not use -x. Added in version 196. --no-hostname Don't show the hostname field of log messages originating from the local host. This switch has an effect only on the short family of output modes (see above). Note: this option does not remove occurrences of the hostname from log entries themselves, so it does not prevent the hostname from being visible in the logs. Added in version 230. --no-full, --full, -l Ellipsize fields when they do not fit in available columns. The default is to show full fields, allowing them to wrap or be truncated by the pager, if one is used. The old options -l/--full are not useful anymore, except to undo --no-full. Added in version 196. -a, --all Show all fields in full, even if they include unprintable characters or are very long. By default, fields with unprintable characters are abbreviated as "blob data". (Note that the pager may escape unprintable characters again.) -f, --follow Show only the most recent journal entries, and continuously print new entries as they are appended to the journal. --no-tail Show all stored output lines, even in follow mode. Undoes the effect of --lines=. -q, --quiet Suppresses all informational messages (i.e. "-- Journal begins at ...", "-- Reboot --"), any warning messages regarding inaccessible system journals when run as a normal user. PAGER CONTROL OPTIONS top The following options control page support: --no-pager Do not pipe output into a pager. -e, --pager-end Immediately jump to the end of the journal inside the implied pager tool. This implies -n1000 to guarantee that the pager will not buffer logs of unbounded size. This may be overridden with an explicit -n with some other numeric value, while -nall will disable this cap. Note that this option is only supported for the less(1) pager. Added in version 198. FORWARD SECURE SEALING (FSS) OPTIONS top The following options may be used together with the --setup-keys command described below: --interval= Specifies the change interval for the sealing key when generating an FSS key pair with --setup-keys. Shorter intervals increase CPU consumption but shorten the time range of undetectable journal alterations. Defaults to 15min. Added in version 189. --verify-key= Specifies the FSS verification key to use for the --verify operation. Added in version 189. --force When --setup-keys is passed and Forward Secure Sealing (FSS) has already been configured, recreate FSS keys. Added in version 206. COMMANDS top The following commands are understood. If none is specified the default is to display journal records. -N, --fields Print all field names currently used in all entries of the journal. Added in version 229. -F, --field= Print all possible data values the specified field can take in all entries of the journal. Added in version 195. --list-boots Show a tabular list of boot numbers (relative to the current boot), their IDs, and the timestamps of the first and last message pertaining to the boot. Added in version 209. --disk-usage Shows the current disk usage of all journal files. This shows the sum of the disk usage of all archived and active journal files. Added in version 190. --vacuum-size=, --vacuum-time=, --vacuum-files= --vacuum-size= removes the oldest archived journal files until the disk space they use falls below the specified size. Accepts the usual "K", "M", "G" and "T" suffixes (to the base of 1024). --vacuum-time= removes archived journal files older than the specified timespan. Accepts the usual "s" (default), "m", "h", "days", "weeks", "months", and "years" suffixes, see systemd.time(7) for details. --vacuum-files= leaves only the specified number of separate journal files. Note that running --vacuum-size= has only an indirect effect on the output shown by --disk-usage, as the latter includes active journal files, while the vacuuming operation only operates on archived journal files. Similarly, --vacuum-files= might not actually reduce the number of journal files to below the specified number, as it will not remove active journal files. --vacuum-size=, --vacuum-time= and --vacuum-files= may be combined in a single invocation to enforce any combination of a size, a time and a number of files limit on the archived journal files. Specifying any of these three parameters as zero is equivalent to not enforcing the specific limit, and is thus redundant. These three switches may also be combined with --rotate into one command. If so, all active files are rotated first, and the requested vacuuming operation is executed right after. The rotation has the effect that all currently active files are archived (and potentially new, empty journal files opened as replacement), and hence the vacuuming operation has the greatest effect as it can take all log data written so far into account. Added in version 218. --verify Check the journal file for internal consistency. If the file has been generated with FSS enabled and the FSS verification key has been specified with --verify-key=, authenticity of the journal file is verified. Added in version 189. --sync Asks the journal daemon to write all yet unwritten journal data to the backing file system and synchronize all journals. This call does not return until the synchronization operation is complete. This command guarantees that any log messages written before its invocation are safely stored on disk at the time it returns. Added in version 228. --relinquish-var Asks the journal daemon for the reverse operation to --flush: if requested the daemon will write further log data to /run/log/journal/ and stops writing to /var/log/journal/. A subsequent call to --flush causes the log output to switch back to /var/log/journal/, see above. Added in version 243. --smart-relinquish-var Similar to --relinquish-var, but executes no operation if the root file system and /var/log/journal/ reside on the same mount point. This operation is used during system shutdown in order to make the journal daemon stop writing data to /var/log/journal/ in case that directory is located on a mount point that needs to be unmounted. Added in version 243. --flush Asks the journal daemon to flush any log data stored in /run/log/journal/ into /var/log/journal/, if persistent storage is enabled. This call does not return until the operation is complete. Note that this call is idempotent: the data is only flushed from /run/log/journal/ into /var/log/journal/ once during system runtime (but see --relinquish-var below), and this command exits cleanly without executing any operation if this has already happened. This command effectively guarantees that all data is flushed to /var/log/journal/ at the time it returns. Added in version 217. --rotate Asks the journal daemon to rotate journal files. This call does not return until the rotation operation is complete. Journal file rotation has the effect that all currently active journal files are marked as archived and renamed, so that they are never written to in future. New (empty) journal files are then created in their place. This operation may be combined with --vacuum-size=, --vacuum-time= and --vacuum-file= into a single command, see above. Added in version 227. --header Instead of showing journal contents, show internal header information of the journal fields accessed. This option is particularly useful when trying to identify out-of-order journal entries, as happens for example when the machine is booted with the wrong system time. Added in version 187. --list-catalog [128-bit-ID...] List the contents of the message catalog as a table of message IDs, plus their short description strings. If any 128-bit-IDs are specified, only those entries are shown. Added in version 196. --dump-catalog [128-bit-ID...] Show the contents of the message catalog, with entries separated by a line consisting of two dashes and the ID (the format is the same as .catalog files). If any 128-bit-IDs are specified, only those entries are shown. Added in version 199. --update-catalog Update the message catalog index. This command needs to be executed each time new catalog files are installed, removed, or updated to rebuild the binary catalog index. Added in version 196. --setup-keys Instead of showing journal contents, generate a new key pair for Forward Secure Sealing (FSS). This will generate a sealing key and a verification key. The sealing key is stored in the journal data directory and shall remain on the host. The verification key should be stored externally. Refer to the Seal= option in journald.conf(5) for information on Forward Secure Sealing and for a link to a refereed scholarly paper detailing the cryptographic theory it is based on. Added in version 189. -h, --help Print a short help text and exit. --version Print a short version string and exit. EXIT STATUS top On success, 0 is returned; otherwise, a non-zero failure code is returned. ENVIRONMENT top $SYSTEMD_LOG_LEVEL The maximum log level of emitted messages (messages with a higher log level, i.e. less important ones, will be suppressed). Either one of (in order of decreasing importance) emerg, alert, crit, err, warning, notice, info, debug, or an integer in the range 0...7. See syslog(3) for more information. $SYSTEMD_LOG_COLOR A boolean. If true, messages written to the tty will be colored according to priority. This setting is only useful when messages are written directly to the terminal, because journalctl(1) and other tools that display logs will color messages based on the log level on their own. $SYSTEMD_LOG_TIME A boolean. If true, console log messages will be prefixed with a timestamp. This setting is only useful when messages are written directly to the terminal or a file, because journalctl(1) and other tools that display logs will attach timestamps based on the entry metadata on their own. $SYSTEMD_LOG_LOCATION A boolean. If true, messages will be prefixed with a filename and line number in the source code where the message originates. Note that the log location is often attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs. $SYSTEMD_LOG_TID A boolean. If true, messages will be prefixed with the current numerical thread ID (TID). Note that the this information is attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs. $SYSTEMD_LOG_TARGET The destination for log messages. One of console (log to the attached tty), console-prefixed (log to the attached tty but with prefixes encoding the log level and "facility", see syslog(3), kmsg (log to the kernel circular log buffer), journal (log to the journal), journal-or-kmsg (log to the journal if available, and to kmsg otherwise), auto (determine the appropriate log target automatically, the default), null (disable log output). $SYSTEMD_LOG_RATELIMIT_KMSG Whether to ratelimit kmsg or not. Takes a boolean. Defaults to "true". If disabled, systemd will not ratelimit messages written to kmsg. $SYSTEMD_PAGER Pager to use when --no-pager is not given; overrides $PAGER. If neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known pager implementations are tried in turn, including less(1) and more(1), until one is found. If no pager implementation is discovered no pager is invoked. Setting this environment variable to an empty string or the value "cat" is equivalent to passing --no-pager. Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER (as well as $PAGER) will be silently ignored. $SYSTEMD_LESS Override the options passed to less (by default "FRSXMK"). Users might want to change two options in particular: K This option instructs the pager to exit immediately when Ctrl+C is pressed. To allow less to handle Ctrl+C itself to switch back to the pager command prompt, unset this option. If the value of $SYSTEMD_LESS does not include "K", and the pager that is invoked is less, Ctrl+C will be ignored by the executable, and needs to be handled by the pager. X This option instructs the pager to not send termcap initialization and deinitialization strings to the terminal. It is set by default to allow command output to remain visible in the terminal even after the pager exits. Nevertheless, this prevents some pager functionality from working, in particular paged output cannot be scrolled with the mouse. See less(1) for more discussion. $SYSTEMD_LESSCHARSET Override the charset passed to less (by default "utf-8", if the invoking terminal is determined to be UTF-8 compatible). $SYSTEMD_PAGERSECURE Takes a boolean argument. When true, the "secure" mode of the pager is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set at all, secure mode is enabled if the effective UID is not the same as the owner of the login session, see geteuid(2) and sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set when invoking the pager, and the pager shall disable commands that open or create new files or start new subprocesses. When $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known to implement secure mode will not be used. (Currently only less(1) implements secure mode.) Note: when commands are invoked with elevated privileges, for example under sudo(8) or pkexec(1), care must be taken to ensure that unintended interactive features are not enabled. "Secure" mode for the pager may be enabled automatically as describe above. Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited environment allows the user to invoke arbitrary commands. Note that if the $SYSTEMD_PAGER or $PAGER variables are to be honoured, $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to completely disable the pager using --no-pager instead. $SYSTEMD_COLORS Takes a boolean argument. When true, systemd and related utilities will use colors in their output, otherwise the output will be monochrome. Additionally, the variable can take one of the following special values: "16", "256" to restrict the use of colors to the base 16 or 256 ANSI colors, respectively. This can be specified to override the automatic decision based on $TERM and what the console is connected to. $SYSTEMD_URLIFY The value must be a boolean. Controls whether clickable links should be generated in the output for terminal emulators supporting this. This can be specified to override the decision that systemd makes based on $TERM and other conditions. EXAMPLES top Without arguments, all collected logs are shown unfiltered: journalctl With one match specified, all entries with a field matching the expression are shown: journalctl _SYSTEMD_UNIT=avahi-daemon.service journalctl _SYSTEMD_CGROUP=/user.slice/user-42.slice/session-c1.scope If two different fields are matched, only entries matching both expressions at the same time are shown: journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 If two matches refer to the same field, all entries matching either expression are shown: journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service If the separator "+" is used, two expressions may be combined in a logical OR. The following will show all messages from the Avahi service process with the PID 28097 plus all messages from the D-Bus service (from any of its processes): journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service To show all fields emitted by a unit and about the unit, option -u/--unit= should be used. journalctl -u name expands to a complex filter similar to _SYSTEMD_UNIT=name.service + UNIT=name.service _PID=1 + OBJECT_SYSTEMD_UNIT=name.service _UID=0 + COREDUMP_UNIT=name.service _UID=0 MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 (see systemd.journal-fields(7) for an explanation of those patterns). Show all logs generated by the D-Bus executable: journalctl /usr/bin/dbus-daemon Show all kernel logs from previous boot: journalctl -k -b -1 Show a live log display from a system service apache.service: journalctl -f -u apache SEE ALSO top systemd(1), systemd-cat(1), systemd-journald.service(8), systemctl(1), coredumpctl(1), systemd.journal-fields(7), journald.conf(5), systemd.time(7), systemd-journal-remote.service(8), systemd-journal-upload.service(8) NOTES top 1. Discoverable Partitions Specification https://uapi-group.org/specifications/specs/discoverable_partitions_specification 2. RFC 3339 https://tools.ietf.org/html/rfc3339 3. Journal Export Format https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format 4. Journal JSON Format https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-json-format 5. Server-Sent Events https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events 6. JavaScript Object Notation (JSON) Text Sequences https://tools.ietf.org/html/rfc7464 7. Message Catalog Developer Documentation https://www.freedesktop.org/wiki/Software/systemd/catalog COLOPHON top This page is part of the systemd (systemd system and service manager) project. Information about the project can be found at http://www.freedesktop.org/wiki/Software/systemd. If you have a bug report for this manual page, see http://www.freedesktop.org/wiki/Software/systemd/#bugreports. This page was obtained from the project's upstream Git repository https://github.com/systemd/systemd.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-22.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] systemd 255 JOURNALCTL(1) Pages that refer to this page: coredumpctl(1), flatpak-history(1), homectl(1), journalctl(1), localectl(1), logger(1), loginctl(1), machinectl(1), pmdasystemd(1), portablectl(1), systemctl(1), systemd(1), systemd-analyze(1), systemd-inhibit(1), systemd-nspawn(1), systemd-vmspawn(1), timedatectl(1), userdbctl(1), sd-id128(3), sd-journal(3), syslog(3), journald.conf(5), org.freedesktop.LogControl1(5), systemd.exec(5), systemd.kill(5), systemd.directives(7), systemd.index(7), systemd.journal-fields(7), systemd.time(7), systemd-coredump(8), systemd-journald.service(8), systemd-journal-gatewayd.service(8), systemd-journal-remote.service(8), systemd-journal-upload.service(8), systemd-machined.service(8), systemd-pstore.service(8), systemd-tmpfiles(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# journalctl\n\n> Query the systemd journal.\n> More information: <https://manned.org/journalctl>.\n\n- Show all messages with priority level 3 (errors) from this [b]oot:\n\n`journalctl -b --priority={{3}}`\n\n- Delete journal logs which are older than 2 days:\n\n`journalctl --vacuum-time={{2d}}`\n\n- [f]ollow new messages (like `tail -f` for traditional syslog):\n\n`journalctl -f`\n\n- Show all messages by a specific [u]nit:\n\n`journalctl -u {{unit}}`\n\n- Show logs for a given unit since the last time it started:\n\n`journalctl _SYSTEMD_INVOCATION_ID=$(systemctl show --value --property=InvocationID {{unit}})`\n\n- Filter messages within a time range (either timestamp or placeholders like "yesterday"):\n\n`journalctl --since {{now|today|yesterday|tomorrow}} --until {{YYYY-MM-DD HH:MM:SS}}`\n\n- Show all messages by a specific process:\n\n`journalctl _PID={{pid}}`\n\n- Show all messages by a specific executable:\n\n`journalctl {{path/to/executable}}`\n
kernel-install
kernel-install(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training kernel-install(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | COMMANDS | COMPATIBILITY WITH THE KERNEL BUILD SYSTEM | THE $BOOT PARTITION | OPTIONS | ENVIRONMENT VARIABLES | EXIT STATUS | FILES | SEE ALSO | NOTES | COLOPHON KERNEL-INSTALL(8) kernel-install KERNEL-INSTALL(8) NAME top kernel-install - Add and remove kernel and initrd images to and from /boot SYNOPSIS top kernel-install [OPTIONS...] add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE...] kernel-install [OPTIONS...] remove KERNEL-VERSION kernel-install [OPTIONS...] inspect [KERNEL-VERSION] [KERNEL-IMAGE] [INITRD-FILE...] kernel-install [OPTIONS...] list DESCRIPTION top kernel-install is used to install and remove kernel and initrd images [1] to and from the boot loader partition, referred to as $BOOT here. It will usually be one of /boot/, /efi/, or /boot/efi/, see below. kernel-install will run the executable files ("plugins") located in the directory /usr/lib/kernel/install.d/ and the local administration directory /etc/kernel/install.d/. All files are collectively sorted and executed in lexical order, regardless of the directory in which they live. However, files with identical filenames replace each other. Files in /etc/kernel/install.d/ take precedence over files with the same name in /usr/lib/kernel/install.d/. This can be used to override a system-supplied executables with a local file if needed; a symbolic link in /etc/kernel/install.d/ with the same name as an executable in /usr/lib/kernel/install.d/, pointing to /dev/null, disables the executable entirely. Executables must have the extension ".install"; other extensions are ignored. An executable placed in these directories should return 0 on success. It may also return 77 to cause the whole operation to terminate (executables later in lexical order will be skipped). COMMANDS top The following commands are understood: add [[[KERNEL-VERSION] KERNEL-IMAGE] [INITRD-FILE ...]] This command takes a kernel version string and a path to a kernel image file as arguments. If the former is omitted, specified as an empty string or as "-" it defaults to the current kernel version, i.e. the same string uname -r returns. If the latter is omitted, specified as an empty string or as "-" defaults to /usr/lib/modules/KERNEL_VERSION/vmlinuz. Optionally, one or more initrd images may be specified as well (note that plugins might generate additional ones). The executable files from /usr/lib/kernel/install.d/*.install and /etc/kernel/install.d/*.install (i.e. the plugins) are called with the following arguments: add KERNEL-VERSION $BOOT/ENTRY-TOKEN/KERNEL-VERSION/ KERNEL-IMAGE \ [INITRD-FILE ...] The third argument directly refers to the path where to place kernel images, initrd images and other resources for Boot Loader Specification[2] Type #1 entries (the "entry directory"). If other boot loader schemes are used the parameter may be ignored. The ENTRY-TOKEN string is typically the machine ID and is supposed to identify the local installation on the system. For details see below. Two default plugins execute the following operations in this case: kernel-install creates $BOOT/ENTRY-TOKEN/KERNEL-VERSION, if enabled (see $KERNEL_INSTALL_LAYOUT). 50-depmod.install runs depmod(8) for the KERNEL-VERSION. 90-loaderentry.install copies KERNEL-IMAGE to $BOOT/ENTRY-TOKEN/KERNEL-VERSION/linux. If INITRD-FILEs are provided, it also copies them to $BOOT/ENTRY-TOKEN/KERNEL_VERSION/INITRD-FILE. This can also be used to prepend microcode before the actual initrd. It also creates a boot loader entry according to the Boot Loader Specification[2] (Type #1) in $BOOT/loader/entries/ENTRY-TOKEN-KERNEL-VERSION.conf. The title of the entry is the PRETTY_NAME parameter specified in /etc/os-release or /usr/lib/os-release (if the former is missing), or "Linux KERNEL-VERSION", if unset. If $KERNEL_INSTALL_LAYOUT is not "bls", this plugin does nothing. 90-uki-copy.install copies a file uki.efi from $KERNEL_INSTALL_STAGING_AREA or if it does not exist the KERNEL-IMAGE argument, only if it has a ".efi" extension, to $BOOT/EFI/Linux/ENTRY-TOKEN-KERNEL-VERSION.efi. If $KERNEL_INSTALL_LAYOUT is not "uki", this plugin does nothing. Added in version 198. add-all This is the same as add (see above), but invokes the operation iteratively for every installed kernel in /usr/lib/modules/. This operation is only supported on systems where the kernel image is installed in /usr/lib/modules/KERNEL-VERSION/vmlinuz. Added in version 255. remove KERNEL-VERSION This command expects a kernel version string as single argument. The executable files from /usr/lib/kernel/install.d/*.install and /etc/kernel/install.d/*.install (i.e. the plugins) are called with the following arguments: remove KERNEL-VERSION $BOOT/ENTRY-TOKEN/KERNEL-VERSION/ Afterwards, kernel-install removes the entry directory $BOOT/ENTRY-TOKEN/KERNEL-VERSION/ and its contents, if it exists. Two default plugins execute the following operations in this case: 50-depmod.install removes the files generated by depmod for this kernel again. 90-loaderentry.install removes the file $BOOT/loader/entries/ENTRY-TOKEN-KERNEL-VERSION.conf. 90-uki-copy.install removes the file $BOOT/EFI/Linux/ENTRY-TOKEN-KERNEL-VERSION.efi. Added in version 198. inspect [[[KERNEL-VERSION] KERNEL-IMAGE] [INITRD-FILE ...]] Takes the same parameters as add. Shows the various paths and parameters configured or auto-detected. In particular shows the values of the various $KERNEL_INSTALL_* environment variables listed below, as they would be passed to plugins. The --json option can be used to get the output of this verb as a JSON object. Added in version 251. list Shows the various installed kernels. This enumerates the subdirectories of /usr/lib/modules/, and shows whether a kernel image is installed there. Added in version 255. COMPATIBILITY WITH THE KERNEL BUILD SYSTEM top installkernel [OPTIONS...] VERSION VMLINUZ [MAP] [INSTALLATION-DIR] When invoked as installkernel, this program accepts arguments as specified by the kernel build system's make install command. The VERSION and VMLINUZ parameters specify the kernel version and the kernel binary. The other two parameters (MAP and INSTALLATION-DIR) are currently ignored. THE $BOOT PARTITION top The partition where the kernels and Boot Loader Specification[2] snippets are located is called $BOOT. kernel-install determines the location of this partition by checking /efi/, /boot/, and /boot/efi/ in turn. The first location where $BOOT/loader/entries/ or $BOOT/ENTRY-TOKEN/ exists is used. OPTIONS top The following options are understood: --esp-path= Path to the EFI System Partition (ESP). If not specified, /efi/, /boot/, and /boot/efi/ are checked in turn. It is recommended to mount the ESP to /efi/, if possible. --boot-path= Path to the Extended Boot Loader partition, as defined in the Boot Loader Specification[2]. If not specified, /boot/ is checked. It is recommended to mount the Extended Boot Loader partition to /boot/, if possible. --make-entry-directory=yes|no|auto Controls creation and deletion of the Boot Loader Specification[2] Type #1 entry directory on the file system containing resources such as kernel and initrd images during add and remove, respectively. The directory is named after the entry token, and is placed immediately below the boot root directory. When "auto", the directory is created or removed only when the install layout is "bls". Defaults to "auto". Added in version 254. --entry-token= Controls how to name and identify boot loader entries for this kernel installation or deletion. Takes one of "auto", "machine-id", "os-id", "os-image-id", or an arbitrary string prefixed by "literal:" as argument. If set to machine-id the entries are named after the machine ID of the running system (e.g. "b0e793a9baf14b5fa13ecbe84ff637ac"). See machine-id(5) for details about the machine ID concept and file. If set to os-id the entries are named after the OS ID of the running system, i.e. the ID= field of os-release(5) (e.g. "fedora"). Similarly, if set to os-image-id the entries are named after the OS image ID of the running system, i.e. the IMAGE_ID= field of os-release (e.g. "vendorx-cashier-system"). If set to auto (the default), the /etc/kernel/entry-token (or $KERNEL_INSTALL_CONF_ROOT/entry-token) file will be read if it exists, and the stored value used. Otherwise if the local machine ID is initialized it is used. Otherwise IMAGE_ID= from os-release will be used, if set. Otherwise, ID= from os-release will be used, if set. Otherwise a randomly generated machine ID is used. Using the machine ID for naming the entries is generally preferable, however there are cases where using the other identifiers is a good option. Specifically: if the identification data that the machine ID entails shall not be stored on the (unencrypted) $BOOT_ROOT partition, or if the ID shall be generated on first boot and is not known when the entries are prepared. Note that using the machine ID has the benefit that multiple parallel installations of the same OS can coexist on the same medium, and they can update their boot loader entries independently. When using another identifier (such as the OS ID or the OS image ID), parallel installations of the same OS would try to use the same entry name. To support parallel installations, the installer must use a different entry token when adding a second installation. Added in version 254. -v, --verbose Output additional information about operations being performed. Added in version 242. --root=root Takes a directory path as an argument. All paths will be prefixed with the given alternate root path, including config search paths. This is useful to operate on a system image mounted to the specified directory instead of the host system itself. Added in version 255. --image=image Takes a path to a disk image file or block device node. If specified, all operations are applied to the file system in the indicated disk image. This option is similar to --root=, but operates on file systems stored in disk images or block devices. The disk image should either contain just a file system or a set of file systems within a GPT partition table, following the Discoverable Partitions Specification[3]. For further information on supported disk images, see systemd-nspawn(1)'s switch of the same name. Added in version 255. -h, --help Print a short help text and exit. --version Print a short version string and exit. --no-pager Do not pipe output into a pager. --json=MODE Shows output formatted as JSON. Expects one of "short" (for the shortest possible output without any redundant whitespace or line breaks), "pretty" (for a pretty version of the same, with indentation and line breaks) or "off" (to turn off JSON output, the default). --image-policy=policy Takes an image policy string as argument, as per systemd.image-policy(7). The policy is enforced when operating on the disk image specified via --image=, see above. If not specified defaults to the "*" policy, i.e. all recognized file systems in the image are used. --no-legend Do not print the legend, i.e. column headers and the footer with hints. ENVIRONMENT VARIABLES top Environment variables exported for plugins If --verbose is used, $KERNEL_INSTALL_VERBOSE=1 will be exported for plugins. They may output additional logs in this case. $KERNEL_INSTALL_IMAGE_TYPE=uki|pe|unknown is set for the plugins to specify the type of the kernel image. uki Unified kernel image. Added in version 254. pe PE binary. Added in version 254. unknown Unknown type. Added in version 254. $KERNEL_INSTALL_MACHINE_ID is set for the plugins to the desired machine-id to use. It's always a 128-bit ID. Normally it's read from /etc/machine-id, but it can also be overridden via $MACHINE_ID (see below). If not specified via these methods, a fallback value will generated by kernel-install and used only for a single invocation. $KERNEL_INSTALL_ENTRY_TOKEN is set for the plugins to the desired entry "token" to use. It's an identifier that shall be used to identify the local installation, and is often the machine ID, i.e. same as $KERNEL_INSTALL_MACHINE_ID, but might also be a different type of identifier, for example a fixed string or the ID=, IMAGE_ID= values from /etc/os-release. The string passed here will be used to name Boot Loader Specification entries, or the directories the kernel image and initial RAM disk images are placed into. Note that while $KERNEL_INSTALL_ENTRY_TOKEN and $KERNEL_INSTALL_MACHINE_ID are often set to the same value, the latter is guaranteed to be a valid 32 character ID in lowercase hexadecimals while the former can be any short string. The entry token to use is read from /etc/kernel/entry-token, if it exists. Otherwise a few possible candidates below $BOOT are checked for Boot Loader Specification Type 1 entry directories, and if found the entry token is derived from that. If that is not successful, $KERNEL_INSTALL_MACHINE_ID is used as fallback. $KERNEL_INSTALL_BOOT_ROOT is set for the plugins to the absolute path of the root directory (mount point, usually) of the hierarchy where boot loader entries, kernel images, and associated resources should be placed. This usually is the path where the XBOOTLDR partition or the ESP (EFI System Partition) are mounted, and also conceptually referred to as $BOOT. Can be overridden by setting $BOOT_ROOT (see below). $KERNEL_INSTALL_LAYOUT=auto|bls|uki|other|... is set for the plugins to specify the installation layout. Additional layout names may be defined by convention. If a plugin uses a special layout, it's encouraged to declare its own layout name and configure layout= in install.conf upon initial installation. The following values are currently understood: bls Standard Boot Loader Specification[2] Type #1 layout, compatible with systemd-boot(7): entries in $BOOT/loader/entries/ENTRY-TOKEN-KERNEL-VERSION[+TRIES].conf, kernel and initrds under $BOOT/ENTRY-TOKEN/KERNEL-VERSION/ Implemented by 90-loaderentry.install. Added in version 250. uki Standard Boot Loader Specification[2] Type #2 layout, compatible with systemd-boot(7): unified kernel images under $BOOT/EFI/Linux as $BOOT/EFI/Linux/ENTRY-TOKEN-KERNEL-VERSION[+TRIES].efi. Implemented by 90-uki-copy.install. Added in version 253. other Some other layout not understood natively by kernel-install. Added in version 250. auto Pick the layout automatically. If the kernel is a UKI set layout to uki. If not default to bls if $BOOT/loader/entries.srel with content "type1" or $BOOT/ENTRY-TOKEN exists, or other otherwise. Leaving layout blank has the same effect. This is the default. Added in version 254. $KERNEL_INSTALL_INITRD_GENERATOR and $KERNEL_INSTALL_UKI_GENERATOR are set for plugins to select the initrd and/or UKI generator. This may be configured as initrd_generator= and uki_generator= in install.conf, see below. $KERNEL_INSTALL_STAGING_AREA is set for plugins to a path to a directory. Plugins may drop files in that directory, and they will be installed as part of the loader entry, based on the file name and extension: Files named initrd* will be installed as INITRD-FILEs, and files named microcode* will be prepended before INITRD-FILEs. Environment variables understood by kernel-install $KERNEL_INSTALL_CONF_ROOT can be set to override the location of the configuration files read by kernel-install. When set, install.conf, entry-token, and other files will be read from this directory. $KERNEL_INSTALL_PLUGINS can be set to override the list of plugins executed by kernel-install. The argument is a whitespace-separated list of paths. "KERNEL_INSTALL_PLUGINS=:" may be used to prevent any plugins from running. $MACHINE_ID can be set for kernel-install to override $KERNEL_INSTALL_MACHINE_ID, the machine ID. $BOOT_ROOT can be set for kernel-install to override $KERNEL_INSTALL_BOOT_ROOT, the installation location for boot entries. The last two variables may also be set in install.conf. Variables set in the environment take precedence over the values specified in the config file. EXIT STATUS top If every executable returns 0 or 77, 0 is returned, and a non-zero failure code otherwise. FILES top /etc/kernel/install.d/*.install, /usr/lib/kernel/install.d/*.install Drop-in files which are executed by kernel-install. Added in version 198. /etc/kernel/cmdline, /usr/lib/kernel/cmdline, /proc/cmdline Specifies the kernel command line to use. The first of the files that is found will be used. $KERNEL_INSTALL_CONF_ROOT may be used to override the search path; see below for details. Added in version 198. /etc/kernel/devicetree, /usr/lib/kernel/devicetree Specifies the partial path to the file containing the device tree blob to install with the kernel and use at boot. The first of the files that is found will be used. $KERNEL_INSTALL_CONF_ROOT may be used to override the search path; see below for details. The devicetree file contains a path, and this path specifies a location relative to the kernel install tree. A set of locations is checked, including in particular /usr/lib/modules/KERNEL_VERSION/dtb/, which is the recommended location to place the dtb files under. For example, with "broadcom/bcm2711-rpi-4-b.dtb" in the devicetree file, the device tree blob for the Raspberry Pi 4 Model B would be installed, and the actual file would be /usr/lib/modules/KERNEL_VERSION/dtb/broadcom/bcm2711-rpi-4-b.dtb. Added in version 255. /etc/kernel/tries Read by 90-loaderentry.install and 90-uki-copy.install. If this file exists, a numeric value is read from it and the naming of the generated entry file or UKI is altered to include it as $BOOT/loader/entries/ENTRY-TOKEN-KERNEL-VERSION+TRIES.conf or $BOOT/EFI/Linux/ENTRY-TOKEN-KERNEL-VERSION+TRIES.efi, respectively. This is useful for boot loaders such as systemd-boot(7) which implement boot attempt counting with a counter embedded in the entry file name. $KERNEL_INSTALL_CONF_ROOT may be used to override the search path; see below for details. Added in version 240. /etc/kernel/entry-token If this file exists it is read and used as "entry token" for this system, i.e. is used for naming Boot Loader Specification entries. See $KERNEL_INSTALL_ENTRY_TOKEN above for details. $KERNEL_INSTALL_CONF_ROOT may be used to override the search path; see below for details. Added in version 251. /etc/machine-id The content of this file specifies the machine identification MACHINE-ID. Added in version 198. /etc/os-release, /usr/lib/os-release Read by 90-loaderentry.install. If available, PRETTY_NAME= is read from these files and used as the title of the boot menu entry. Otherwise, "Linux KERNEL-VERSION" will be used. Added in version 198. /etc/kernel/install.conf, /usr/lib/kernel/install.conf Configuration file with options for kernel-install, as a series of KEY=VALUE assignments, compatible with shell syntax, following the same rules as described in os-release(5). The first of the files that is found will be used. $KERNEL_INSTALL_CONF_ROOT may be used to override the search path; see below for details. Currently, the following keys are supported: MACHINE_ID=, BOOT_ROOT=, layout=, initrd_generator=, uki_generator=. See the Environment variables section above for details. Added in version 250. /etc/kernel/uki.conf Ini-style configuration file for ukify(1) which is only effective when $KERNEL_INSTALL_LAYOUT or layout= in install.conf is set to uki and $KERNEL_INSTALL_UKI_GENERATOR or uki_generator= in install.conf is set to ukify, or is unset. $KERNEL_INSTALL_CONF_ROOT may be used to override the search path; see below for details. Added in version 255. /usr/lib/modules/KERNEL-VERSION/ Location for installed kernel modules and other kernel related resources. For each locally installed kernel a directory named after the kernel version (uname -r) is kept. Added in version 255. /usr/lib/modules/KERNEL-VERSION/vmlinuz Location for installed kernel images. This is the recommended location for OS package managers to install kernel images into (as applicable), from which kernel-install add then copies it into the final boot partition. Added in version 255. For various cases listed above, if the $KERNEL_INSTALL_CONF_ROOT environment variable is set, it will override the search path. The files will be loaded only from the directory specified by the environment variable. When the variable is not set, the listed paths are tried in turn, and the first file that exists is used. SEE ALSO top machine-id(5), os-release(5), depmod(8), systemd-boot(7), ukify(1), Boot Loader Specification[2] NOTES top 1. Nowadays actually CPIO archives used as an "initramfs", rather than "initrd". See bootup(7) for an explanation. 2. Boot Loader Specification https://uapi-group.org/specifications/specs/boot_loader_specification 3. Discoverable Partitions Specification https://uapi-group.org/specifications/specs/discoverable_partitions_specification COLOPHON top This page is part of the systemd (systemd system and service manager) project. Information about the project can be found at http://www.freedesktop.org/wiki/Software/systemd. If you have a bug report for this manual page, see http://www.freedesktop.org/wiki/Software/systemd/#bugreports. This page was obtained from the project's upstream Git repository https://github.com/systemd/systemd.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-22.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] systemd 255 KERNEL-INSTALL(8) Pages that refer to this page: systemd-firstboot(1), ukify(1), systemd.directives(7), systemd.index(7) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# kernel-install\n\n> Add and remove kernel and initrd images to and from `/boot`.\n> More information: <https://manned.org/kernel-install.8>.\n\n- Add kernel and initramfs images to bootloader partition:\n\n`sudo kernel-install add {{kernel-version}} {{kernel-image}} {{path/to/initrd-file ...}}`\n\n- Remove kernel from the bootloader partition:\n\n`sudo kernel-install remove {{kernel-version}}`\n\n- Show various paths and parameters that have been configured or auto-detected:\n\n`sudo kernel-install inspect {{kernel-image}}`\n
kexec
kexec(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training kexec(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | USAGE | EXAMPLE | OPTIONS | SUPPORTED KERNEL FILE TYPES AND OPTIONS | ARCHITECTURE OPTIONS | COLOPHON kexec(8) User Manuals kexec(8) NAME top kexec - directly boot into a new kernel SYNOPSIS top /sbin/kexec [-v (--version)] [-f (--force)] [-x (--no-ifdown)] [-y (--no-sync)] [-l (--load)] [-p (--load-panic)] [-u (--unload)] [-e (--exec)] [-t (--type)] [--mem-min=addr] [--mem-max=addr] DESCRIPTION top kexec is a system call that enables you to load and boot into another kernel from the currently running kernel. kexec performs the function of the boot loader from within the kernel. The primary difference between a standard system boot and a kexec boot is that the hardware initialization normally performed by the BIOS or firmware (depending on architecture) is not performed during a kexec boot. This has the effect of reducing the time required for a reboot. Make sure you have selected CONFIG_KEXEC=y when configuring the kernel. The CONFIG_KEXEC option enables the kexec system call. USAGE top Using kexec consists of (1) loading the kernel to be rebooted to into memory, and (2) actually rebooting to the pre-loaded kernel. To load a kernel, the syntax is as follows: kexec -l kernel-image --append=command-line-options --initrd=initrd-image where kernel-image is the kernel file that you intend to reboot to. Insert the command-line parameters that must be passed to the new kernel into command-line-options. Passing the exact contents of /proc/cmdline into command-line-options is the safest way to ensure that correct values are passed to the rebooting kernel. The optional initrd-image is the initrd image to be used during boot. It's also possible to invoke kexec without an option parameter. In that case, kexec loads the specified kernel and then invokes shutdown(8). If the shutdown scripts of your Linux distribution support kexec-based rebooting, they then call kexec -e just before actually rebooting the machine. That way, the machine does a clean shutdown including all shutdown scripts. EXAMPLE top For example, if the kernel image you want to reboot to is /boot/vmlinux, the contents of /proc/cmdline is root=/dev/hda1, and the path to the initrd is /boot/initrd, then you would use the following command to load the kernel: kexec -l /boot/vmlinux --append=root=/dev/hda1 --initrd=/boot/initrd After this kernel is loaded, assuming the user-space supports kexec-based rebooting, it can be booted to, with a clean shutdown, using the command: reboot Alternatively, it can also be booted to, without calling shutdown(8), with the command: kexec -e OPTIONS top -d (--debug) Enable debugging messages. -S (--status) Return 1 if the type (by default crash) is loaded, 0 if not. Can be used in conjuction with -l or -p to toggle the type. Note this option supersedes other options and it will not load or unload the kernel. -e (--exec) Run the currently loaded kernel. Note that it will reboot into the loaded kernel without calling shutdown(8). -f (--force) Force an immediate kexec call, do not call shutdown(8) (contrary to the default action without any option parameter). This option performs the same actions like executing -l and -e in one call. -h (--help) Open a help file for kexec. --hotplug Setup for kernel modification of the elfcorehdr. This option performs the steps needed to support kernel updates to the elfcorehdr in the presence of hot un/plug and/or on/offline events. This option only useful for KEXEC_LOAD syscall. -i (--no-checks) Fast reboot, no memory integrity checks. -l (--load) kernel Load the specified kernel into the current kernel. -p (--load-panic) Load the new kernel for use on panic. -t (--type=type) Specify that the new kernel is of this type. -s (--kexec-file-syscall) Specify that the new KEXEC_FILE_LOAD syscall should be used exclusively. -c (--kexec-syscall) Specify that the old KEXEC_LOAD syscall should be used exclusively. -a (--kexec-syscall-auto) Try the new KEXEC_FILE_LOAD syscall first and when it is not supported or the kernel does not understand the supplied image fall back to the old KEXEC_LOAD interface. There is no one single interface that always works, so this is the default. KEXEC_FILE_LOAD is required on systems that use locked- down secure boot to verify the kernel signature. KEXEC_LOAD may be also disabled in the kernel configuration. KEXEC_LOAD is required for some kernel image formats and on architectures that do not implement KEXEC_FILE_LOAD. -u (--unload) Unload the current kexec target kernel. If a capture kernel is being unloaded then specify -p with -u. -v (--version) Return the version number of the installed utility. -x (--no-ifdown) Shut down the running kernel, but restore the interface on reload. -y (--no-sync) Shut down the running kernel, but skip syncing the filesystems. --mem-min=addr Specify the lowest memory address addr to load code into. --mem-max=addr Specify the highest memory address addr to load code into. --entry=addr Specify the jump back address. (0 means it's not jump back or preserve context) --load-preserve-context Load the new kernel and preserve context of current kernel during kexec. --load-jump-back-helper Load a helper image to jump back to original kernel. --reuseinitrd Reuse initrd from first boot. --print-ckr-size Print crash kernel region size, if available. SUPPORTED KERNEL FILE TYPES AND OPTIONS top Beoboot-x86 --args-elf Pass ELF boot notes. --args-linux Pass Linux kernel style options. --real-mode Use the kernel's real mode entry point. elf-x86 --append=string Append string to the kernel command line. --command-line=string Set the kernel command line to string. --reuse-cmdline Use the command line from the running system. When a panic kernel is loaded, it strips the crashkernel parameter automatically. The BOOT_IMAGE parameter is also stripped. --initrd=file Use file as the kernel's initial ramdisk. --ramdisk=file Use file as the kernel's initial ramdisk. bzImage-x86 --append=string Append string to the kernel command line. --command-line=string Set the kernel command line to string. --reuse-cmdline Use the command line from the running system. When a panic kernel is loaded, it strips the crashkernel parameter automatically. The BOOT_IMAGE parameter is also stripped. --initrd=file Use file as the kernel's initial ramdisk. --ramdisk=file Use file as the kernel's initial ramdisk. --real-mode Use real-mode entry point. multiboot-x86 --command-line=string Set the kernel command line to string. --reuse-cmdline Use the command line from the running system. When a panic kernel is loaded, it strips the crashkernel parameter automatically. The BOOT_IMAGE parameter is also stripped. --module=mod arg1 arg2 ... Load module mod with command-line arguments arg1 arg2 ... This parameter can be specified multiple times. multiboot2-x86 --command-line=string Set the kernel command line to string. --reuse-cmdline Use the command line from the running system. When a panic kernel is loaded, it strips the crashkernel parameter automatically. The BOOT_IMAGE parameter is also stripped. --module=mod arg1 arg2 ... Load module mod with command-line arguments arg1 arg2 ... This parameter can be specified multiple times. elf-ppc64 --reuse-cmdline Use the kernel command line from the running system. --command-line=string Set the kernel command line to string. --append=string Set the kernel command line to string. --ramdisk=file Use file as the initial RAM disk. --initrd=file Use file as the initial RAM disk. --devicetreeblob=file Specify device tree blob file. Not applicable while using --kexec-file-syscall. --dtb=file Specify device tree blob file. Not applicable while using --kexec-file-syscall. ARCHITECTURE OPTIONS top --console-serial Enable the serial console. --console-vga Enable the VGA console. --elf32-core-headers Prepare core headers in ELF32 format. --elf64-core-headers Prepare core headers in ELF64 format. --reset-vga Attempt to reset a standard VGA device. --serial=port Specify the serial port for debug output. --serial-baud=baud_rate Specify the baud rate of the serial port. --dt-no-old-root Do not reuse old kernel root=<device> param while creating flatten device tree. COLOPHON top This page is part of the kexec-tools (kexec-tools) project. Information about the project can be found at https://projects.horms.net/projects/kexec/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-02.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Linux April 2006 kexec(8) Pages that refer to this page: kexec_load(2) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# kexec\n\n> Directly reboot into a new kernel.\n> More information: <https://manned.org/kexec>.\n\n- Load a new kernel:\n\n`kexec -l {{path/to/kernel}} --initrd={{path/to/initrd}} --command-line={{arguments}}`\n\n- Load a new kernel with current boot parameters:\n\n`kexec -l {{path/to/kernel}} --initrd={{path/to/initrd}} --reuse-cmdline`\n\n- Execute a currently loaded kernel:\n\n`kexec -e`\n\n- Unload current kexec target kernel:\n\n`kexec -u`\n
keyctl
keyctl(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training keyctl(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | KEY IDENTIFIERS | COMMAND SYNTAX | ERRORS | SEE ALSO | COLOPHON KEYCTL(1) Linux Key Management Utilities KEYCTL(1) NAME top keyctl - key management facility control SYNOPSIS top keyctl --version keyctl supports [<cap> | --raw] keyctl id [<keyring>] keyctl show [-x] [<keyring>] keyctl add [-x] <type> <desc> <data> <keyring> keyctl padd [-x] <type> <desc> <keyring> keyctl request <type> <desc> [<dest_keyring>] keyctl request2 <type> <desc> <info> [<dest_keyring>] keyctl prequest2 <type> <desc> [<dest_keyring>] keyctl update [-x] <key> <data> keyctl pupdate [-x] <key> keyctl newring <name> <keyring> keyctl revoke <key> keyctl clear <keyring> keyctl link <key> <keyring> keyctl unlink <key> [<keyring>] keyctl move [-f] <key> <from_keyring> <to_keyring> keyctl search <keyring> <type> <desc> [<dest_keyring>] keyctl restrict_keyring <keyring> [<type> [<restriction>]] keyctl read <key> keyctl pipe <key> keyctl print <key> keyctl list <keyring> keyctl rlist <keyring> keyctl describe <keyring> keyctl rdescribe <keyring> [sep] keyctl chown <key> <uid> keyctl chgrp <key> <gid> keyctl setperm <key> <mask> keyctl new_session [<name>] keyctl session keyctl session - [<prog> <arg1> <arg2> ...] keyctl session <name> [<prog> <arg1> <arg2> ...] keyctl instantiate [-x] <key> <data> <keyring> keyctl pinstantiate [-x] <key> <keyring> keyctl negate <key> <timeout> <keyring> keyctl reject <key> <timeout> <error> <keyring> keyctl timeout <key> <timeout> keyctl security <key> keyctl reap [-v] keyctl purge <type> keyctl purge [-i] [-p] <type> <desc> keyctl purge -s <type> <desc> keyctl get_persistent <keyring> [<uid>] keyctl dh_compute <private> <prime> <base> keyctl dh_compute_kdf <private> <prime> <base> <output_length> <hash_type> keyctl dh_compute_kdf_oi [-x] <private> <prime> <base> <output_length> <hash_type> keyctl pkey_query <key> <pass> [k=v]* keyctl pkey_encrypt <key> <pass> <datafile> [k=v]* ><encfile> keyctl pkey_decrypt <key> <pass> <encfile> [k=v]* ><datafile> keyctl pkey_sign <key> <pass> <datafile> [k=v]* ><sigfile> keyctl pkey_decrypt <key> <pass> <datafile> <sigfile> [k=v]* keyctl watch [-f<filters>] <key> keyctl watch_add <fd> <key> keyctl watch_rm <fd> <key> keyctl watch_session [-f <filters>] [-n <name>] \ <notifylog> <gclog> <fd> <prog> [<arg1> <arg2> ...] DESCRIPTION top This program is used to control the key management facility in various ways using a variety of subcommands. KEY IDENTIFIERS top The key identifiers passed to or returned from keyctl are, in general, positive integers. There are, however, some special values with special meanings that can be passed as arguments: No key: 0 Thread keyring: @t or -1 Each thread may have its own keyring. This is searched first, before all others. The thread keyring is replaced by (v)fork, exec and clone. Process keyring: @p or -2 Each process (thread group) may have its own keyring. This is shared between all members of a group and will be searched after the thread keyring. The process keyring is replaced by (v)fork and exec. Session keyring: @s or -3 Each process subscribes to a session keyring that is inherited across (v)fork, exec and clone. This is searched after the process keyring. Session keyrings can be named and an extant keyring can be joined in place of a process's current session keyring. User specific keyring: @u or -4 This keyring is shared between all the processes owned by a particular user. It isn't searched directly, but is normally linked to from the session keyring. User default session keyring: @us or -5 This is the default session keyring for a particular user. Login processes that change to a particular user will bind to this session until another session is set. Group specific keyring: @g or -6 This is a place holder for a group specific keyring, but is not actually implemented yet in the kernel. Assumed request_key authorisation key: @a or -7 This selects the authorisation key provided to the request_key() helper to permit it to access the callers keyrings and instantiate the target key. Keyring by name: %:<name> A named keyring. This will be searched for in the process's keyrings and in /proc/keys. Key by name: %<type>:<name> A named key of the given type. This will be searched for in the process's keyrings and in /proc/keys. COMMAND SYNTAX top Any non-ambiguous shortening of a command name may be used in lieu of the full command name. This facility should not be used in scripting as new commands may be added in future that then cause ambiguity. Display the package version number keyctl --version This command prints the package version number and build date and exits: $ keyctl --version keyctl from keyutils-1.5.3 (Built 2011-08-24) Query subsystem capabilities keyctl supports keyctl supports --raw keyctl supports <cap> This command can list the available capabilities: $ keyctl supports have_capabilities=0 have_persistent_keyrings=1 have_dh_compute=1 have_public_key=1 produce a raw hex dump of the capabilities list: $ keyctl supports --raw ff0f or query a specific capability: $ keyctl supports pkey echo $? 0 which exits 0 if the capability is supported, 1 if it isn't and 3 if the name is not recognised. The capabilities supported are: capabilities The kernel supports capability querying. If not, the other capabilities will be queried as best libkeyutils can manage. persistent_keyrings The kernel supports persistent keyrings. dh_compute The kernel supports Diffie-Hellman computation operations. public_key The kernel supports public key operations. big_key_type The kernel supports the big_key key type. key_invalidate The kernel supports the invalidate key operaiton. restrict_keyring The kernel supports the restrict_keyring operation. move_key The kernel supports the move key operation. ns_keyring_name Keyring names are segregated according to the user- namespace in which the keyrings are created. ns_key_tag Keys can get tagged with namespace tags, allowing keys with the same type and description, but different namespaces to coexist in the same keyring. Tagging is done automatically according to the key type. Show actual key or keyring ID keyctl id [<key>] This command looks up the real ID of a key or keyring from the identifier given, which is typically a symbolic ID such as "@s" indicating the session keyring, but can also be a numeric ID or "%type:desc" notation. If a special keyring is specified that isn't created yet, an error will be given rather than causing that keyring to be created. Show process keyrings keyctl show [-x] [<keyring>] By default this command recursively shows what keyrings a process is subscribed to and what keys and keyrings they contain. If a keyring is specified then that keyring will be dumped instead. If -x is specified then the keyring IDs will be dumped in hex instead of decimal. Add a key to a keyring keyctl add [-x] <type> <desc> <data> <keyring> keyctl padd [-x] <type> <desc> <keyring> This command creates a key of the specified type and description; instantiates it with the given data and attaches it to the specified keyring. It then prints the new key's ID on stdout: $ keyctl add user mykey stuff @u 26 The padd variant of the command reads the data from stdin rather than taking it from the command line: $ echo -n stuff | keyctl padd user mykey @u 26 If -x is given, then the data is hex-decoded with whitespace being discarded. Request a key keyctl request <type> <desc> [<dest_keyring>] keyctl request2 <type> <desc> <info> [<dest_keyring>] keyctl prequest2 <type> <desc> [<dest_keyring>] These three commands request the lookup of a key of the given type and description. The process's keyrings will be searched, and if a match is found the matching key's ID will be printed to stdout; and if a destination keyring is given, the key will be added to that keyring also. If there is no key, the first command will simply return the error ENOKEY and fail. The second and third commands will create a partial key with the type and description, and call out to /sbin/request-key with that key and the extra information supplied. This will then attempt to instantiate the key in some manner, such that a valid key is obtained. The third command is like the second, except that the callout information is read from stdin rather than being passed on the command line. If a valid key is obtained, the ID will be printed and the key attached as if the original search had succeeded. If there wasn't a valid key obtained, a temporary negative key will be attached to the destination keyring if given and the error "Requested key not available" will be given. $ keyctl request2 user debug:hello wibble 23 $ echo -n wibble | keyctl prequest2 user debug:hello 23 $ keyctl request user debug:hello 23 Update a key keyctl update [-x] <key> <data> keyctl pupdate [-x] <key> This command replaces the data attached to a key with a new set of data. If the type of the key doesn't support update then error "Operation not supported" will be returned. $ keyctl update 23 zebra The pupdate variant of the command reads the data from stdin rather than taking it from the command line: $ echo -n zebra | keyctl pupdate 23 $ echo 616263313233 | keyctl pupdate -x 23 If -x is given, then the data is hex-decoded with whitespace being discarded. Create a keyring keyctl newring <name> <keyring> This command creates a new keyring of the specified name and attaches it to the specified keyring. The ID of the new keyring will be printed to stdout if successful. $ keyctl newring squelch @us 27 Revoke a key keyctl revoke <key> This command marks a key as being revoked. Any further operations on that key (apart from unlinking it) will return error "Key has been revoked". $ keyctl revoke 26 $ keyctl describe 26 keyctl_describe: Key has been revoked Clear a keyring keyctl clear <keyring> This command unlinks all the keys attached to the specified keyring. Error "Not a directory" will be returned if the key specified is not a keyring. $ keyctl clear 27 Link a key to a keyring keyctl link <key> <keyring> This command makes a link from the key to the keyring if there's enough capacity to do so. Error "Not a directory" will be returned if the destination is not a keyring. Error "Permission denied" will be returned if the key doesn't have link permission or the keyring doesn't have write permission. Error "File table overflow" will be returned if the keyring is full. Error "Resource deadlock avoided" will be returned if an attempt was made to introduce a recursive link. $ keyctl link 23 27 $ keyctl link 27 27 keyctl_link: Resource deadlock avoided Unlink a key from a keyring or the session keyring tree keyctl unlink <key> [<keyring>] If the keyring is specified, this command removes a link to the key from the keyring. Error "Not a directory" will be returned if the destination is not a keyring. Error "Permission denied" will be returned if the keyring doesn't have write permission. Error "No such file or directory" will be returned if the key is not linked to by the keyring. If the keyring is not specified, this command performs a depth- first search of the session keyring tree and removes all the links to the nominated key that it finds (and that it is permitted to remove). It prints the number of successful unlinks before exiting. $ keyctl unlink 23 27 Move a key between keyrings. keyctl move [-f] <key> <from_keyring> <to_keyring> This command moves a key from one keyring to another, atomically combining "keyctl unlink <key> <from_keyring>" and "keyctl link <key> <to_keyring>". If the "-f" flag is present, any matching key will be displaced from "to_keyring"; if not present, the command will fail with the error message "File exists" if the key would otherwise displace another key from "to_keyring". $ keyctl move 23 27 29 $ keyctl move -f 71 @u @s Search a keyring keyctl search <keyring> <type> <desc> [<dest_keyring>] This command non-recursively searches a keyring for a key of a particular type and description. If found, the ID of the key will be printed on stdout and the key will be attached to the destination keyring if present. Error "Requested key not available" will be returned if the key is not found. $ keyctl search @us user debug:hello 23 $ keyctl search @us user debug:bye keyctl_search: Requested key not available Restrict a keyring keyctl restrict_keyring <keyring> [<type> [<restriction>]] This command limits the linkage of keys to the given keyring using a provided restriction scheme. The scheme is associated with a given key type, with further details provided in the restriction option string. Options typically contain a restriction name possibly followed by key ids or other data relevant to the restriction. If no restriction scheme is provided, the keyring will reject all links. $ keyctl restrict_keyring $1 asymmetric builtin_trusted Read a key keyctl read <key> keyctl pipe <key> keyctl print <key> These commands read the payload of a key. "read" prints it on stdout as a hex dump, "pipe" dumps the raw data to stdout and "print" dumps it to stdout directly if it's entirely printable or as a hexdump preceded by ":hex:" if not. If the key type does not support reading of the payload, then error "Operation not supported" will be returned. $ keyctl read 26 1 bytes of data in key: 62 $ keyctl print 26 b $ keyctl pipe 26 b$ List a keyring keyctl list <keyring> keyctl rlist <keyring> These commands list the contents of a key as a keyring. "list" pretty prints the contents and "rlist" just produces a space- separated list of key IDs. No attempt is made to check that the specified keyring is a keyring. $ keyctl list @us 2 keys in keyring: 22: vrwsl---------- 4043 -1 keyring: _uid.4043 23: vrwsl---------- 4043 4043 user: debug:hello $ keyctl rlist @us 22 23 Describe a key keyctl describe <keyring> keyctl rdescribe <keyring> [sep] These commands fetch a description of a keyring. "describe" pretty prints the description in the same fashion as the "list" command; "rdescribe" prints the raw data returned from the kernel. $ keyctl describe @us -5: vrwsl---------- 4043 -1 keyring: _uid_ses.4043 $ keyctl rdescribe @us keyring;4043;-1;3f1f0000;_uid_ses.4043 The raw string is "<type>;<uid>;<gid>;<perms>;<description>", where uid and gid are the decimal user and group IDs, perms is the permissions mask in hex, type and description are the type name and description strings (neither of which will contain semicolons). Change the access controls on a key keyctl chown <key> <uid> keyctl chgrp <key> <gid> These two commands change the UID and GID associated with evaluating a key's permissions mask. The UID also governs which quota a key is taken out of. The chown command is not currently supported; attempting it will earn the error "Operation not supported" at best. For non-superuser users, the GID may only be set to the process's GID or a GID in the process's groups list. The superuser may set any GID it likes. $ sudo keyctl chown 27 0 keyctl_chown: Operation not supported $ sudo keyctl chgrp 27 0 Set the permissions mask on a key keyctl setperm <key> <mask> This command changes the permission control mask on a key. The mask may be specified as a hex number if it begins "0x", an octal number if it begins "0" or a decimal number otherwise. The hex numbers are a combination of: Possessor UID GID Other Permission Granted ======== ======== ======== ======== ================== 01000000 00010000 00000100 00000001 View 02000000 00020000 00000200 00000002 Read 04000000 00040000 00000400 00000004 Write 08000000 00080000 00000800 00000008 Search 10000000 00100000 00001000 00000010 Link 20000000 00200000 00002000 00000020 Set Attribute 3f000000 003f0000 00003f00 0000003f All View permits the type, description and other parameters of a key to be viewed. Read permits the payload (or keyring list) to be read if supported by the type. Write permits the payload (or keyring list) to be modified or updated. Search on a key permits it to be found when a keyring to which it is linked is searched. Link permits a key to be linked to a keyring. Set Attribute permits a key to have its owner, group membership, permissions mask and timeout changed. $ keyctl setperm 27 0x1f1f1f00 Start a new session with fresh keyrings keyctl session keyctl session - [<prog> <arg1> <arg2> ...] keyctl session <name> [<prog> <arg1> <arg2> ...] These commands join or create a new keyring and then run a shell or other program with that keyring as the session key. The variation with no arguments just creates an anonymous session keyring and attaches that as the session keyring; it then exec's $SHELL. The variation with a dash in place of a name creates an anonymous session keyring and attaches that as the session keyring; it then exec's the supplied command, or $SHELL if one isn't supplied. The variation with a name supplied creates or joins the named keyring and attaches that as the session keyring; it then exec's the supplied command, or $SHELL if one isn't supplied. $ keyctl rdescribe @s keyring;4043;-1;3f1f0000;_uid_ses.4043 $ keyctl session Joined session keyring: 28 $ keyctl rdescribe @s keyring;4043;4043;3f1f0000;_ses.24082 $ keyctl session - Joined session keyring: 29 $ keyctl rdescribe @s keyring;4043;4043;3f1f0000;_ses.24139 $ keyctl session - keyctl rdescribe @s Joined session keyring: 30 keyring;4043;4043;3f1f0000;_ses.24185 $ keyctl session fish Joined session keyring: 34 $ keyctl rdescribe @s keyring;4043;4043;3f1f0000;fish $ keyctl session fish keyctl rdesc @s Joined session keyring: 35 keyring;4043;4043;3f1f0000;fish Instantiate a key keyctl instantiate [-x] <key> <data> <keyring> keyctl pinstantiate [-x] <key> <keyring> keyctl negate <key> <timeout> <keyring> keyctl reject <key> <timeout> <error> <keyring> These commands are used to attach data to a partially set up key (as created by the kernel and passed to /sbin/request-key). "instantiate" marks a key as being valid and attaches the data as the payload. "negate" and "reject" mark a key as invalid and sets a timeout on it so that it'll go away after a while. This prevents a lot of quickly sequential requests from slowing the system down overmuch when they all fail, as all subsequent requests will then fail with error "Requested key not found" (if negated) or the specified error (if rejected) until the negative key has expired. Reject's error argument can either be a UNIX error number or one of 'rejected', 'expired' or 'revoked'. The newly instantiated key will be attached to the specified keyring. These commands may only be run from the program run by request-key - a special authorisation key is set up by the kernel and attached to the request-key's session keyring. This special key is revoked once the key to which it refers has been instantiated one way or another. $ keyctl instantiate $1 "Debug $3" $4 $ keyctl negate $1 30 $4 $ keyctl reject $1 30 64 $4 The pinstantiate variant of the command reads the data from stdin rather than taking it from the command line: $ echo -n "Debug $3" | keyctl pinstantiate $1 $4 If -x is given, then the data is hex-decoded with whitespace being discarded: $ echo 01 02 03 04 | keyctl pinstantiate -x $1 $4 Set the expiry time on a key keyctl timeout <key> <timeout> This command is used to set the timeout on a key, or clear an existing timeout if the value specified is zero. The timeout is given as a number of seconds into the future. $ keyctl timeout $1 45 Retrieve a key's security context keyctl security <key> This command is used to retrieve a key's LSM security context. The label is printed on stdout. $ keyctl security @s unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 Give the parent process a new session keyring keyctl new_session [<name>] This command is used to give the invoking process (typically a shell) a new session keyring, discarding its old session keyring. If a name is given, the keyring is given that name, otherwise it will be given a name of "_ses" and will not be manually joinable. $ keyctl session foo Joined session keyring: 723488146 $ keyctl show Session Keyring -3 --alswrv 0 0 keyring: foo $ keyctl new_session 490511412 $ keyctl show Session Keyring -3 --alswrv 0 0 keyring: _ses Note that this affects the parent of the process that invokes the system call, and so may only affect processes with matching credentials. Furthermore, the change does not take effect till the parent process next transitions from kernel space to user space - typically when the wait() system call returns. Remove dead keys from the session keyring tree keyctl reap This command performs a depth-first search of the caller's session keyring tree and attempts to unlink any key that it finds that is inaccessible due to expiry, revocation, rejection or negation. It does not attempt to remove live keys that are unavailable simply due to a lack of granted permission. A key that is designated reapable will only be removed from a keyring if the caller has Write permission on that keyring, and only keyrings that grant Search permission to the caller will be searched. The command prints the number of keys reaped before it exits. If the -v flag is passed then the reaped keys are listed as they're being reaped, together with the success or failure of the unlink. Remove matching keys from the session keyring tree keyctl purge <type> keyctl purge [-i] [-p] <type> <desc> keyctl purge -s <type> <desc> These commands perform a depth-first search to find matching keys in the caller's session keyring tree and attempts to unlink them. The number of keys successfully unlinked is printed at the end. The keyrings must grant Read and View permission to the caller to be searched, and the keys to be removed must also grant View permission. Keys can only be removed from keyrings that grant Write permission. The first variant purges all keys of the specified type. The second variant purges all keys of the specified type that also match the given description literally. The -i flag allows a case-independent match and the -p flag allows a prefix match. The third variant purges all keys of the specified type and matching description using the key type's comparator in the kernel to match the description. This permits the key type to match a key with a variety of descriptions. Get persistent keyring keyctl get_persistent <keyring> [<uid>] This command gets the persistent keyring for either the current UID or the specified UID and attaches it to the nominated keyring. The persistent keyring's ID will be printed on stdout. The kernel will create the keyring if it doesn't exist and every time this command is called, will reset the expiration timeout on the keyring to the value in: /proc/sys/kernel/keys/persistent_keyring_expiry (by default three days). Should the timeout be reached, the persistent keyring will be removed and everything it pins can then be garbage collected. If a UID other than the process's real or effective UIDs is specified, then an error will be given if the process does not have the CAP_SETUID capability. Compute a Diffie-Hellman shared secret or public key keyctl dh_compute <private> <prime> <base> This command computes either a Diffie-Hellman shared secret or the public key corresponding to the provided private key using the payloads of three keys. The computation is: base ^ private (mod prime) The three inputs must be user keys with read permission. If the provided base key contains the shared generator value, the public key will be computed. If the provided base key contains the remote public key value, the shared secret will be computed. The result is printed to stdout as a hex dump. $ keyctl dh_compute $1 $2 $3 8 bytes of data in result: 00010203 04050607 Compute a Diffie-Hellman shared secret and derive key material keyctl dh_compute_kdf <private> <prime> <base> <output_length> <hash_type> This command computes a Diffie-Hellman shared secret and derives key material from the shared secret using a key derivation function (KDF). The shared secret is derived as outlined above and is input to the KDF using the specified hash type. The hash type must point to a hash name known to the kernel crypto API. The operation derives key material of the length specified by the caller. The operation is compliant to the specification of SP800-56A. The result is printed to stdout as hex dump. Compute a Diffie-Hellman shared secret and apply KDF with other input keyctl dh_compute_kdf_oi [-x] <private> <prime> <base> <output_length> <hash_type> This command is identical to the command dh_compute_kdf to generate a Diffie-Hellman shared secret followed by a key derivation operation. This command allows the caller to provide the other input data (OI data) compliant to SP800-56A via stdin. If -x is given, then the data passed to stdin is hex-decoded with whitespace being discarded. Perform public-key operations with an asymmetric key keyctl pkey_query <key> <pass> [k=v]* keyctl pkey_encrypt <key> <pass> <datafile> [k=v]* > <encfile> keyctl pkey_decrypt <key> <pass> <encfile> [k=v]* > <datafile> keyctl pkey_sign <key> <pass> <datafile> [k=v]* > <sigfile> keyctl pkey_verify <key> <pass> <datafile> <sigfile> [k=v]* These commands query an asymmetric key, encrypt data with it, decrypt the encrypted data, generate a signature over some data and verify that signature. For encrypt, decrypt and sign, the resulting data is written to stdout; verify reads the data and the signature files and compares them. [!] NOTE that the data is of very limited capacity, with no more bits than the size of the key. For signatures, the caller is expected to digest the actual data and pass in the result of the digest as the datafile. The name of the digest should be specified on the end of the command line as "hash=<name>". The key ID indicates the key to use; pass is a placeholder for future password provision and should be "0" for the moment; datafile is the unencrypted data to be encrypted, signed or to have its signature checked; encfile is a file containing encrypted data; and sigfile is a file containing a signature. A list of parameters in "key[=val]" form can be included on the end of the command line. These specify things like the digest algorithm used ("hash=<name>") or the encoding form ("enc=<type>"). k=`keyctl padd asymmetric "" @s <key.pkcs8.der` keyctl pkey_query $k 0 enc=pkcs1 hash=sha256 keyctl pkey_encrypt $k 0 foo.hash enc=pkcs1 >foo.enc keyctl pkey_decrypt $k 0 foo.enc enc=pkcs1 >foo.hash keyctl pkey_sign $k 0 foo.hash enc=pkcs1 hash=sha256 >foo.sig keyctl pkey_verify $k 0 foo.hash foo.sig enc=pkcs1 hash=sha256 See asymmetric-key(7) for more information. Change notifications keyctl watch [-f<filters>] <key> keyctl watch_session [-f <filters>] [-n <name>] \ <notifylog> <gclog> <fd> <prog> [<arg1> <arg2> ...] keyctl watch_add <fd> <key> keyctl watch_rm <fd> <key> The watch command watches a single key, printing notifications to stdout until the key is destroyed. Filters can be employed to cut down the events that will be delivered. The filter string is a series of letters, each one of which enables a particular event subtype: i - The key has been instantiated p - The key has been updated l - A link has been added to a keyring n - A link has been removed from a keyring c - A keyring has been cleared r - A key has been revoked v - A key has been invalidated s - A key has had its attributes changed The output of the command looks like: <keyid> <event> [<aux>] Where keyid is the primary subject of the notification, op is the event and aux is the secondary key if there is one (such as link where the primary key is the keyring secondary key is the key being linked in to it). For example: 255913279 link 340681059 255913279 clr An additional notication is generated when a key being watched is garbage collected, e.g.: 255913279 gc The watch_session command creates a new session keyring, with name name if given, watches it for notifications and runs program prog with it. The program is given the specified arguments. A second process is forked off to monitor the notifications. The output from that is directed to the files notifylog for most notifications and gclog for key removal notifications (which are asynchronous and may be deferred). The watch_queue(7) device is exported to the program attached to fd number fd. This can be passed by the other two commands. The watch_add command adds a watch on key to the watch_queue attached to fd as exported by watch_session and the watch_rm caommand removes it. A watch_queue can handle multiple keys and even non-keys sources as well. ERRORS top There are a number of common errors returned by this program: "Not a directory" - a key wasn't a keyring. "Requested key not found" - the looked for key isn't available. "Key has been revoked" - a revoked key was accessed. "Key has expired" - an expired key was accessed. "Permission denied" - permission was denied by a UID/GID/mask combination. SEE ALSO top keyctl(1), keyctl(2), request_key(2), keyctl(3), request-key.conf(5), keyrings(7), request-key(8) COLOPHON top This page is part of the keyutils (key management utilities) project. Information about the project can be found at [unknown -- if you know, please contact [email protected]] If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository http://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-03-20.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Linux 20 Feb 2014 KEYCTL(1) Pages that refer to this page: keyctl(1), systemd-ask-password(1), add_key(2), keyctl(2), request_key(2), keyctl(3), keyctl_capabilities(3), keyctl_chown(3), keyctl_clear(3), keyctl_describe(3), keyctl_dh_compute(3), keyctl_get_keyring_ID(3), keyctl_get_persistent(3), keyctl_get_security(3), keyctl_instantiate(3), keyctl_invalidate(3), keyctl_join_session_keyring(3), keyctl_link(3), keyctl_move(3), keyctl_pkey_encrypt(3), keyctl_pkey_query(3), keyctl_pkey_sign(3), keyctl_read(3), keyctl_restrict_keyring(3), keyctl_revoke(3), keyctl_search(3), keyctl_session_to_parent(3), keyctl_setperm(3), keyctl_set_reqkey_keyring(3), keyctl_set_timeout(3), keyctl_update(3), keyctl_watch_key(3), request-key.conf(5), asymmetric-key(7), keyrings(7), keyutils(7), persistent-keyring(7), process-keyring(7), session-keyring(7), thread-keyring(7), user-keyring(7), user-session-keyring(7), e4crypt(8), pam_keyinit(8), request-key(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# keyctl\n\n> Manipulate the Linux kernel keyring.\n> More information: <https://manned.org/keyctl>.\n\n- List keys in a specific keyring:\n\n`keyctl list {{target_keyring}}`\n\n- List current keys in the user default session:\n\n`keyctl list {{@us}}`\n\n- Store a key in a specific keyring:\n\n`keyctl add {{type_keyring}} {{key_name}} {{key_value}} {{target_keyring}}`\n\n- Store a key with its value from `stdin`:\n\n`echo -n {{key_value}} | keyctl padd {{type_keyring}} {{key_name}} {{target_keyring}}`\n\n- Put a timeout on a key:\n\n`keyctl timeout {{key_name}} {{timeout_in_seconds}}`\n\n- Read a key and format it as a hex-dump if not printable:\n\n`keyctl read {{key_name}}`\n\n- Read a key and format as-is:\n\n`keyctl pipe {{key_name}}`\n\n- Revoke a key and prevent any further action on it:\n\n`keyctl revoke {{key_name}}`\n
kill
kill(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training Other versions of this page are provided by these projects: coreutils procps-ng kill(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | ARGUMENTS | OPTIONS | EXIT STATUS | NOTES | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY KILL(1) User Commands KILL(1) NAME top kill - terminate a process SYNOPSIS top kill [-signal|-s signal|-p] [-q value] [-a] [--timeout milliseconds signal] [--] pid|name... kill -l [number] | -L DESCRIPTION top The command kill sends the specified signal to the specified processes or process groups. If no signal is specified, the TERM signal is sent. The default action for this signal is to terminate the process. This signal should be used in preference to the KILL signal (number 9), since a process may install a handler for the TERM signal in order to perform clean-up steps before terminating in an orderly fashion. If a process does not terminate after a TERM signal has been sent, then the KILL signal may be used; be aware that the latter signal cannot be caught, and so does not give the target process the opportunity to perform any clean-up before terminating. Most modern shells have a builtin kill command, with a usage rather similar to that of the command described here. The --all, --pid, and --queue options, and the possibility to specify processes by command name, are local extensions. If signal is 0, then no actual signal is sent, but error checking is still performed. ARGUMENTS top The list of processes to be signaled can be a mixture of names and PIDs. pid Each pid can be expressed in one of the following ways: n where n is larger than 0. The process with PID n is signaled. 0 All processes in the current process group are signaled. -1 All processes with a PID larger than 1 are signaled. -n where n is larger than 1. All processes in process group n are signaled. When an argument of the form '-n' is given, and it is meant to denote a process group, either a signal must be specified first, or the argument must be preceded by a '--' option, otherwise it will be taken as the signal to send. name All processes invoked using this name will be signaled. OPTIONS top -s, --signal signal The signal to send. It may be given as a name or a number. -l, --list [number] Print a list of signal names, or convert the given signal number to a name. The signals can be found in /usr/include/linux/signal.h. -L, --table Similar to -l, but it will print signal names and their corresponding numbers. -a, --all Do not restrict the command-name-to-PID conversion to processes with the same UID as the present process. -p, --pid Only print the process ID (PID) of the named processes, do not send any signals. -r, --require-handler Do not send the signal if it is not caught in userspace by the signalled process. --verbose Print PID(s) that will be signaled with kill along with the signal. -q, --queue value Send the signal using sigqueue(3) rather than kill(2). The value argument is an integer that is sent along with the signal. If the receiving process has installed a handler for this signal using the SA_SIGINFO flag to sigaction(2), then it can obtain this data via the si_sigval field of the siginfo_t structure. --timeout milliseconds signal Send a signal defined in the usual way to a process, followed by an additional signal after a specified delay. The --timeout option causes kill to wait for a period defined in milliseconds before sending a follow-up signal to the process. This feature is implemented using the Linux kernel PID file descriptor feature in order to guarantee that the follow-up signal is sent to the same process or not sent if the process no longer exists. Note that the operating system may re-use PIDs and implementing an equivalent feature in a shell using kill and sleep would be subject to races whereby the follow-up signal might be sent to a different process that used a recycled PID. The --timeout option can be specified multiple times: the signals are sent sequentially with the specified timeouts. The --timeout option can be combined with the --queue option. As an example, the following command sends the signals QUIT, TERM and KILL in sequence and waits for 1000 milliseconds between sending the signals: kill --verbose --timeout 1000 TERM --timeout 1000 KILL \ --signal QUIT 12345 EXIT STATUS top kill has the following exit status values: 0 success 1 failure 64 partial success (when more than one process specified) NOTES top Although it is possible to specify the TID (thread ID, see gettid(2)) of one of the threads in a multithreaded process as the argument of kill, the signal is nevertheless directed to the process (i.e., the entire thread group). In other words, it is not possible to send a signal to an explicitly selected thread in a multithreaded process. The signal will be delivered to an arbitrarily selected thread in the target process that is not blocking the signal. For more details, see signal(7) and the description of CLONE_THREAD in clone(2). Various shells provide a builtin kill command that is preferred in relation to the kill(1) executable described by this manual. The easiest way to ensure one is executing the command described in this page is to use the full path when calling the command, for example: /bin/kill --version AUTHORS top Salvatore Valente <[email protected]>, Karel Zak <[email protected]> The original version was taken from BSD 4.4. SEE ALSO top bash(1), tcsh(1), sigaction(2), kill(2), sigqueue(3), signal(7) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The kill command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 KILL(1) Pages that refer to this page: fuser(1), kill(1), killall(1), pgrep(1), pmsignal(1), skill(1), tcpdump(1), timeout(1), xargs(1), kill(2), sigaction(2), signal(2), posix_spawn(3), signal(7), ldattach(8), lsof(8), systemd-coredump(8), tcpdump(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# kill\n\n> Sends a signal to a process, usually related to stopping the process.\n> All signals except for SIGKILL and SIGSTOP can be intercepted by the process to perform a clean exit.\n> More information: <https://manned.org/kill>.\n\n- Terminate a program using the default SIGTERM (terminate) signal:\n\n`kill {{process_id}}`\n\n- List signal values and their corresponding names (to be used without the `SIG` prefix):\n\n`kill -{{L|-table}}`\n\n- Terminate a background job:\n\n`kill %{{job_id}}`\n\n- Terminate a program using the SIGHUP (hang up) signal. Many daemons will reload instead of terminating:\n\n`kill -{{1|HUP}} {{process_id}}`\n\n- Terminate a program using the SIGINT (interrupt) signal. This is typically initiated by the user pressing `Ctrl + C`:\n\n`kill -{{2|INT}} {{process_id}}`\n\n- Signal the operating system to immediately terminate a program (which gets no chance to capture the signal):\n\n`kill -{{9|KILL}} {{process_id}}`\n\n- Signal the operating system to pause a program until a SIGCONT ("continue") signal is received:\n\n`kill -{{17|STOP}} {{process_id}}`\n\n- Send a `SIGUSR1` signal to all processes with the given GID (group id):\n\n`kill -{{SIGUSR1}} -{{group_id}}`\n
killall
killall(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training killall(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | FILES | KNOWN BUGS | SEE ALSO | COLOPHON KILLALL(1) User Commands KILLALL(1) NAME top killall - kill processes by name SYNOPSIS top killall [-Z, --context pattern] [-e, --exact] [-g, --process-group] [-i, --interactive] [-n, --ns PID] [-o, --older-than TIME] [-q, --quiet] [-r, --regexp] [-s, --signal SIGNAL, -SIGNAL] [-u, --user user] [-v, --verbose] [-w, --wait] [-y, --younger-than TIME] [-I, --ignore-case] [-V, --version] [--] name ... killall -l, --list killall -V, --version DESCRIPTION top killall sends a signal to all processes running any of the specified commands. If no signal name is specified, SIGTERM is sent. Signals can be specified either by name (e.g. -HUP or -SIGHUP) or by number (e.g. -1) or by option -s. If the command name is not regular expression (option -r) and contains a slash (/), processes executing that particular file will be selected for killing, independent of their name. killall returns a zero return code if at least one process has been killed for each listed command, or no commands were listed and at least one process matched the -u and -Z search criteria. killall returns non-zero otherwise. A killall process never kills itself (but may kill other killall processes). OPTIONS top -e, --exact Require an exact match for very long names. If a command name is longer than 15 characters, the full name may be unavailable (i.e. it is swapped out). In this case, killall will kill everything that matches within the first 15 characters. With -e, such entries are skipped. killall prints a message for each skipped entry if -v is specified in addition to -e. -I, --ignore-case Do case insensitive process name match. -g, --process-group Kill the process group to which the process belongs. The kill signal is only sent once per group, even if multiple processes belonging to the same process group were found. -i, --interactive Interactively ask for confirmation before killing. -l, --list List all known signal names. -n, --ns Match against the PID namespace of the given PID. The default is to match against all namespaces. -o, --older-than Match only processes that are older (started before) the time specified. The time is specified as a float then a unit. The units are s,m,h,d,w,M,y for seconds, minutes, hours, days, weeks, months and years respectively. -q, --quiet Do not complain if no processes were killed. -r, --regexp Interpret process name pattern as a POSIX extended regular expression, per regex(3). -s, --signal, -SIGNAL Send this signal instead of SIGTERM. -u, --user Kill only processes the specified user owns. Command names are optional. -v, --verbose Report if the signal was successfully sent. -V, --version Display version information. -w, --wait Wait for all killed processes to die. killall checks once per second if any of the killed processes still exist and only returns if none are left. Note that killall may wait forever if the signal was ignored, had no effect, or if the process stays in zombie state. -y, --younger-than Match only processes that are younger (started after) the time specified. The time is specified as a float then a unit. The units are s,m,h,d,w,M,y for seconds, minutes, hours, days, weeks, Months and years respectively. -Z, --context Specify security context: kill only processes having security context that match with given extended regular expression pattern. Must precede other arguments on the command line. Command names are optional. FILES top /proc location of the proc file system KNOWN BUGS top Killing by file only works for executables that are kept open during execution, i.e. impure executables can't be killed this way. Be warned that typing killall name may not have the desired effect on non-Linux systems, especially when done by a privileged user. killall -w doesn't detect if a process disappears and is replaced by a new process with the same PID between scans. If processes change their name, killall may not be able to match them correctly. killall has a limit of names that can be specified on the command line. This figure is the size of an unsigned long integer multiplied by 8. For most 32 bit systems the limit is 32 and similarly for a 64 bit system the limit is usually 64. SEE ALSO top kill(1), fuser(1), pgrep(1), pidof(1), pkill(1), ps(1), kill(2), regex(3). COLOPHON top This page is part of the psmisc (Small utilities that use the /proc filesystem) project. Information about the project can be found at https://gitlab.com/psmisc/psmisc. If you have a bug report for this manual page, see https://gitlab.com/psmisc/psmisc/issues. This page was obtained from the project's upstream Git repository https://gitlab.com/psmisc/psmisc.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-11-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] psmisc 2023-06-17 KILLALL(1) Pages that refer to this page: fuser(1), kill(1@@procps-ng), pgrep(1), pmsignal(1), skill(1), start-stop-daemon(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# killall\n\n> Send kill signal to all instances of a process by name (must be exact name).\n> All signals except SIGKILL and SIGSTOP can be intercepted by the process, allowing a clean exit.\n> More information: <https://manned.org/killall>.\n\n- Terminate a process using the default SIGTERM (terminate) signal:\n\n`killall {{process_name}}`\n\n- List available signal names (to be used without the 'SIG' prefix):\n\n`killall --list`\n\n- Interactively ask for confirmation before termination:\n\n`killall -i {{process_name}}`\n\n- Terminate a process using the SIGINT (interrupt) signal, which is the same signal sent by pressing `Ctrl + C`:\n\n`killall -INT {{process_name}}`\n\n- Force kill a process:\n\n`killall -KILL {{process_name}}`\n
last
last(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training Another version of this page is provided by the util-linux project last(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | FILES | AUTHOR | SEE ALSO | COLOPHON LAST(1) General Commands Manual LAST(1) NAME top last - list logins on the system SYNOPSIS top last [ -num | -n num | --lines num ] [ -f filename | --file filename ] [ people ... ] [ ttys ... ] [ --complain ] [ --no-truncate-ftp-entries ] [ -x | --more-records ] [ -a | --all-records ] [ --tw-leniency num ] [ --tw-suspicious num ] [ -i | --ip-address ] [ --debug ] [ -w | --wide ] [ -s | --print-seconds ] [ -y | --print-year ] [ -V | --version ] [ -h | --help ] DESCRIPTION top last looks through the file wtmp (which records all logins/logouts) and prints information about connect times of users. Records are printed from most recent to least recent. Records can be specified by tty and username. tty names can be abbreviated: last 0 is equivalent to last tty0. Multiple arguments can be specified: last root console will print all of the entries for the user root and all entries logged in on the console tty. The special users reboot and shutdown log in when the system reboots or (surprise) shuts down. last reboot will produce a record of reboot times. If last is interrupted by a quit signal, it prints out how far its search in the wtmp file had reached and then quits. OPTIONS top -n num, --lines num Limit the number of lines that last outputs. This is different from u*x last, which lets you specify the number right after a dash. -f filename, --file filename Read from the file filename instead of the system's wtmp file. --complain When the wtmp file has a problem (a time-warp, missing record, or whatever), print out an appropriate error. --tw-leniency num Set the time warp leniency to num seconds. Records in wtmp files might be slightly out of order (most notably when two logins occur within a one-second period - the second one gets written first). By default, this value is set to 60. If the program notices this problem, time is not assigned to users unless the --timewarps flag is used. --tw-suspicious num Set the time warp suspicious value to num seconds. If two records in the wtmp file are farther than this number of seconds apart, there is a problem with the wtmp file (or your machine hasn't been used in a year). If the program notices this problem, time is not assigned to users unless the --timewarps flag is used. --no-truncate-ftp-entries When printing out the information, don't chop the number part off of `ftp'XXXX entries. -x, --more-records Print out run level changes, shutdowns, and time changes in addition to the normal records. -a, --all-records Print out all records in the wtmp file. -i, --ip-address Some machines store the IP address of a connection in a utmp record. Enabling this option makes last print the IP address instead of the hostname. -w, --wide By default, last tries to print each entry within in 80 columns. Use this option to instruct last to print out the fields in the wtmp file with full field widths. --debug Print verbose internal information. -s, --print-seconds Print seconds when displaying dates. -y, --print-year Print year when displaying dates. -V, --version Print last's version number. -h, --help Prints the usage string and default locations of system files to standard output and exits. FILES top wtmp The system wide login record file. See wtmp(5) for further details. AUTHOR top The GNU accounting utilities were written by Noel Cragg <[email protected]>. The man page was added by Dirk Eddelbuettel <[email protected]>. SEE ALSO top who(1), wtmp(5) COLOPHON top This page is part of the psacct (process accounting utilities) project. Information about the project can be found at http://www.gnu.org/software/acct/. If you have a bug report for this manual page, see http://www.gnu.org/software/acct/. This page was obtained from the tarball acct-6.6.4.tar.gz fetched from http://ftp.gnu.org/gnu/acct/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 1997 August 19 LAST(1) Pages that refer to this page: lastcomm(1), utmpdump(1), utmp(5) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# last\n\n> View the last logged in users.\n> More information: <https://manned.org/last>.\n\n- View last logins, their duration and other information as read from `/var/log/wtmp`:\n\n`last`\n\n- Specify how many of the last logins to show:\n\n`last -n {{login_count}}`\n\n- Print the full date and time for entries and then display the hostname column last to prevent truncation:\n\n`last -F -a`\n\n- View all logins by a specific user and show the IP address instead of the hostname:\n\n`last {{username}} -i`\n\n- View all recorded reboots (i.e., the last logins of the pseudo user "reboot"):\n\n`last reboot`\n\n- View all recorded shutdowns (i.e., the last logins of the pseudo user "shutdown"):\n\n`last shutdown`\n
lastb
last(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training Another version of this page is provided by the util-linux project last(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | FILES | AUTHOR | SEE ALSO | COLOPHON LAST(1) General Commands Manual LAST(1) NAME top last - list logins on the system SYNOPSIS top last [ -num | -n num | --lines num ] [ -f filename | --file filename ] [ people ... ] [ ttys ... ] [ --complain ] [ --no-truncate-ftp-entries ] [ -x | --more-records ] [ -a | --all-records ] [ --tw-leniency num ] [ --tw-suspicious num ] [ -i | --ip-address ] [ --debug ] [ -w | --wide ] [ -s | --print-seconds ] [ -y | --print-year ] [ -V | --version ] [ -h | --help ] DESCRIPTION top last looks through the file wtmp (which records all logins/logouts) and prints information about connect times of users. Records are printed from most recent to least recent. Records can be specified by tty and username. tty names can be abbreviated: last 0 is equivalent to last tty0. Multiple arguments can be specified: last root console will print all of the entries for the user root and all entries logged in on the console tty. The special users reboot and shutdown log in when the system reboots or (surprise) shuts down. last reboot will produce a record of reboot times. If last is interrupted by a quit signal, it prints out how far its search in the wtmp file had reached and then quits. OPTIONS top -n num, --lines num Limit the number of lines that last outputs. This is different from u*x last, which lets you specify the number right after a dash. -f filename, --file filename Read from the file filename instead of the system's wtmp file. --complain When the wtmp file has a problem (a time-warp, missing record, or whatever), print out an appropriate error. --tw-leniency num Set the time warp leniency to num seconds. Records in wtmp files might be slightly out of order (most notably when two logins occur within a one-second period - the second one gets written first). By default, this value is set to 60. If the program notices this problem, time is not assigned to users unless the --timewarps flag is used. --tw-suspicious num Set the time warp suspicious value to num seconds. If two records in the wtmp file are farther than this number of seconds apart, there is a problem with the wtmp file (or your machine hasn't been used in a year). If the program notices this problem, time is not assigned to users unless the --timewarps flag is used. --no-truncate-ftp-entries When printing out the information, don't chop the number part off of `ftp'XXXX entries. -x, --more-records Print out run level changes, shutdowns, and time changes in addition to the normal records. -a, --all-records Print out all records in the wtmp file. -i, --ip-address Some machines store the IP address of a connection in a utmp record. Enabling this option makes last print the IP address instead of the hostname. -w, --wide By default, last tries to print each entry within in 80 columns. Use this option to instruct last to print out the fields in the wtmp file with full field widths. --debug Print verbose internal information. -s, --print-seconds Print seconds when displaying dates. -y, --print-year Print year when displaying dates. -V, --version Print last's version number. -h, --help Prints the usage string and default locations of system files to standard output and exits. FILES top wtmp The system wide login record file. See wtmp(5) for further details. AUTHOR top The GNU accounting utilities were written by Noel Cragg <[email protected]>. The man page was added by Dirk Eddelbuettel <[email protected]>. SEE ALSO top who(1), wtmp(5) COLOPHON top This page is part of the psacct (process accounting utilities) project. Information about the project can be found at http://www.gnu.org/software/acct/. If you have a bug report for this manual page, see http://www.gnu.org/software/acct/. This page was obtained from the tarball acct-6.6.4.tar.gz fetched from http://ftp.gnu.org/gnu/acct/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 1997 August 19 LAST(1) Pages that refer to this page: lastcomm(1), utmpdump(1), utmp(5) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lastb\n\n> List last logged in users.\n> More information: <https://manned.org/lastb>.\n\n- List last logged in users:\n\n`sudo lastb`\n\n- List all last logged in users since a given time:\n\n`sudo lastb --since {{YYYY-MM-DD}}`\n\n- List all last logged in users until a given time:\n\n`sudo lastb --until {{YYYY-MM-DD}}`\n\n- List all logged in users at a specific time:\n\n`sudo lastb --present {{hh:mm}}`\n\n- List all last logged in users and translate the IP into a hostname:\n\n`sudo lastb --dns`\n
lastcomm
lastcomm(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lastcomm(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | FILES | AUTHOR | SEE ALSO | COLOPHON LASTCOMM(1) General Commands Manual LASTCOMM(1) NAME top lastcomm - print out information about previously executed commands. SYNOPSIS top lastcomm [ command-name ... ] [ user-name ... ] [ terminal-name ... ] [ OPTION ... ] DESCRIPTION top lastcomm prints out information about previously executed commands. If no arguments are specified, lastcomm will print info about all of the commands in acct (the record file). If called with one or more of command-name, user-name, or terminal- name, only records containing those items will be displayed. For example, to find out which users used command `a.out' and which users were logged into `tty0', type: lastcomm a.out tty0 This will print any entry for which `a.out' or `tty0' matches in any of the record's fields (command, name, or terminal). If you want to find only items that match *all* of the arguments on the command line, you must use the '-strict-match' option. For example, to list all of the executions of command a.out by user root on terminal tty0, type: lastcomm --strict-match --command a.out --user root --tty tty0 The order of the arguments is not important. For each entry the following information is printed: + command name of the process + flags, as recorded by the system accounting routines: S -- command executed by super-user F -- command executed after a fork but without a following exec C -- command run in PDP-11 compatibility mode (VAX only) D -- command terminated with the generation of a core file X -- command was terminated with the signal SIGTERM + the name of the user who ran the process + time the process started OPTIONS top --strict-match Print only entries that match *all* of the arguments on the command line. --print-controls Print control characters. --user name List records for user with name. This is useful if you're trying to match a username that happens to be the same as a command (e.g., ed ). --command name List records for command name. --tty name List records for tty name. --forwards Read file forwards instead of backwards. This avoids trying to seek on the file and can be used to read from a pipe. This must be specified prior to any -f arguments. -f filename, --file filename Read from the file filename instead of acct. A filename of "-" will result in reading from stdin. This must either be the first -f option, or --forwards must precede all -f options. --ahz hz Use this flag to tell the program what AHZ should be (in hertz). This option is useful if you are trying to view an acct file created on another machine which has the same byte order and file format as your current machine, but has a different value for AHZ. -p, --show-paging Print paging statistics. --pid Show PID and PPID of the process if acct version 3 format is supported by kernel. --pid Add pid of the process and pid of the process parent to the output (pid is the last but one and parent pid the last column). These values are shown only when they are generated by acct function (depends on the version of kernel) --debug Print verbose internal information. -V, --version Print the version number of lastcomm. -h, --help Prints the usage string and default locations of system files to standard output and exits. FILES top acct The system wide process accounting file. See acct(5) (or pacct(5)) for further details. /var/log/account This directory contains pacct files which contain the binary process accounting data as written by the kernel. AUTHOR top The GNU accounting utilities were written by Noel Cragg <[email protected]>. The man page was adapted from the accounting texinfo page by Susan Kleinmann <[email protected]>. SEE ALSO top last(1), acct(5) COLOPHON top This page is part of the psacct (process accounting utilities) project. Information about the project can be found at http://www.gnu.org/software/acct/. If you have a bug report for this manual page, see http://www.gnu.org/software/acct/. This page was obtained from the tarball acct-6.6.4.tar.gz fetched from http://ftp.gnu.org/gnu/acct/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 1995 October 31 LASTCOMM(1) Pages that refer to this page: acct(5), dump-acct(8), dump-utmp(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lastcomm\n\n> Show last commands executed.\n> More information: <https://manpages.debian.org/latest/acct/lastcomm.1.en.html>.\n\n- Print information about all the commands in the acct (record file):\n\n`lastcomm`\n\n- Display commands executed by a given user:\n\n`lastcomm --user {{user}}`\n\n- Display information about a given command executed on the system:\n\n`lastcomm --command {{command}}`\n\n- Display information about commands executed on a given terminal:\n\n`lastcomm --tty {{terminal_name}}`\n
lastlog
lastlog(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lastlog(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | NOTE | CONFIGURATION | FILES | CAVEATS | COLOPHON LASTLOG(8) System Management Commands LASTLOG(8) NAME top lastlog - reports the most recent login of all users or of a given user SYNOPSIS top lastlog [options] DESCRIPTION top lastlog formats and prints the contents of the last login log /var/log/lastlog file. The login-name, port, and last login time will be printed. The default (no flags) causes lastlog entries to be printed, sorted by their order in /etc/passwd. OPTIONS top The options which apply to the lastlog command are: -b, --before DAYS Print only lastlog records older than DAYS. -C, --clear Clear lastlog record of a user. This option can be used only together with -u (--user)). -h, --help Display help message and exit. -R, --root CHROOT_DIR Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory. Only absolute paths are supported. -S, --set Set lastlog record of a user to the current time. This option can be used only together with -u (--user)). -t, --time DAYS Print the lastlog records more recent than DAYS. -u, --user LOGIN|RANGE Print the lastlog record of the specified user(s). The users can be specified by a login name, a numerical user ID, or a RANGE of users. This RANGE of users can be specified with a min and max values (UID_MIN-UID_MAX), a max value (-UID_MAX), or a min value (UID_MIN-). If the user has never logged in the message ** Never logged in** will be displayed instead of the port and time. Only the entries for the current users of the system will be displayed. Other entries may exist for users that were deleted previously. NOTE top The lastlog file is a database which contains info on the last login of each user. You should not rotate it. It is a sparse file, so its size on the disk is usually much smaller than the one shown by "ls -l" (which can indicate a really big file if you have in passwd users with a high UID). You can display its real size with "ls -s". CONFIGURATION top The following configuration variables in /etc/login.defs change the behavior of this tool: LASTLOG_UID_MAX (number) Highest user ID number for which the lastlog entries should be updated. As higher user IDs are usually tracked by remote user identity and authentication services there is no need to create a huge sparse lastlog file for them. No LASTLOG_UID_MAX option present in the configuration means that there is no user ID limit for writing lastlog entries. FILES top /var/log/lastlog Database times of previous user logins. CAVEATS top Large gaps in UID numbers will cause the lastlog program to run longer with no output to the screen (i.e. if in lastlog database there is no entries for users with UID between 170 and 800 lastlog will appear to hang as it processes entries with UIDs 171-799). Having high UIDs can create problems when handling the <term> /var/log/lastlog</term> with external tools. Although the actual file is sparse and does not use too much space, certain applications are not designed to identify sparse files by default and may require a specific option to handle them. COLOPHON top This page is part of the shadow-utils (utilities for managing accounts and shadow password files) project. Information about the project can be found at https://github.com/shadow-maint/shadow. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository https://github.com/shadow-maint/shadow on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-15.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] shadow-utils 4.11.1 12/22/2023 LASTLOG(8) Pages that refer to this page: login(1), lslogins(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lastlog\n\n> Show the most recent login of all users or of a user.\n> More information: <https://manned.org/lastlog>.\n\n- Display the most recent login of all users:\n\n`lastlog`\n\n- Display the lastlog record of the specified user:\n\n`lastlog --user {{username}}`\n\n- Display records older than 7 days:\n\n`lastlog --before 7`\n\n- Display records more recent than 3 days:\n\n`lastlog --time 3`\n
ld
ld(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ld(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | ENVIRONMENT | SEE ALSO | COPYRIGHT | COLOPHON LD(1) GNU Development Tools LD(1) NAME top ld - The GNU linker SYNOPSIS top ld [options] objfile ... DESCRIPTION top ld combines a number of object and archive files, relocates their data and ties up symbol references. Usually the last step in compiling a program is to run ld. ld accepts Linker Command Language files written in a superset of AT&T's Link Editor Command Language syntax, to provide explicit and total control over the linking process. This man page does not describe the command language; see the ld entry in "info" for full details on the command language and on other aspects of the GNU linker. This version of ld uses the general purpose BFD libraries to operate on object files. This allows ld to read, combine, and write object files in many different formats---for example, COFF or "a.out". Different formats may be linked together to produce any available kind of object file. Aside from its flexibility, the GNU linker is more helpful than other linkers in providing diagnostic information. Many linkers abandon execution immediately upon encountering an error; whenever possible, ld continues executing, allowing you to identify other errors (or, in some cases, to get an output file in spite of the error). The GNU linker ld is meant to cover a broad range of situations, and to be as compatible as possible with other linkers. As a result, you have many choices to control its behavior. OPTIONS top The linker supports a plethora of command-line options, but in actual practice few of them are used in any particular context. For instance, a frequent use of ld is to link standard Unix object files on a standard, supported Unix system. On such a system, to link a file "hello.o": ld -o <output> /lib/crt0.o hello.o -lc This tells ld to produce a file called output as the result of linking the file "/lib/crt0.o" with "hello.o" and the library "libc.a", which will come from the standard search directories. (See the discussion of the -l option below.) Some of the command-line options to ld may be specified at any point in the command line. However, options which refer to files, such as -l or -T, cause the file to be read at the point at which the option appears in the command line, relative to the object files and other file options. Repeating non-file options with a different argument will either have no further effect, or override prior occurrences (those further to the left on the command line) of that option. Options which may be meaningfully specified more than once are noted in the descriptions below. Non-option arguments are object files or archives which are to be linked together. They may follow, precede, or be mixed in with command-line options, except that an object file argument may not be placed between an option and its argument. Usually the linker is invoked with at least one object file, but you can specify other forms of binary input files using -l, -R, and the script command language. If no binary input files at all are specified, the linker does not produce any output, and issues the message No input files. If the linker cannot recognize the format of an object file, it will assume that it is a linker script. A script specified in this way augments the main linker script used for the link (either the default linker script or the one specified by using -T). This feature permits the linker to link against a file which appears to be an object or an archive, but actually merely defines some symbol values, or uses "INPUT" or "GROUP" to load other objects. Specifying a script in this way merely augments the main linker script, with the extra commands placed after the main script; use the -T option to replace the default linker script entirely, but note the effect of the "INSERT" command. For options whose names are a single letter, option arguments must either follow the option letter without intervening whitespace, or be given as separate arguments immediately following the option that requires them. For options whose names are multiple letters, either one dash or two can precede the option name; for example, -trace-symbol and --trace-symbol are equivalent. Note---there is one exception to this rule. Multiple letter options that start with a lower case 'o' can only be preceded by two dashes. This is to reduce confusion with the -o option. So for example -omagic sets the output file name to magic whereas --omagic sets the NMAGIC flag on the output. Arguments to multiple-letter options must either be separated from the option name by an equals sign, or be given as separate arguments immediately following the option that requires them. For example, --trace-symbol foo and --trace-symbol=foo are equivalent. Unique abbreviations of the names of multiple-letter options are accepted. Note---if the linker is being invoked indirectly, via a compiler driver (e.g. gcc) then all the linker command-line options should be prefixed by -Wl, (or whatever is appropriate for the particular compiler driver) like this: gcc -Wl,--start-group foo.o bar.o -Wl,--end-group This is important, because otherwise the compiler driver program may silently drop the linker options, resulting in a bad link. Confusion may also arise when passing options that require values through a driver, as the use of a space between option and argument acts as a separator, and causes the driver to pass only the option to the linker and the argument to the compiler. In this case, it is simplest to use the joined forms of both single- and multiple-letter options, such as: gcc foo.o bar.o -Wl,-eENTRY -Wl,-Map=a.map Here is a table of the generic command-line switches accepted by the GNU linker: @file Read command-line options from file. The options read are inserted in place of the original @file option. If file does not exist, or cannot be read, then the option will be treated literally, and not removed. Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a backslash. The file may itself contain additional @file options; any such options will be processed recursively. -a keyword This option is supported for HP/UX compatibility. The keyword argument must be one of the strings archive, shared, or default. -aarchive is functionally equivalent to -Bstatic, and the other two keywords are functionally equivalent to -Bdynamic. This option may be used any number of times. --audit AUDITLIB Adds AUDITLIB to the "DT_AUDIT" entry of the dynamic section. AUDITLIB is not checked for existence, nor will it use the DT_SONAME specified in the library. If specified multiple times "DT_AUDIT" will contain a colon separated list of audit interfaces to use. If the linker finds an object with an audit entry while searching for shared libraries, it will add a corresponding "DT_DEPAUDIT" entry in the output file. This option is only meaningful on ELF platforms supporting the rtld-audit interface. -b input-format --format=input-format ld may be configured to support more than one kind of object file. If your ld is configured this way, you can use the -b option to specify the binary format for input object files that follow this option on the command line. Even when ld is configured to support alternative object formats, you don't usually need to specify this, as ld should be configured to expect as a default input format the most usual format on each machine. input-format is a text string, the name of a particular format supported by the BFD libraries. (You can list the available binary formats with objdump -i.) You may want to use this option if you are linking files with an unusual binary format. You can also use -b to switch formats explicitly (when linking object files of different formats), by including -b input-format before each group of object files in a particular format. The default format is taken from the environment variable "GNUTARGET". You can also define the input format from a script, using the command "TARGET"; -c MRI-commandfile --mri-script=MRI-commandfile For compatibility with linkers produced by MRI, ld accepts script files written in an alternate, restricted command language, described in the MRI Compatible Script Files section of GNU ld documentation. Introduce MRI script files with the option -c; use the -T option to run linker scripts written in the general-purpose ld scripting language. If MRI-cmdfile does not exist, ld looks for it in the directories specified by any -L options. -d -dc -dp These three options are equivalent; multiple forms are supported for compatibility with other linkers. They assign space to common symbols even if a relocatable output file is specified (with -r). The script command "FORCE_COMMON_ALLOCATION" has the same effect. --depaudit AUDITLIB -P AUDITLIB Adds AUDITLIB to the "DT_DEPAUDIT" entry of the dynamic section. AUDITLIB is not checked for existence, nor will it use the DT_SONAME specified in the library. If specified multiple times "DT_DEPAUDIT" will contain a colon separated list of audit interfaces to use. This option is only meaningful on ELF platforms supporting the rtld-audit interface. The -P option is provided for Solaris compatibility. --enable-linker-version Enables the "LINKER_VERSION" linker script directive, described in Output Section Data. If this directive is used in a linker script and this option has been enabled then a string containing the linker version will be inserted at the current point. Note - this location of this option on the linker command line is significant. It will only affect linker scripts that come after it on the command line, or which are built into the linker. --disable-linker-version Disables the "LINKER_VERSION" linker script directive, so that it does not insert a version string. This is the default. --enable-non-contiguous-regions This option avoids generating an error if an input section does not fit a matching output section. The linker tries to allocate the input section to subseque nt matching output sections, and generates an error only if no output section is large enough. This is useful when several non-contiguous memory regions are available and the input section does not require a particular one. The order in which input sections are evaluated does not change, for instance: MEMORY { MEM1 (rwx) : ORIGIN = 0x1000, LENGTH = 0x14 MEM2 (rwx) : ORIGIN = 0x1000, LENGTH = 0x40 MEM3 (rwx) : ORIGIN = 0x2000, LENGTH = 0x40 } SECTIONS { mem1 : { *(.data.*); } > MEM1 mem2 : { *(.data.*); } > MEM2 mem3 : { *(.data.*); } > MEM3 } with input sections: .data.1: size 8 .data.2: size 0x10 .data.3: size 4 results in .data.1 affected to mem1, and .data.2 and .data.3 affected to mem2, even though .data.3 would fit in mem3. This option is incompatible with INSERT statements because it changes the way input sections are mapped to output sections. --enable-non-contiguous-regions-warnings This option enables warnings when "--enable-non-contiguous-regions" allows possibly unexpected matches in sections mapping, potentially leading to silently discarding a section instead of failing because it does not fit any output region. -e entry --entry=entry Use entry as the explicit symbol for beginning execution of your program, rather than the default entry point. If there is no symbol named entry, the linker will try to parse entry as a number, and use that as the entry address (the number will be interpreted in base 10; you may use a leading 0x for base 16, or a leading 0 for base 8). --exclude-libs lib,lib,... Specifies a list of archive libraries from which symbols should not be automatically exported. The library names may be delimited by commas or colons. Specifying "--exclude-libs ALL" excludes symbols in all archive libraries from automatic export. This option is available only for the i386 PE targeted port of the linker and for ELF targeted ports. For i386 PE, symbols explicitly listed in a .def file are still exported, regardless of this option. For ELF targeted ports, symbols affected by this option will be treated as hidden. --exclude-modules-for-implib module,module,... Specifies a list of object files or archive members, from which symbols should not be automatically exported, but which should be copied wholesale into the import library being generated during the link. The module names may be delimited by commas or colons, and must match exactly the filenames used by ld to open the files; for archive members, this is simply the member name, but for object files the name listed must include and match precisely any path used to specify the input file on the linker's command-line. This option is available only for the i386 PE targeted port of the linker. Symbols explicitly listed in a .def file are still exported, regardless of this option. -E --export-dynamic --no-export-dynamic When creating a dynamically linked executable, using the -E option or the --export-dynamic option causes the linker to add all symbols to the dynamic symbol table. The dynamic symbol table is the set of symbols which are visible from dynamic objects at run time. If you do not use either of these options (or use the --no-export-dynamic option to restore the default behavior), the dynamic symbol table will normally contain only those symbols which are referenced by some dynamic object mentioned in the link. If you use "dlopen" to load a dynamic object which needs to refer back to the symbols defined by the program, rather than some other dynamic object, then you will probably need to use this option when linking the program itself. You can also use the dynamic list to control what symbols should be added to the dynamic symbol table if the output format supports it. See the description of --dynamic-list. Note that this option is specific to ELF targeted ports. PE targets support a similar function to export all symbols from a DLL or EXE; see the description of --export-all-symbols below. --export-dynamic-symbol=glob When creating a dynamically linked executable, symbols matching glob will be added to the dynamic symbol table. When creating a shared library, references to symbols matching glob will not be bound to the definitions within the shared library. This option is a no-op when creating a shared library and -Bsymbolic or --dynamic-list are not specified. This option is only meaningful on ELF platforms which support shared libraries. --export-dynamic-symbol-list=file Specify a --export-dynamic-symbol for each pattern in the file. The format of the file is the same as the version node without scope and node name. See VERSION for more information. -EB Link big-endian objects. This affects the default output format. -EL Link little-endian objects. This affects the default output format. -f name --auxiliary=name When creating an ELF shared object, set the internal DT_AUXILIARY field to the specified name. This tells the dynamic linker that the symbol table of the shared object should be used as an auxiliary filter on the symbol table of the shared object name. If you later link a program against this filter object, then, when you run the program, the dynamic linker will see the DT_AUXILIARY field. If the dynamic linker resolves any symbols from the filter object, it will first check whether there is a definition in the shared object name. If there is one, it will be used instead of the definition in the filter object. The shared object name need not exist. Thus the shared object name may be used to provide an alternative implementation of certain functions, perhaps for debugging or for machine-specific performance. This option may be specified more than once. The DT_AUXILIARY entries will be created in the order in which they appear on the command line. -F name --filter=name When creating an ELF shared object, set the internal DT_FILTER field to the specified name. This tells the dynamic linker that the symbol table of the shared object which is being created should be used as a filter on the symbol table of the shared object name. If you later link a program against this filter object, then, when you run the program, the dynamic linker will see the DT_FILTER field. The dynamic linker will resolve symbols according to the symbol table of the filter object as usual, but it will actually link to the definitions found in the shared object name. Thus the filter object can be used to select a subset of the symbols provided by the object name. Some older linkers used the -F option throughout a compilation toolchain for specifying object-file format for both input and output object files. The GNU linker uses other mechanisms for this purpose: the -b, --format, --oformat options, the "TARGET" command in linker scripts, and the "GNUTARGET" environment variable. The GNU linker will ignore the -F option when not creating an ELF shared object. -fini=name When creating an ELF executable or shared object, call NAME when the executable or shared object is unloaded, by setting DT_FINI to the address of the function. By default, the linker uses "_fini" as the function to call. -g Ignored. Provided for compatibility with other tools. -G value --gpsize=value Set the maximum size of objects to be optimized using the GP register to size. This is only meaningful for object file formats such as MIPS ELF that support putting large and small objects into different sections. This is ignored for other object file formats. -h name -soname=name When creating an ELF shared object, set the internal DT_SONAME field to the specified name. When an executable is linked with a shared object which has a DT_SONAME field, then when the executable is run the dynamic linker will attempt to load the shared object specified by the DT_SONAME field rather than using the file name given to the linker. -i Perform an incremental link (same as option -r). -init=name When creating an ELF executable or shared object, call NAME when the executable or shared object is loaded, by setting DT_INIT to the address of the function. By default, the linker uses "_init" as the function to call. -l namespec --library=namespec Add the archive or object file specified by namespec to the list of files to link. This option may be used any number of times. If namespec is of the form :filename, ld will search the library path for a file called filename, otherwise it will search the library path for a file called libnamespec.a. On systems which support shared libraries, ld may also search for files other than libnamespec.a. Specifically, on ELF and SunOS systems, ld will search a directory for a library called libnamespec.so before searching for one called libnamespec.a. (By convention, a ".so" extension indicates a shared library.) Note that this behavior does not apply to :filename, which always specifies a file called filename. The linker will search an archive only once, at the location where it is specified on the command line. If the archive defines a symbol which was undefined in some object which appeared before the archive on the command line, the linker will include the appropriate file(s) from the archive. However, an undefined symbol in an object appearing later on the command line will not cause the linker to search the archive again. See the -( option for a way to force the linker to search archives multiple times. You may list the same archive multiple times on the command line. This type of archive searching is standard for Unix linkers. However, if you are using ld on AIX, note that it is different from the behaviour of the AIX linker. -L searchdir --library-path=searchdir Add path searchdir to the list of paths that ld will search for archive libraries and ld control scripts. You may use this option any number of times. The directories are searched in the order in which they are specified on the command line. Directories specified on the command line are searched before the default directories. All -L options apply to all -l options, regardless of the order in which the options appear. -L options do not affect how ld searches for a linker script unless -T option is specified. If searchdir begins with "=" or $SYSROOT, then this prefix will be replaced by the sysroot prefix, controlled by the --sysroot option, or specified when the linker is configured. The default set of paths searched (without being specified with -L) depends on which emulation mode ld is using, and in some cases also on how it was configured. The paths can also be specified in a link script with the "SEARCH_DIR" command. Directories specified this way are searched at the point in which the linker script appears in the command line. -m emulation Emulate the emulation linker. You can list the available emulations with the --verbose or -V options. If the -m option is not used, the emulation is taken from the "LDEMULATION" environment variable, if that is defined. Otherwise, the default emulation depends upon how the linker was configured. --remap-inputs=pattern=filename --remap-inputs-file=file These options allow the names of input files to be changed before the linker attempts to open them. The option --remap-inputs=foo.o=bar.o will cause any attempt to load a file called foo.o to instead try to load a file called bar.o. Wildcard patterns are permitted in the first filename, so --remap-inputs=foo*.o=bar.o will rename any input file that matches foo*.o to bar.o. An alternative form of the option --remap-inputs-file=filename allows the remappings to be read from a file. Each line in the file can contain a single remapping. Blank lines are ignored. Anything from a hash character (#) to the end of a line is considered to be a comment and is also ignored. The mapping pattern can be separated from the filename by whitespace or an equals (=) character. The options can be specified multiple times. Their contents accumulate. The remappings will be processed in the order in which they occur on the command line, and if they come from a file, in the order in which they occur in the file. If a match is made, no further checking for that filename will be performed. If the replacement filename is /dev/null or just NUL then the remapping will actually cause the input file to be ignored. This can be a convenient way to experiment with removing input files from a complicated build environment. Note that this option is position dependent and only affects filenames that come after it on the command line. Thus: ld foo.o --remap-inputs=foo.o=bar.o Will have no effect, whereas: ld --remap-inputs=foo.o=bar.o foo.o Will rename the input file foo.o to bar.o. Note - these options also affect files referenced by INPUT statements in linker scripts. But since linker scripts are processed after the entire command line is read, the position of the remap options on the command line is not significant. If the verbose option is enabled then any mappings that match will be reported, although again the verbose option needs to be enabled on the command line before the remaped filenames appear. If the -Map or --print-map options are enabled then the remapping list will be included in the map output. -M --print-map Print a link map to the standard output. A link map provides information about the link, including the following: Where object files are mapped into memory. How common symbols are allocated. All archive members included in the link, with a mention of the symbol which caused the archive member to be brought in. The values assigned to symbols. Note - symbols whose values are computed by an expression which involves a reference to a previous value of the same symbol may not have correct result displayed in the link map. This is because the linker discards intermediate results and only retains the final value of an expression. Under such circumstances the linker will display the final value enclosed by square brackets. Thus for example a linker script containing: foo = 1 foo = foo * 4 foo = foo + 8 will produce the following output in the link map if the -M option is used: 0x00000001 foo = 0x1 [0x0000000c] foo = (foo * 0x4) [0x0000000c] foo = (foo + 0x8) See Expressions for more information about expressions in linker scripts. How GNU properties are merged. When the linker merges input .note.gnu.property sections into one output .note.gnu.property section, some properties are removed or updated. These actions are reported in the link map. For example: Removed property 0xc0000002 to merge foo.o (0x1) and bar.o (not found) This indicates that property 0xc0000002 is removed from output when merging properties in foo.o, whose property 0xc0000002 value is 0x1, and bar.o, which doesn't have property 0xc0000002. Updated property 0xc0010001 (0x1) to merge foo.o (0x1) and bar.o (0x1) This indicates that property 0xc0010001 value is updated to 0x1 in output when merging properties in foo.o, whose 0xc0010001 property value is 0x1, and bar.o, whose 0xc0010001 property value is 0x1. --print-map-discarded --no-print-map-discarded Print (or do not print) the list of discarded and garbage collected sections in the link map. Enabled by default. --print-map-locals --no-print-map-locals Print (or do not print) local symbols in the link map. Local symbols will have the text (local) printed before their name, and will be listed after all of the global symbols in a given section. Temporary local symbols (typically those that start with .L) will not be included in the output. Disabled by default. -n --nmagic Turn off page alignment of sections, and disable linking against shared libraries. If the output format supports Unix style magic numbers, mark the output as "NMAGIC". -N --omagic Set the text and data sections to be readable and writable. Also, do not page-align the data segment, and disable linking against shared libraries. If the output format supports Unix style magic numbers, mark the output as "OMAGIC". Note: Although a writable text section is allowed for PE-COFF targets, it does not conform to the format specification published by Microsoft. --no-omagic This option negates most of the effects of the -N option. It sets the text section to be read-only, and forces the data segment to be page-aligned. Note - this option does not enable linking against shared libraries. Use -Bdynamic for this. -o output --output=output Use output as the name for the program produced by ld; if this option is not specified, the name a.out is used by default. The script command "OUTPUT" can also specify the output file name. --dependency-file=depfile Write a dependency file to depfile. This file contains a rule suitable for "make" describing the output file and all the input files that were read to produce it. The output is similar to the compiler's output with -M -MP. Note that there is no option like the compiler's -MM, to exclude "system files" (which is not a well-specified concept in the linker, unlike "system headers" in the compiler). So the output from --dependency-file is always specific to the exact state of the installation where it was produced, and should not be copied into distributed makefiles without careful editing. -O level If level is a numeric values greater than zero ld optimizes the output. This might take significantly longer and therefore probably should only be enabled for the final binary. At the moment this option only affects ELF shared library generation. Future releases of the linker may make more use of this option. Also currently there is no difference in the linker's behaviour for different non-zero values of this option. Again this may change with future releases. -plugin name Involve a plugin in the linking process. The name parameter is the absolute filename of the plugin. Usually this parameter is automatically added by the complier, when using link time optimization, but users can also add their own plugins if they so wish. Note that the location of the compiler originated plugins is different from the place where the ar, nm and ranlib programs search for their plugins. In order for those commands to make use of a compiler based plugin it must first be copied into the ${libdir}/bfd-plugins directory. All gcc based linker plugins are backward compatible, so it is sufficient to just copy in the newest one. --push-state The --push-state allows one to preserve the current state of the flags which govern the input file handling so that they can all be restored with one corresponding --pop-state option. The option which are covered are: -Bdynamic, -Bstatic, -dn, -dy, -call_shared, -non_shared, -static, -N, -n, --whole-archive, --no-whole-archive, -r, -Ur, --copy-dt-needed-entries, --no-copy-dt-needed-entries, --as-needed, --no-as-needed, and -a. One target for this option are specifications for pkg-config. When used with the --libs option all possibly needed libraries are listed and then possibly linked with all the time. It is better to return something as follows: -Wl,--push-state,--as-needed -libone -libtwo -Wl,--pop-state --pop-state Undoes the effect of --push-state, restores the previous values of the flags governing input file handling. -q --emit-relocs Leave relocation sections and contents in fully linked executables. Post link analysis and optimization tools may need this information in order to perform correct modifications of executables. This results in larger executables. This option is currently only supported on ELF platforms. --force-dynamic Force the output file to have dynamic sections. This option is specific to VxWorks targets. -r --relocatable Generate relocatable output---i.e., generate an output file that can in turn serve as input to ld. This is often called partial linking. As a side effect, in environments that support standard Unix magic numbers, this option also sets the output file's magic number to "OMAGIC". If this option is not specified, an absolute file is produced. When linking C++ programs, this option will not resolve references to constructors; to do that, use -Ur. When an input file does not have the same format as the output file, partial linking is only supported if that input file does not contain any relocations. Different output formats can have further restrictions; for example some "a.out"-based formats do not support partial linking with input files in other formats at all. This option does the same thing as -i. -R filename --just-symbols=filename Read symbol names and their addresses from filename, but do not relocate it or include it in the output. This allows your output file to refer symbolically to absolute locations of memory defined in other programs. You may use this option more than once. For compatibility with other ELF linkers, if the -R option is followed by a directory name, rather than a file name, it is treated as the -rpath option. -s --strip-all Omit all symbol information from the output file. -S --strip-debug Omit debugger symbol information (but not all symbols) from the output file. --strip-discarded --no-strip-discarded Omit (or do not omit) global symbols defined in discarded sections. Enabled by default. -t --trace Print the names of the input files as ld processes them. If -t is given twice then members within archives are also printed. -t output is useful to generate a list of all the object files and scripts involved in linking, for example, when packaging files for a linker bug report. -T scriptfile --script=scriptfile Use scriptfile as the linker script. This script replaces ld's default linker script (rather than adding to it), unless the script contains "INSERT", so commandfile must specify everything necessary to describe the output file. If scriptfile does not exist in the current directory, "ld" looks for it in the directories specified by any preceding -L options. Multiple -T options accumulate. -dT scriptfile --default-script=scriptfile Use scriptfile as the default linker script. This option is similar to the --script option except that processing of the script is delayed until after the rest of the command line has been processed. This allows options placed after the --default-script option on the command line to affect the behaviour of the linker script, which can be important when the linker command line cannot be directly controlled by the user. (eg because the command line is being constructed by another tool, such as gcc). -u symbol --undefined=symbol Force symbol to be entered in the output file as an undefined symbol. Doing this may, for example, trigger linking of additional modules from standard libraries. -u may be repeated with different option arguments to enter additional undefined symbols. This option is equivalent to the "EXTERN" linker script command. If this option is being used to force additional modules to be pulled into the link, and if it is an error for the symbol to remain undefined, then the option --require-defined should be used instead. --require-defined=symbol Require that symbol is defined in the output file. This option is the same as option --undefined except that if symbol is not defined in the output file then the linker will issue an error and exit. The same effect can be achieved in a linker script by using "EXTERN", "ASSERT" and "DEFINED" together. This option can be used multiple times to require additional symbols. -Ur For programs that do not use constructors or destructors, or for ELF based systems this option is equivalent to -r: it generates relocatable output---i.e., an output file that can in turn serve as input to ld. For other binaries however the -Ur option is similar to -r but it also resolves references to constructors and destructors. For those systems where -r and -Ur behave differently, it does not work to use -Ur on files that were themselves linked with -Ur; once the constructor table has been built, it cannot be added to. Use -Ur only for the last partial link, and -r for the others. --orphan-handling=MODE Control how orphan sections are handled. An orphan section is one not specifically mentioned in a linker script. MODE can have any of the following values: "place" Orphan sections are placed into a suitable output section following the strategy described in Orphan Sections. The option --unique also affects how sections are placed. "discard" All orphan sections are discarded, by placing them in the /DISCARD/ section. "warn" The linker will place the orphan section as for "place" and also issue a warning. "error" The linker will exit with an error if any orphan section is found. The default if --orphan-handling is not given is "place". --unique[=SECTION] Creates a separate output section for every input section matching SECTION, or if the optional wildcard SECTION argument is missing, for every orphan input section. An orphan section is one not specifically mentioned in a linker script. You may use this option multiple times on the command line; It prevents the normal merging of input sections with the same name, overriding output section assignments in a linker script. -v --version -V Display the version number for ld. The -V option also lists the supported emulations. See also the description of the --enable-linker-version in Options,,Command-line Options which can be used to insert the linker version string into a binary. -x --discard-all Delete all local symbols. -X --discard-locals Delete all temporary local symbols. (These symbols start with system-specific local label prefixes, typically .L for ELF systems or L for traditional a.out systems.) -y symbol --trace-symbol=symbol Print the name of each linked file in which symbol appears. This option may be given any number of times. On many systems it is necessary to prepend an underscore. This option is useful when you have an undefined symbol in your link but don't know where the reference is coming from. -Y path Add path to the default library search path. This option exists for Solaris compatibility. -z keyword The recognized keywords are: call-nop=prefix-addr call-nop=suffix-nop call-nop=prefix-byte call-nop=suffix-byte Specify the 1-byte "NOP" padding when transforming indirect call to a locally defined function, foo, via its GOT slot. call-nop=prefix-addr generates "0x67 call foo". call-nop=suffix-nop generates "call foo 0x90". call-nop=prefix-byte generates "byte call foo". call-nop=suffix-byte generates "call foo byte". Supported for i386 and x86_64. cet-report=none cet-report=warning cet-report=error Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_IBT and GNU_PROPERTY_X86_FEATURE_1_SHSTK properties in input .note.gnu.property section. cet-report=none, which is the default, will make the linker not report missing properties in input files. cet-report=warning will make the linker issue a warning for missing properties in input files. cet-report=error will make the linker issue an error for missing properties in input files. Note that ibt will turn off the missing GNU_PROPERTY_X86_FEATURE_1_IBT property report and shstk will turn off the missing GNU_PROPERTY_X86_FEATURE_1_SHSTK property report. Supported for Linux/i386 and Linux/x86_64. combreloc nocombreloc Combine multiple dynamic relocation sections and sort to improve dynamic symbol lookup caching. Do not do this if nocombreloc. common nocommon Generate common symbols with STT_COMMON type during a relocatable link. Use STT_OBJECT type if nocommon. common-page-size=value Set the page size most commonly used to value. Memory image layout will be optimized to minimize memory pages if the system is using pages of this size. defs Report unresolved symbol references from regular object files. This is done even if the linker is creating a non-symbolic shared library. This option is the inverse of -z undefs. dynamic-undefined-weak nodynamic-undefined-weak Make undefined weak symbols dynamic when building a dynamic object, if they are referenced from a regular object file and not forced local by symbol visibility or versioning. Do not make them dynamic if nodynamic- undefined-weak. If neither option is given, a target may default to either option being in force, or make some other selection of undefined weak symbols dynamic. Not all targets support these options. execstack Marks the object as requiring executable stack. global This option is only meaningful when building a shared object. It makes the symbols defined by this shared object available for symbol resolution of subsequently loaded libraries. globalaudit This option is only meaningful when building a dynamic executable. This option marks the executable as requiring global auditing by setting the "DF_1_GLOBAUDIT" bit in the "DT_FLAGS_1" dynamic tag. Global auditing requires that any auditing library defined via the --depaudit or -P command-line options be run for all dynamic objects loaded by the application. ibtplt Generate Intel Indirect Branch Tracking (IBT) enabled PLT entries. Supported for Linux/i386 and Linux/x86_64. ibt Generate GNU_PROPERTY_X86_FEATURE_1_IBT in .note.gnu.property section to indicate compatibility with IBT. This also implies ibtplt. Supported for Linux/i386 and Linux/x86_64. indirect-extern-access noindirect-extern-access Generate GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS in .note.gnu.property section to indicate that object file requires canonical function pointers and cannot be used with copy relocation. This option also implies noextern- protected-data and nocopyreloc. Supported for i386 and x86-64. noindirect-extern-access removes GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS from .note.gnu.property section. initfirst This option is only meaningful when building a shared object. It marks the object so that its runtime initialization will occur before the runtime initialization of any other objects brought into the process at the same time. Similarly the runtime finalization of the object will occur after the runtime finalization of any other objects. interpose Specify that the dynamic loader should modify its symbol search order so that symbols in this shared library interpose all other shared libraries not so marked. unique nounique When generating a shared library or other dynamically loadable ELF object mark it as one that should (by default) only ever be loaded once, and only in the main namespace (when using "dlmopen"). This is primarily used to mark fundamental libraries such as libc, libpthread et al which do not usually function correctly unless they are the sole instances of themselves. This behaviour can be overridden by the "dlmopen" caller and does not apply to certain loading mechanisms (such as audit libraries). lam-u48 Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U48 in .note.gnu.property section to indicate compatibility with Intel LAM_U48. Supported for Linux/x86_64. lam-u57 Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U57 in .note.gnu.property section to indicate compatibility with Intel LAM_U57. Supported for Linux/x86_64. lam-u48-report=none lam-u48-report=warning lam-u48-report=error Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_LAM_U48 property in input .note.gnu.property section. lam-u48-report=none, which is the default, will make the linker not report missing properties in input files. lam-u48-report=warning will make the linker issue a warning for missing properties in input files. lam-u48-report=error will make the linker issue an error for missing properties in input files. Supported for Linux/x86_64. lam-u57-report=none lam-u57-report=warning lam-u57-report=error Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_LAM_U57 property in input .note.gnu.property section. lam-u57-report=none, which is the default, will make the linker not report missing properties in input files. lam-u57-report=warning will make the linker issue a warning for missing properties in input files. lam-u57-report=error will make the linker issue an error for missing properties in input files. Supported for Linux/x86_64. lam-report=none lam-report=warning lam-report=error Specify how to report the missing GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and GNU_PROPERTY_X86_FEATURE_1_LAM_U57 properties in input .note.gnu.property section. lam-report=none, which is the default, will make the linker not report missing properties in input files. lam-report=warning will make the linker issue a warning for missing properties in input files. lam-report=error will make the linker issue an error for missing properties in input files. Supported for Linux/x86_64. lazy When generating an executable or shared library, mark it to tell the dynamic linker to defer function call resolution to the point when the function is called (lazy binding), rather than at load time. Lazy binding is the default. loadfltr Specify that the object's filters be processed immediately at runtime. max-page-size=value Set the maximum memory page size supported to value. muldefs Allow multiple definitions. nocopyreloc Disable linker generated .dynbss variables used in place of variables defined in shared libraries. May result in dynamic text relocations. nodefaultlib Specify that the dynamic loader search for dependencies of this object should ignore any default library search paths. nodelete Specify that the object shouldn't be unloaded at runtime. nodlopen Specify that the object is not available to "dlopen". nodump Specify that the object can not be dumped by "dldump". noexecstack Marks the object as not requiring executable stack. noextern-protected-data Don't treat protected data symbols as external when building a shared library. This option overrides the linker backend default. It can be used to work around incorrect relocations against protected data symbols generated by compiler. Updates on protected data symbols by another module aren't visible to the resulting shared library. Supported for i386 and x86-64. noreloc-overflow Disable relocation overflow check. This can be used to disable relocation overflow check if there will be no dynamic relocation overflow at run-time. Supported for x86_64. now When generating an executable or shared library, mark it to tell the dynamic linker to resolve all symbols when the program is started, or when the shared library is loaded by dlopen, instead of deferring function call resolution to the point when the function is first called. origin Specify that the object requires $ORIGIN handling in paths. pack-relative-relocs nopack-relative-relocs Generate compact relative relocation in position- independent executable and shared library. It adds "DT_RELR", "DT_RELRSZ" and "DT_RELRENT" entries to the dynamic section. It is ignored when building position- dependent executable and relocatable output. nopack- relative-relocs is the default, which disables compact relative relocation. When linked against the GNU C Library, a GLIBC_ABI_DT_RELR symbol version dependency on the shared C Library is added to the output. Supported for i386 and x86-64. relro norelro Create an ELF "PT_GNU_RELRO" segment header in the object. This specifies a memory segment that should be made read-only after relocation, if supported. Specifying common-page-size smaller than the system page size will render this protection ineffective. Don't create an ELF "PT_GNU_RELRO" segment if norelro. report-relative-reloc Report dynamic relative relocations generated by linker. Supported for Linux/i386 and Linux/x86_64. sectionheader nosectionheader Generate section header. Don't generate section header if nosectionheader is used. sectionheader is the default. separate-code noseparate-code Create separate code "PT_LOAD" segment header in the object. This specifies a memory segment that should contain only instructions and must be in wholly disjoint pages from any other data. Don't create separate code "PT_LOAD" segment if noseparate-code is used. shstk Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK in .note.gnu.property section to indicate compatibility with Intel Shadow Stack. Supported for Linux/i386 and Linux/x86_64. stack-size=value Specify a stack size for an ELF "PT_GNU_STACK" segment. Specifying zero will override any default non-zero sized "PT_GNU_STACK" segment creation. start-stop-gc nostart-stop-gc When --gc-sections is in effect, a reference from a retained section to "__start_SECNAME" or "__stop_SECNAME" causes all input sections named "SECNAME" to also be retained, if "SECNAME" is representable as a C identifier and either "__start_SECNAME" or "__stop_SECNAME" is synthesized by the linker. -z start-stop-gc disables this effect, allowing sections to be garbage collected as if the special synthesized symbols were not defined. -z start-stop-gc has no effect on a definition of "__start_SECNAME" or "__stop_SECNAME" in an object file or linker script. Such a definition will prevent the linker providing a synthesized "__start_SECNAME" or "__stop_SECNAME" respectively, and therefore the special treatment by garbage collection for those references. start-stop-visibility=value Specify the ELF symbol visibility for synthesized "__start_SECNAME" and "__stop_SECNAME" symbols. value must be exactly default, internal, hidden, or protected. If no -z start-stop-visibility option is given, protected is used for compatibility with historical practice. However, it's highly recommended to use -z start-stop-visibility=hidden in new programs and shared libraries so that these symbols are not exported between shared objects, which is not usually what's intended. text notext textoff Report an error if DT_TEXTREL is set, i.e., if the position-independent or shared object has dynamic relocations in read-only sections. Don't report an error if notext or textoff. undefs Do not report unresolved symbol references from regular object files, either when creating an executable, or when creating a shared library. This option is the inverse of -z defs. unique-symbol nounique-symbol Avoid duplicated local symbol names in the symbol string table. Append "."number"" to duplicated local symbol names if unique-symbol is used. nounique-symbol is the default. x86-64-baseline x86-64-v2 x86-64-v3 x86-64-v4 Specify the x86-64 ISA level needed in .note.gnu.property section. x86-64-baseline generates "GNU_PROPERTY_X86_ISA_1_BASELINE". x86-64-v2 generates "GNU_PROPERTY_X86_ISA_1_V2". x86-64-v3 generates "GNU_PROPERTY_X86_ISA_1_V3". x86-64-v4 generates "GNU_PROPERTY_X86_ISA_1_V4". Supported for Linux/i386 and Linux/x86_64. Other keywords are ignored for Solaris compatibility. -( archives -) --start-group archives --end-group The archives should be a list of archive files. They may be either explicit file names, or -l options. The specified archives are searched repeatedly until no new undefined references are created. Normally, an archive is searched only once in the order that it is specified on the command line. If a symbol in that archive is needed to resolve an undefined symbol referred to by an object in an archive that appears later on the command line, the linker would not be able to resolve that reference. By grouping the archives, they will all be searched repeatedly until all possible references are resolved. Using this option has a significant performance cost. It is best to use it only when there are unavoidable circular references between two or more archives. --accept-unknown-input-arch --no-accept-unknown-input-arch Tells the linker to accept input files whose architecture cannot be recognised. The assumption is that the user knows what they are doing and deliberately wants to link in these unknown input files. This was the default behaviour of the linker, before release 2.14. The default behaviour from release 2.14 onwards is to reject such input files, and so the --accept-unknown-input-arch option has been added to restore the old behaviour. --as-needed --no-as-needed This option affects ELF DT_NEEDED tags for dynamic libraries mentioned on the command line after the --as-needed option. Normally the linker will add a DT_NEEDED tag for each dynamic library mentioned on the command line, regardless of whether the library is actually needed or not. --as-needed causes a DT_NEEDED tag to only be emitted for a library that at that point in the link satisfies a non-weak undefined symbol reference from a regular object file or, if the library is not found in the DT_NEEDED lists of other needed libraries, a non-weak undefined symbol reference from another needed dynamic library. Object files or libraries appearing on the command line after the library in question do not affect whether the library is seen as needed. This is similar to the rules for extraction of object files from archives. --no-as-needed restores the default behaviour. Note: On Linux based systems the --as-needed option also has an affect on the behaviour of the --rpath and --rpath-link options. See the description of --rpath-link for more details. --add-needed --no-add-needed These two options have been deprecated because of the similarity of their names to the --as-needed and --no-as-needed options. They have been replaced by --copy-dt-needed-entries and --no-copy-dt-needed-entries. -assert keyword This option is ignored for SunOS compatibility. -Bdynamic -dy -call_shared Link against dynamic libraries. This is only meaningful on platforms for which shared libraries are supported. This option is normally the default on such platforms. The different variants of this option are for compatibility with various systems. You may use this option multiple times on the command line: it affects library searching for -l options which follow it. -Bgroup Set the "DF_1_GROUP" flag in the "DT_FLAGS_1" entry in the dynamic section. This causes the runtime linker to handle lookups in this object and its dependencies to be performed only inside the group. --unresolved-symbols=report-all is implied. This option is only meaningful on ELF platforms which support shared libraries. -Bstatic -dn -non_shared -static Do not link against shared libraries. This is only meaningful on platforms for which shared libraries are supported. The different variants of this option are for compatibility with various systems. You may use this option multiple times on the command line: it affects library searching for -l options which follow it. This option also implies --unresolved-symbols=report-all. This option can be used with -shared. Doing so means that a shared library is being created but that all of the library's external references must be resolved by pulling in entries from static libraries. -Bsymbolic When creating a shared library, bind references to global symbols to the definition within the shared library, if any. Normally, it is possible for a program linked against a shared library to override the definition within the shared library. This option is only meaningful on ELF platforms which support shared libraries. -Bsymbolic-functions When creating a shared library, bind references to global function symbols to the definition within the shared library, if any. This option is only meaningful on ELF platforms which support shared libraries. -Bno-symbolic This option can cancel previously specified -Bsymbolic and -Bsymbolic-functions. --dynamic-list=dynamic-list-file Specify the name of a dynamic list file to the linker. This is typically used when creating shared libraries to specify a list of global symbols whose references shouldn't be bound to the definition within the shared library, or creating dynamically linked executables to specify a list of symbols which should be added to the symbol table in the executable. This option is only meaningful on ELF platforms which support shared libraries. The format of the dynamic list is the same as the version node without scope and node name. See VERSION for more information. --dynamic-list-data Include all global data symbols to the dynamic list. --dynamic-list-cpp-new Provide the builtin dynamic list for C++ operator new and delete. It is mainly useful for building shared libstdc++. --dynamic-list-cpp-typeinfo Provide the builtin dynamic list for C++ runtime type identification. --check-sections --no-check-sections Asks the linker not to check section addresses after they have been assigned to see if there are any overlaps. Normally the linker will perform this check, and if it finds any overlaps it will produce suitable error messages. The linker does know about, and does make allowances for sections in overlays. The default behaviour can be restored by using the command-line switch --check-sections. Section overlap is not usually checked for relocatable links. You can force checking in that case by using the --check-sections option. --copy-dt-needed-entries --no-copy-dt-needed-entries This option affects the treatment of dynamic libraries referred to by DT_NEEDED tags inside ELF dynamic libraries mentioned on the command line. Normally the linker won't add a DT_NEEDED tag to the output binary for each library mentioned in a DT_NEEDED tag in an input dynamic library. With --copy-dt-needed-entries specified on the command line however any dynamic libraries that follow it will have their DT_NEEDED entries added. The default behaviour can be restored with --no-copy-dt-needed-entries. This option also has an effect on the resolution of symbols in dynamic libraries. With --copy-dt-needed-entries dynamic libraries mentioned on the command line will be recursively searched, following their DT_NEEDED tags to other libraries, in order to resolve symbols required by the output binary. With the default setting however the searching of dynamic libraries that follow it will stop with the dynamic library itself. No DT_NEEDED links will be traversed to resolve symbols. --cref Output a cross reference table. If a linker map file is being generated, the cross reference table is printed to the map file. Otherwise, it is printed on the standard output. The format of the table is intentionally simple, so that it may be easily processed by a script if necessary. The symbols are printed out, sorted by name. For each symbol, a list of file names is given. If the symbol is defined, the first file listed is the location of the definition. If the symbol is defined as a common value then any files where this happens appear next. Finally any files that reference the symbol are listed. --ctf-variables --no-ctf-variables The CTF debuginfo format supports a section which encodes the names and types of variables found in the program which do not appear in any symbol table. These variables clearly cannot be looked up by address by conventional debuggers, so the space used for their types and names is usually wasted: the types are usually small but the names are often not. --ctf-variables causes the generation of such a section. The default behaviour can be restored with --no-ctf-variables. --ctf-share-types=method Adjust the method used to share types between translation units in CTF. share-unconflicted Put all types that do not have ambiguous definitions into the shared dictionary, where debuggers can easily access them, even if they only occur in one translation unit. This is the default. share-duplicated Put only types that occur in multiple translation units into the shared dictionary: types with only one definition go into per-translation-unit dictionaries. Types with ambiguous definitions in multiple translation units always go into per-translation-unit dictionaries. This tends to make the CTF larger, but may reduce the amount of CTF in the shared dictionary. For very large projects this may speed up opening the CTF and save memory in the CTF consumer at runtime. --no-define-common This option inhibits the assignment of addresses to common symbols. The script command "INHIBIT_COMMON_ALLOCATION" has the same effect. The --no-define-common option allows decoupling the decision to assign addresses to Common symbols from the choice of the output file type; otherwise a non-Relocatable output type forces assigning addresses to Common symbols. Using --no-define-common allows Common symbols that are referenced from a shared library to be assigned addresses only in the main program. This eliminates the unused duplicate space in the shared library, and also prevents any possible confusion over resolving to the wrong duplicate when there are many dynamic modules with specialized search paths for runtime symbol resolution. --force-group-allocation This option causes the linker to place section group members like normal input sections, and to delete the section groups. This is the default behaviour for a final link but this option can be used to change the behaviour of a relocatable link (-r). The script command "FORCE_GROUP_ALLOCATION" has the same effect. --defsym=symbol=expression Create a global symbol in the output file, containing the absolute address given by expression. You may use this option as many times as necessary to define multiple symbols in the command line. A limited form of arithmetic is supported for the expression in this context: you may give a hexadecimal constant or the name of an existing symbol, or use "+" and "-" to add or subtract hexadecimal constants or symbols. If you need more elaborate expressions, consider using the linker command language from a script. Note: there should be no white space between symbol, the equals sign ("="), and expression. The linker processes --defsym arguments and -T arguments in order, placing --defsym before -T will define the symbol before the linker script from -T is processed, while placing --defsym after -T will define the symbol after the linker script has been processed. This difference has consequences for expressions within the linker script that use the --defsym symbols, which order is correct will depend on what you are trying to achieve. --demangle[=style] --no-demangle These options control whether to demangle symbol names in error messages and other output. When the linker is told to demangle, it tries to present symbol names in a readable fashion: it strips leading underscores if they are used by the object file format, and converts C++ mangled symbol names into user readable names. Different compilers have different mangling styles. The optional demangling style argument can be used to choose an appropriate demangling style for your compiler. The linker will demangle by default unless the environment variable COLLECT_NO_DEMANGLE is set. These options may be used to override the default. -Ifile --dynamic-linker=file Set the name of the dynamic linker. This is only meaningful when generating dynamically linked ELF executables. The default dynamic linker is normally correct; don't use this unless you know what you are doing. --no-dynamic-linker When producing an executable file, omit the request for a dynamic linker to be used at load-time. This is only meaningful for ELF executables that contain dynamic relocations, and usually requires entry point code that is capable of processing these relocations. --embedded-relocs This option is similar to the --emit-relocs option except that the relocs are stored in a target-specific section. This option is only supported by the BFIN, CR16 and M68K targets. --disable-multiple-abs-defs Do not allow multiple definitions with symbols included in filename invoked by -R or --just-symbols --fatal-warnings --no-fatal-warnings Treat all warnings as errors. The default behaviour can be restored with the option --no-fatal-warnings. -w --no-warnings Do not display any warning or error messages. This overrides --fatal-warnings if it has been enabled. This option can be used when it is known that the output binary will not work, but there is still a need to create it. --force-exe-suffix Make sure that an output file has a .exe suffix. If a successfully built fully linked output file does not have a ".exe" or ".dll" suffix, this option forces the linker to copy the output file to one of the same name with a ".exe" suffix. This option is useful when using unmodified Unix makefiles on a Microsoft Windows host, since some versions of Windows won't run an image unless it ends in a ".exe" suffix. --gc-sections --no-gc-sections Enable garbage collection of unused input sections. It is ignored on targets that do not support this option. The default behaviour (of not performing this garbage collection) can be restored by specifying --no-gc-sections on the command line. Note that garbage collection for COFF and PE format targets is supported, but the implementation is currently considered to be experimental. --gc-sections decides which input sections are used by examining symbols and relocations. The section containing the entry symbol and all sections containing symbols undefined on the command-line will be kept, as will sections containing symbols referenced by dynamic objects. Note that when building shared libraries, the linker must assume that any visible symbol is referenced. Once this initial set of sections has been determined, the linker recursively marks as used any section referenced by their relocations. See --entry, --undefined, and --gc-keep-exported. This option can be set when doing a partial link (enabled with option -r). In this case the root of symbols kept must be explicitly specified either by one of the options --entry, --undefined, or --gc-keep-exported or by a "ENTRY" command in the linker script. As a GNU extension, ELF input sections marked with the "SHF_GNU_RETAIN" flag will not be garbage collected. --print-gc-sections --no-print-gc-sections List all sections removed by garbage collection. The listing is printed on stderr. This option is only effective if garbage collection has been enabled via the --gc-sections) option. The default behaviour (of not listing the sections that are removed) can be restored by specifying --no-print-gc-sections on the command line. --gc-keep-exported When --gc-sections is enabled, this option prevents garbage collection of unused input sections that contain global symbols having default or protected visibility. This option is intended to be used for executables where unreferenced sections would otherwise be garbage collected regardless of the external visibility of contained symbols. Note that this option has no effect when linking shared objects since it is already the default behaviour. This option is only supported for ELF format targets. --print-output-format Print the name of the default output format (perhaps influenced by other command-line options). This is the string that would appear in an "OUTPUT_FORMAT" linker script command. --print-memory-usage Print used size, total size and used size of memory regions created with the MEMORY command. This is useful on embedded targets to have a quick view of amount of free memory. The format of the output has one headline and one line per region. It is both human readable and easily parsable by tools. Here is an example of an output: Memory region Used Size Region Size %age Used ROM: 256 KB 1 MB 25.00% RAM: 32 B 2 GB 0.00% --help Print a summary of the command-line options on the standard output and exit. --target-help Print a summary of all target-specific options on the standard output and exit. -Map=mapfile Print a link map to the file mapfile. See the description of the -M option, above. If mapfile is just the character "-" then the map will be written to stdout. Specifying a directory as mapfile causes the linker map to be written as a file inside the directory. Normally name of the file inside the directory is computed as the basename of the output file with ".map" appended. If however the special character "%" is used then this will be replaced by the full path of the output file. Additionally if there are any characters after the % symbol then ".map" will no longer be appended. -o foo.exe -Map=bar [Creates ./bar] -o ../dir/foo.exe -Map=bar [Creates ./bar] -o foo.exe -Map=../dir [Creates ../dir/foo.exe.map] -o ../dir2/foo.exe -Map=../dir [Creates ../dir/foo.exe.map] -o foo.exe -Map=% [Creates ./foo.exe.map] -o ../dir/foo.exe -Map=% [Creates ../dir/foo.exe.map] -o foo.exe -Map=%.bar [Creates ./foo.exe.bar] -o ../dir/foo.exe -Map=%.bar [Creates ../dir/foo.exe.bar] -o ../dir2/foo.exe -Map=../dir/% [Creates ../dir/../dir2/foo.exe.map] -o ../dir2/foo.exe -Map=../dir/%.bar [Creates ../dir/../dir2/foo.exe.bar] It is an error to specify more than one "%" character. If the map file already exists then it will be overwritten by this operation. --no-keep-memory ld normally optimizes for speed over memory usage by caching the symbol tables of input files in memory. This option tells ld to instead optimize for memory usage, by rereading the symbol tables as necessary. This may be required if ld runs out of memory space while linking a large executable. --no-undefined -z defs Report unresolved symbol references from regular object files. This is done even if the linker is creating a non- symbolic shared library. The switch --[no-]allow-shlib-undefined controls the behaviour for reporting unresolved references found in shared libraries being linked in. The effects of this option can be reverted by using "-z undefs". --allow-multiple-definition -z muldefs Normally when a symbol is defined multiple times, the linker will report a fatal error. These options allow multiple definitions and the first definition will be used. --allow-shlib-undefined --no-allow-shlib-undefined Allows or disallows undefined symbols in shared libraries. This switch is similar to --no-undefined except that it determines the behaviour when the undefined symbols are in a shared library rather than a regular object file. It does not affect how undefined symbols in regular object files are handled. The default behaviour is to report errors for any undefined symbols referenced in shared libraries if the linker is being used to create an executable, but to allow them if the linker is being used to create a shared library. The reasons for allowing undefined symbol references in shared libraries specified at link time are that: A shared library specified at link time may not be the same as the one that is available at load time, so the symbol might actually be resolvable at load time. There are some operating systems, eg BeOS and HPPA, where undefined symbols in shared libraries are normal. The BeOS kernel for example patches shared libraries at load time to select whichever function is most appropriate for the current architecture. This is used, for example, to dynamically select an appropriate memset function. --error-handling-script=scriptname If this option is provided then the linker will invoke scriptname whenever an error is encountered. Currently however only two kinds of error are supported: missing symbols and missing libraries. Two arguments will be passed to script: the keyword "undefined-symbol" or `missing-lib" and the name of the undefined symbol or missing library. The intention is that the script will provide suggestions to the user as to where the symbol or library might be found. After the script has finished then the normal linker error message will be displayed. The availability of this option is controlled by a configure time switch, so it may not be present in specific implementations. --no-undefined-version Normally when a symbol has an undefined version, the linker will ignore it. This option disallows symbols with undefined version and a fatal error will be issued instead. --default-symver Create and use a default symbol version (the soname) for unversioned exported symbols. --default-imported-symver Create and use a default symbol version (the soname) for unversioned imported symbols. --no-warn-mismatch Normally ld will give an error if you try to link together input files that are mismatched for some reason, perhaps because they have been compiled for different processors or for different endiannesses. This option tells ld that it should silently permit such possible errors. This option should only be used with care, in cases when you have taken some special action that ensures that the linker errors are inappropriate. --no-warn-search-mismatch Normally ld will give a warning if it finds an incompatible library during a library search. This option silences the warning. --no-whole-archive Turn off the effect of the --whole-archive option for subsequent archive files. --noinhibit-exec Retain the executable output file whenever it is still usable. Normally, the linker will not produce an output file if it encounters errors during the link process; it exits without writing an output file when it issues any error whatsoever. -nostdlib Only search library directories explicitly specified on the command line. Library directories specified in linker scripts (including linker scripts specified on the command line) are ignored. --oformat=output-format ld may be configured to support more than one kind of object file. If your ld is configured this way, you can use the --oformat option to specify the binary format for the output object file. Even when ld is configured to support alternative object formats, you don't usually need to specify this, as ld should be configured to produce as a default output format the most usual format on each machine. output- format is a text string, the name of a particular format supported by the BFD libraries. (You can list the available binary formats with objdump -i.) The script command "OUTPUT_FORMAT" can also specify the output format, but this option overrides it. --out-implib file Create an import library in file corresponding to the executable the linker is generating (eg. a DLL or ELF program). This import library (which should be called "*.dll.a" or "*.a" for DLLs) may be used to link clients against the generated executable; this behaviour makes it possible to skip a separate import library creation step (eg. "dlltool" for DLLs). This option is only available for the i386 PE and ELF targetted ports of the linker. -pie --pic-executable Create a position independent executable. This is currently only supported on ELF platforms. Position independent executables are similar to shared libraries in that they are relocated by the dynamic linker to the virtual address the OS chooses for them (which can vary between invocations). Like normal dynamically linked executables they can be executed and symbols defined in the executable cannot be overridden by shared libraries. -no-pie Create a position dependent executable. This is the default. -qmagic This option is ignored for Linux compatibility. -Qy This option is ignored for SVR4 compatibility. --relax --no-relax An option with machine dependent effects. This option is only supported on a few targets. On some platforms the --relax option performs target specific, global optimizations that become possible when the linker resolves addressing in the program, such as relaxing address modes, synthesizing new instructions, selecting shorter version of current instructions, and combining constant values. On some platforms these link time global optimizations may make symbolic debugging of the resulting executable impossible. This is known to be the case for the Matsushita MN10200 and MN10300 family of processors. On platforms where the feature is supported, the option --no-relax will disable it. On platforms where the feature is not supported, both --relax and --no-relax are accepted, but ignored. --retain-symbols-file=filename Retain only the symbols listed in the file filename, discarding all others. filename is simply a flat file, with one symbol name per line. This option is especially useful in environments (such as VxWorks) where a large global symbol table is accumulated gradually, to conserve run-time memory. --retain-symbols-file does not discard undefined symbols, or symbols needed for relocations. You may only specify --retain-symbols-file once in the command line. It overrides -s and -S. -rpath=dir Add a directory to the runtime library search path. This is used when linking an ELF executable with shared objects. All -rpath arguments are concatenated and passed to the runtime linker, which uses them to locate shared objects at runtime. The -rpath option is also used when locating shared objects which are needed by shared objects explicitly included in the link; see the description of the -rpath-link option. Searching -rpath in this way is only supported by native linkers and cross linkers which have been configured with the --with-sysroot option. If -rpath is not used when linking an ELF executable, the contents of the environment variable "LD_RUN_PATH" will be used if it is defined. The -rpath option may also be used on SunOS. By default, on SunOS, the linker will form a runtime search path out of all the -L options it is given. If a -rpath option is used, the runtime search path will be formed exclusively using the -rpath options, ignoring the -L options. This can be useful when using gcc, which adds many -L options which may be on NFS mounted file systems. For compatibility with other ELF linkers, if the -R option is followed by a directory name, rather than a file name, it is treated as the -rpath option. -rpath-link=dir When using ELF or SunOS, one shared library may require another. This happens when an "ld -shared" link includes a shared library as one of the input files. When the linker encounters such a dependency when doing a non-shared, non-relocatable link, it will automatically try to locate the required shared library and include it in the link, if it is not included explicitly. In such a case, the -rpath-link option specifies the first set of directories to search. The -rpath-link option may specify a sequence of directory names either by specifying a list of names separated by colons, or by appearing multiple times. The tokens $ORIGIN and $LIB can appear in these search directories. They will be replaced by the full path to the directory containing the program or shared object in the case of $ORIGIN and either lib - for 32-bit binaries - or lib64 - for 64-bit binaries - in the case of $LIB. The alternative form of these tokens - ${ORIGIN} and ${LIB} can also be used. The token $PLATFORM is not supported. This option should be used with caution as it overrides the search path that may have been hard compiled into a shared library. In such a case it is possible to use unintentionally a different search path than the runtime linker would do. The linker uses the following search paths to locate required shared libraries: 1. Any directories specified by -rpath-link options. 2. Any directories specified by -rpath options. The difference between -rpath and -rpath-link is that directories specified by -rpath options are included in the executable and used at runtime, whereas the -rpath-link option is only effective at link time. Searching -rpath in this way is only supported by native linkers and cross linkers which have been configured with the --with-sysroot option. 3. On an ELF system, for native linkers, if the -rpath and -rpath-link options were not used, search the contents of the environment variable "LD_RUN_PATH". 4. On SunOS, if the -rpath option was not used, search any directories specified using -L options. 5. For a native linker, search the contents of the environment variable "LD_LIBRARY_PATH". 6. For a native ELF linker, the directories in "DT_RUNPATH" or "DT_RPATH" of a shared library are searched for shared libraries needed by it. The "DT_RPATH" entries are ignored if "DT_RUNPATH" entries exist. 7. For a linker for a Linux system, if the file /etc/ld.so.conf exists, the list of directories found in that file. Note: the path to this file is prefixed with the "sysroot" value, if that is defined, and then any "prefix" string if the linker was configured with the --prefix=<path> option. 8. For a native linker on a FreeBSD system, any directories specified by the "_PATH_ELF_HINTS" macro defined in the elf-hints.h header file. 9. Any directories specified by a "SEARCH_DIR" command in a linker script given on the command line, including scripts specified by -T (but not -dT). 10. The default directories, normally /lib and /usr/lib. 11. Any directories specified by a plugin LDPT_SET_EXTRA_LIBRARY_PATH. 12. Any directories specified by a "SEARCH_DIR" command in a default linker script. Note however on Linux based systems there is an additional caveat: If the --as-needed option is active and a shared library is located which would normally satisfy the search and this library does not have DT_NEEDED tag for libc.so and there is a shared library later on in the set of search directories which also satisfies the search and this second shared library does have a DT_NEEDED tag for libc.so then the second library will be selected instead of the first. If the required shared library is not found, the linker will issue a warning and continue with the link. -shared -Bshareable Create a shared library. This is currently only supported on ELF, XCOFF and SunOS platforms. On SunOS, the linker will automatically create a shared library if the -e option is not used and there are undefined symbols in the link. --sort-common --sort-common=ascending --sort-common=descending This option tells ld to sort the common symbols by alignment in ascending or descending order when it places them in the appropriate output sections. The symbol alignments considered are sixteen-byte or larger, eight-byte, four-byte, two-byte, and one-byte. This is to prevent gaps between symbols due to alignment constraints. If no sorting order is specified, then descending order is assumed. --sort-section=name This option will apply "SORT_BY_NAME" to all wildcard section patterns in the linker script. --sort-section=alignment This option will apply "SORT_BY_ALIGNMENT" to all wildcard section patterns in the linker script. --spare-dynamic-tags=count This option specifies the number of empty slots to leave in the .dynamic section of ELF shared objects. Empty slots may be needed by post processing tools, such as the prelinker. The default is 5. --split-by-file[=size] Similar to --split-by-reloc but creates a new output section for each input file when size is reached. size defaults to a size of 1 if not given. --split-by-reloc[=count] Tries to creates extra sections in the output file so that no single output section in the file contains more than count relocations. This is useful when generating huge relocatable files for downloading into certain real time kernels with the COFF object file format; since COFF cannot represent more than 65535 relocations in a single section. Note that this will fail to work with object file formats which do not support arbitrary sections. The linker will not split up individual input sections for redistribution, so if a single input section contains more than count relocations one output section will contain that many relocations. count defaults to a value of 32768. --stats Compute and display statistics about the operation of the linker, such as execution time and memory usage. --sysroot=directory Use directory as the location of the sysroot, overriding the configure-time default. This option is only supported by linkers that were configured using --with-sysroot. --task-link This is used by COFF/PE based targets to create a task-linked object file where all of the global symbols have been converted to statics. --traditional-format For some targets, the output of ld is different in some ways from the output of some existing linker. This switch requests ld to use the traditional format instead. For example, on SunOS, ld combines duplicate entries in the symbol string table. This can reduce the size of an output file with full debugging information by over 30 percent. Unfortunately, the SunOS "dbx" program can not read the resulting program ("gdb" has no trouble). The --traditional-format switch tells ld to not combine duplicate entries. --section-start=sectionname=org Locate a section in the output file at the absolute address given by org. You may use this option as many times as necessary to locate multiple sections in the command line. org must be a single hexadecimal integer; for compatibility with other linkers, you may omit the leading 0x usually associated with hexadecimal values. Note: there should be no white space between sectionname, the equals sign ("="), and org. -Tbss=org -Tdata=org -Ttext=org Same as --section-start, with ".bss", ".data" or ".text" as the sectionname. -Ttext-segment=org When creating an ELF executable, it will set the address of the first byte of the text segment. -Trodata-segment=org When creating an ELF executable or shared object for a target where the read-only data is in its own segment separate from the executable text, it will set the address of the first byte of the read-only data segment. -Tldata-segment=org When creating an ELF executable or shared object for x86-64 medium memory model, it will set the address of the first byte of the ldata segment. --unresolved-symbols=method Determine how to handle unresolved symbols. There are four possible values for method: ignore-all Do not report any unresolved symbols. report-all Report all unresolved symbols. This is the default. ignore-in-object-files Report unresolved symbols that are contained in shared libraries, but ignore them if they come from regular object files. ignore-in-shared-libs Report unresolved symbols that come from regular object files, but ignore them if they come from shared libraries. This can be useful when creating a dynamic binary and it is known that all the shared libraries that it should be referencing are included on the linker's command line. The behaviour for shared libraries on their own can also be controlled by the --[no-]allow-shlib-undefined option. Normally the linker will generate an error message for each reported unresolved symbol but the option --warn-unresolved-symbols can change this to a warning. --dll-verbose --verbose[=NUMBER] Display the version number for ld and list the linker emulations supported. Display which input files can and cannot be opened. Display the linker script being used by the linker. If the optional NUMBER argument > 1, plugin symbol status will also be displayed. --version-script=version-scriptfile Specify the name of a version script to the linker. This is typically used when creating shared libraries to specify additional information about the version hierarchy for the library being created. This option is only fully supported on ELF platforms which support shared libraries; see VERSION. It is partially supported on PE platforms, which can use version scripts to filter symbol visibility in auto-export mode: any symbols marked local in the version script will not be exported. --warn-common Warn when a common symbol is combined with another common symbol or with a symbol definition. Unix linkers allow this somewhat sloppy practice, but linkers on some other operating systems do not. This option allows you to find potential problems from combining global symbols. Unfortunately, some C libraries use this practice, so you may get some warnings about symbols in the libraries as well as in your programs. There are three kinds of global symbols, illustrated here by C examples: int i = 1; A definition, which goes in the initialized data section of the output file. extern int i; An undefined reference, which does not allocate space. There must be either a definition or a common symbol for the variable somewhere. int i; A common symbol. If there are only (one or more) common symbols for a variable, it goes in the uninitialized data area of the output file. The linker merges multiple common symbols for the same variable into a single symbol. If they are of different sizes, it picks the largest size. The linker turns a common symbol into a declaration, if there is a definition of the same variable. The --warn-common option can produce five kinds of warnings. Each warning consists of a pair of lines: the first describes the symbol just encountered, and the second describes the previous symbol encountered with the same name. One or both of the two symbols will be a common symbol. 1. Turning a common symbol into a reference, because there is already a definition for the symbol. <file>(<section>): warning: common of `<symbol>' overridden by definition <file>(<section>): warning: defined here 2. Turning a common symbol into a reference, because a later definition for the symbol is encountered. This is the same as the previous case, except that the symbols are encountered in a different order. <file>(<section>): warning: definition of `<symbol>' overriding common <file>(<section>): warning: common is here 3. Merging a common symbol with a previous same-sized common symbol. <file>(<section>): warning: multiple common of `<symbol>' <file>(<section>): warning: previous common is here 4. Merging a common symbol with a previous larger common symbol. <file>(<section>): warning: common of `<symbol>' overridden by larger common <file>(<section>): warning: larger common is here 5. Merging a common symbol with a previous smaller common symbol. This is the same as the previous case, except that the symbols are encountered in a different order. <file>(<section>): warning: common of `<symbol>' overriding smaller common <file>(<section>): warning: smaller common is here --warn-constructors Warn if any global constructors are used. This is only useful for a few object file formats. For formats like COFF or ELF, the linker can not detect the use of global constructors. --warn-execstack --no-warn-execstack On ELF platforms this option controls how the linker generates warning messages when it creates an output file with an executable stack. By default the linker will not warn if the -z execstack command line option has been used, but this behaviour can be overridden by the --warn-execstack option. On the other hand the linker will normally warn if the stack is made executable because one or more of the input files need an execuable stack and neither of the -z execstack or -z noexecstack command line options have been specified. This warning can be disabled via the --no-warn-execstack option. Note: ELF format input files specify that they need an executable stack by having a .note.GNU-stack section with the executable bit set in its section flags. They can specify that they do not need an executable stack by having that section, but without the executable flag bit set. If an input file does not have a .note.GNU-stack section present then the default behaviour is target specific. For some targets, then absence of such a section implies that an executable stack is required. This is often a problem for hand crafted assembler files. --warn-multiple-gp Warn if multiple global pointer values are required in the output file. This is only meaningful for certain processors, such as the Alpha. Specifically, some processors put large- valued constants in a special section. A special register (the global pointer) points into the middle of this section, so that constants can be loaded efficiently via a base- register relative addressing mode. Since the offset in base- register relative mode is fixed and relatively small (e.g., 16 bits), this limits the maximum size of the constant pool. Thus, in large programs, it is often necessary to use multiple global pointer values in order to be able to address all possible constants. This option causes a warning to be issued whenever this case occurs. --warn-once Only warn once for each undefined symbol, rather than once per module which refers to it. --warn-rwx-segments --no-warn-rwx-segments Warn if the linker creates a loadable, non-zero sized segment that has all three of the read, write and execute permission flags set. Such a segment represents a potential security vulnerability. In addition warnings will be generated if a thread local storage segment is created with the execute permission flag set, regardless of whether or not it has the read and/or write flags set. These warnings are enabled by default. They can be disabled via the --no-warn-rwx-segments option and re-enabled via the --warn-rwx-segments option. --warn-section-align Warn if the address of an output section is changed because of alignment. Typically, the alignment will be set by an input section. The address will only be changed if it not explicitly specified; that is, if the "SECTIONS" command does not specify a start address for the section. --warn-textrel Warn if the linker adds DT_TEXTREL to a position-independent executable or shared object. --warn-alternate-em Warn if an object has alternate ELF machine code. --warn-unresolved-symbols If the linker is going to report an unresolved symbol (see the option --unresolved-symbols) it will normally generate an error. This option makes it generate a warning instead. --error-unresolved-symbols This restores the linker's default behaviour of generating errors when it is reporting unresolved symbols. --whole-archive For each archive mentioned on the command line after the --whole-archive option, include every object file in the archive in the link, rather than searching the archive for the required object files. This is normally used to turn an archive file into a shared library, forcing every object to be included in the resulting shared library. This option may be used more than once. Two notes when using this option from gcc: First, gcc doesn't know about this option, so you have to use -Wl,-whole-archive. Second, don't forget to use -Wl,-no-whole-archive after your list of archives, because gcc will add its own list of archives to your link and you may not want this flag to affect those as well. --wrap=symbol Use a wrapper function for symbol. Any undefined reference to symbol will be resolved to "__wrap_symbol". Any undefined reference to "__real_symbol" will be resolved to symbol. This can be used to provide a wrapper for a system function. The wrapper function should be called "__wrap_symbol". If it wishes to call the system function, it should call "__real_symbol". Here is a trivial example: void * __wrap_malloc (size_t c) { printf ("malloc called with %zu\n", c); return __real_malloc (c); } If you link other code with this file using --wrap malloc, then all calls to "malloc" will call the function "__wrap_malloc" instead. The call to "__real_malloc" in "__wrap_malloc" will call the real "malloc" function. You may wish to provide a "__real_malloc" function as well, so that links without the --wrap option will succeed. If you do this, you should not put the definition of "__real_malloc" in the same file as "__wrap_malloc"; if you do, the assembler may resolve the call before the linker has a chance to wrap it to "malloc". Only undefined references are replaced by the linker. So, translation unit internal references to symbol are not resolved to "__wrap_symbol". In the next example, the call to "f" in "g" is not resolved to "__wrap_f". int f (void) { return 123; } int g (void) { return f(); } --eh-frame-hdr --no-eh-frame-hdr Request (--eh-frame-hdr) or suppress (--no-eh-frame-hdr) the creation of ".eh_frame_hdr" section and ELF "PT_GNU_EH_FRAME" segment header. --no-ld-generated-unwind-info Request creation of ".eh_frame" unwind info for linker generated code sections like PLT. This option is on by default if linker generated unwind info is supported. This option also controls the generation of ".sframe" stack trace info for linker generated code sections like PLT. --enable-new-dtags --disable-new-dtags This linker can create the new dynamic tags in ELF. But the older ELF systems may not understand them. If you specify --enable-new-dtags, the new dynamic tags will be created as needed and older dynamic tags will be omitted. If you specify --disable-new-dtags, no new dynamic tags will be created. By default, the new dynamic tags are not created. Note that those options are only available for ELF systems. --hash-size=number Set the default size of the linker's hash tables to a prime number close to number. Increasing this value can reduce the length of time it takes the linker to perform its tasks, at the expense of increasing the linker's memory requirements. Similarly reducing this value can reduce the memory requirements at the expense of speed. --hash-style=style Set the type of linker's hash table(s). style can be either "sysv" for classic ELF ".hash" section, "gnu" for new style GNU ".gnu.hash" section or "both" for both the classic ELF ".hash" and new style GNU ".gnu.hash" hash tables. The default depends upon how the linker was configured, but for most Linux based systems it will be "both". --compress-debug-sections=none --compress-debug-sections=zlib --compress-debug-sections=zlib-gnu --compress-debug-sections=zlib-gabi --compress-debug-sections=zstd On ELF platforms, these options control how DWARF debug sections are compressed using zlib. --compress-debug-sections=none doesn't compress DWARF debug sections. --compress-debug-sections=zlib-gnu compresses DWARF debug sections and renames them to begin with .zdebug instead of .debug. --compress-debug-sections=zlib-gabi also compresses DWARF debug sections, but rather than renaming them it sets the SHF_COMPRESSED flag in the sections' headers. The --compress-debug-sections=zlib option is an alias for --compress-debug-sections=zlib-gabi. --compress-debug-sections=zstd compresses DWARF debug sections using zstd. Note that this option overrides any compression in input debug sections, so if a binary is linked with --compress-debug-sections=none for example, then any compressed debug sections in input files will be uncompressed before they are copied into the output binary. The default compression behaviour varies depending upon the target involved and the configure options used to build the toolchain. The default can be determined by examining the output from the linker's --help option. --reduce-memory-overheads This option reduces memory requirements at ld runtime, at the expense of linking speed. This was introduced to select the old O(n^2) algorithm for link map file generation, rather than the new O(n) algorithm which uses about 40% more memory for symbol storage. Another effect of the switch is to set the default hash table size to 1021, which again saves memory at the cost of lengthening the linker's run time. This is not done however if the --hash-size switch has been used. The --reduce-memory-overheads switch may be also be used to enable other tradeoffs in future versions of the linker. --max-cache-size=size ld normally caches the relocation information and symbol tables of input files in memory with the unlimited size. This option sets the maximum cache size to size. --build-id --build-id=style Request the creation of a ".note.gnu.build-id" ELF note section or a ".buildid" COFF section. The contents of the note are unique bits identifying this linked file. style can be "uuid" to use 128 random bits, "sha1" to use a 160-bit SHA1 hash on the normative parts of the output contents, "md5" to use a 128-bit MD5 hash on the normative parts of the output contents, or "0xhexstring" to use a chosen bit string specified as an even number of hexadecimal digits ("-" and ":" characters between digit pairs are ignored). If style is omitted, "sha1" is used. The "md5" and "sha1" styles produces an identifier that is always the same in an identical output file, but will be unique among all nonidentical output files. It is not intended to be compared as a checksum for the file's contents. A linked file may be changed later by other tools, but the build ID bit string identifying the original linked file does not change. Passing "none" for style disables the setting from any "--build-id" options earlier on the command line. --package-metadata=JSON Request the creation of a ".note.package" ELF note section. The contents of the note are in JSON format, as per the package metadata specification. For more information see: https://systemd.io/ELF_PACKAGE_METADATA/ If the JSON argument is missing/empty then this will disable the creation of the metadata note, if one had been enabled by an earlier occurrence of the --package-metdata option. If the linker has been built with libjansson, then the JSON string will be validated. The i386 PE linker supports the -shared option, which causes the output to be a dynamically linked library (DLL) instead of a normal executable. You should name the output "*.dll" when you use this option. In addition, the linker fully supports the standard "*.def" files, which may be specified on the linker command line like an object file (in fact, it should precede archives it exports symbols from, to ensure that they get linked in, just like a normal object file). In addition to the options common to all targets, the i386 PE linker support additional command-line options that are specific to the i386 PE target. Options that take values may be separated from their values by either a space or an equals sign. --add-stdcall-alias If given, symbols with a stdcall suffix (@nn) will be exported as-is and also with the suffix stripped. [This option is specific to the i386 PE targeted port of the linker] --base-file file Use file as the name of a file in which to save the base addresses of all the relocations needed for generating DLLs with dlltool. [This is an i386 PE specific option] --dll Create a DLL instead of a regular executable. You may also use -shared or specify a "LIBRARY" in a given ".def" file. [This option is specific to the i386 PE targeted port of the linker] --enable-long-section-names --disable-long-section-names The PE variants of the COFF object format add an extension that permits the use of section names longer than eight characters, the normal limit for COFF. By default, these names are only allowed in object files, as fully-linked executable images do not carry the COFF string table required to support the longer names. As a GNU extension, it is possible to allow their use in executable images as well, or to (probably pointlessly!) disallow it in object files, by using these two options. Executable images generated with these long section names are slightly non-standard, carrying as they do a string table, and may generate confusing output when examined with non-GNU PE-aware tools, such as file viewers and dumpers. However, GDB relies on the use of PE long section names to find Dwarf-2 debug information sections in an executable image at runtime, and so if neither option is specified on the command-line, ld will enable long section names, overriding the default and technically correct behaviour, when it finds the presence of debug information while linking an executable image and not stripping symbols. [This option is valid for all PE targeted ports of the linker] --enable-stdcall-fixup --disable-stdcall-fixup If the link finds a symbol that it cannot resolve, it will attempt to do "fuzzy linking" by looking for another defined symbol that differs only in the format of the symbol name (cdecl vs stdcall) and will resolve that symbol by linking to the match. For example, the undefined symbol "_foo" might be linked to the function "_foo@12", or the undefined symbol "_bar@16" might be linked to the function "_bar". When the linker does this, it prints a warning, since it normally should have failed to link, but sometimes import libraries generated from third-party dlls may need this feature to be usable. If you specify --enable-stdcall-fixup, this feature is fully enabled and warnings are not printed. If you specify --disable-stdcall-fixup, this feature is disabled and such mismatches are considered to be errors. [This option is specific to the i386 PE targeted port of the linker] --leading-underscore --no-leading-underscore For most targets default symbol-prefix is an underscore and is defined in target's description. By this option it is possible to disable/enable the default underscore symbol- prefix. --export-all-symbols If given, all global symbols in the objects used to build a DLL will be exported by the DLL. Note that this is the default if there otherwise wouldn't be any exported symbols. When symbols are explicitly exported via DEF files or implicitly exported via function attributes, the default is to not export anything else unless this option is given. Note that the symbols "DllMain@12", "DllEntryPoint@0", "DllMainCRTStartup@12", and "impure_ptr" will not be automatically exported. Also, symbols imported from other DLLs will not be re-exported, nor will symbols specifying the DLL's internal layout such as those beginning with "_head_" or ending with "_iname". In addition, no symbols from "libgcc", "libstd++", "libmingw32", or "crtX.o" will be exported. Symbols whose names begin with "__rtti_" or "__builtin_" will not be exported, to help with C++ DLLs. Finally, there is an extensive list of cygwin-private symbols that are not exported (obviously, this applies on when building DLLs for cygwin targets). These cygwin-excludes are: "_cygwin_dll_entry@12", "_cygwin_crt0_common@8", "_cygwin_noncygwin_dll_entry@12", "_fmode", "_impure_ptr", "cygwin_attach_dll", "cygwin_premain0", "cygwin_premain1", "cygwin_premain2", "cygwin_premain3", and "environ". [This option is specific to the i386 PE targeted port of the linker] --exclude-symbols symbol,symbol,... Specifies a list of symbols which should not be automatically exported. The symbol names may be delimited by commas or colons. [This option is specific to the i386 PE targeted port of the linker] --exclude-all-symbols Specifies no symbols should be automatically exported. [This option is specific to the i386 PE targeted port of the linker] --file-alignment Specify the file alignment. Sections in the file will always begin at file offsets which are multiples of this number. This defaults to 512. [This option is specific to the i386 PE targeted port of the linker] --heap reserve --heap reserve,commit Specify the number of bytes of memory to reserve (and optionally commit) to be used as heap for this program. The default is 1MB reserved, 4K committed. [This option is specific to the i386 PE targeted port of the linker] --image-base value Use value as the base address of your program or dll. This is the lowest memory location that will be used when your program or dll is loaded. To reduce the need to relocate and improve performance of your dlls, each should have a unique base address and not overlap any other dlls. The default is 0x400000 for executables, and 0x10000000 for dlls. [This option is specific to the i386 PE targeted port of the linker] --kill-at If given, the stdcall suffixes (@nn) will be stripped from symbols before they are exported. [This option is specific to the i386 PE targeted port of the linker] --large-address-aware If given, the appropriate bit in the "Characteristics" field of the COFF header is set to indicate that this executable supports virtual addresses greater than 2 gigabytes. This should be used in conjunction with the /3GB or /USERVA=value megabytes switch in the "[operating systems]" section of the BOOT.INI. Otherwise, this bit has no effect. [This option is specific to PE targeted ports of the linker] --disable-large-address-aware Reverts the effect of a previous --large-address-aware option. This is useful if --large-address-aware is always set by the compiler driver (e.g. Cygwin gcc) and the executable does not support virtual addresses greater than 2 gigabytes. [This option is specific to PE targeted ports of the linker] --major-image-version value Sets the major number of the "image version". Defaults to 1. [This option is specific to the i386 PE targeted port of the linker] --major-os-version value Sets the major number of the "os version". Defaults to 4. [This option is specific to the i386 PE targeted port of the linker] --major-subsystem-version value Sets the major number of the "subsystem version". Defaults to 4. [This option is specific to the i386 PE targeted port of the linker] --minor-image-version value Sets the minor number of the "image version". Defaults to 0. [This option is specific to the i386 PE targeted port of the linker] --minor-os-version value Sets the minor number of the "os version". Defaults to 0. [This option is specific to the i386 PE targeted port of the linker] --minor-subsystem-version value Sets the minor number of the "subsystem version". Defaults to 0. [This option is specific to the i386 PE targeted port of the linker] --output-def file The linker will create the file file which will contain a DEF file corresponding to the DLL the linker is generating. This DEF file (which should be called "*.def") may be used to create an import library with "dlltool" or may be used as a reference to automatically or implicitly exported symbols. [This option is specific to the i386 PE targeted port of the linker] --enable-auto-image-base --enable-auto-image-base=value Automatically choose the image base for DLLs, optionally starting with base value, unless one is specified using the "--image-base" argument. By using a hash generated from the dllname to create unique image bases for each DLL, in-memory collisions and relocations which can delay program execution are avoided. [This option is specific to the i386 PE targeted port of the linker] --disable-auto-image-base Do not automatically generate a unique image base. If there is no user-specified image base ("--image-base") then use the platform default. [This option is specific to the i386 PE targeted port of the linker] --dll-search-prefix string When linking dynamically to a dll without an import library, search for "<string><basename>.dll" in preference to "lib<basename>.dll". This behaviour allows easy distinction between DLLs built for the various "subplatforms": native, cygwin, uwin, pw, etc. For instance, cygwin DLLs typically use "--dll-search-prefix=cyg". [This option is specific to the i386 PE targeted port of the linker] --enable-auto-import Do sophisticated linking of "_symbol" to "__imp__symbol" for DATA imports from DLLs, thus making it possible to bypass the dllimport mechanism on the user side and to reference unmangled symbol names. [This option is specific to the i386 PE targeted port of the linker] The following remarks pertain to the original implementation of the feature and are obsolete nowadays for Cygwin and MinGW targets. Note: Use of the 'auto-import' extension will cause the text section of the image file to be made writable. This does not conform to the PE-COFF format specification published by Microsoft. Note - use of the 'auto-import' extension will also cause read only data which would normally be placed into the .rdata section to be placed into the .data section instead. This is in order to work around a problem with consts that is described here: http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html Using 'auto-import' generally will 'just work' -- but sometimes you may see this message: "variable '<var>' can't be auto-imported. Please read the documentation for ld's "--enable-auto-import" for details." This message occurs when some (sub)expression accesses an address ultimately given by the sum of two constants (Win32 import tables only allow one). Instances where this may occur include accesses to member fields of struct variables imported from a DLL, as well as using a constant index into an array variable imported from a DLL. Any multiword variable (arrays, structs, long long, etc) may trigger this error condition. However, regardless of the exact data type of the offending exported variable, ld will always detect it, issue the warning, and exit. There are several ways to address this difficulty, regardless of the data type of the exported variable: One way is to use --enable-runtime-pseudo-reloc switch. This leaves the task of adjusting references in your client code for runtime environment, so this method works only when runtime environment supports this feature. A second solution is to force one of the 'constants' to be a variable -- that is, unknown and un-optimizable at compile time. For arrays, there are two possibilities: a) make the indexee (the array's address) a variable, or b) make the 'constant' index a variable. Thus: extern type extern_array[]; extern_array[1] --> { volatile type *t=extern_array; t[1] } or extern type extern_array[]; extern_array[1] --> { volatile int t=1; extern_array[t] } For structs (and most other multiword data types) the only option is to make the struct itself (or the long long, or the ...) variable: extern struct s extern_struct; extern_struct.field --> { volatile struct s *t=&extern_struct; t->field } or extern long long extern_ll; extern_ll --> { volatile long long * local_ll=&extern_ll; *local_ll } A third method of dealing with this difficulty is to abandon 'auto-import' for the offending symbol and mark it with "__declspec(dllimport)". However, in practice that requires using compile-time #defines to indicate whether you are building a DLL, building client code that will link to the DLL, or merely building/linking to a static library. In making the choice between the various methods of resolving the 'direct address with constant offset' problem, you should consider typical real-world usage: Original: --foo.h extern int arr[]; --foo.c #include "foo.h" void main(int argc, char **argv){ printf("%d\n",arr[1]); } Solution 1: --foo.h extern int arr[]; --foo.c #include "foo.h" void main(int argc, char **argv){ /* This workaround is for win32 and cygwin; do not "optimize" */ volatile int *parr = arr; printf("%d\n",parr[1]); } Solution 2: --foo.h /* Note: auto-export is assumed (no __declspec(dllexport)) */ #if (defined(_WIN32) || defined(__CYGWIN__)) && \ !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC)) #define FOO_IMPORT __declspec(dllimport) #else #define FOO_IMPORT #endif extern FOO_IMPORT int arr[]; --foo.c #include "foo.h" void main(int argc, char **argv){ printf("%d\n",arr[1]); } A fourth way to avoid this problem is to re-code your library to use a functional interface rather than a data interface for the offending variables (e.g. set_foo() and get_foo() accessor functions). --disable-auto-import Do not attempt to do sophisticated linking of "_symbol" to "__imp__symbol" for DATA imports from DLLs. [This option is specific to the i386 PE targeted port of the linker] --enable-runtime-pseudo-reloc If your code contains expressions described in --enable-auto-import section, that is, DATA imports from DLL with non-zero offset, this switch will create a vector of 'runtime pseudo relocations' which can be used by runtime environment to adjust references to such data in your client code. [This option is specific to the i386 PE targeted port of the linker] --disable-runtime-pseudo-reloc Do not create pseudo relocations for non-zero offset DATA imports from DLLs. [This option is specific to the i386 PE targeted port of the linker] --enable-extra-pe-debug Show additional debug info related to auto-import symbol thunking. [This option is specific to the i386 PE targeted port of the linker] --section-alignment Sets the section alignment. Sections in memory will always begin at addresses which are a multiple of this number. Defaults to 0x1000. [This option is specific to the i386 PE targeted port of the linker] --stack reserve --stack reserve,commit Specify the number of bytes of memory to reserve (and optionally commit) to be used as stack for this program. The default is 2MB reserved, 4K committed. [This option is specific to the i386 PE targeted port of the linker] --subsystem which --subsystem which:major --subsystem which:major.minor Specifies the subsystem under which your program will execute. The legal values for which are "native", "windows", "console", "posix", and "xbox". You may optionally set the subsystem version also. Numeric values are also accepted for which. [This option is specific to the i386 PE targeted port of the linker] The following options set flags in the "DllCharacteristics" field of the PE file header: [These options are specific to PE targeted ports of the linker] --high-entropy-va --disable-high-entropy-va Image is compatible with 64-bit address space layout randomization (ASLR). This option is enabled by default for 64-bit PE images. This option also implies --dynamicbase and --enable-reloc-section. --dynamicbase --disable-dynamicbase The image base address may be relocated using address space layout randomization (ASLR). This feature was introduced with MS Windows Vista for i386 PE targets. This option is enabled by default but can be disabled via the --disable-dynamicbase option. This option also implies --enable-reloc-section. --forceinteg --disable-forceinteg Code integrity checks are enforced. This option is disabled by default. --nxcompat --disable-nxcompat The image is compatible with the Data Execution Prevention. This feature was introduced with MS Windows XP SP2 for i386 PE targets. The option is enabled by default. --no-isolation --disable-no-isolation Although the image understands isolation, do not isolate the image. This option is disabled by default. --no-seh --disable-no-seh The image does not use SEH. No SE handler may be called from this image. This option is disabled by default. --no-bind --disable-no-bind Do not bind this image. This option is disabled by default. --wdmdriver --disable-wdmdriver The driver uses the MS Windows Driver Model. This option is disabled by default. --tsaware --disable-tsaware The image is Terminal Server aware. This option is disabled by default. --insert-timestamp --no-insert-timestamp Insert a real timestamp into the image. This is the default behaviour as it matches legacy code and it means that the image will work with other, proprietary tools. The problem with this default is that it will result in slightly different images being produced each time the same sources are linked. The option --no-insert-timestamp can be used to insert a zero value for the timestamp, this ensuring that binaries produced from identical sources will compare identically. --enable-reloc-section --disable-reloc-section Create the base relocation table, which is necessary if the image is loaded at a different image base than specified in the PE header. This option is enabled by default. The C6X uClinux target uses a binary format called DSBT to support shared libraries. Each shared library in the system needs to have a unique index; all executables use an index of 0. --dsbt-size size This option sets the number of entries in the DSBT of the current executable or shared library to size. The default is to create a table with 64 entries. --dsbt-index index This option sets the DSBT index of the current executable or shared library to index. The default is 0, which is appropriate for generating executables. If a shared library is generated with a DSBT index of 0, the "R_C6000_DSBT_INDEX" relocs are copied into the output file. The --no-merge-exidx-entries switch disables the merging of adjacent exidx entries in frame unwind info. --branch-stub This option enables linker branch relaxation by inserting branch stub sections when needed to extend the range of branches. This option is usually not required since C-SKY supports branch and call instructions that can access the full memory range and branch relaxation is normally handled by the compiler or assembler. --stub-group-size=N This option allows finer control of linker branch stub creation. It sets the maximum size of a group of input sections that can be handled by one stub section. A negative value of N locates stub sections after their branches, while a positive value allows stub sections to appear either before or after the branches. Values of 1 or -1 indicate that the linker should choose suitable defaults. The 68HC11 and 68HC12 linkers support specific options to control the memory bank switching mapping and trampoline code generation. --no-trampoline This option disables the generation of trampoline. By default a trampoline is generated for each far function which is called using a "jsr" instruction (this happens when a pointer to a far function is taken). --bank-window name This option indicates to the linker the name of the memory region in the MEMORY specification that describes the memory bank window. The definition of such region is then used by the linker to compute paging and addresses within the memory window. The following options are supported to control handling of GOT generation when linking for 68K targets. --got=type This option tells the linker which GOT generation scheme to use. type should be one of single, negative, multigot or target. For more information refer to the Info entry for ld. The following options are supported to control microMIPS instruction generation and branch relocation checks for ISA mode transitions when linking for MIPS targets. --insn32 --no-insn32 These options control the choice of microMIPS instructions used in code generated by the linker, such as that in the PLT or lazy binding stubs, or in relaxation. If --insn32 is used, then the linker only uses 32-bit instruction encodings. By default or if --no-insn32 is used, all instruction encodings are used, including 16-bit ones where possible. --ignore-branch-isa --no-ignore-branch-isa These options control branch relocation checks for invalid ISA mode transitions. If --ignore-branch-isa is used, then the linker accepts any branch relocations and any ISA mode transition required is lost in relocation calculation, except for some cases of "BAL" instructions which meet relaxation conditions and are converted to equivalent "JALX" instructions as the associated relocation is calculated. By default or if --no-ignore-branch-isa is used a check is made causing the loss of an ISA mode transition to produce an error. --compact-branches --no-compact-branches These options control the generation of compact instructions by the linker in the PLT entries for MIPS R6. For the pdp11-aout target, three variants of the output format can be produced as selected by the following options. The default variant for pdp11-aout is the --omagic option, whereas for other targets --nmagic is the default. The --imagic option is defined only for the pdp11-aout target, while the others are described here as they apply to the pdp11-aout target. -N --omagic Mark the output as "OMAGIC" (0407) in the a.out header to indicate that the text segment is not to be write-protected and shared. Since the text and data sections are both readable and writable, the data section is allocated immediately contiguous after the text segment. This is the oldest format for PDP11 executable programs and is the default for ld on PDP11 Unix systems from the beginning through 2.11BSD. -n --nmagic Mark the output as "NMAGIC" (0410) in the a.out header to indicate that when the output file is executed, the text portion will be read-only and shareable among all processes executing the same file. This involves moving the data areas up to the first possible 8K byte page boundary following the end of the text. This option creates a pure executable format. -z --imagic Mark the output as "IMAGIC" (0411) in the a.out header to indicate that when the output file is executed, the program text and data areas will be loaded into separate address spaces using the split instruction and data space feature of the memory management unit in larger models of the PDP11. This doubles the address space available to the program. The text segment is again pure, write-protected, and shareable. The only difference in the output format between this option and the others, besides the magic number, is that both the text and data sections start at location 0. The -z option selected this format in 2.11BSD. This option creates a separate executable format. --no-omagic Equivalent to --nmagic for pdp11-aout. ENVIRONMENT top You can change the behaviour of ld with the environment variables "GNUTARGET", "LDEMULATION" and "COLLECT_NO_DEMANGLE". "GNUTARGET" determines the input-file object format if you don't use -b (or its synonym --format). Its value should be one of the BFD names for an input format. If there is no "GNUTARGET" in the environment, ld uses the natural format of the target. If "GNUTARGET" is set to "default" then BFD attempts to discover the input format by examining binary input files; this method often succeeds, but there are potential ambiguities, since there is no method of ensuring that the magic number used to specify object- file formats is unique. However, the configuration procedure for BFD on each system places the conventional format for that system first in the search-list, so ambiguities are resolved in favor of convention. "LDEMULATION" determines the default emulation if you don't use the -m option. The emulation can affect various aspects of linker behaviour, particularly the default linker script. You can list the available emulations with the --verbose or -V options. If the -m option is not used, and the "LDEMULATION" environment variable is not defined, the default emulation depends upon how the linker was configured. Normally, the linker will default to demangling symbols. However, if "COLLECT_NO_DEMANGLE" is set in the environment, then it will default to not demangling symbols. This environment variable is used in a similar fashion by the "gcc" linker wrapper program. The default may be overridden by the --demangle and --no-demangle options. SEE ALSO top ar(1), nm(1), objcopy(1), objdump(1), readelf(1) and the Info entries for binutils and ld. COPYRIGHT top Copyright (c) 1991-2023 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". COLOPHON top This page is part of the binutils (a collection of tools for working with executable binaries) project. Information about the project can be found at http://www.gnu.org/software/binutils/. If you have a bug report for this manual page, see http://sourceware.org/bugzilla/enter_bug.cgi?product=binutils. This page was obtained from the tarball binutils-2.41.tar.gz fetched from https://ftp.gnu.org/gnu/binutils/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] binutils-2.41 2023-07-30 LD(1) Pages that refer to this page: as(1), objcopy(1), uselib(2), backtrace(3), dlopen(3), elf(5), ld.so(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ld\n\n> Link object files together.\n> More information: <https://sourceware.org/binutils/docs-2.38/ld.html>.\n\n- Link a specific object file with no dependencies into an executable:\n\n`ld {{path/to/file.o}} --output {{path/to/output_executable}}`\n\n- Link two object files together:\n\n`ld {{path/to/file1.o}} {{path/to/file2.o}} --output {{path/to/output_executable}}`\n\n- Dynamically link an x86_64 program to glibc (file paths change depending on the system):\n\n`ld --output {{path/to/output_executable}} --dynamic-linker /lib/ld-linux-x86-64.so.2 /lib/crt1.o /lib/crti.o -lc {{path/to/file.o}} /lib/crtn.o`\n
ldapsearch
ldapsearch(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ldapsearch(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OUTPUT FORMAT | EXAMPLE | DIAGNOSTICS | SEE ALSO | AUTHOR | ACKNOWLEDGEMENTS | COLOPHON LDAPSEARCH(1) General Commands Manual LDAPSEARCH(1) NAME top ldapsearch - LDAP search tool SYNOPSIS top ldapsearch [-V[V]] [-d debuglevel] [-n] [-v] [-c] [-u] [-t[t]] [-T path] [-F prefix] [-A] [-L[L[L]]] [-S attribute] [-b searchbase] [-s {base|one|sub|children}] [-a {never|always|search|find}] [-l timelimit] [-z sizelimit] [-f file] [-M[M]] [-x] [-D binddn] [-W] [-w passwd] [-y passwdfile] [-H ldapuri] [-P {2|3}] [-e [!]ext[=extparam]] [-E [!]ext[=extparam]] [-o opt[=optparam]] [-O security- properties] [-I] [-Q] [-N] [-U authcid] [-R realm] [-X authzid] [-Y mech] [-Z[Z]] filter [attrs...] DESCRIPTION top ldapsearch is a shell-accessible interface to the ldap_search_ext(3) library call. ldapsearch opens a connection to an LDAP server, binds, and performs a search using specified parameters. The filter should conform to the string representation for search filters as defined in RFC 4515. If not provided, the default filter, (objectClass=*), is used. If ldapsearch finds one or more entries, the attributes specified by attrs are returned. If * is listed, all user attributes are returned. If + is listed, all operational attributes are returned. If no attrs are listed, all user attributes are returned. If only 1.1 is listed, no attributes will be returned. The search results are displayed using an extended version of LDIF. Option -L controls the format of the output. OPTIONS top -V[V] Print version info. If -VV is given, exit after providing version info. Otherwise proceed with the specified search -d debuglevel Set the LDAP debugging level to debuglevel. ldapsearch must be compiled with LDAP_DEBUG defined for this option to have any effect. -n Show what would be done, but don't actually perform the search. Useful for debugging in conjunction with -v. -v Run in verbose mode, with many diagnostics written to standard output. -c Continuous operation mode. Errors are reported, but ldapsearch will continue with searches. The default is to exit after reporting an error. Only useful in conjunction with -f. -u Include the User Friendly Name form of the Distinguished Name (DN) in the output. -t[t] A single -t writes retrieved non-printable values to a set of temporary files. This is useful for dealing with values containing non-character data such as jpegPhoto or audio. A second -t writes all retrieved values to files. -T path Write temporary files to directory specified by path (default: system default tmp directory). The environment variables TMPDIR, TMP, or TEMP will override the default path. -F prefix URL prefix for temporary files. Default is file://path where path is the system default tmp directory or the value specified with -T. -A Retrieve attributes only (no values). This is useful when you just want to see if an attribute is present in an entry and are not interested in the specific values. -L Search results are display in LDAP Data Interchange Format detailed in ldif(5). A single -L restricts the output to LDIFv1. A second -L disables comments. A third -L disables printing of the LDIF version. The default is to use an extended version of LDIF. -S attribute Sort the entries returned based on attribute. The default is not to sort entries returned. If attribute is a zero- length string (""), the entries are sorted by the components of their Distinguished Name. See ldap_sort(3) for more details. Note that ldapsearch normally prints out entries as it receives them. The use of the -S option defeats this behavior, causing all entries to be retrieved, then sorted, then printed. -b searchbase Use searchbase as the starting point for the search instead of the default. -s {base|one|sub|children} Specify the scope of the search to be one of base, one, sub, or children to specify a base object, one-level, subtree, or children search. The default is sub. Note: children scope requires LDAPv3 subordinate feature extension. -a {never|always|search|find} Specify how aliases dereferencing is done. Should be one of never, always, search, or find to specify that aliases are never dereferenced, always dereferenced, dereferenced when searching, or dereferenced only when locating the base object for the search. The default is to never dereference aliases. -l timelimit wait at most timelimit seconds for a search to complete. A timelimit of 0 (zero) or none means no limit. A timelimit of max means the maximum integer allowable by the protocol. A server may impose a maximal timelimit which only the root user may override. -z sizelimit retrieve at most sizelimit entries for a search. A sizelimit of 0 (zero) or none means no limit. A sizelimit of max means the maximum integer allowable by the protocol. A server may impose a maximal sizelimit which only the root user may override. -f file Read a series of lines from file, performing one LDAP search for each line. In this case, the filter given on the command line is treated as a pattern where the first and only occurrence of %s is replaced with a line from file. Any other occurrence of the the % character in the pattern will be regarded as an error. Where it is desired that the search filter include a % character, the character should be encoded as \25 (see RFC 4515). If file is a single - character, then the lines are read from standard input. ldapsearch will exit when the first non- successful search result is returned, unless -c is used. -M[M] Enable manage DSA IT control. -MM makes control critical. -x Use simple authentication instead of SASL. -D binddn Use the Distinguished Name binddn to bind to the LDAP directory. For SASL binds, the server is expected to ignore this value. -W Prompt for simple authentication. This is used instead of specifying the password on the command line. -w passwd Use passwd as the password for simple authentication. -y passwdfile Use complete contents of passwdfile as the password for simple authentication. -H ldapuri Specify URI(s) referring to the ldap server(s); a list of URI, separated by whitespace or commas is expected; only the protocol/host/port fields are allowed. As an exception, if no host/port is specified, but a DN is, the DN is used to look up the corresponding host(s) using the DNS SRV records, according to RFC 2782. The DN must be a non-empty sequence of AVAs whose attribute type is "dc" (domain component), and must be escaped according to RFC 2396. -P {2|3} Specify the LDAP protocol version to use. -e [!]ext[=extparam] -E [!]ext[=extparam] Specify general extensions with -e and search extensions with -E. ! indicates criticality. General extensions: [!]assert=<filter> (an RFC 4515 Filter) !authzid=<authzid> ("dn:<dn>" or "u:<user>") [!]bauthzid (RFC 3829 authzid control) [!]chaining[=<resolve>[/<cont>]] [!]manageDSAit [!]noop ppolicy [!]postread[=<attrs>] (a comma-separated attribute list) [!]preread[=<attrs>] (a comma-separated attribute list) [!]relax sessiontracking[=<username>] abandon,cancel,ignore (SIGINT sends abandon/cancel, or ignores response; if critical, doesn't wait for SIGINT. not really controls) Search extensions: !dontUseCopy [!]domainScope (domain scope) [!]mv=<filter> (matched values filter) [!]pr=<size>[/prompt|noprompt] (paged results/prompt) [!]sss=[-]<attr[:OID]>[/[-]<attr[:OID]>...] (server side sorting) [!]subentries[=true|false] (subentries) [!]sync=ro[/<cookie>] (LDAP Sync refreshOnly) rp[/<cookie>][/<slimit>] (LDAP Sync refreshAndPersist) [!]vlv=<before>/<after>(/<offset>/<count>|:<value>) (virtual list view) [!]deref=derefAttr:attr[,attr[...]][;derefAttr:attr[,attr[...]]] [!]<oid>[=:<value>|::<b64value>] -o opt[=optparam] Specify any ldap.conf(5) option or one of the following: nettimeout=<timeout> (in seconds, or "none" or "max") ldif_wrap=<width> (in columns, or "no" for no wrapping) -O security-properties Specify SASL security properties. -I Enable SASL Interactive mode. Always prompt. Default is to prompt only as needed. -Q Enable SASL Quiet mode. Never prompt. -N Do not use reverse DNS to canonicalize SASL host name. -U authcid Specify the authentication ID for SASL bind. The form of the ID depends on the actual SASL mechanism used. -R realm Specify the realm of authentication ID for SASL bind. The form of the realm depends on the actual SASL mechanism used. -X authzid Specify the requested authorization ID for SASL bind. authzid must be one of the following formats: dn:<distinguished name> or u:<username> -Y mech Specify the SASL mechanism to be used for authentication. If it's not specified, the program will choose the best mechanism the server knows. -Z[Z] Issue StartTLS (Transport Layer Security) extended operation. If you use -ZZ, the command will require the operation to be successful. OUTPUT FORMAT top If one or more entries are found, each entry is written to standard output in LDAP Data Interchange Format or ldif(5): version: 1 # bjensen, example, net dn: uid=bjensen,dc=example,dc=net objectClass: person objectClass: dcObject uid: bjensen cn: Barbara Jensen sn: Jensen ... If the -t option is used, the URI of a temporary file is used in place of the actual value. If the -A option is given, only the "attributename" part is written. EXAMPLE top The following command: ldapsearch -LLL "(sn=smith)" cn sn telephoneNumber will perform a subtree search (using the default search base and other parameters defined in ldap.conf(5)) for entries with a surname (sn) of smith. The common name (cn), surname (sn) and telephoneNumber values will be retrieved and printed to standard output. The output might look something like this if two entries are found: dn: uid=jts,dc=example,dc=com cn: John Smith cn: John T. Smith sn: Smith sn;lang-en: Smith sn;lang-de: Schmidt telephoneNumber: 1 555 123-4567 dn: uid=sss,dc=example,dc=com cn: Steve Smith cn: Steve S. Smith sn: Smith sn;lang-en: Smith sn;lang-de: Schmidt telephoneNumber: 1 555 765-4321 The command: ldapsearch -LLL -u -t "(uid=xyz)" jpegPhoto audio will perform a subtree search using the default search base for entries with user id of "xyz". The user friendly form of the entry's DN will be output after the line that contains the DN itself, and the jpegPhoto and audio values will be retrieved and written to temporary files. The output might look like this if one entry with one value for each of the requested attributes is found: dn: uid=xyz,dc=example,dc=com ufn: xyz, example, com audio:< file:///tmp/ldapsearch-audio-a19924 jpegPhoto:< file:///tmp/ldapsearch-jpegPhoto-a19924 This command: ldapsearch -LLL -s one -b "c=US" "(o=University*)" o description will perform a one-level search at the c=US level for all entries whose organization name (o) begins with University. The organization name and description attribute values will be retrieved and printed to standard output, resulting in output similar to this: dn: o=University of Alaska Fairbanks,c=US o: University of Alaska Fairbanks description: Naturally Inspiring description: leaf node only dn: o=University of Colorado at Boulder,c=US o: University of Colorado at Boulder description: No personnel information description: Institution of education and research dn: o=University of Colorado at Denver,c=US o: University of Colorado at Denver o: UCD o: CU/Denver o: CU-Denver description: Institute for Higher Learning and Research dn: o=University of Florida,c=US o: University of Florida o: UFl description: Warper of young minds ... DIAGNOSTICS top Exit status is zero if no errors occur. Errors result in a non- zero exit status and a diagnostic message being written to standard error. SEE ALSO top ldapadd(1), ldapdelete(1), ldapmodify(1), ldapmodrdn(1), ldap.conf(5), ldif(5), ldap(3), ldap_search_ext(3), ldap_sort(3) AUTHOR top The OpenLDAP Project <http://www.openldap.org/> ACKNOWLEDGEMENTS top OpenLDAP Software is developed and maintained by The OpenLDAP Project <http://www.openldap.org/>. OpenLDAP Software is derived from the University of Michigan LDAP 3.3 Release. COLOPHON top This page is part of the OpenLDAP (an open source implementation of the Lightweight Directory Access Protocol) project. Information about the project can be found at http://www.openldap.org/. If you have a bug report for this manual page, see http://www.openldap.org/its/. This page was obtained from the project's upstream Git repository https://git.openldap.org/openldap/openldap.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-19.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] OpenLDAP LDVERSION RELEASEDATE LDAPSEARCH(1) Pages that refer to this page: ldapdelete(1), ldapmodify(1), ldapmodrdn(1), pmdads389(1), ldap.conf(5), ldif(5), slapo-valsort(5) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ldapsearch\n\n> Query an LDAP directory.\n> More information: <https://docs.ldap.com/ldap-sdk/docs/tool-usages/ldapsearch.html>.\n\n- Query an LDAP server for all items that are a member of the given group and return the object's displayName value:\n\n`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} -b {{base_ou}} '{{memberOf=group1}}' displayName`\n\n- Query an LDAP server with a no-newline password file for all items that are a member of the given group and return the object's displayName value:\n\n`ldapsearch -D '{{admin_DN}}' -y '{{password_file}}' -h {{ldap_host}} -b {{base_ou}} '{{memberOf=group1}}' displayName`\n\n- Return 5 items that match the given filter:\n\n`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} -b {{base_ou}} '{{memberOf=group1}}' -z 5 displayName`\n\n- Wait up to 7 seconds for a response:\n\n`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} -b {{base_ou}} '{{memberOf=group1}}' -l 7 displayName`\n\n- Invert the filter:\n\n`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} -b {{base_ou}} '(!(memberOf={{group1}}))' displayName`\n\n- Return all items that are part of multiple groups, returning the display name for each item:\n\n`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} '(&({{memberOf=group1}})({{memberOf=group2}})({{memberOf=group3}}))' "displayName"`\n\n- Return all items that are members of at least 1 of the specified groups:\n\n`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} '(|({{memberOf=group1}})({{memberOf=group1}})({{memberOf=group3}}))' displayName`\n\n- Combine multiple boolean logic filters:\n\n`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} '(&({{memberOf=group1}})({{memberOf=group2}})(!({{memberOf=group3}})))' displayName`\n
ldconfig
ldconfig(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ldconfig(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | FILES | SEE ALSO ldconfig(8) System Manager's Manual ldconfig(8) NAME top ldconfig - configure dynamic linker run-time bindings SYNOPSIS top /sbin/ldconfig [-nNvVX] [-C cache] [-f conf] [-r root] directory ... /sbin/ldconfig -l [-v] library ... /sbin/ldconfig -p DESCRIPTION top ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories, /lib and /usr/lib. On some 64-bit architectures such as x86-64, /lib and /usr/lib are the trusted directories for 32-bit libraries, while /lib64 and /usr/lib64 are used for 64-bit libraries. The cache is used by the run-time linker, ld.so or ld-linux.so. ldconfig checks the header and filenames of the libraries it encounters when determining which versions should have their links updated. ldconfig should normally be run by the superuser as it may require write permission on some root owned directories and files. ldconfig will look only at files that are named lib*.so* (for regular shared objects) or ld-*.so* (for the dynamic loader itself). Other files will be ignored. Also, ldconfig expects a certain pattern to how the symbolic links are set up, like this example, where the middle file (libfoo.so.1 here) is the SONAME for the library: libfoo.so -> libfoo.so.1 -> libfoo.so.1.12 Failure to follow this pattern may result in compatibility issues after an upgrade. OPTIONS top -c fmt --format=fmt (Since glibc 2.2) Use cache format fmt, which is one of old, new, or compat. Since glibc 2.32, the default is new. Before that, it was compat. -C cache Use cache instead of /etc/ld.so.cache. -f conf Use conf instead of /etc/ld.so.conf. -i --ignore-aux-cache (Since glibc 2.7) Ignore auxiliary cache file. -l (Since glibc 2.2) Interpret each operand as a library name and configure its links. Intended for use only by experts. -n Process only the directories specified on the command line; don't process the trusted directories, nor those specified in /etc/ld.so.conf. Implies -N. -N Don't rebuild the cache. Unless -X is also specified, links are still updated. -p --print-cache Print the lists of directories and candidate libraries stored in the current cache. -r root Change to and use root as the root directory. -v --verbose Verbose mode. Print current version number, the name of each directory as it is scanned, and any links that are created. Overrides quiet mode. -V --version Print program version. -X Don't update links. Unless -N is also specified, the cache is still rebuilt. FILES top /lib/ld.so is the run-time linker/loader. /etc/ld.so.conf contains a list of directories, one per line, in which to search for libraries. /etc/ld.so.cache contains an ordered list of libraries found in the directories specified in /etc/ld.so.conf, as well as those found in the trusted directories. SEE ALSO top ldd(1), ld.so(8) Linux man-pages (unreleased) (date) ldconfig(8) Pages that refer to this page: dpkg-divert(1), ldd(1), dlopen(3), rtld-audit(7), ld.so(8), sln(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ldconfig\n\n> Configure symlinks and cache for shared library dependencies.\n> More information: <https://manned.org/ldconfig>.\n\n- Update symlinks and rebuild the cache (usually run when a new library is installed):\n\n`sudo ldconfig`\n\n- Update the symlinks for a given directory:\n\n`sudo ldconfig -n {{path/to/directory}}`\n\n- Print the libraries in the cache and check whether a given library is present:\n\n`ldconfig -p | grep {{library_name}}`\n
ldd
ldd(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ldd(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | BUGS | SEE ALSO ldd(1) General Commands Manual ldd(1) NAME top ldd - print shared object dependencies SYNOPSIS top ldd [option]... file... DESCRIPTION top ldd prints the shared objects (shared libraries) required by each program or shared object specified on the command line. An example of its use and output is the following: $ ldd /bin/ls linux-vdso.so.1 (0x00007ffcc3563000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f87e5459000) libcap.so.2 => /lib64/libcap.so.2 (0x00007f87e5254000) libc.so.6 => /lib64/libc.so.6 (0x00007f87e4e92000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f87e4c22000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f87e4a1e000) /lib64/ld-linux-x86-64.so.2 (0x00005574bf12e000) libattr.so.1 => /lib64/libattr.so.1 (0x00007f87e4817000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f87e45fa000) In the usual case, ldd invokes the standard dynamic linker (see ld.so(8)) with the LD_TRACE_LOADED_OBJECTS environment variable set to 1. This causes the dynamic linker to inspect the program's dynamic dependencies, and find (according to the rules described in ld.so(8)) and load the objects that satisfy those dependencies. For each dependency, ldd displays the location of the matching object and the (hexadecimal) address at which it is loaded. (The linux-vdso and ld-linux shared dependencies are special; see vdso(7) and ld.so(8).) Security Be aware that in some circumstances (e.g., where the program specifies an ELF interpreter other than ld-linux.so), some versions of ldd may attempt to obtain the dependency information by attempting to directly execute the program, which may lead to the execution of whatever code is defined in the program's ELF interpreter, and perhaps to execution of the program itself. (Before glibc 2.27, the upstream ldd implementation did this for example, although most distributions provided a modified version that did not.) Thus, you should never employ ldd on an untrusted executable, since this may result in the execution of arbitrary code. A safer alternative when dealing with untrusted executables is: $ objdump -p /path/to/program | grep NEEDED Note, however, that this alternative shows only the direct dependencies of the executable, while ldd shows the entire dependency tree of the executable. OPTIONS top --version Print the version number of ldd. -v, --verbose Print all information, including, for example, symbol versioning information. -u, --unused Print unused direct dependencies. (Since glibc 2.3.4.) -d, --data-relocs Perform relocations and report any missing objects (ELF only). -r, --function-relocs Perform relocations for both data objects and functions, and report any missing objects or functions (ELF only). --help Usage information. BUGS top ldd does not work on a.out shared libraries. ldd does not work with some extremely old a.out programs which were built before ldd support was added to the compiler releases. If you use ldd on one of these programs, the program will attempt to run with argc = 0 and the results will be unpredictable. SEE ALSO top pldd(1), sprof(1), ld.so(8), ldconfig(8) Linux man-pages (unreleased) (date) ldd(1) Pages that refer to this page: pldd(1), sprof(1), uselib(2), dl_iterate_phdr(3), dlopen(3), babeltrace2-filter.lttng-utils.debug-info(7), rtld-audit(7), vdso(7), ldconfig(8), ld.so(8), prelink(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ldd\n\n> Display shared library dependencies of a binary.\n> Do not use on an untrusted binary, use objdump for that instead.\n> More information: <https://manned.org/ldd>.\n\n- Display shared library dependencies of a binary:\n\n`ldd {{path/to/binary}}`\n\n- Display all information about dependencies:\n\n`ldd --verbose {{path/to/binary}}`\n\n- Display unused direct dependencies:\n\n`ldd --unused {{path/to/binary}}`\n\n- Report missing data objects and perform data relocations:\n\n`ldd --data-relocs {{path/to/binary}}`\n\n- Report missing data objects and functions, and perform relocations for both:\n\n`ldd --function-relocs {{path/to/binary}}`\n
less
less(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training less(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | COMMANDS | OPTIONS | LINE EDITING | KEY BINDINGS | INPUT PREPROCESSOR | NATIONAL CHARACTER SETS | PROMPTS | SECURITY | COMPATIBILITY WITH MORE | ENVIRONMENT VARIABLES | SEE ALSO | COPYRIGHT | AUTHOR | COLOPHON LESS(1) General Commands Manual LESS(1) NAME top less - opposite of more SYNOPSIS top less -? less --help less -V less --version less [-[+]aABcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~] [-b space] [-h lines] [-j line] [-k keyfile] [-{oO} logfile] [-p pattern] [-P prompt] [-t tag] [-T tagsfile] [-x tab,...] [-y lines] [-[z] lines] [-# shift] [+[+]cmd] [--] [filename]... (See the OPTIONS section for alternate option syntax with long option names.) DESCRIPTION top Less is a program similar to more(1), but which allows backward movement in the file as well as forward movement. Also, less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like vi(1). Less uses termcap (or terminfo on some systems), so it can run on a variety of terminals. There is even limited support for hardcopy terminals. (On a hardcopy terminal, lines which should be printed at the top of the screen are prefixed with a caret.) Commands are based on both more and vi. Commands may be preceded by a decimal number, called N in the descriptions below. The number is used by some commands, as indicated. COMMANDS top In the following descriptions, ^X means control-X. ESC stands for the ESCAPE key; for example ESC-v means the two character sequence "ESCAPE", then "v". h or H Help: display a summary of these commands. If you forget all the other commands, remember this one. SPACE or ^V or f or ^F Scroll forward N lines, default one window (see option -z below). If N is more than the screen size, only the final screenful is displayed. Warning: some systems use ^V as a special literalization character. z Like SPACE, but if N is specified, it becomes the new window size. ESC-SPACE Like SPACE, but scrolls a full screenful, even if it reaches end-of-file in the process. ENTER or RETURN or ^N or e or ^E or j or ^J Scroll forward N lines, default 1. The entire N lines are displayed, even if N is more than the screen size. d or ^D Scroll forward N lines, default one half of the screen size. If N is specified, it becomes the new default for subsequent d and u commands. b or ^B or ESC-v Scroll backward N lines, default one window (see option -z below). If N is more than the screen size, only the final screenful is displayed. w Like ESC-v, but if N is specified, it becomes the new window size. y or ^Y or ^P or k or ^K Scroll backward N lines, default 1. The entire N lines are displayed, even if N is more than the screen size. Warning: some systems use ^Y as a special job control character. u or ^U Scroll backward N lines, default one half of the screen size. If N is specified, it becomes the new default for subsequent d and u commands. J Like j, but continues to scroll beyond the end of the file. K or Y Like k, but continues to scroll beyond the beginning of the file. ESC-) or RIGHTARROW Scroll horizontally right N characters, default half the screen width (see the -# option). If a number N is specified, it becomes the default for future RIGHTARROW and LEFTARROW commands. While the text is scrolled, it acts as though the -S option (chop lines) were in effect. ESC-( or LEFTARROW Scroll horizontally left N characters, default half the screen width (see the -# option). If a number N is specified, it becomes the default for future RIGHTARROW and LEFTARROW commands. ESC-} or ^RIGHTARROW Scroll horizontally right to show the end of the longest displayed line. ESC-{ or ^LEFTARROW Scroll horizontally left back to the first column. r or ^R or ^L Repaint the screen. R Repaint the screen, discarding any buffered input. That is, reload the current file. Useful if the file is changing while it is being viewed. F Scroll forward, and keep trying to read when the end of file is reached. Normally this command would be used when already at the end of the file. It is a way to monitor the tail of a file which is growing while it is being viewed. (The behavior is similar to the "tail -f" command.) To stop waiting for more data, enter the interrupt character (usually ^C). On systems which support poll(2) you can also use ^X or the character specified by the --intr option. If the input is a pipe and the --exit-follow-on-close option is in effect, less will automatically stop waiting for data when the input side of the pipe is closed. ESC-F Like F, but as soon as a line is found which matches the last search pattern, the terminal bell is rung and forward scrolling stops. g or < or ESC-< Go to line N in the file, default 1 (beginning of file). (Warning: this may be slow if N is large.) G or > or ESC-> Go to line N in the file, default the end of the file. (Warning: this may be slow if N is large, or if N is not specified and standard input, rather than a file, is being read.) ESC-G Same as G, except if no number N is specified and the input is standard input, goes to the last line which is currently buffered. p or % Go to a position N percent into the file. N should be between 0 and 100, and may contain a decimal point. P Go to the line containing byte offset N in the file. { If a left curly bracket appears in the top line displayed on the screen, the { command will go to the matching right curly bracket. The matching right curly bracket is positioned on the bottom line of the screen. If there is more than one left curly bracket on the top line, a number N may be used to specify the N-th bracket on the line. } If a right curly bracket appears in the bottom line displayed on the screen, the } command will go to the matching left curly bracket. The matching left curly bracket is positioned on the top line of the screen. If there is more than one right curly bracket on the bottom line, a number N may be used to specify the N-th bracket on the line. ( Like {, but applies to parentheses rather than curly brackets. ) Like }, but applies to parentheses rather than curly brackets. [ Like {, but applies to square brackets rather than curly brackets. ] Like }, but applies to square brackets rather than curly brackets. ESC-^F Followed by two characters, acts like {, but uses the two characters as open and close brackets, respectively. For example, "ESC ^F < >" could be used to go forward to the > which matches the < in the top displayed line. ESC-^B Followed by two characters, acts like }, but uses the two characters as open and close brackets, respectively. For example, "ESC ^B < >" could be used to go backward to the < which matches the > in the bottom displayed line. m Followed by any lowercase or uppercase letter, marks the first displayed line with that letter. If the status column is enabled via the -J option, the status column shows the marked line. M Acts like m, except the last displayed line is marked rather than the first displayed line. ' (Single quote.) Followed by any lowercase or uppercase letter, returns to the position which was previously marked with that letter. Followed by another single quote, returns to the position at which the last "large" movement command was executed. Followed by a ^ or $, jumps to the beginning or end of the file respectively. Marks are preserved when a new file is examined, so the ' command can be used to switch between input files. ^X^X Same as single quote. ESC-m Followed by any lowercase or uppercase letter, clears the mark identified by that letter. /pattern Search forward in the file for the N-th line containing the pattern. N defaults to 1. The pattern is a regular expression, as recognized by the regular expression library supplied by your system. By default, searching is case-sensitive (uppercase and lowercase are considered different); the -i option can be used to change this. The search starts at the first line displayed (but see the -a and -j options, which change this). Certain characters are special if entered at the beginning of the pattern; they modify the type of search rather than become part of the pattern: ^N or ! Search for lines which do NOT match the pattern. ^E or * Search multiple files. That is, if the search reaches the END of the current file without finding a match, the search continues in the next file in the command line list. ^F or @ Begin the search at the first line of the FIRST file in the command line list, regardless of what is currently displayed on the screen or the settings of the -a or -j options. ^K Highlight any text which matches the pattern on the current screen, but don't move to the first match (KEEP current position). ^R Don't interpret regular expression metacharacters; that is, do a simple textual comparison. ^S Followed by a digit N between 1 and 5. Only text which has a non-empty match for the N-th parenthesized SUB-PATTERN will be considered to match the pattern. (Supported only if less is built with one of the regular expression libraries posix, pcre, or pcre2.) Multiple ^S modifiers can be specified, to match more than one sub-pattern. ^W WRAP around the current file. That is, if the search reaches the end of the current file without finding a match, the search continues from the first line of the current file up to the line where it started. If the ^W modifier is set, the ^E modifier is ignored. ?pattern Search backward in the file for the N-th line containing the pattern. The search starts at the last line displayed (but see the -a and -j options, which change this). Certain characters are special as in the / command: ^N or ! Search for lines which do NOT match the pattern. ^E or * Search multiple files. That is, if the search reaches the beginning of the current file without finding a match, the search continues in the previous file in the command line list. ^F or @ Begin the search at the last line of the last file in the command line list, regardless of what is currently displayed on the screen or the settings of the -a or -j options. ^K As in forward searches. ^R As in forward searches. ^S As in forward searches. ^W WRAP around the current file. That is, if the search reaches the beginning of the current file without finding a match, the search continues from the last line of the current file up to the line where it started. ESC-/pattern Same as "/*". ESC-?pattern Same as "?*". n Repeat previous search, for N-th line containing the last pattern. If the previous search was modified by ^N, the search is made for the N-th line NOT containing the pattern. If the previous search was modified by ^E, the search continues in the next (or previous) file if not satisfied in the current file. If the previous search was modified by ^R, the search is done without using regular expressions. There is no effect if the previous search was modified by ^F or ^K. N Repeat previous search, but in the reverse direction. ESC-n Repeat previous search, but crossing file boundaries. The effect is as if the previous search were modified by *. ESC-N Repeat previous search, but in the reverse direction and crossing file boundaries. ESC-u Undo search highlighting. Turn off highlighting of strings matching the current search pattern. If highlighting is already off because of a previous ESC-u command, turn highlighting back on. Any search command will also turn highlighting back on. (Highlighting can also be disabled by toggling the -G option; in that case search commands do not turn highlighting back on.) ESC-U Like ESC-u but also clears the saved search pattern. If the status column is enabled via the -J option, this clears all search matches marked in the status column. &pattern Display only lines which match the pattern; lines which do not match the pattern are not displayed. If pattern is empty (if you type & immediately followed by ENTER), any filtering is turned off, and all lines are displayed. While filtering is in effect, an ampersand is displayed at the beginning of the prompt, as a reminder that some lines in the file may be hidden. Multiple & commands may be entered, in which case only lines which match all of the patterns will be displayed. Certain characters are special as in the / command: ^N or ! Display only lines which do NOT match the pattern. ^R Don't interpret regular expression metacharacters; that is, do a simple textual comparison. :e [filename] Examine a new file. If the filename is missing, the "current" file (see the :n and :p commands below) from the list of files in the command line is re-examined. A percent sign (%) in the filename is replaced by the name of the current file. A pound sign (#) is replaced by the name of the previously examined file. However, two consecutive percent signs are simply replaced with a single percent sign. This allows you to enter a filename that contains a percent sign in the name. Similarly, two consecutive pound signs are replaced with a single pound sign. The filename is inserted into the command line list of files so that it can be seen by subsequent :n and :p commands. If the filename consists of several files, they are all inserted into the list of files and the first one is examined. If the filename contains one or more spaces, the entire filename should be enclosed in double quotes (also see the -" option). ^X^V or E Same as :e. Warning: some systems use ^V as a special literalization character. On such systems, you may not be able to use ^V. :n Examine the next file (from the list of files given in the command line). If a number N is specified, the N-th next file is examined. :p Examine the previous file in the command line list. If a number N is specified, the N-th previous file is examined. :x Examine the first file in the command line list. If a number N is specified, the N-th file in the list is examined. :d Remove the current file from the list of files. t Go to the next tag, if there were more than one matches for the current tag. See the -t option for more details about tags. T Go to the previous tag, if there were more than one matches for the current tag. = or ^G or :f Prints some information about the file being viewed, including its name and the line number and byte offset of the bottom line being displayed. If possible, it also prints the length of the file, the number of lines in the file and the percent of the file above the last displayed line. - Followed by one of the command line option letters (see OPTIONS below), this will change the setting of that option and print a message describing the new setting. If a ^P (CONTROL-P) is entered immediately after the dash, the setting of the option is changed but no message is printed. If the option letter has a numeric value (such as -b or -h), or a string value (such as -P or -t), a new value may be entered after the option letter. If no new value is entered, a message describing the current setting is printed and nothing is changed. -- Like the - command, but takes a long option name (see OPTIONS below) rather than a single option letter. You must press ENTER or RETURN after typing the option name. A ^P immediately after the second dash suppresses printing of a message describing the new setting, as in the - command. -+ Followed by one of the command line option letters this will reset the option to its default setting and print a message describing the new setting. (The "-+X" command does the same thing as "-+X" on the command line.) This does not work for string-valued options. --+ Like the -+ command, but takes a long option name rather than a single option letter. -! Followed by one of the command line option letters, this will reset the option to the "opposite" of its default setting and print a message describing the new setting. This does not work for numeric or string-valued options. --! Like the -! command, but takes a long option name rather than a single option letter. _ (Underscore.) Followed by one of the command line option letters, this will print a message describing the current setting of that option. The setting of the option is not changed. __ (Double underscore.) Like the _ (underscore) command, but takes a long option name rather than a single option letter. You must press ENTER or RETURN after typing the option name. +cmd Causes the specified cmd to be executed each time a new file is examined. For example, +G causes less to initially display each file starting at the end rather than the beginning. V Prints the version number of less being run. q or Q or :q or :Q or ZZ Exits less. The following six commands may or may not be valid, depending on your particular installation. v Invokes an editor to edit the current file being viewed. The editor is taken from the environment variable VISUAL if defined, or EDITOR if VISUAL is not defined, or defaults to "vi" if neither VISUAL nor EDITOR is defined. See also the discussion of LESSEDIT under the section on PROMPTS below. ! shell-command Invokes a shell to run the shell-command given. A percent sign (%) in the command is replaced by the name of the current file. A pound sign (#) is replaced by the name of the previously examined file. "!!" repeats the last shell command. "!" with no shell command simply invokes a shell. On Unix systems, the shell is taken from the environment variable SHELL, or defaults to "sh". On MS- DOS and OS/2 systems, the shell is the normal command processor. # shell-command Similar to the "!" command, except that the command is expanded in the same way as prompt strings. For example, the name of the current file would be given as "%f". | <m> shell-command <m> represents any mark letter. Pipes a section of the input file to the given shell command. The section of the file to be piped is between the position marked by the letter and the current screen. The entire current screen is included, regardless of whether the marked position is before or after the current screen. <m> may also be ^ or $ to indicate beginning or end of file respectively. If <m> is . or newline, the current screen is piped. s filename Save the input to a file. This works only if the input is a pipe, not an ordinary file. ^X When the "Waiting for data" message is displayed, such as while in the F command, pressing ^X will stop less from waiting and return to a prompt. This may cause less to think that the file ends at the current position, so it may be necessary to use the R or F command to see more data. The --intr option can be used to specify a different character to use instead of ^X. This command works only on systems that support the poll(2) function. On systems without poll(2), the interrupt character (usually ^C) can be used instead. OPTIONS top Command line options are described below. Most options may be changed while less is running, via the "-" command. Some options may be given in one of two forms: either a dash followed by a single letter, or two dashes followed by a long option name. A long option name may be abbreviated as long as the abbreviation is unambiguous. For example, --quit-at-eof may be abbreviated --quit, but not --qui, since both --quit-at-eof and --quiet begin with --qui. Some long option names are in uppercase, such as --QUIT-AT-EOF, as distinct from --quit-at-eof. Such option names need only have their first letter capitalized; the remainder of the name may be in either case. For example, --Quit-at-eof is equivalent to --QUIT-AT-EOF. Options are also taken from the environment variable "LESS". For example, to avoid typing "less -options ..." each time less is invoked, you might tell csh: setenv LESS "-options" or if you use sh: LESS="-options"; export LESS On MS-DOS, you don't need the quotes, but you should replace any percent signs in the options string by double percent signs. The environment variable is parsed before the command line, so command line options override the LESS environment variable. If an option appears in the LESS variable, it can be reset to its default value on the command line by beginning the command line option with "-+". Some options like -k or -D require a string to follow the option letter. The string for that option is considered to end when a dollar sign ($) is found. For example, you can set two -D options like this: LESS="Dn9.1$Ds4.1" If the --use-backslash option appears earlier in the options, then a dollar sign or backslash may be included literally in an option string by preceding it with a backslash. If the --use- backslash option is not in effect, then backslashes are not treated specially, and there is no way to include a dollar sign in the option string. -? or --help This option displays a summary of the commands accepted by less (the same as the h command). (Depending on how your shell interprets the question mark, it may be necessary to quote the question mark, thus: "-\?".) -a or --search-skip-screen By default, forward searches start at the top of the displayed screen and backwards searches start at the bottom of the displayed screen (except for repeated searches invoked by the n or N commands, which start after or before the "target" line respectively; see the -j option for more about the target line). The -a option causes forward searches to instead start at the bottom of the screen and backward searches to start at the top of the screen, thus skipping all lines displayed on the screen. -A or --SEARCH-SKIP-SCREEN Causes all forward searches (not just non-repeated searches) to start just after the target line, and all backward searches to start just before the target line. Thus, forward searches will skip part of the displayed screen (from the first line up to and including the target line). Similarly backwards searches will skip the displayed screen from the last line up to and including the target line. This was the default behavior in less versions prior to 441. -bn or --buffers=n Specifies the amount of buffer space less will use for each file, in units of kilobytes (1024 bytes). By default 64 KB of buffer space is used for each file (unless the file is a pipe; see the -B option). The -b option specifies instead that n kilobytes of buffer space should be used for each file. If n is -1, buffer space is unlimited; that is, the entire file can be read into memory. -B or --auto-buffers By default, when data is read from a pipe, buffers are allocated automatically as needed. If a large amount of data is read from the pipe, this can cause a large amount of memory to be allocated. The -B option disables this automatic allocation of buffers for pipes, so that only 64 KB (or the amount of space specified by the -b option) is used for the pipe. Warning: use of -B can result in erroneous display, since only the most recently viewed part of the piped data is kept in memory; any earlier data is lost. Lost characters are displayed as question marks. -c or --clear-screen Causes full screen repaints to be painted from the top line down. By default, full screen repaints are done by scrolling from the bottom of the screen. -C or --CLEAR-SCREEN Same as -c, for compatibility with older versions of less. -d or --dumb The -d option suppresses the error message normally displayed if the terminal is dumb; that is, lacks some important capability, such as the ability to clear the screen or scroll backward. The -d option does not otherwise change the behavior of less on a dumb terminal. -Dxcolor or --color=xcolor Changes the color of different parts of the displayed text. x is a single character which selects the type of text whose color is being set: B Binary characters. C Control characters. E Errors and informational messages. H Header lines and columns, set via the --header option. M Mark letters in the status column. N Line numbers enabled via the -N option. P Prompts. R The rscroll character. S Search results. 1-5 The text in a search result which matches the first through fifth parenthesized sub-pattern. Sub- pattern coloring works only if less is built with one of the regular expression libraries posix, pcre, or pcre2. W The highlight enabled via the -w option. d Bold text. k Blinking text. s Standout text. u Underlined text. The uppercase letters and digits can be used only when the --use-color option is enabled. When text color is specified by both an uppercase letter and a lowercase letter, the uppercase letter takes precedence. For example, error messages are normally displayed as standout text. So if both "s" and "E" are given a color, the "E" color applies to error messages, and the "s" color applies to other standout text. The "d" and "u" letters refer to bold and underline text formed by overstriking with backspaces (see the -U option), not to text using ANSI escape sequences with the -R option. A lowercase letter may be followed by a + to indicate that the normal format change and the specified color should both be used. For example, -Dug displays underlined text as green without underlining; the green color has replaced the usual underline formatting. But -Du+g displays underlined text as both green and in underlined format. color is either a 4-bit color string or an 8-bit color string: A 4-bit color string is zero, one or two characters, where the first character specifies the foreground color and the second specifies the background color as follows: b Blue c Cyan g Green k Black m Magenta r Red w White y Yellow The corresponding uppercase letter denotes a brighter shade of the color. For example, -DNGk displays line numbers as bright green text on a black background, and -DEbR displays error messages as blue text on a bright red background. If either character is a "-" or is omitted, the corresponding color is set to that of normal text. An 8-bit color string is one or two decimal integers separated by a dot, where the first integer specifies the foreground color and the second specifies the background color. Each integer is a value between 0 and 255 inclusive which selects a "CSI 38;5" color value (see https://en.wikipedia.org/wiki/ANSI_escape_code#SGR) If either integer is a "-" or is omitted, the corresponding color is set to that of normal text. On MS-DOS versions of less, 8-bit color is not supported; instead, decimal values are interpreted as 4-bit CHAR_INFO.Attributes values (see https://docs.microsoft.com/en-us/windows/console/char-info-str). On MS-DOS only, the -Da option may be used to specify strict parsing of ANSI color (SGR) sequences when the -R option is used. Without this option, sequences that change text attributes (bold, underline, etc.) may clear the text color. -e or --quit-at-eof Causes less to automatically exit the second time it reaches end-of-file. By default, the only way to exit less is via the "q" command. -E or --QUIT-AT-EOF Causes less to automatically exit the first time it reaches end-of-file. -f or --force Forces non-regular files to be opened. (A non-regular file is a directory or a device special file.) Also suppresses the warning message when a binary file is opened. By default, less will refuse to open non-regular files. Note that some operating systems will not allow directories to be read, even if -f is set. -F or --quit-if-one-screen Causes less to automatically exit if the entire file can be displayed on the first screen. -g or --hilite-search Normally, less will highlight ALL strings which match the last search command. The -g option changes this behavior to highlight only the particular string which was found by the last search command. This can cause less to run somewhat faster than the default. -G or --HILITE-SEARCH The -G option suppresses all highlighting of strings found by search commands. -hn or --max-back-scroll=n Specifies a maximum number of lines to scroll backward. If it is necessary to scroll backward more than n lines, the screen is repainted in a forward direction instead. (If the terminal does not have the ability to scroll backward, -h0 is implied.) -i or --ignore-case Causes searches to ignore case; that is, uppercase and lowercase are considered identical. This option is ignored if any uppercase letters appear in the search pattern; in other words, if a pattern contains uppercase letters, then that search does not ignore case. -I or --IGNORE-CASE Like -i, but searches ignore case even if the pattern contains uppercase letters. -jn or --jump-target=n Specifies a line on the screen where the "target" line is to be positioned. The target line is the line specified by any command to search for a pattern, jump to a line number, jump to a file percentage or jump to a tag. The screen line may be specified by a number: the top line on the screen is 1, the next is 2, and so on. The number may be negative to specify a line relative to the bottom of the screen: the bottom line on the screen is -1, the second to the bottom is -2, and so on. Alternately, the screen line may be specified as a fraction of the height of the screen, starting with a decimal point: .5 is in the middle of the screen, .3 is three tenths down from the first line, and so on. If the line is specified as a fraction, the actual line number is recalculated if the terminal window is resized. If any form of the -j option is used, repeated forward searches (invoked with "n" or "N") begin at the line immediately after the target line, and repeated backward searches begin at the target line, unless changed by -a or -A. For example, if "-j4" is used, the target line is the fourth line on the screen, so forward searches begin at the fifth line on the screen. However nonrepeated searches (invoked with "/" or "?") always begin at the start or end of the current screen respectively. -J or --status-column Displays a status column at the left edge of the screen. The character displayed in the status column may be one of: > The line is chopped with the -S option, and the text that is chopped off beyond the right edge of the screen contains a match for the current search. < The line is horizontally shifted, and the text that is shifted beyond the left side of the screen contains a match for the current search. = The line is both chopped and shifted, and there are matches beyond both sides of the screen. * There are matches in the visible part of the line but none to the right or left of it. a-z, A-Z The line has been marked with the corresponding letter via the m command. -kfilename or --lesskey-file=filename Causes less to open and interpret the named file as a lesskey(1) binary file. Multiple -k options may be specified. If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or if a lesskey file is found in a standard place (see KEY BINDINGS), it is also used as a lesskey file. --lesskey-src=filename Causes less to open and interpret the named file as a lesskey(1) source file. If the LESSKEYIN or LESSKEYIN_SYSTEM environment variable is set, or if a lesskey source file is found in a standard place (see KEY BINDINGS), it is also used as a lesskey source file. Prior to version 582, the lesskey program needed to be run to convert a lesskey source file to a lesskey binary file for less to use. Newer versions of less read the lesskey source file directly and ignore the binary file if the source file exists. -K or --quit-on-intr Causes less to exit immediately (with status 2) when an interrupt character (usually ^C) is typed. Normally, an interrupt character causes less to stop whatever it is doing and return to its command prompt. Note that use of this option makes it impossible to return to the command prompt from the "F" command. -L or --no-lessopen Ignore the LESSOPEN environment variable (see the INPUT PREPROCESSOR section below). This option can be set from within less, but it will apply only to files opened subsequently, not to the file which is currently open. -m or --long-prompt Causes less to prompt verbosely (like more(1)), with the percent into the file. By default, less prompts with a colon. -M or --LONG-PROMPT Causes less to prompt even more verbosely than more(1). -n or --line-numbers Suppresses line numbers. The default (to use line numbers) may cause less to run more slowly in some cases, especially with a very large input file. Suppressing line numbers with the -n option will avoid this problem. Using line numbers means: the line number will be displayed in the verbose prompt and in the = command, and the v command will pass the current line number to the editor (see also the discussion of LESSEDIT in PROMPTS below). -N or --LINE-NUMBERS Causes a line number to be displayed at the beginning of each line in the display. -ofilename or --log-file=filename Causes less to copy its input to the named file as it is being viewed. This applies only when the input file is a pipe, not an ordinary file. If the file already exists, less will ask for confirmation before overwriting it. -Ofilename or --LOG-FILE=filename The -O option is like -o, but it will overwrite an existing file without asking for confirmation. If no log file has been specified, the -o and -O options can be used from within less to specify a log file. Without a file name, they will simply report the name of the log file. The "s" command is equivalent to specifying -o from within less. -ppattern or --pattern=pattern The -p option on the command line is equivalent to specifying +/pattern; that is, it tells less to start at the first occurrence of pattern in the file. -Pprompt or --prompt=prompt Provides a way to tailor the three prompt styles to your own preference. This option would normally be put in the LESS environment variable, rather than being typed in with each less command. Such an option must either be the last option in the LESS variable, or be terminated by a dollar sign. -Ps followed by a string changes the default (short) prompt to that string. -Pm changes the medium (-m) prompt. -PM changes the long (-M) prompt. -Ph changes the prompt for the help screen. -P= changes the message printed by the = command. -Pw changes the message printed while waiting for data (in the "F" command). All prompt strings consist of a sequence of letters and special escape sequences. See the section on PROMPTS for more details. -q or --quiet or --silent Causes moderately "quiet" operation: the terminal bell is not rung if an attempt is made to scroll past the end of the file or before the beginning of the file. If the terminal has a "visual bell", it is used instead. The bell will be rung on certain other errors, such as typing an invalid character. The default is to ring the terminal bell in all such cases. -Q or --QUIET or --SILENT Causes totally "quiet" operation: the terminal bell is never rung. If the terminal has a "visual bell", it is used in all cases where the terminal bell would have been rung. -r or --raw-control-chars Causes "raw" control characters to be displayed. The default is to display control characters using the caret notation; for example, a control-A (octal 001) is displayed as "^A" (with some exceptions as described under the -U option). Warning: when the -r option is used, less cannot keep track of the actual appearance of the screen (since this depends on how the screen responds to each type of control character). Thus, various display problems may result, such as long lines being split in the wrong place. USE OF THE -r OPTION IS NOT RECOMMENDED. -R or --RAW-CONTROL-CHARS Like -r, but only ANSI "color" escape sequences and OSC 8 hyperlink sequences are output in "raw" form. Unlike -r, the screen appearance is maintained correctly, provided that there are no escape sequences in the file other than these types of escape sequences. Color escape sequences are only supported when the color is changed within one line, not across lines. In other words, the beginning of each line is assumed to be normal (non-colored), regardless of any escape sequences in previous lines. For the purpose of keeping track of screen appearance, these escape sequences are assumed to not move the cursor. OSC 8 hyperlinks are sequences of the form: ESC ] 8 ; ... \7 The terminating sequence may be either a BEL character (\7) or the two-character sequence "ESC \". ANSI color escape sequences are sequences of the form: ESC [ ... m where the "..." is zero or more color specification characters. You can make less think that characters other than "m" can end ANSI color escape sequences by setting the environment variable LESSANSIENDCHARS to the list of characters which can end a color escape sequence. And you can make less think that characters other than the standard ones may appear between the ESC and the m by setting the environment variable LESSANSIMIDCHARS to the list of characters which can appear. -s or --squeeze-blank-lines Causes consecutive blank lines to be squeezed into a single blank line. This is useful when viewing nroff output. -S or --chop-long-lines Causes lines longer than the screen width to be chopped (truncated) rather than wrapped. That is, the portion of a long line that does not fit in the screen width is not displayed until you press RIGHT-ARROW. The default is to wrap long lines; that is, display the remainder on the next line. See also the --wordwrap option. -ttag or --tag=tag The -t option, followed immediately by a TAG, will edit the file containing that tag. For this to work, tag information must be available; for example, there may be a file in the current directory called "tags", which was previously built by ctags(1) or an equivalent command. If the environment variable LESSGLOBALTAGS is set, it is taken to be the name of a command compatible with global(1), and that command is executed to find the tag. (See http://www.gnu.org/software/global/global.html). The -t option may also be specified from within less (using the - command) as a way of examining a new file. The command ":t" is equivalent to specifying -t from within less. -Ttagsfile or --tag-file=tagsfile Specifies a tags file to be used instead of "tags". -u or --underline-special Causes backspaces and carriage returns to be treated as printable characters; that is, they are sent to the terminal when they appear in the input. -U or --UNDERLINE-SPECIAL Causes backspaces, tabs, carriage returns and "formatting characters" (as defined by Unicode) to be treated as control characters; that is, they are handled as specified by the -r option. By default, if neither -u nor -U is given, backspaces which appear adjacent to an underscore character are treated specially: the underlined text is displayed using the terminal's hardware underlining capability. Also, backspaces which appear between two identical characters are treated specially: the overstruck text is printed using the terminal's hardware boldface capability. Other backspaces are deleted, along with the preceding character. Carriage returns immediately followed by a newline are deleted. Other carriage returns are handled as specified by the -r option. Unicode formatting characters, such as the Byte Order Mark, are sent to the terminal. Text which is overstruck or underlined can be searched for if neither -u nor -U is in effect. See also the --proc-backspace, --proc-tab, and --proc- return options. -V or --version Displays the version number of less. -w or --hilite-unread Temporarily highlights the first "new" line after a forward movement of a full page. The first "new" line is the line immediately following the line previously at the bottom of the screen. Also highlights the target line after a g or p command. The highlight is removed at the next command which causes movement. If the --status-line option is in effect, the entire line (the width of the screen) is highlighted. Otherwise, only the text in the line is highlighted, unless the -J option is in effect, in which case only the status column is highlighted. -W or --HILITE-UNREAD Like -w, but temporarily highlights the first new line after any forward movement command larger than one line. -xn,... or --tabs=n,... Sets tab stops. If only one n is specified, tab stops are set at multiples of n. If multiple values separated by commas are specified, tab stops are set at those positions, and then continue with the same spacing as the last two. For example, "-x9,17" will set tabs at positions 9, 17, 25, 33, etc. The default for n is 8. -X or --no-init Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen. -yn or --max-forw-scroll=n Specifies a maximum number of lines to scroll forward. If it is necessary to scroll forward more than n lines, the screen is repainted instead. The -c or -C option may be used to repaint from the top of the screen if desired. By default, any forward movement causes scrolling. -zn or --window=n or -n Changes the default scrolling window size to n lines. The default is one screenful. The z and w commands can also be used to change the window size. The "z" may be omitted for compatibility with some versions of more(1). If the number n is negative, it indicates n lines less than the current screen size. For example, if the screen is 24 lines, -z-4 sets the scrolling window to 20 lines. If the screen is resized to 40 lines, the scrolling window automatically changes to 36 lines. -"cc or --quotes=cc Changes the filename quoting character. This may be necessary if you are trying to name a file which contains both spaces and quote characters. Followed by a single character, this changes the quote character to that character. Filenames containing a space should then be surrounded by that character rather than by double quotes. Followed by two characters, changes the open quote to the first character, and the close quote to the second character. Filenames containing a space should then be preceded by the open quote character and followed by the close quote character. Note that even after the quote characters are changed, this option remains -" (a dash followed by a double quote). -~ or --tilde Normally lines after end of file are displayed as a single tilde (~). This option causes lines after end of file to be displayed as blank lines. -# or --shift Specifies the default number of positions to scroll horizontally in the RIGHTARROW and LEFTARROW commands. If the number specified is zero, it sets the default number of positions to one half of the screen width. Alternately, the number may be specified as a fraction of the width of the screen, starting with a decimal point: .5 is half of the screen width, .3 is three tenths of the screen width, and so on. If the number is specified as a fraction, the actual number of scroll positions is recalculated if the terminal window is resized. --exit-follow-on-close When using the "F" command on a pipe, less will automatically stop waiting for more data when the input side of the pipe is closed. --file-size If --file-size is specified, less will determine the size of the file immediately after opening the file. Then the "=" command will display the number of lines in the file. Normally this is not done, because it can be slow if the input file is non-seekable (such as a pipe) and is large. --follow-name Normally, if the input file is renamed while an F command is executing, less will continue to display the contents of the original file despite its name change. If --follow-name is specified, during an F command less will periodically attempt to reopen the file by name. If the reopen succeeds and the file is a different file from the original (which means that a new file has been created with the same name as the original (now renamed) file), less will display the contents of that new file. --header=N[,M] Sets the number of header lines and columns displayed on the screen. The value may be of the form "N,M" where N and M are integers, to set the header lines to N and the header columns to M, or it may be a single integer "N" which sets the header lines to N and the header columns to zero, or it may be ",M" which sets the header columns to M and the header lines to zero. When N is nonzero, the first N lines at the top of the screen are replaced with the first N lines of the file, regardless of what part of the file are being viewed. When M is nonzero, the characters displayed at the beginning of each line are replaced with the first M characters of the line, even if the rest of the line is scrolled horizontally. If either N or M is zero, less stops displaying header lines or columns, respectively. (Note that it may be necessary to change the setting of the -j option to ensure that the target line is not obscured by the header line(s).) --incsearch Subsequent search commands will be "incremental"; that is, less will advance to the next line containing the search pattern as each character of the pattern is typed in. --intr=c Use the character c instead of ^X to interrupt a read when the "Waiting for data" message is displayed. c must be an ASCII character; that is, one with a value between 1 and 127 inclusive. A caret followed by a single character can be used to specify a control character. --line-num-width=n Sets the minimum width of the line number field when the -N option is in effect to n characters. The default is 7. --modelines=n Before displaying a file, less will read the first n lines to try to find a vim-compatible modeline. If n is zero, less does not try to find modelines. By using a modeline, the file itself can specify the tab stops that should be used when viewing it. A modeline contains, anywhere in the line, a program name ("vi", "vim", "ex", or "less"), followed by a colon, possibly followed by the word "set", and finally followed by zero or more option settings. If the word "set" is used, option settings are separated by spaces, and end at the first colon. If the word "set" is not used, option settings may be separated by either spaces or colons. The word "set" is required if the program name is "less" but optional if any of the other three names are used. If any option setting is of the form "tabstop=n" or "ts=n", then tab stops are automatically set as if --tabs=n had been given. See the --tabs description for acceptable values of n. --mouse Enables mouse input: scrolling the mouse wheel down moves forward in the file, scrolling the mouse wheel up moves backwards in the file, and clicking the mouse sets the "#" mark to the line where the mouse is clicked. The number of lines to scroll when the wheel is moved can be set by the --wheel-lines option. Mouse input works only on terminals which support X11 mouse reporting, and on the Windows version of less. --MOUSE Like --mouse, except the direction scrolled on mouse wheel movement is reversed. --no-keypad Disables sending the keypad initialization and deinitialization strings to the terminal. This is sometimes useful if the keypad strings make the numeric keypad behave in an undesirable manner. --no-histdups This option changes the behavior so that if a search string or file name is typed in, and the same string is already in the history list, the existing copy is removed from the history list before the new one is added. Thus, a given string will appear only once in the history list. Normally, a string may appear multiple times. --no-number-headers Header lines (defined via the --header option) are not assigned line numbers. Line number 1 is assigned to the first line after any header lines. --no-search-headers Searches do not include header lines or header columns. --no-vbell Disables the terminal's visual bell. --proc-backspace If set, backspaces are handled as if neither the -u option nor the -U option were set. That is, a backspace adjacent to an underscore causes text to be displayed in underline mode, and a backspace between identical characters cause text to be displayed in boldface mode. This option overrides the -u and -U options, so that display of backspaces can be controlled separate from tabs and carriage returns. If not set, backspace display is controlled by the -u and -U options. --PROC-BACKSPACE If set, backspaces are handled as if the -U option were set; that is backspaces are treated as control characters. --proc-return If set, carriage returns are handled as if neither the -u option nor the -U option were set. That is, a carriage return immediately before a newline is deleted. This option overrides the -u and -U options, so that display of carriage returns can be controlled separate from that of backspaces and tabs. If not set, carriage return display is controlled by the -u and -U options. --PROC-RETURN If set, carriage returns are handled as if the -U option were set; that is carriage returns are treated as control characters. --proc-tab If set, tabs are handled as if the -U option were not set. That is, tabs are expanded to spaces. This option overrides the -U option, so that display of tabs can be controlled separate from that of backspaces and carriage returns. If not set, tab display is controlled by the -U options. --PROC-TAB If set, tabs are handled as if the -U option were set; that is tabs are treated as control characters. --redraw-on-quit When quitting, after sending the terminal deinitialization string, redraws the entire last screen. On terminals whose terminal deinitialization string causes the terminal to switch from an alternate screen, this makes the last screenful of the current file remain visible after less has quit. --rscroll=c This option changes the character used to mark truncated lines. It may begin with a two-character attribute indicator like LESSBINFMT does. If there is no attribute indicator, standout is used. If set to "-", truncated lines are not marked. --save-marks Save marks in the history file, so marks are retained across different invocations of less. --search-options=... Sets default search modifiers. The value is a string of one or more of the characters E, F, K, N, R or W. Setting any of these has the same effect as typing that control character at the beginning of every search pattern. For example, setting --search-options=W is the same as typing ^W at the beginning of every pattern. The value may also contain a digit between 1 and 5, which has the same effect as typing ^S followed by that digit at the beginning of every search pattern. The value "-" disables all default search modifiers. --show-preproc-errors If a preprocessor produces data, then exits with a non- zero exit code, less will display a warning. --status-col-width=n Sets the width of the status column when the -J option is in effect. The default is 2 characters. --status-line If a line is marked, the entire line (rather than just the status column) is highlighted. Also lines highlighted due to the -w option will have the entire line highlighted. If --use-color is set, the line is colored rather than highlighted. --use-backslash This option changes the interpretations of options which follow this one. After the --use-backslash option, any backslash in an option string is removed and the following character is taken literally. This allows a dollar sign to be included in option strings. --use-color Enables colored text in various places. The -D option can be used to change the colors. Colored text works only if the terminal supports ANSI color escape sequences (as defined in ECMA-48 SGR; see https://www.ecma-international.org/publications-and-standards/standards/ecma-48). --wheel-lines=n Set the number of lines to scroll when the mouse wheel is scrolled and the --mouse or --MOUSE option is in effect. The default is 1 line. --wordwrap When the -S option is not in use, wrap each line at a space or tab if possible, so that a word is not split between two lines. The default is to wrap at any character. -- A command line argument of "--" marks the end of option arguments. Any arguments following this are interpreted as filenames. This can be useful when viewing a file whose name begins with a "-" or "+". + If a command line option begins with +, the remainder of that option is taken to be an initial command to less. For example, +G tells less to start at the end of the file rather than the beginning, and +/xyz tells it to start at the first occurrence of "xyz" in the file. As a special case, +<number> acts like +<number>g; that is, it starts the display at the specified line number (however, see the caveat under the "g" command above). If the option starts with ++, the initial command applies to every file being viewed, not just the first one. The + command described previously may also be used to set (or change) an initial command for every file. LINE EDITING top When entering a command line at the bottom of the screen (for example, a filename for the :e command, or the pattern for a search command), certain keys can be used to manipulate the command line. Most commands have an alternate form in [ brackets ] which can be used if a key does not exist on a particular keyboard. (Note that the forms beginning with ESC do not work in some MS-DOS and Windows systems because ESC is the line erase character.) Any of these special keys may be entered literally by preceding it with the "literal" character, either ^V or ^A. A backslash itself may also be entered literally by entering two backslashes. LEFTARROW [ ESC-h ] Move the cursor one space to the left. RIGHTARROW [ ESC-l ] Move the cursor one space to the right. ^LEFTARROW [ ESC-b or ESC-LEFTARROW ] (That is, CONTROL and LEFTARROW simultaneously.) Move the cursor one word to the left. ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ] (That is, CONTROL and RIGHTARROW simultaneously.) Move the cursor one word to the right. HOME [ ESC-0 ] Move the cursor to the beginning of the line. END [ ESC-$ ] Move the cursor to the end of the line. BACKSPACE Delete the character to the left of the cursor, or cancel the command if the command line is empty. DELETE or [ ESC-x ] Delete the character under the cursor. ^BACKSPACE [ ESC-BACKSPACE ] (That is, CONTROL and BACKSPACE simultaneously.) Delete the word to the left of the cursor. ^DELETE [ ESC-X or ESC-DELETE ] (That is, CONTROL and DELETE simultaneously.) Delete the word under the cursor. UPARROW [ ESC-k ] Retrieve the previous command line. If you first enter some text and then press UPARROW, it will retrieve the previous command which begins with that text. DOWNARROW [ ESC-j ] Retrieve the next command line. If you first enter some text and then press DOWNARROW, it will retrieve the next command which begins with that text. TAB Complete the partial filename to the left of the cursor. If it matches more than one filename, the first match is entered into the command line. Repeated TABs will cycle thru the other matching filenames. If the completed filename is a directory, a "/" is appended to the filename. (On MS-DOS systems, a "\" is appended.) The environment variable LESSSEPARATOR can be used to specify a different character to append to a directory name. BACKTAB [ ESC-TAB ] Like, TAB, but cycles in the reverse direction thru the matching filenames. ^L Complete the partial filename to the left of the cursor. If it matches more than one filename, all matches are entered into the command line (if they fit). ^U (Unix and OS/2) or ESC (MS-DOS) Delete the entire command line, or cancel the command if the command line is empty. If you have changed your line- kill character in Unix to something other than ^U, that character is used instead of ^U. ^G Delete the entire command line and return to the main prompt. KEY BINDINGS top You may define your own less commands by creating a lesskey source file. This file specifies a set of command keys and an action associated with each key. You may also change the line- editing keys (see LINE EDITING), and set environment variables used by less. See the lesskey(1) manual page for details about the file format. If the environment variable LESSKEYIN is set, less uses that as the name of the lesskey source file. Otherwise, less looks in a standard place for the lesskey source file: On Unix systems, less looks for a lesskey file called "$XDG_CONFIG_HOME/lesskey" or "$HOME/.config/lesskey" or "$HOME/.lesskey". On MS-DOS and Windows systems, less looks for a lesskey file called "$HOME/_lesskey", and if it is not found there, then looks for a lesskey file called "_lesskey" in any directory specified in the PATH environment variable. On OS/2 systems, less looks for a lesskey file called "$HOME/lesskey.ini", and if it is not found, then looks for a lesskey file called "lesskey.ini" in any directory specified in the INIT environment variable, and if it not found there, then looks for a lesskey file called "lesskey.ini" in any directory specified in the PATH environment variable. A system-wide lesskey source file may also be set up to provide key bindings. If a key is defined in both a local lesskey file and in the system-wide file, key bindings in the local file take precedence over those in the system-wide file. If the environment variable LESSKEYIN_SYSTEM is set, less uses that as the name of the system-wide lesskey file. Otherwise, less looks in a standard place for the system-wide lesskey file: On Unix systems, the system-wide lesskey file is /usr/local/etc/syslesskey. (However, if less was built with a different sysconf directory than /usr/local/etc, that directory is where the sysless file is found.) On MS-DOS and Windows systems, the system-wide lesskey file is c:\_syslesskey. On OS/2 systems, the system-wide lesskey file is c:\syslesskey.ini. Previous versions of less (before v582) used lesskey files with a binary format, produced by the lesskey program. It is no longer necessary to use the lesskey program. INPUT PREPROCESSOR top You may define an "input preprocessor" for less. Before less opens a file, it first gives your input preprocessor a chance to modify the way the contents of the file are displayed. An input preprocessor is simply an executable program (or shell script), which writes the contents of the file to a different file, called the replacement file. The contents of the replacement file are then displayed in place of the contents of the original file. However, it will appear to the user as if the original file is opened; that is, less will display the original filename as the name of the current file. An input preprocessor receives one command line argument, the original filename, as entered by the user. It should create the replacement file, and when finished, print the name of the replacement file to its standard output. If the input preprocessor does not output a replacement filename, less uses the original file, as normal. The input preprocessor is not called when viewing standard input. To set up an input preprocessor, set the LESSOPEN environment variable to a command line which will invoke your input preprocessor. This command line should include one occurrence of the string "%s", which will be replaced by the filename when the input preprocessor command is invoked. When less closes a file opened in such a way, it will call another program, called the input postprocessor, which may perform any desired clean-up action (such as deleting the replacement file created by LESSOPEN). This program receives two command line arguments, the original filename as entered by the user, and the name of the replacement file. To set up an input postprocessor, set the LESSCLOSE environment variable to a command line which will invoke your input postprocessor. It may include two occurrences of the string "%s"; the first is replaced with the original name of the file and the second with the name of the replacement file, which was output by LESSOPEN. For example, on many Unix systems, these two scripts will allow you to keep files in compressed format, but still let less view them directly: lessopen.sh: #! /bin/sh case "$1" in *.Z) TEMPFILE=$(mktemp) uncompress -c $1 >$TEMPFILE 2>/dev/null if [ -s $TEMPFILE ]; then echo $TEMPFILE else rm -f $TEMPFILE fi ;; esac lessclose.sh: #! /bin/sh rm $2 To use these scripts, put them both where they can be executed and set LESSOPEN="lessopen.sh %s", and LESSCLOSE="lessclose.sh %s %s". More complex LESSOPEN and LESSCLOSE scripts may be written to accept other types of compressed files, and so on. It is also possible to set up an input preprocessor to pipe the file data directly to less, rather than putting the data into a replacement file. This avoids the need to decompress the entire file before starting to view it. An input preprocessor that works this way is called an input pipe. An input pipe, instead of writing the name of a replacement file on its standard output, writes the entire contents of the replacement file on its standard output. If the input pipe does not write any characters on its standard output, then there is no replacement file and less uses the original file, as normal. To use an input pipe, make the first character in the LESSOPEN environment variable a vertical bar (|) to signify that the input preprocessor is an input pipe. As with non-pipe input preprocessors, the command string must contain one occurrence of %s, which is replaced with the filename of the input file. For example, on many Unix systems, this script will work like the previous example scripts: lesspipe.sh: #! /bin/sh case "$1" in *.Z) uncompress -c $1 2>/dev/null ;; *) exit 1 ;; esac exit $? To use this script, put it where it can be executed and set LESSOPEN="|lesspipe.sh %s". Note that a preprocessor cannot output an empty file, since that is interpreted as meaning there is no replacement, and the original file is used. To avoid this, if LESSOPEN starts with two vertical bars, the exit status of the script determines the behavior when the output is empty. If the output is empty and the exit status is zero, the empty output is considered to be replacement text. If the output is empty and the exit status is nonzero, the original file is used. For compatibility with previous versions of less, if LESSOPEN starts with only one vertical bar, the exit status of the preprocessor is ignored. When an input pipe is used, a LESSCLOSE postprocessor can be used, but it is usually not necessary since there is no replacement file to clean up. In this case, the replacement file name passed to the LESSCLOSE postprocessor is "-". For compatibility with previous versions of less, the input preprocessor or pipe is not used if less is viewing standard input. However, if the first character of LESSOPEN is a dash (-), the input preprocessor is used on standard input as well as other files. In this case, the dash is not considered to be part of the preprocessor command. If standard input is being viewed, the input preprocessor is passed a file name consisting of a single dash. Similarly, if the first two characters of LESSOPEN are vertical bar and dash (|-) or two vertical bars and a dash (||-), the input pipe is used on standard input as well as other files. Again, in this case the dash is not considered to be part of the input pipe command. NATIONAL CHARACTER SETS top There are three types of characters in the input file: normal characters can be displayed directly to the screen. control characters should not be displayed directly, but are expected to be found in ordinary text files (such as backspace and tab). binary characters should not be displayed directly and are not expected to be found in text files. A "character set" is simply a description of which characters are to be considered normal, control, and binary. The LESSCHARSET environment variable may be used to select a character set. Possible values for LESSCHARSET are: ascii BS, TAB, NL, CR, and formfeed are control characters, all chars with values between 32 and 126 are normal, and all others are binary. iso8859 Selects an ISO 8859 character set. This is the same as ASCII, except characters between 160 and 255 are treated as normal characters. latin1 Same as iso8859. latin9 Same as iso8859. dos Selects a character set appropriate for MS-DOS. ebcdic Selects an EBCDIC character set. IBM-1047 Selects an EBCDIC character set used by OS/390 Unix Services. This is the EBCDIC analogue of latin1. You get similar results by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US in your environment. koi8-r Selects a Russian character set. next Selects a character set appropriate for NeXT computers. utf-8 Selects the UTF-8 encoding of the ISO 10646 character set. UTF-8 is special in that it supports multi-byte characters in the input file. It is the only character set that supports multi-byte characters. windows Selects a character set appropriate for Microsoft Windows (cp 1251). In rare cases, it may be desired to tailor less to use a character set other than the ones definable by LESSCHARSET. In this case, the environment variable LESSCHARDEF can be used to define a character set. It should be set to a string where each character in the string represents one character in the character set. The character "." is used for a normal character, "c" for control, and "b" for binary. A decimal number may be used for repetition. For example, "bccc4b." would mean character 0 is binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are binary, and 8 is normal. All characters after the last are taken to be the same as the last, so characters 9 through 255 would be normal. (This is an example, and does not necessarily represent any real character set.) This table shows the value of LESSCHARDEF which is equivalent to each of the possible values for LESSCHARSET: ascii 8bcccbcc18b95.b dos 8bcccbcc12bc5b95.b. ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc 191.b iso8859 8bcccbcc18b95.33b. koi8-r 8bcccbcc18b95.b128. latin1 8bcccbcc18b95.33b. next 8bcccbcc18b95.bb125.bb If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_CTYPE or LANG environment variables, then the default character set is utf-8. If that string is not found, but your system supports the setlocale interface, less will use setlocale to determine the character set. setlocale is controlled by setting the LANG or LC_CTYPE environment variables. Finally, if the setlocale interface is also not available, the default character set is latin1. Control and binary characters are displayed in standout (reverse video). Each such character is displayed in caret notation if possible (e.g. ^A for control-A). Caret notation is used only if inverting the 0100 bit results in a normal printable character. Otherwise, the character is displayed as a hex number in angle brackets. This format can be changed by setting the LESSBINFMT environment variable. LESSBINFMT may begin with a "*" and one character to select the display attribute: "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout, and "*n" is normal. If LESSBINFMT does not begin with a "*", normal attribute is assumed. The remainder of LESSBINFMT is a string which may include one printf-style escape sequence (a % followed by x, X, o, d, etc.). For example, if LESSBINFMT is "*u[%x]", binary characters are displayed in underlined hexadecimal surrounded by brackets. The default if no LESSBINFMT is specified is "*s<%02X>". Warning: the result of expanding the character via LESSBINFMT must be less than 31 characters. When the character set is utf-8, the LESSUTFBINFMT environment variable acts similarly to LESSBINFMT but it applies to Unicode code points that were successfully decoded but are unsuitable for display (e.g., unassigned code points). Its default value is "<U+%04lX>". Note that LESSUTFBINFMT and LESSBINFMT share their display attribute setting ("*x") so specifying one will affect both; LESSUTFBINFMT is read after LESSBINFMT so its setting, if any, will have priority. Problematic octets in a UTF-8 file (octets of a truncated sequence, octets of a complete but non- shortest form sequence, invalid octets, and stray trailing octets) are displayed individually using LESSBINFMT so as to facilitate diagnostic of how the UTF-8 file is ill-formed. When the character set is utf-8, in rare cases it may be desirable to override the Unicode definition of the type of certain characters. For example, characters in a Private Use Area are normally treated as control characters, but if you are using a custom font with printable characters in that range, it may be desirable to tell less to treat such characters as printable. This can be done by setting the LESSUTFCHARDEF environment variable to a comma-separated list of character type definitions. Each character type definition consists of either one hexadecimal codepoint or a pair of codepoints separated by a dash, followed by a colon and a type character. Each hexadecimal codepoint may optionally be preceded by a "U" or "U+". If a pair of codepoints is given, the type is set for all characters inclusively between the two values. If there are multiple comma- separated codepoint values, they must be in ascending numerical order. The type character may be one of: p A normal printable character. w A wide (2-space) printable character. b A binary (non-printable) character. c A composing (zero width) character. For example, setting LESSUTFCHARDEF to E000-F8FF:p,F0000-FFFFD:p,100000-10FFFD:p would make all Private Use Area characters be treated as printable. PROMPTS top The -P option allows you to tailor the prompt to your preference. The string given to the -P option replaces the specified prompt string. Certain characters in the string are interpreted specially. The prompt mechanism is rather complicated to provide flexibility, but the ordinary user need not understand the details of constructing personalized prompt strings. A percent sign followed by a single character is expanded according to what the following character is. (References to the input file size below refer to the preprocessed size, if an input preprocessor is being used.) %bX Replaced by the byte offset into the current input file. The b is followed by a single character (shown as X above) which specifies the line whose byte offset is to be used. If the character is a "t", the byte offset of the top line in the display is used, an "m" means use the middle line, a "b" means use the bottom line, a "B" means use the line just after the bottom line, and a "j" means use the "target" line, as specified by the -j option. %B Replaced by the size of the current input file. %c Replaced by the column number of the text appearing in the first column of the screen. %dX Replaced by the page number of a line in the input file. The line to be used is determined by the X, as with the %b option. %D Replaced by the number of pages in the input file, or equivalently, the page number of the last line in the input file. %E Replaced by the name of the editor (from the VISUAL environment variable, or the EDITOR environment variable if VISUAL is not defined). See the discussion of the LESSEDIT feature below. %f Replaced by the name of the current input file. %F Replaced by the last component of the name of the current input file. %g Replaced by the shell-escaped name of the current input file. This is useful when the expanded string will be used in a shell command, such as in LESSEDIT. %i Replaced by the index of the current file in the list of input files. %lX Replaced by the line number of a line in the input file. The line to be used is determined by the X, as with the %b option. %L Replaced by the line number of the last line in the input file. %m Replaced by the total number of input files. %pX Replaced by the percent into the current input file, based on byte offsets. The line used is determined by the X as with the %b option. %PX Replaced by the percent into the current input file, based on line numbers. The line used is determined by the X as with the %b option. %s Same as %B. %t Causes any trailing spaces to be removed. Usually used at the end of the string, but may appear anywhere. %T Normally expands to the word "file". However if viewing files via a tags list using the -t option, it expands to the word "tag". %x Replaced by the name of the next input file in the list. If any item is unknown (for example, the file size if input is a pipe), a question mark is printed instead. The format of the prompt string can be changed depending on certain conditions. A question mark followed by a single character acts like an "IF": depending on the following character, a condition is evaluated. If the condition is true, any characters following the question mark and condition character, up to a period, are included in the prompt. If the condition is false, such characters are not included. A colon appearing between the question mark and the period can be used to establish an "ELSE": any characters between the colon and the period are included in the string if and only if the IF condition is false. Condition characters (which follow a question mark) may be: ?a True if any characters have been included in the prompt so far. ?bX True if the byte offset of the specified line is known. ?B True if the size of current input file is known. ?c True if the text is horizontally shifted (%c is not zero). ?dX True if the page number of the specified line is known. ?e True if at end-of-file. ?f True if there is an input filename (that is, if input is not a pipe). ?lX True if the line number of the specified line is known. ?L True if the line number of the last line in the file is known. ?m True if there is more than one input file. ?n True if this is the first prompt in a new input file. ?pX True if the percent into the current input file, based on byte offsets, of the specified line is known. ?PX True if the percent into the current input file, based on line numbers, of the specified line is known. ?s Same as "?B". ?x True if there is a next input file (that is, if the current input file is not the last one). Any characters other than the special ones (question mark, colon, period, percent, and backslash) become literally part of the prompt. Any of the special characters may be included in the prompt literally by preceding it with a backslash. Some examples: ?f%f:Standard input. This prompt prints the filename, if known; otherwise the string "Standard input". ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-... This prompt would print the filename, if known. The filename is followed by the line number, if known, otherwise the percent if known, otherwise the byte offset if known. Otherwise, a dash is printed. Notice how each question mark has a matching period, and how the % after the %pt is included literally by escaping it with a backslash. ?n?f%f .?m(%T %i of %m) ..?e(END) ?x- Next\: %x..%t"; This prints the filename if this is the first prompt in a file, followed by the "file N of N" message if there is more than one input file. Then, if we are at end-of-file, the string "(END)" is printed followed by the name of the next file, if there is one. Finally, any trailing spaces are truncated. This is the default prompt. For reference, here are the defaults for the other two prompts (-m and -M respectively). Each is broken into two lines here for readability only. ?n?f%f .?m(%T %i of %m) ..?e(END) ?x- Next\: %x.: ?pB%pB\%:byte %bB?s/%s...%t ?f%f .?n?m(%T %i of %m) ..?ltlines %lt-%lb?L/%L. : byte %bB?s/%s. .?e(END) ?x- Next\: %x.:?pB%pB\%..%t And here is the default message produced by the = command: ?f%f .?m(%T %i of %m) .?ltlines %lt-%lb?L/%L. . byte %bB?s/%s. ?e(END) :?pB%pB\%..%t The prompt expansion features are also used for another purpose: if an environment variable LESSEDIT is defined, it is used as the command to be executed when the v command is invoked. The LESSEDIT string is expanded in the same way as the prompt strings. The default value for LESSEDIT is: %E ?lm+%lm. %g Note that this expands to the editor name, followed by a + and the line number, followed by the shell-escaped file name. If your editor does not accept the "+linenumber" syntax, or has other differences in invocation syntax, the LESSEDIT variable can be changed to modify this default. SECURITY top When the environment variable LESSSECURE is set to 1, less runs in a "secure" mode. This means these features are disabled: ! the shell command # the pshell command | the pipe command :e the examine command. v the editing command s -o log files -k use of lesskey files -t use of tags files metacharacters in filenames, such as * filename completion (TAB, ^L) history file Less can also be compiled to be permanently in "secure" mode. COMPATIBILITY WITH MORE top If the environment variable LESS_IS_MORE is set to 1, or if the program is invoked via a file link named "more", less behaves (mostly) in conformance with the POSIX more(1) command specification. In this mode, less behaves differently in these ways: The -e option works differently. If the -e option is not set, less behaves as if the -e option were set. If the -e option is set, less behaves as if the -E option were set. The -m option works differently. If the -m option is not set, the medium prompt is used, and it is prefixed with the string "--More--". If the -m option is set, the short prompt is used. The -n option acts like the -z option. The normal behavior of the -n option is unavailable in this mode. The parameter to the -p option is taken to be a less command rather than a search pattern. The LESS environment variable is ignored, and the MORE environment variable is used in its place. ENVIRONMENT VARIABLES top Environment variables may be specified either in the system environment as usual, or in a lesskey(1) file. If environment variables are defined in more than one place, variables defined in a local lesskey file take precedence over variables defined in the system environment, which take precedence over variables defined in the system-wide lesskey file. COLUMNS Sets the number of columns on the screen. Takes precedence over the number of columns specified by the TERM variable. (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD, the window system's idea of the screen size takes precedence over the LINES and COLUMNS environment variables.) EDITOR The name of the editor (used for the v command). HOME Name of the user's home directory (used to find a lesskey file on Unix and OS/2 systems). HOMEDRIVE, HOMEPATH Concatenation of the HOMEDRIVE and HOMEPATH environment variables is the name of the user's home directory if the HOME variable is not set (only in the Windows version). INIT Name of the user's init directory (used to find a lesskey file on OS/2 systems). LANG Language for determining the character set. LC_CTYPE Language for determining the character set. LESS Options which are passed to less automatically. LESSANSIENDCHARS Characters which may end an ANSI color escape sequence (default "m"). LESSANSIMIDCHARS Characters which may appear between the ESC character and the end character in an ANSI color escape sequence (default "0123456789:;[?!"'#%()*+ ". LESSBINFMT Format for displaying non-printable, non-control characters. LESSCHARDEF Defines a character set. LESSCHARSET Selects a predefined character set. LESSCLOSE Command line to invoke the (optional) input-postprocessor. LESSECHO Name of the lessecho program (default "lessecho"). The lessecho program is needed to expand metacharacters, such as * and ?, in filenames on Unix systems. LESSEDIT Editor prototype string (used for the v command). See discussion under PROMPTS. LESSGLOBALTAGS Name of the command used by the -t option to find global tags. Normally should be set to "global" if your system has the global(1) command. If not set, global tags are not used. LESSHISTFILE Name of the history file used to remember search commands and shell commands between invocations of less. If set to "-" or "/dev/null", a history file is not used. The default depends on the operating system, but is usually: Linux and Unix "$XDG_STATE_HOME/lesshst" or "$HOME/.local/state/lesshst" or "$XDG_DATA_HOME/lesshst" or "$HOME/.lesshst". Windows and MS-DOS "$HOME/_lesshst". OS/2 "$HOME/lesshst.ini" or "$INIT/lesshst.ini". LESSHISTSIZE The maximum number of commands to save in the history file. The default is 100. LESSKEYIN Name of the default lesskey source file. LESSKEY Name of the default lesskey binary file. (Not used if "$LESSKEYIN" exists.) LESSKEYIN_SYSTEM Name of the default system-wide lesskey source file. LESSKEY_SYSTEM Name of the default system-wide lesskey binary file. (Not used if "$LESSKEYIN_SYSTEM" exists.) LESSMETACHARS List of characters which are considered "metacharacters" by the shell. LESSMETAESCAPE Prefix which less will add before each metacharacter in a command sent to the shell. If LESSMETAESCAPE is an empty string, commands containing metacharacters will not be passed to the shell. LESSOPEN Command line to invoke the (optional) input-preprocessor. LESSSECURE Runs less in "secure" mode. See discussion under SECURITY. LESSSEPARATOR String to be appended to a directory name in filename completion. LESSUTFBINFMT Format for displaying non-printable Unicode code points. LESSUTFCHARDEF Overrides the type of specified Unicode characters. LESS_COLUMNS Sets the number of columns on the screen. Unlike COLUMNS, takes precedence over the system's idea of the screen size, so it can be used to make less use less than the full screen width. If set to a negative number, sets the number of columns used to this much less than the actual screen width. LESS_LINES Sets the number of lines on the screen. Unlike LINES, takes precedence over the system's idea of the screen size, so it can be used to make less use less than the full screen height. If set to a negative number, sets the number of lines used to this much less than the actual screen height. When set, less repaints the entire screen on every movement command, so scrolling may be slower. LESS_DATA_DELAY Duration (in milliseconds) after starting to read data from the input, after which the "Waiting for data" message will be displayed. The default is 4000 (4 seconds). LESS_IS_MORE Emulate the more(1) command. LESS_TERMCAP_xx Where "xx" is any two characters, overrides the definition of the termcap "xx" capability for the terminal. LINES Sets the number of lines on the screen. Takes precedence over the number of lines specified by the TERM variable. (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD, the window system's idea of the screen size takes precedence over the LINES and COLUMNS environment variables.) MORE Options which are passed to less automatically when running in more-compatible mode. PATH User's search path (used to find a lesskey file on MS-DOS and OS/2 systems). SHELL The shell used to execute the ! command, as well as to expand filenames. TERM The type of terminal on which less is being run. VISUAL The name of the editor (used for the v command). XDG_CONFIG_HOME Possible location of the lesskey file; see the KEY BINDINGS section. XDG_DATA_HOME Possible location of the history file; see the description of the LESSHISTFILE environment variable. XDG_STATE_HOME Possible location of the history file; see the description of the LESSHISTFILE environment variable. SEE ALSO top lesskey(1), lessecho(1) COPYRIGHT top Copyright (C) 1984-2023 Mark Nudelman less is part of the GNU project and is free software. You can redistribute it and/or modify it under the terms of either (1) the GNU General Public License as published by the Free Software Foundation; or (2) the Less License. See the file README in the less distribution for more details regarding redistribution. You should have received a copy of the GNU General Public License along with the source for less; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. You should also have received a copy of the Less License; see the file LICENSE. less is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. AUTHOR top Mark Nudelman Report bugs at https://github.com/gwsw/less/issues. For more information, see the less homepage at https://greenwoodsoftware.com/less COLOPHON top This page is part of the less (A file pager) project. Information about the project can be found at http://www.greenwoodsoftware.com/less/. If you have a bug report for this manual page, see http://www.greenwoodsoftware.com/less/faq.html#bugs. This page was obtained from the tarball less-643.tar.gz fetched from http://www.greenwoodsoftware.com/less/download.html on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up- to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Version 643: 20 Jul 2023 LESS(1) Pages that refer to this page: homectl(1), journalctl(1), lessecho(1), lesskey(1), localectl(1), loginctl(1), machinectl(1), man(1), more(1), portablectl(1), quilt(1), systemctl(1), systemd(1), systemd-analyze(1), systemd-inhibit(1), systemd-nspawn(1), systemd-vmspawn(1), timedatectl(1), userdbctl(1), environ(7), debugfs(8), systemd-tmpfiles(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# less\n\n> Open a file for interactive reading, allowing scrolling and search.\n> More information: <https://greenwoodsoftware.com/less/>.\n\n- Open a file:\n\n`less {{source_file}}`\n\n- Page down/up:\n\n`<Space> (down), b (up)`\n\n- Go to end/start of file:\n\n`G (end), g (start)`\n\n- Forward search for a string (press `n`/`N` to go to next/previous match):\n\n`/{{something}}`\n\n- Backward search for a string (press `n`/`N` to go to next/previous match):\n\n`?{{something}}`\n\n- Follow the output of the currently opened file:\n\n`F`\n\n- Open the current file in an editor:\n\n`v`\n\n- Exit:\n\n`q`\n
lex
lex(1p) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lex(1p) Linux manual page PROLOG | NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OPERANDS | STDIN | INPUT FILES | ENVIRONMENT VARIABLES | ASYNCHRONOUS EVENTS | STDOUT | STDERR | OUTPUT FILES | EXTENDED DESCRIPTION | EXIT STATUS | CONSEQUENCES OF ERRORS | APPLICATION USAGE | EXAMPLES | RATIONALE | FUTURE DIRECTIONS | SEE ALSO | COPYRIGHT LEX(1P) POSIX Programmer's Manual LEX(1P) PROLOG top This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME top lex generate programs for lexical tasks (DEVELOPMENT) SYNOPSIS top lex [-t] [-n|-v] [file...] DESCRIPTION top The lex utility shall generate C programs to be used in lexical processing of character input, and that can be used as an interface to yacc. The C programs shall be generated from lex source code and conform to the ISO C standard, without depending on any undefined, unspecified, or implementation-defined behavior, except in cases where the code is copied directly from the supplied source, or in cases that are documented by the implementation. Usually, the lex utility shall write the program it generates to the file lex.yy.c; the state of this file is unspecified if lex exits with a non-zero exit status. See the EXTENDED DESCRIPTION section for a complete description of the lex input language. OPTIONS top The lex utility shall conform to the Base Definitions volume of POSIX.12017, Section 12.2, Utility Syntax Guidelines, except for Guideline 9. The following options shall be supported: -n Suppress the summary of statistics usually written with the -v option. If no table sizes are specified in the lex source code and the -v option is not specified, then -n is implied. -t Write the resulting program to standard output instead of lex.yy.c. -v Write a summary of lex statistics to the standard output. (See the discussion of lex table sizes in Definitions in lex.) If the -t option is specified and -n is not specified, this report shall be written to standard error. If table sizes are specified in the lex source code, and if the -n option is not specified, the -v option may be enabled. OPERANDS top The following operand shall be supported: file A pathname of an input file. If more than one such file is specified, all files shall be concatenated to produce a single lex program. If no file operands are specified, or if a file operand is '-', the standard input shall be used. STDIN top The standard input shall be used if no file operands are specified, or if a file operand is '-'. See INPUT FILES. INPUT FILES top The input files shall be text files containing lex source code, as described in the EXTENDED DESCRIPTION section. ENVIRONMENT VARIABLES top The following environment variables shall affect the execution of lex: LANG Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.12017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_COLLATE Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements within regular expressions. If this variable is not set to the POSIX locale, the results are unspecified. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files), and the behavior of character classes within regular expressions. If this variable is not set to the POSIX locale, the results are unspecified. LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES. ASYNCHRONOUS EVENTS top Default. STDOUT top If the -t option is specified, the text file of C source code output of lex shall be written to standard output. If the -t option is not specified: * Implementation-defined informational, error, and warning messages concerning the contents of lex source code input shall be written to either the standard output or standard error. * If the -v option is specified and the -n option is not specified, lex statistics shall also be written to either the standard output or standard error, in an implementation- defined format. These statistics may also be generated if table sizes are specified with a '%' operator in the Definitions section, as long as the -n option is not specified. STDERR top If the -t option is specified, implementation-defined informational, error, and warning messages concerning the contents of lex source code input shall be written to the standard error. If the -t option is not specified: 1. Implementation-defined informational, error, and warning messages concerning the contents of lex source code input shall be written to either the standard output or standard error. 2. If the -v option is specified and the -n option is not specified, lex statistics shall also be written to either the standard output or standard error, in an implementation- defined format. These statistics may also be generated if table sizes are specified with a '%' operator in the Definitions section, as long as the -n option is not specified. OUTPUT FILES top A text file containing C source code shall be written to lex.yy.c, or to the standard output if the -t option is present. EXTENDED DESCRIPTION top Each input file shall contain lex source code, which is a table of regular expressions with corresponding actions in the form of C program fragments. When lex.yy.c is compiled and linked with the lex library (using the -l l operand with c99), the resulting program shall read character input from the standard input and shall partition it into strings that match the given expressions. When an expression is matched, these actions shall occur: * The input string that was matched shall be left in yytext as a null-terminated string; yytext shall either be an external character array or a pointer to a character string. As explained in Definitions in lex, the type can be explicitly selected using the %array or %pointer declarations, but the default is implementation-defined. * The external int yyleng shall be set to the length of the matching string. * The expression's corresponding program fragment, or action, shall be executed. During pattern matching, lex shall search the set of patterns for the single longest possible match. Among rules that match the same number of characters, the rule given first shall be chosen. The general format of lex source shall be: Definitions %% Rules %% UserSubroutines The first "%%" is required to mark the beginning of the rules (regular expressions and actions); the second "%%" is required only if user subroutines follow. Any line in the Definitions section beginning with a <blank> shall be assumed to be a C program fragment and shall be copied to the external definition area of the lex.yy.c file. Similarly, anything in the Definitions section included between delimiter lines containing only "%{" and "%}" shall also be copied unchanged to the external definition area of the lex.yy.c file. Any such input (beginning with a <blank> or within "%{" and "%}" delimiter lines) appearing at the beginning of the Rules section before any rules are specified shall be written to lex.yy.c after the declarations of variables for the yylex() function and before the first line of code in yylex(). Thus, user variables local to yylex() can be declared here, as well as application code to execute upon entry to yylex(). The action taken by lex when encountering any input beginning with a <blank> or within "%{" and "%}" delimiter lines appearing in the Rules section but coming after one or more rules is undefined. The presence of such input may result in an erroneous definition of the yylex() function. C-language code in the input shall not contain C-language trigraphs. The C-language code within "%{" and "%}" delimiter lines shall not contain any lines consisting only of "%}", or only of "%%". Definitions in lex Definitions appear before the first "%%" delimiter. Any line in this section not contained between "%{" and "%}" lines and not beginning with a <blank> shall be assumed to define a lex substitution string. The format of these lines shall be: name substitute If a name does not meet the requirements for identifiers in the ISO C standard, the result is undefined. The string substitute shall replace the string {name} when it is used in a rule. The name string shall be recognized in this context only when the braces are provided and when it does not appear within a bracket expression or within double-quotes. In the Definitions section, any line beginning with a <percent- sign> ('%') character and followed by an alphanumeric word beginning with either 's' or 'S' shall define a set of start conditions. Any line beginning with a '%' followed by a word beginning with either 'x' or 'X' shall define a set of exclusive start conditions. When the generated scanner is in a %s state, patterns with no state specified shall be also active; in a %x state, such patterns shall not be active. The rest of the line, after the first word, shall be considered to be one or more <blank>-separated names of start conditions. Start condition names shall be constructed in the same way as definition names. Start conditions can be used to restrict the matching of regular expressions to one or more states as described in Regular Expressions in lex. Implementations shall accept either of the following two mutually-exclusive declarations in the Definitions section: %array Declare the type of yytext to be a null-terminated character array. %pointer Declare the type of yytext to be a pointer to a null- terminated character string. The default type of yytext is implementation-defined. If an application refers to yytext outside of the scanner source file (that is, via an extern), the application shall include the appropriate %array or %pointer declaration in the scanner source file. Implementations shall accept declarations in the Definitions section for setting certain internal table sizes. The declarations are shown in the following table. Table: Table Size Declarations in lex Declaration Description Minimum Value %p n Number of positions 2500 %n n Number of states 500 %a n Number of transitions 2000 %e n Number of parse tree nodes 1000 %k n Number of packed character classes 1000 %o n Size of the output array 3000 In the table, n represents a positive decimal integer, preceded by one or more <blank> characters. The exact meaning of these table size numbers is implementation-defined. The implementation shall document how these numbers affect the lex utility and how they are related to any output that may be generated by the implementation should limitations be encountered during the execution of lex. It shall be possible to determine from this output which of the table size values needs to be modified to permit lex to successfully generate tables for the input language. The values in the column Minimum Value represent the lowest values conforming implementations shall provide. Rules in lex The rules in lex source files are a table in which the left column contains regular expressions and the right column contains actions (C program fragments) to be executed when the expressions are recognized. ERE action ERE action ... The extended regular expression (ERE) portion of a row shall be separated from action by one or more <blank> characters. A regular expression containing <blank> characters shall be recognized under one of the following conditions: * The entire expression appears within double-quotes. * The <blank> characters appear within double-quotes or square brackets. * Each <blank> is preceded by a <backslash> character. User Subroutines in lex Anything in the user subroutines section shall be copied to lex.yy.c following yylex(). Regular Expressions in lex The lex utility shall support the set of extended regular expressions (see the Base Definitions volume of POSIX.12017, Section 9.4, Extended Regular Expressions), with the following additions and exceptions to the syntax: "..." Any string enclosed in double-quotes shall represent the characters within the double-quotes as themselves, except that <backslash>-escapes (which appear in the following table) shall be recognized. Any <backslash>-escape sequence shall be terminated by the closing quote. For example, "\01""1" represents a single string: the octal value 1 followed by the character '1'. <state>r, <state1,state2,...>r The regular expression r shall be matched only when the program is in one of the start conditions indicated by state, state1, and so on; see Actions in lex. (As an exception to the typographical conventions of the rest of this volume of POSIX.12017, in this case <state> does not represent a metavariable, but the literal angle-bracket characters surrounding a symbol.) The start condition shall be recognized as such only at the beginning of a regular expression. r/x The regular expression r shall be matched only if it is followed by an occurrence of regular expression x (x is the instance of trailing context, further defined below). The token returned in yytext shall only match r. If the trailing portion of r matches the beginning of x, the result is unspecified. The r expression cannot include further trailing context or the '$' (match-end-of-line) operator; x cannot include the '^' (match-beginning-of-line) operator, nor trailing context, nor the '$' operator. That is, only one occurrence of trailing context is allowed in a lex regular expression, and the '^' operator only can be used at the beginning of such an expression. {name} When name is one of the substitution symbols from the Definitions section, the string, including the enclosing braces, shall be replaced by the substitute value. The substitute value shall be treated in the extended regular expression as if it were enclosed in parentheses. No substitution shall occur if {name} occurs within a bracket expression or within double- quotes. Within an ERE, a <backslash> character shall be considered to begin an escape sequence as specified in the table in the Base Definitions volume of POSIX.12017, Chapter 5, File Format Notation ('\\', '\a', '\b', '\f', '\n', '\r', '\t', '\v'). In addition, the escape sequences in the following table shall be recognized. A literal <newline> cannot occur within an ERE; the escape sequence '\n' can be used to represent a <newline>. A <newline> shall not be matched by a period operator. Table: Escape Sequences in lex Escape Sequence Description Meaning \digits A <backslash> character The character whose followed by the longest encoding is represented sequence of one, two, or by the one, two, or three octal-digit three-digit octal characters (01234567). integer. Multi-byte If all of the digits are characters require 0 (that is, multiple, concatenated representation of the escape sequences of this NUL character), the type, including the behavior is undefined. leading <backslash> for each byte. \xdigits A <backslash> character The character whose followed by the longest encoding is represented sequence of hexadecimal- by the hexadecimal digit characters integer. (01234567abcdefABCDEF). If all of the digits are 0 (that is, representation of the NUL character), the behavior is undefined. \c A <backslash> character The character 'c', followed by any unchanged. character not described in this table or in the table in the Base Definitions volume of POSIX.12017, Chapter 5, File Format Notation ('\\', '\a', '\b', '\f', '\n', '\r', '\t', '\v'). Note: If a '\x' sequence needs to be immediately followed by a hexadecimal digit character, a sequence such as "\x1""1" can be used, which represents a character containing the value 1, followed by the character '1'. The order of precedence given to extended regular expressions for lex differs from that specified in the Base Definitions volume of POSIX.12017, Section 9.4, Extended Regular Expressions. The order of precedence for lex shall be as shown in the following table, from high to low. Note: The escaped characters entry is not meant to imply that these are operators, but they are included in the table to show their relationships to the true operators. The start condition, trailing context, and anchoring notations have been omitted from the table because of the placement restrictions described in this section; they can only appear at the beginning or ending of an ERE. Table: ERE Precedence in lex Extended Regular Expression Precedence collation-related bracket symbols [= =] [: :] [. .] escaped characters \<special character> bracket expression [ ] quoting "..." grouping ( ) definition {name} single-character RE duplication * + ? concatenation interval expression {m,n} alternation | The ERE anchoring operators '^' and '$' do not appear in the table. With lex regular expressions, these operators are restricted in their use: the '^' operator can only be used at the beginning of an entire regular expression, and the '$' operator only at the end. The operators apply to the entire regular expression. Thus, for example, the pattern "(^abc)|(def$)" is undefined; it can instead be written as two separate rules, one with the regular expression "^abc" and one with "def$", which share a common action via the special '|' action (see below). If the pattern were written "^abc|def$", it would match either "abc" or "def" on a line by itself. Unlike the general ERE rules, embedded anchoring is not allowed by most historical lex implementations. An example of embedded anchoring would be for patterns such as "(^| )foo( |$)" to match "foo" when it exists as a complete word. This functionality can be obtained using existing lex features: ^foo/[ \n] | " foo"/[ \n] /* Found foo as a separate word. */ Note also that '$' is a form of trailing context (it is equivalent to "/\n") and as such cannot be used with regular expressions containing another instance of the operator (see the preceding discussion of trailing context). The additional regular expressions trailing-context operator '/' can be used as an ordinary character if presented within double- quotes, "/"; preceded by a <backslash>, "\/"; or within a bracket expression, "[/]". The start-condition '<' and '>' operators shall be special only in a start condition at the beginning of a regular expression; elsewhere in the regular expression they shall be treated as ordinary characters. Actions in lex The action to be taken when an ERE is matched can be a C program fragment or the special actions described below; the program fragment can contain one or more C statements, and can also include special actions. The empty C statement ';' shall be a valid action; any string in the lex.yy.c input that matches the pattern portion of such a rule is effectively ignored or skipped. However, the absence of an action shall not be valid, and the action lex takes in such a condition is undefined. The specification for an action, including C statements and special actions, can extend across several lines if enclosed in braces: ERE <one or more blanks> { program statement program statement } The program statements shall not contain unbalanced curly brace preprocessing tokens. The default action when a string in the input to a lex.yy.c program is not matched by any expression shall be to copy the string to the output. Because the default behavior of a program generated by lex is to read the input and copy it to the output, a minimal lex source program that has just "%%" shall generate a C program that simply copies the input to the output unchanged. Four special actions shall be available: | ECHO; REJECT; BEGIN | The action '|' means that the action for the next rule is the action for this rule. Unlike the other three actions, '|' cannot be enclosed in braces or be <semicolon>-terminated; the application shall ensure that it is specified alone, with no other actions. ECHO; Write the contents of the string yytext on the output. REJECT; Usually only a single expression is matched by a given string in the input. REJECT means ``continue to the next expression that matches the current input'', and shall cause whatever rule was the second choice after the current rule to be executed for the same input. Thus, multiple rules can be matched and executed for one input string or overlapping input strings. For example, given the regular expressions "xyz" and "xy" and the input "xyz", usually only the regular expression "xyz" would match. The next attempted match would start after z. If the last action in the "xyz" rule is REJECT, both this rule and the "xy" rule would be executed. The REJECT action may be implemented in such a fashion that flow of control does not continue after it, as if it were equivalent to a goto to another part of yylex(). The use of REJECT may result in somewhat larger and slower scanners. BEGIN The action: BEGIN newstate; switches the state (start condition) to newstate. If the string newstate has not been declared previously as a start condition in the Definitions section, the results are unspecified. The initial state is indicated by the digit '0' or the token INITIAL. The functions or macros described below are accessible to user code included in the lex input. It is unspecified whether they appear in the C code output of lex, or are accessible only through the -l l operand to c99 (the lex library). int yylex(void) Performs lexical analysis on the input; this is the primary function generated by the lex utility. The function shall return zero when the end of input is reached; otherwise, it shall return non-zero values (tokens) determined by the actions that are selected. int yymore(void) When called, indicates that when the next input string is recognized, it is to be appended to the current value of yytext rather than replacing it; the value in yyleng shall be adjusted accordingly. int yyless(int n) Retains n initial characters in yytext, NUL-terminated, and treats the remaining characters as if they had not been read; the value in yyleng shall be adjusted accordingly. int input(void) Returns the next character from the input, or zero on end- of-file. It shall obtain input from the stream pointer yyin, although possibly via an intermediate buffer. Thus, once scanning has begun, the effect of altering the value of yyin is undefined. The character read shall be removed from the input stream of the scanner without any processing by the scanner. int unput(int c) Returns the character 'c' to the input; yytext and yyleng are undefined until the next expression is matched. The result of using unput() for more characters than have been input is unspecified. The following functions shall appear only in the lex library accessible through the -l l operand; they can therefore be redefined by a conforming application: int yywrap(void) Called by yylex() at end-of-file; the default yywrap() shall always return 1. If the application requires yylex() to continue processing with another source of input, then the application can include a function yywrap(), which associates another file with the external variable FILE * yyin and shall return a value of zero. int main(int argc, char *argv[]) Calls yylex() to perform lexical analysis, then exits. The user code can contain main() to perform application- specific operations, calling yylex() as applicable. Except for input(), unput(), and main(), all external and static names generated by lex shall begin with the prefix yy or YY. EXIT STATUS top The following exit values shall be returned: 0 Successful completion. >0 An error occurred. CONSEQUENCES OF ERRORS top Default. The following sections are informative. APPLICATION USAGE top Conforming applications are warned that in the Rules section, an ERE without an action is not acceptable, but need not be detected as erroneous by lex. This may result in compilation or runtime errors. The purpose of input() is to take characters off the input stream and discard them as far as the lexical analysis is concerned. A common use is to discard the body of a comment once the beginning of a comment is recognized. The lex utility is not fully internationalized in its treatment of regular expressions in the lex source code or generated lexical analyzer. It would seem desirable to have the lexical analyzer interpret the regular expressions given in the lex source according to the environment specified when the lexical analyzer is executed, but this is not possible with the current lex technology. Furthermore, the very nature of the lexical analyzers produced by lex must be closely tied to the lexical requirements of the input language being described, which is frequently locale-specific anyway. (For example, writing an analyzer that is used for French text is not automatically useful for processing other languages.) EXAMPLES top The following is an example of a lex program that implements a rudimentary scanner for a Pascal-like syntax: %{ /* Need this for the call to atof() below. */ #include <math.h> /* Need this for printf(), fopen(), and stdin below. */ #include <stdio.h> %} DIGIT [0-9] ID [a-z][a-z0-9]* %% {DIGIT}+ { printf("An integer: %s (%d)\n", yytext, atoi(yytext)); } {DIGIT}+"."{DIGIT}* { printf("A float: %s (%g)\n", yytext, atof(yytext)); } if|then|begin|end|procedure|function { printf("A keyword: %s\n", yytext); } {ID} printf("An identifier: %s\n", yytext); "+"|"-"|"*"|"/" printf("An operator: %s\n", yytext); "{"[^}\n]*"}" /* Eat up one-line comments. */ [ \t\n]+ /* Eat up white space. */ . printf("Unrecognized character: %s\n", yytext); %% int main(int argc, char *argv[]) { ++argv, --argc; /* Skip over program name. */ if (argc > 0) yyin = fopen(argv[0], "r"); else yyin = stdin; yylex(); } RATIONALE top Even though the -c option and references to the C language are retained in this description, lex may be generalized to other languages, as was done at one time for EFL, the Extended FORTRAN Language. Since the lex input specification is essentially language-independent, versions of this utility could be written to produce Ada, Modula-2, or Pascal code, and there are known historical implementations that do so. The current description of lex bypasses the issue of dealing with internationalized EREs in the lex source code or generated lexical analyzer. If it follows the model used by awk (the source code is assumed to be presented in the POSIX locale, but input and output are in the locale specified by the environment variables), then the tables in the lexical analyzer produced by lex would interpret EREs specified in the lex source in terms of the environment variables specified when lex was executed. The desired effect would be to have the lexical analyzer interpret the EREs given in the lex source according to the environment specified when the lexical analyzer is executed, but this is not possible with the current lex technology. The description of octal and hexadecimal-digit escape sequences agrees with the ISO C standard use of escape sequences. Earlier versions of this standard allowed for implementations with bytes other than eight bits, but this has been modified in this version. There is no detailed output format specification. The observed behavior of lex under four different historical implementations was that none of these implementations consistently reported the line numbers for error and warning messages. Furthermore, there was a desire that lex be allowed to output additional diagnostic messages. Leaving message formats unspecified avoids these formatting questions and problems with internationalization. Although the %x specifier for exclusive start conditions is not historical practice, it is believed to be a minor change to historical implementations and greatly enhances the usability of lex programs since it permits an application to obtain the expected functionality with fewer statements. The %array and %pointer declarations were added as a compromise between historical systems. The System V-based lex copies the matched text to a yytext array. The flex program, supported in BSD and GNU systems, uses a pointer. In the latter case, significant performance improvements are available for some scanners. Most historical programs should require no change in porting from one system to another because the string being referenced is null-terminated in both cases. (The method used by flex in its case is to null-terminate the token in place by remembering the character that used to come right after the token and replacing it before continuing on to the next scan.) Multi- file programs with external references to yytext outside the scanner source file should continue to operate on their historical systems, but would require one of the new declarations to be considered strictly portable. The description of EREs avoids unnecessary duplication of ERE details because their meanings within a lex ERE are the same as that for the ERE in this volume of POSIX.12017. The reason for the undefined condition associated with text beginning with a <blank> or within "%{" and "%}" delimiter lines appearing in the Rules section is historical practice. Both the BSD and System V lex copy the indented (or enclosed) input in the Rules section (except at the beginning) to unreachable areas of the yylex() function (the code is written directly after a break statement). In some cases, the System V lex generates an error message or a syntax error, depending on the form of indented input. The intention in breaking the list of functions into those that may appear in lex.yy.c versus those that only appear in libl.a is that only those functions in libl.a can be reliably redefined by a conforming application. The descriptions of standard output and standard error are somewhat complicated because historical lex implementations chose to issue diagnostic messages to standard output (unless -t was given). POSIX.12008 allows this behavior, but leaves an opening for the more expected behavior of using standard error for diagnostics. Also, the System V behavior of writing the statistics when any table sizes are given is allowed, while BSD- derived systems can avoid it. The programmer can always precisely obtain the desired results by using either the -t or -n options. The OPERANDS section does not mention the use of - as a synonym for standard input; not all historical implementations support such usage for any of the file operands. A description of the translation table was deleted from early proposals because of its relatively low usage in historical applications. The change to the definition of the input() function that allows buffering of input presents the opportunity for major performance gains in some applications. The following examples clarify the differences between lex regular expressions and regular expressions appearing elsewhere in this volume of POSIX.12017. For regular expressions of the form "r/x", the string matching r is always returned; confusion may arise when the beginning of x matches the trailing portion of r. For example, given the regular expression "a*b/cc" and the input "aaabcc", yytext would contain the string "aaab" on this match. But given the regular expression "x*/xy" and the input "xxxy", the token xxx, not xx, is returned by some implementations because xxx matches "x*". In the rule "ab*/bc", the "b*" at the end of r extends r's match into the beginning of the trailing context, so the result is unspecified. If this rule were "ab/bc", however, the rule matches the text "ab" when it is followed by the text "bc". In this latter case, the matching of r cannot extend into the beginning of x, so the result is specified. FUTURE DIRECTIONS top None. SEE ALSO top c99(1p), ed(1p), yacc(1p) The Base Definitions volume of POSIX.12017, Chapter 5, File Format Notation, Chapter 8, Environment Variables, Chapter 9, Regular Expressions, Section 12.2, Utility Syntax Guidelines COPYRIGHT top Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE/The Open Group 2017 LEX(1P) Pages that refer to this page: awk(1p), cflow(1p), make(1p), yacc(1p) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lex\n\n> Lexical analyzer generator.\n> Given the specification for a lexical analyzer, generates C code implementing it.\n> More information: <https://manned.org/lex.1>.\n\n- Generate an analyzer from a Lex file, storing it to the file `lex.yy.c`:\n\n`lex {{analyzer.l}}`\n\n- Write analyzer to `stdout`:\n\n`lex -{{-stdout|t}} {{analyzer.l}}`\n\n- Specify the output file:\n\n`lex {{analyzer.l}} --outfile {{analyzer.c}}`\n\n- Generate a [B]atch scanner instead of an interactive scanner:\n\n`lex -B {{analyzer.l}}`\n\n- Compile a C file generated by Lex:\n\n`cc {{path/to/lex.yy.c}} --output {{executable}}`\n
link
link(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training link(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | AUTHOR | REPORTING BUGS | COPYRIGHT | SEE ALSO | COLOPHON LINK(1) User Commands LINK(1) NAME top link - call the link function to create a link to a file SYNOPSIS top link FILE1 FILE2 link OPTION DESCRIPTION top Call the link function to create a link named FILE2 to an existing FILE1. --help display this help and exit --version output version information and exit AUTHOR top Written by Michael Stone. REPORTING BUGS top GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT top Copyright 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO top link(2) Full documentation <https://www.gnu.org/software/coreutils/link> or available locally via: info '(coreutils) link invocation' COLOPHON top This page is part of the coreutils (basic file, shell and text manipulation utilities) project. Information about the project can be found at http://www.gnu.org/software/coreutils/. If you have a bug report for this manual page, see http://www.gnu.org/software/coreutils/. This page was obtained from the tarball coreutils-9.4.tar.xz fetched from http://ftp.gnu.org/gnu/coreutils/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] GNU coreutils 9.4 August 2023 LINK(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# link\n\n> Create a hard link to an existing file.\n> For more options, see the `ln` command.\n> More information: <https://www.gnu.org/software/coreutils/link>.\n\n- Create a hard link from a new file to an existing file:\n\n`link {{path/to/existing_file}} {{path/to/new_file}}`\n
ln
ln(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ln(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | AUTHOR | REPORTING BUGS | COPYRIGHT | SEE ALSO | COLOPHON LN(1) User Commands LN(1) NAME top ln - make links between files SYNOPSIS top ln [OPTION]... [-T] TARGET LINK_NAME ln [OPTION]... TARGET ln [OPTION]... TARGET... DIRECTORY ln [OPTION]... -t DIRECTORY TARGET... DESCRIPTION top In the 1st form, create a link to TARGET with the name LINK_NAME. In the 2nd form, create a link to TARGET in the current directory. In the 3rd and 4th forms, create links to each TARGET in DIRECTORY. Create hard links by default, symbolic links with --symbolic. By default, each destination (name of new link) should not already exist. When creating hard links, each TARGET must exist. Symbolic links can hold arbitrary text; if later resolved, a relative link is interpreted in relation to its parent directory. Mandatory arguments to long options are mandatory for short options too. --backup[=CONTROL] make a backup of each existing destination file -b like --backup but does not accept an argument -d, -F, --directory allow the superuser to attempt to hard link directories (note: will probably fail due to system restrictions, even for the superuser) -f, --force remove existing destination files -i, --interactive prompt whether to remove destinations -L, --logical dereference TARGETs that are symbolic links -n, --no-dereference treat LINK_NAME as a normal file if it is a symbolic link to a directory -P, --physical make hard links directly to symbolic links -r, --relative with -s, create links relative to link location -s, --symbolic make symbolic links instead of hard links -S, --suffix=SUFFIX override the usual backup suffix -t, --target-directory=DIRECTORY specify the DIRECTORY in which to create the links -T, --no-target-directory treat LINK_NAME as a normal file always -v, --verbose print name of each linked file --help display this help and exit --version output version information and exit The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. Here are the values: none, off never make backups (even if --backup is given) numbered, t make numbered backups existing, nil numbered if numbered backups exist, simple otherwise simple, never always make simple backups Using -s ignores -L and -P. Otherwise, the last option specified controls behavior when a TARGET is a symbolic link, defaulting to -P. AUTHOR top Written by Mike Parker and David MacKenzie. REPORTING BUGS top GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT top Copyright 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO top link(2), symlink(2) Full documentation <https://www.gnu.org/software/coreutils/ln> or available locally via: info '(coreutils) ln invocation' COLOPHON top This page is part of the coreutils (basic file, shell and text manipulation utilities) project. Information about the project can be found at http://www.gnu.org/software/coreutils/. If you have a bug report for this manual page, see http://www.gnu.org/software/coreutils/. This page was obtained from the tarball coreutils-9.4.tar.xz fetched from http://ftp.gnu.org/gnu/coreutils/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] GNU coreutils 9.4 August 2023 LN(1) Pages that refer to this page: dh_link(1), pmlogmv(1), update-alternatives(1), link(2), symlink(2), hier(7), symlink(7), sln(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ln\n\n> Creates links to files and directories.\n> More information: <https://www.gnu.org/software/coreutils/ln>.\n\n- Create a symbolic link to a file or directory:\n\n`ln -s {{/path/to/file_or_directory}} {{path/to/symlink}}`\n\n- Overwrite an existing symbolic link to point to a different file:\n\n`ln -sf {{/path/to/new_file}} {{path/to/symlink}}`\n\n- Create a hard link to a file:\n\n`ln {{/path/to/file}} {{path/to/hardlink}}`\n
loadkeys
loadkeys(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training loadkeys(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | RESET TO DEFAULT | LOAD KERNEL KEYMAP | LOAD KERNEL ACCENT TABLE | LOAD KERNEL STRING TABLE | CREATE KERNEL SOURCE TABLE | CREATE BINARY KEYMAP | UNICODE MODE | OTHER OPTIONS | WARNING | FILES | SEE ALSO | COLOPHON LOADKEYS(1) General Commands Manual LOADKEYS(1) NAME top loadkeys - load keyboard translation tables SYNOPSIS top loadkeys [OPTION]... FILENAME... loadkeys --default loadkeys --mktable loadkeys --bkeymap loadkeys --parse DESCRIPTION top The program loadkeys reads the file or files specified by FILENAME.... Its main purpose is to load the kernel keymap for the console. You can specify console device by the -C (or --console ) option. RESET TO DEFAULT top If the -d (or --default ) option is given, loadkeys loads a default keymap, probably the file defkeymap.map either in @DATADIR@/keymaps or in /usr/src/linux/drivers/char. (Probably the former was user-defined, while the latter is a qwerty keyboard map for PCs - maybe not what was desired.) Sometimes, with a strange keymap loaded (with the minus on some obscure unknown modifier combination) it is easier to type `loadkeys defkeymap'. LOAD KERNEL KEYMAP top The main function of loadkeys is to load or modify the keyboard driver's translation tables. When specifying the file names, standard input can be denoted by dash (-). If no file is specified, the data is read from the standard input. For many countries and keyboard types appropriate keymaps are available already, and a command like `loadkeys uk' might do what you want. On the other hand, it is easy to construct one's own keymap. The user has to tell what symbols belong to each key. She can find the keycode for a key by use of showkey(1), while the keymap format is given in keymaps(5) and can also be seen from the output of dumpkeys(1). LOAD KERNEL ACCENT TABLE top If the input file does not contain any compose key definitions, the kernel accent table is left unchanged, unless the -c (or --clearcompose ) option is given, in which case the kernel accent table is emptied. If the input file does contain compose key definitions, then all old definitions are removed, and replaced by the specified new entries. The kernel accent table is a sequence of (by default 68) entries describing how dead diacritical signs and compose keys behave. For example, a line compose ',' 'c' to ccedilla means that <ComposeKey><,><c> must be combined to <ccedilla>. The current content of this table can be see using `dumpkeys --compose-only'. LOAD KERNEL STRING TABLE top The option -s (or --clearstrings ) clears the kernel string table. If this option is not given, loadkeys will only add or replace strings, not remove them. (Thus, the option -s is required to reach a well-defined state.) The kernel string table is a sequence of strings with names like F31. One can make function key F5 (on an ordinary PC keyboard) produce the text `Hello!', and Shift+F5 `Goodbye!' using lines keycode 63 = F70 F71 string F70 = "Hello!" string F71 = "Goodbye!" in the keymap. The default bindings for the function keys are certain escape sequences mostly inspired by the VT100 terminal. CREATE KERNEL SOURCE TABLE top If the -m (or --mktable ) option is given loadkeys prints to the standard output a file that may be used as /usr/src/linux /drivers/char/defkeymap.c, specifying the default key bindings for a kernel (and does not modify the current keymap). CREATE BINARY KEYMAP top If the -b (or --bkeymap ) option is given loadkeys prints to the standard output a file that may be used as a binary keymap as expected by Busybox loadkmap command (and does not modify the current keymap). UNICODE MODE top loadkeys automatically detects whether the console is in Unicode or ASCII (XLATE) mode. When a keymap is loaded, literal keysyms (such as section) are resolved accordingly; numerical keysyms are converted to fit the current console mode, regardless of the way they are specified (decimal, octal, hexadecimal or Unicode). The -u (or --unicode) switch forces loadkeys to convert all keymaps to Unicode. If the keyboard is in a non-Unicode mode, such as XLATE, loadkeys will change it to Unicode for the time of its execution. A warning message will be printed in this case. It is recommended to run kbd_mode(1) before loadkeys instead of using the -u option. OTHER OPTIONS top -a --ascii Force conversion to ASCII. -h --help loadkeys prints its version number and a short usage message to the programs standard error output and exits. -p --parse loadkeys searches and parses keymap without action. -q --quiet loadkeys suppresses all normal output. -V --version loadkeys prints version number and exits. WARNING top Note that anyone having read access to /dev/console can run loadkeys and thus change the keyboard layout, possibly making it unusable. Note that the keyboard translation table is common for all the virtual consoles, so any changes to the keyboard bindings affect all the virtual consoles simultaneously. Note that because the changes affect all the virtual consoles, they also outlive your session. This means that even at the login prompt the key bindings may not be what the user expects. FILES top @DATADIR@/keymaps default directory for keymaps. /usr/src/linux/drivers/char/defkeymap.map default kernel keymap. SEE ALSO top dumpkeys(1), keymaps(5) COLOPHON top This page is part of the kbd (Linux keyboard tools) project. Information about the project can be found at http://www.kbd-project.org/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository https://github.com/legionus/kbd.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-13.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] kbd 6 Feb 1994 LOADKEYS(1) Pages that refer to this page: dumpkeys(1), kbd_mode(1), localectl(1), setleds(1), setmetamode(1), showkey(1), unicode_start(1), ioctl_console(2), reboot(2), keymaps(5), vconsole.conf(5), setkeycodes(8), systemd-localed.service(8), systemd-vconsole-setup.service(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# loadkeys\n\n> Load the kernel keymap for the console.\n> More information: <https://manned.org/loadkeys>.\n\n- Load a default keymap:\n\n`loadkeys --default`\n\n- Load default keymap when an unusual keymap is loaded and `-` sign cannot be found:\n\n`loadkeys defmap`\n\n- Create a kernel source table:\n\n`loadkeys --mktable`\n\n- Create a binary keymap:\n\n`loadkeys --bkeymap`\n\n- Search and parse keymap without action:\n\n`loadkeys --parse`\n\n- Load the keymap suppressing all output:\n\n`loadkeys --quiet`\n\n- Load a keymap from the specified file for the console:\n\n`loadkeys --console {{/dev/ttyN}} {{/path/to/file}}`\n\n- Use standard names for keymaps of different locales:\n\n`loadkeys --console {{/dev/ttyN}} {{uk}}`\n
locale
locale(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training locale(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | FILES | STANDARDS | HISTORY | EXAMPLES | SEE ALSO locale(1) General Commands Manual locale(1) NAME top locale - get locale-specific information SYNOPSIS top locale [option] locale [option] -a locale [option] -m locale [option] name... DESCRIPTION top The locale command displays information about the current locale, or all locales, on standard output. When invoked without arguments, locale displays the current locale settings for each locale category (see locale(5)), based on the settings of the environment variables that control the locale (see locale(7)). Values for variables set in the environment are printed without double quotes, implied values are printed with double quotes. If either the -a or the -m option (or one of their long-format equivalents) is specified, the behavior is as follows: -a, --all-locales Display a list of all available locales. The -v option causes the LC_IDENTIFICATION metadata about each locale to be included in the output. -m, --charmaps Display the available charmaps (character set description files). To display the current character set for the locale, use locale -c charmap. The locale command can also be provided with one or more arguments, which are the names of locale keywords (for example, date_fmt, ctype-class-names, yesexpr, or decimal_point) or locale categories (for example, LC_CTYPE or LC_TIME). For each argument, the following is displayed: For a locale keyword, the value of that keyword to be displayed. For a locale category, the values of all keywords in that category are displayed. When arguments are supplied, the following options are meaningful: -c, --category-name For a category name argument, write the name of the locale category on a separate line preceding the list of keyword values for that category. For a keyword name argument, write the name of the locale category for this keyword on a separate line preceding the keyword value. This option improves readability when multiple name arguments are specified. It can be combined with the -k option. -k, --keyword-name For each keyword whose value is being displayed, include also the name of that keyword, so that the output has the format: keyword="value" The locale command also knows about the following options: -v, --verbose Display additional information for some command-line option and argument combinations. -?, --help Display a summary of command-line options and arguments and exit. --usage Display a short usage message and exit. -V, --version Display the program version and exit. FILES top /usr/lib/locale/locale-archive Usual default locale archive location. /usr/share/i18n/locales Usual default path for locale definition files. STANDARDS top POSIX.1-2008. HISTORY top POSIX.1-2001. EXAMPLES top $ locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= $ locale date_fmt %a %b %e %H:%M:%S %Z %Y $ locale -k date_fmt date_fmt="%a %b %e %H:%M:%S %Z %Y" $ locale -ck date_fmt LC_TIME date_fmt="%a %b %e %H:%M:%S %Z %Y" $ locale LC_TELEPHONE +%c (%a) %l (%a) %l 11 1 UTF-8 $ locale -k LC_TELEPHONE tel_int_fmt="+%c (%a) %l" tel_dom_fmt="(%a) %l" int_select="11" int_prefix="1" telephone-codeset="UTF-8" The following example compiles a custom locale from the ./wrk directory with the localedef(1) utility under the $HOME/.locale directory, then tests the result with the date(1) command, and then sets the environment variables LOCPATH and LANG in the shell profile file so that the custom locale will be used in the subsequent user sessions: $ mkdir -p $HOME/.locale $ I18NPATH=./wrk/ localedef -f UTF-8 -i fi_SE $HOME/.locale/fi_SE.UTF-8 $ LOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF-8 date $ echo "export LOCPATH=\$HOME/.locale" >> $HOME/.bashrc $ echo "export LANG=fi_SE.UTF-8" >> $HOME/.bashrc SEE ALSO top localedef(1), charmap(5), locale(5), locale(7) Linux man-pages (unreleased) (date) locale(1) Pages that refer to this page: iconv(1), localedef(1), localeconv(3), newlocale(3), nl_langinfo(3), setlocale(3), sysconf(3), uselocale(3), charmap(5), locale(5), repertoiremap(5), locale(7), unicode(7), utf-8(7) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# locale\n\n> Get locale-specific information.\n> More information: <https://manned.org/locale>.\n\n- List all global environment variables describing the user's locale:\n\n`locale`\n\n- List all available locales:\n\n`locale --all-locales`\n\n- Display all available locales and the associated metadata:\n\n`locale --all-locales --verbose`\n\n- Display the current date format:\n\n`locale date_fmt`\n
localectl
localectl(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training localectl(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | COMMANDS | OPTIONS | EXIT STATUS | ENVIRONMENT | SEE ALSO | NOTES | COLOPHON LOCALECTL(1) localectl LOCALECTL(1) NAME top localectl - Control the system locale and keyboard layout settings SYNOPSIS top localectl [OPTIONS...] {COMMAND} DESCRIPTION top localectl may be used to query and change the system locale and keyboard layout settings. It communicates with systemd-localed(8) to modify files such as /etc/locale.conf and /etc/vconsole.conf. The system locale controls the language settings of system services and of the UI before the user logs in, such as the display manager, as well as the default for users after login. The keyboard settings control the keyboard layout used on the text console and of the graphical UI before the user logs in, such as the display manager, as well as the default for users after login. Note that the changes performed using this tool might require the initrd to be rebuilt to take effect during early system boot. The initrd is not rebuilt automatically by localectl, this task has to be performed manually, usually using a tool like dracut(8). Note that systemd-firstboot(1) may be used to initialize the system locale for mounted (but not booted) system images. COMMANDS top The following commands are understood: status Show current settings of the system locale and keyboard mapping. If no command is specified, this is the implied default. Added in version 195. set-locale LOCALE, set-locale VARIABLE=LOCALE... Set the system locale. This takes one locale such as "en_US.UTF-8", or takes one or more locale assignments such as "LANG=de_DE.utf8", "LC_MESSAGES=en_GB.utf8", and so on. If one locale without variable name is provided, then "LANG=" locale variable will be set. See locale(7) for details on the available settings and their meanings. Use list-locales for a list of available locales (see below). Added in version 195. list-locales List available locales useful for configuration with set-locale. Added in version 195. set-keymap MAP [TOGGLEMAP] Set the system keyboard mapping for the console and X11. This takes a mapping name (such as "de" or "us"), and possibly a second one to define a toggle keyboard mapping. Unless --no-convert is passed, the selected setting is also applied as the default system keyboard mapping of X11, after converting it to the closest matching X11 keyboard mapping. Use list-keymaps for a list of available keyboard mappings (see below). Added in version 195. list-keymaps List available keyboard mappings for the console, useful for configuration with set-keymap. Added in version 195. set-x11-keymap LAYOUT [MODEL [VARIANT [OPTIONS]]] Set the system default keyboard mapping for X11 and the virtual console. This takes a keyboard mapping name (such as "de" or "us"), and possibly a model, variant, and options, see kbd(4) for details. Unless --no-convert is passed, the selected setting is also applied as the system console keyboard mapping, after converting it to the closest matching console keyboard mapping. Added in version 195. list-x11-keymap-models, list-x11-keymap-layouts, list-x11-keymap-variants [LAYOUT], list-x11-keymap-options List available X11 keymap models, layouts, variants and options, useful for configuration with set-keymap. The command list-x11-keymap-variants optionally takes a layout parameter to limit the output to the variants suitable for the specific layout. Added in version 201. OPTIONS top The following options are understood: --no-ask-password Do not query the user for authentication for privileged operations. Added in version 195. --no-convert If set-keymap or set-x11-keymap is invoked and this option is passed, then the keymap will not be converted from the console to X11, or X11 to console, respectively. Added in version 195. -H, --host= Execute the operation remotely. Specify a hostname, or a username and hostname separated by "@", to connect to. The hostname may optionally be suffixed by a port ssh is listening on, separated by ":", and then a container name, separated by "/", which connects directly to a specific container on the specified host. This will use SSH to talk to the remote machine manager instance. Container names may be enumerated with machinectl -H HOST. Put IPv6 addresses in brackets. -M, --machine= Execute operation on a local container. Specify a container name to connect to, optionally prefixed by a user name to connect as and a separating "@" character. If the special string ".host" is used in place of the container name, a connection to the local system is made (which is useful to connect to a specific user's user bus: "--user [email protected]"). If the "@" syntax is not used, the connection is made as root user. If the "@" syntax is used either the left hand side or the right hand side may be omitted (but not both) in which case the local user name and ".host" are implied. -h, --help Print a short help text and exit. --version Print a short version string and exit. --no-pager Do not pipe output into a pager. EXIT STATUS top On success, 0 is returned, a non-zero failure code otherwise. ENVIRONMENT top $SYSTEMD_LOG_LEVEL The maximum log level of emitted messages (messages with a higher log level, i.e. less important ones, will be suppressed). Either one of (in order of decreasing importance) emerg, alert, crit, err, warning, notice, info, debug, or an integer in the range 0...7. See syslog(3) for more information. $SYSTEMD_LOG_COLOR A boolean. If true, messages written to the tty will be colored according to priority. This setting is only useful when messages are written directly to the terminal, because journalctl(1) and other tools that display logs will color messages based on the log level on their own. $SYSTEMD_LOG_TIME A boolean. If true, console log messages will be prefixed with a timestamp. This setting is only useful when messages are written directly to the terminal or a file, because journalctl(1) and other tools that display logs will attach timestamps based on the entry metadata on their own. $SYSTEMD_LOG_LOCATION A boolean. If true, messages will be prefixed with a filename and line number in the source code where the message originates. Note that the log location is often attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs. $SYSTEMD_LOG_TID A boolean. If true, messages will be prefixed with the current numerical thread ID (TID). Note that the this information is attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs. $SYSTEMD_LOG_TARGET The destination for log messages. One of console (log to the attached tty), console-prefixed (log to the attached tty but with prefixes encoding the log level and "facility", see syslog(3), kmsg (log to the kernel circular log buffer), journal (log to the journal), journal-or-kmsg (log to the journal if available, and to kmsg otherwise), auto (determine the appropriate log target automatically, the default), null (disable log output). $SYSTEMD_LOG_RATELIMIT_KMSG Whether to ratelimit kmsg or not. Takes a boolean. Defaults to "true". If disabled, systemd will not ratelimit messages written to kmsg. $SYSTEMD_PAGER Pager to use when --no-pager is not given; overrides $PAGER. If neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known pager implementations are tried in turn, including less(1) and more(1), until one is found. If no pager implementation is discovered no pager is invoked. Setting this environment variable to an empty string or the value "cat" is equivalent to passing --no-pager. Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER (as well as $PAGER) will be silently ignored. $SYSTEMD_LESS Override the options passed to less (by default "FRSXMK"). Users might want to change two options in particular: K This option instructs the pager to exit immediately when Ctrl+C is pressed. To allow less to handle Ctrl+C itself to switch back to the pager command prompt, unset this option. If the value of $SYSTEMD_LESS does not include "K", and the pager that is invoked is less, Ctrl+C will be ignored by the executable, and needs to be handled by the pager. X This option instructs the pager to not send termcap initialization and deinitialization strings to the terminal. It is set by default to allow command output to remain visible in the terminal even after the pager exits. Nevertheless, this prevents some pager functionality from working, in particular paged output cannot be scrolled with the mouse. See less(1) for more discussion. $SYSTEMD_LESSCHARSET Override the charset passed to less (by default "utf-8", if the invoking terminal is determined to be UTF-8 compatible). $SYSTEMD_PAGERSECURE Takes a boolean argument. When true, the "secure" mode of the pager is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set at all, secure mode is enabled if the effective UID is not the same as the owner of the login session, see geteuid(2) and sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set when invoking the pager, and the pager shall disable commands that open or create new files or start new subprocesses. When $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known to implement secure mode will not be used. (Currently only less(1) implements secure mode.) Note: when commands are invoked with elevated privileges, for example under sudo(8) or pkexec(1), care must be taken to ensure that unintended interactive features are not enabled. "Secure" mode for the pager may be enabled automatically as describe above. Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited environment allows the user to invoke arbitrary commands. Note that if the $SYSTEMD_PAGER or $PAGER variables are to be honoured, $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to completely disable the pager using --no-pager instead. $SYSTEMD_COLORS Takes a boolean argument. When true, systemd and related utilities will use colors in their output, otherwise the output will be monochrome. Additionally, the variable can take one of the following special values: "16", "256" to restrict the use of colors to the base 16 or 256 ANSI colors, respectively. This can be specified to override the automatic decision based on $TERM and what the console is connected to. $SYSTEMD_URLIFY The value must be a boolean. Controls whether clickable links should be generated in the output for terminal emulators supporting this. This can be specified to override the decision that systemd makes based on $TERM and other conditions. SEE ALSO top systemd(1), locale(7), locale.conf(5), vconsole.conf(5), loadkeys(1), kbd(4), The XKB Configuration Guide[1], systemctl(1), systemd-localed.service(8), systemd-firstboot(1), dracut(8) NOTES top 1. The XKB Configuration Guide http://www.x.org/releases/current/doc/xorg-docs/input/XKB-Config.html COLOPHON top This page is part of the systemd (systemd system and service manager) project. Information about the project can be found at http://www.freedesktop.org/wiki/Software/systemd. If you have a bug report for this manual page, see http://www.freedesktop.org/wiki/Software/systemd/#bugreports. This page was obtained from the project's upstream Git repository https://github.com/systemd/systemd.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-22.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] systemd 255 LOCALECTL(1) Pages that refer to this page: systemd-firstboot(1), locale.conf(5), vconsole.conf(5), systemd.directives(7), systemd.index(7), systemd-localed.service(8), systemd-machined.service(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# localectl\n\n> Control the system locale and keyboard layout settings.\n> More information: <https://www.freedesktop.org/software/systemd/man/localectl.html>.\n\n- Show the current settings of the system locale and keyboard mapping:\n\n`localectl`\n\n- List available locales:\n\n`localectl list-locales`\n\n- Set a system locale variable:\n\n`localectl set-locale {{LANG}}={{en_US.UTF-8}}`\n\n- List available keymaps:\n\n`localectl list-keymaps`\n\n- Set the system keyboard mapping for the console and X11:\n\n`localectl set-keymap {{us}}`\n
locate
locate(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training locate(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | ENVIRONMENT | HISTORY | BUGS | REPORTING BUGS | COPYRIGHT | SEE ALSO | COLOPHON LOCATE(1) General Commands Manual LOCATE(1) NAME top locate - list files in databases that match a pattern SYNOPSIS top locate [-d path | --database=path] [-e | -E | --[non-]existing] [-i | --ignore-case] [-0 | --null] [-c | --count] [-w | --wholename] [-b | --basename] [-l N | --limit=N] [-S | --statistics] [-r | --regex ] [--regextype R] [--max-database-age D] [-P | -H | --nofollow] [-L | --follow] [--version] [-A | --all] [-p | --print] [--help] pattern... DESCRIPTION top This manual page documents the GNU version of locate. For each given pattern, locate searches one or more databases of file names and displays the file names that contain the pattern. Patterns can contain shell-style metacharacters: `*', `?', and `[]'. The metacharacters do not treat `/' or `.' specially. Therefore, a pattern `foo*bar' can match a file name that contains `foo3/bar', and a pattern `*duck*' can match a file name that contains `lake/.ducky'. Patterns that contain metacharacters should be quoted to protect them from expansion by the shell. If a pattern is a plain string it contains no metacharacters locate displays all file names in the database that contain that string anywhere. If a pattern does contain metacharacters, locate only displays file names that match the pattern exactly. As a result, patterns that contain metacharacters should usually begin with a `*', and will most often end with one as well. The exceptions are patterns that are intended to explicitly match the beginning or end of a file name. The file name databases contain lists of files that were on the system when the databases were last updated. The system administrator can choose the file name of the default database, the frequency with which the databases are updated, and the directories for which they contain entries; see updatedb(1). If locate's output is going to a terminal, unusual characters in the output are escaped in the same way as for the -print action of the find command. If the output is not going to a terminal, file names are printed exactly as-is. OPTIONS top -0, --null Use ASCII NUL as a separator, instead of newline. -A, --all Print only names which match all non-option arguments, not those matching one or more non-option arguments. -b, --basename Results are considered to match if the pattern specified matches the final component of the name of a file as listed in the database. This final component is usually referred to as the `base name'. -c, --count Instead of printing the matched filenames, just print the total number of matches we found, unless --print (-p) is also present. -d path, --database=path Instead of searching the default file name database, search the file name databases in path, which is a colon- separated list of database file names. You can also use the environment variable LOCATE_PATH to set the list of database files to search. The option overrides the environment variable if both are used. Empty elements in the path are taken to be synonyms for the file name of the default database. A database can be supplied on stdin, using `-' as an element of path. If more than one element of path is `-', later instances are ignored (and a warning message is printed). The file name database format changed starting with GNU find and locate version 4.0 to allow machines with different byte orderings to share the databases. This version of locate can automatically recognize and read databases produced for older versions of GNU locate or Unix versions of locate or find. Support for the old locate database format will be discontinued in a future release. -e, --existing Only print out such names that currently exist (instead of such names that existed when the database was created). Note that this may slow down the program a lot, if there are many matches in the database. If you are using this option within a program, please note that it is possible for the file to be deleted after locate has checked that it exists, but before you use it. -E, --non-existing Only print out such names that currently do not exist (instead of such names that existed when the database was created). Note that this may slow down the program a lot, if there are many matches in the database. --help Print a summary of the options to locate and exit. -i, --ignore-case Ignore case distinctions in both the pattern and the file names. -l N, --limit=N Limit the number of matches to N. If a limit is set via this option, the number of results printed for the -c option will never be larger than this number. -L, --follow If testing for the existence of files (with the -e or -E options), consider broken symbolic links to be non- existing. This is the default. --max-database-age D Normally, locate will issue a warning message when it searches a database which is more than 8 days old. This option changes that value to something other than 8. The effect of specifying a negative value is undefined. -m, --mmap Accepted but does nothing, for compatibility with BSD locate. -P, -H, --nofollow If testing for the existence of files (with the -e or -E options), treat broken symbolic links as if they were existing files. The -H form of this option is provided purely for similarity with find; the use of -P is recommended over -H. -p, --print Print search results when they normally would not, because of the presence of --statistics (-S) or --count (-c). -r, --regex The pattern specified on the command line is understood to be a regular expression, as opposed to a glob pattern. The Regular expressions work in the same was as in emacs except for the fact that "." will match a newline. GNU find uses the same regular expressions. Filenames whose full paths match the specified regular expression are printed (or, in the case of the -c option, counted). If you wish to anchor your regular expression at the ends of the full path name, then as is usual with regular expressions, you should use the characters ^ and $ to signify this. --regextype R Use regular expression dialect R. Supported dialects include `findutils-default', `posix-awk', `posix-basic', `posix-egrep', `posix-extended', `posix-minimal-basic', `awk', `ed', `egrep', `emacs', `gnu-awk', `grep' and `sed'. See the Texinfo documentation for a detailed explanation of these dialects. -s, --stdio Accepted but does nothing, for compatibility with BSD locate. -S, --statistics Print various statistics about each locate database and then exit without performing a search, unless non-option arguments are given. For compatibility with BSD, -S is accepted as a synonym for --statistics. However, the output of locate -S is different for the GNU and BSD implementations of locate. --version Print the version number of locate and exit. -w, --wholename Match against the whole name of the file as listed in the database. This is the default. ENVIRONMENT top LOCATE_PATH Colon-separated list of databases to search. If the value has a leading or trailing colon, or has two colons in a row, you may get results that vary between different versions of locate. HISTORY top The locate program started life as the BSD fast find program, contributed to BSD by James A. Woods. This was described by his paper Finding Files Fast which was published in Usenix ;login:, Vol 8, No 1, February/March, 1983, pp. 8-10. When the find program began to assume a default -print action if no action was specified, this changed the interpretation of find pattern. The BSD developers therefore moved the fast find functionality into locate. The GNU implementation of locate appears to be derived from the same code. Significant changes to locate in reverse order: 4.3.7 Byte-order independent support for old database format 4.3.3 locate -i supports multi-byte characters correctly Introduced --max_db_age 4.3.2 Support for the slocate database format 4.2.22 Introduced the --all option 4.2.15 Introduced the --regex option 4.2.14 Introduced options -L, -P, -H 4.2.12 Empty items in LOCATE_PATH now indicate the default database 4.2.11 Introduced the --statistics option 4.2.4 Introduced --count and --limit 4.2.0 Glob characters cause matching against the whole file name 4.0 Introduced the LOCATE02 database format 3.7 Locate can search multiple databases BUGS top The locate database correctly handles filenames containing newlines, but only if the system's sort command has a working -z option. If you suspect that locate may need to return filenames containing newlines, consider using its --null option. REPORTING BUGS top GNU findutils online help: <https://www.gnu.org/software/findutils/#get-help> Report any translation bugs to <https://translationproject.org/team/> Report any other issue via the form at the GNU Savannah bug tracker: <https://savannah.gnu.org/bugs/?group=findutils> General topics about the GNU findutils package are discussed at the bug-findutils mailing list: <https://lists.gnu.org/mailman/listinfo/bug-findutils> COPYRIGHT top Copyright 1994-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO top find(1), updatedb(1), xargs(1), glob(3), locatedb(5) Full documentation <https://www.gnu.org/software/findutils/locate> or available locally via: info locate COLOPHON top This page is part of the findutils (find utilities) project. Information about the project can be found at http://www.gnu.org/software/findutils/. If you have a bug report for this manual page, see https://savannah.gnu.org/bugs/?group=findutils. This page was obtained from the project's upstream Git repository git://git.savannah.gnu.org/findutils.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-11-11.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] LOCATE(1) Pages that refer to this page: find(1), intro(1), updatedb(1), xargs(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# locate\n\n> Find filenames quickly.\n> More information: <https://manned.org/locate>.\n\n- Look for pattern in the database. Note: the database is recomputed periodically (usually weekly or daily):\n\n`locate {{pattern}}`\n\n- Look for a file by its exact filename (a pattern containing no globbing characters is interpreted as `*pattern*`):\n\n`locate '*/{{filename}}'`\n\n- Recompute the database. You need to do it if you want to find recently added files:\n\n`sudo updatedb`\n
logger
logger(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training logger(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXIT STATUS | FACILITIES AND LEVELS | CONFORMING TO | EXAMPLES | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY LOGGER(1) User Commands LOGGER(1) NAME top logger - enter messages into the system log SYNOPSIS top logger [options] message DESCRIPTION top logger makes entries in the system log. When the optional message argument is present, it is written to the log. If it is not present, and the -f option is not given either, then standard input is logged. OPTIONS top -d, --udp Use datagrams (UDP) only. By default the connection is tried to the syslog port defined in /etc/services, which is often 514. See also --server and --socket to specify where to connect. -e, --skip-empty Ignore empty lines when processing files. An empty line is defined to be a line without any characters. Thus a line consisting only of whitespace is NOT considered empty. Note that when the --prio-prefix option is specified, the priority is not part of the line. Thus an empty line in this mode is a line that does not have any characters after the priority prefix (e.g., <13>). -f, --file file Log the contents of the specified file. This option cannot be combined with a command-line message. -i Log the PID of the logger process with each line. --id[=id] Log the PID of the logger process with each line. When the optional argument id is specified, then it is used instead of the logger commands PID. The use of --id=$$ (PPID) is recommended in scripts that send several messages. Note that the system logging infrastructure (for example systemd when listening on /dev/log) may follow local socket credentials to overwrite the PID specified in the message. logger(1) is able to set those socket credentials to the given id, but only if you have root permissions and a process with the specified PID exists, otherwise the socket credentials are not modified and the problem is silently ignored. --journald[=file] Write a systemd journal entry. The entry is read from the given file, when specified, otherwise from standard input. Each line must begin with a field that is accepted by journald; see systemd.journal-fields(7) for details. The use of a MESSAGE_ID field is generally a good idea, as it makes finding entries easy. Examples: logger --journald <<end MESSAGE_ID=67feb6ffbaf24c5cbec13c008dd72309 MESSAGE=The dogs bark, but the caravan goes on. DOGS=bark CARAVAN=goes on end logger --journald=entry.txt Notice that --journald will ignore values of other options, such as priority. If priority is needed it must be within input, and use PRIORITY field. The simple execution of journalctl(1) will display MESSAGE field. Use journalctl --output json-pretty to see rest of the fields. To include newlines in MESSAGE, specify MESSAGE several times. This is handled as a special case, other fields will be stored as an array in the journal if they appear multiple times. --msgid msgid Sets the RFC 5424 <https://tools.ietf.org/html/rfc5424> MSGID field. Note that the space character is not permitted inside of msgid. This option is only used if --rfc5424 is specified as well; otherwise, it is silently ignored. -n, --server server Write to the specified remote syslog server instead of to the system log socket. Unless --udp or --tcp is specified, logger will first try to use UDP, but if this fails a TCP connection is attempted. --no-act Causes everything to be done except for writing the log message to the system log, and removing the connection to the journal. This option can be used together with --stderr for testing purposes. --octet-count Use the RFC 6587 <https://tools.ietf.org/html/rfc6587> octet counting framing method for sending messages. When this option is not used, the default is no framing on UDP, and RFC6587 non-transparent framing (also known as octet stuffing) on TCP. -P, --port port Use the specified port. When this option is not specified, the port defaults to syslog for udp and to syslog-conn for tcp connections. -p, --priority priority Enter the message into the log with the specified priority. The priority may be specified numerically or as a facility.level pair. For example, -p local3.info logs the message as informational in the local3 facility. The default is user.notice. --prio-prefix Look for a syslog prefix on every line read from standard input. This prefix is a decimal number within angle brackets that encodes both the facility and the level. The number is constructed by multiplying the facility by 8 and then adding the level. For example, local0.info, meaning facility=16 and level=6, becomes <134>. If the prefix contains no facility, the facility defaults to what is specified by the -p option. Similarly, if no prefix is provided, the line is logged using the priority given with -p. This option doesnt affect a command-line message. --rfc3164 Use the RFC 3164 <https://tools.ietf.org/html/rfc3164> BSD syslog protocol to submit messages to a remote server. --rfc5424[=without] Use the RFC 5424 <https://tools.ietf.org/html/rfc5424> syslog protocol to submit messages to a remote server. The optional without argument can be a comma-separated list of the following values: notq, notime, nohost. The notq value suppresses the time-quality structured data from the submitted message. The time-quality information shows whether the local clock was synchronized plus the maximum number of microseconds the timestamp might be off. The time quality is also automatically suppressed when --sd-id timeQuality is specified. The notime value (which implies notq) suppresses the complete sender timestamp that is in ISO-8601 format, including microseconds and timezone. The nohost value suppresses gethostname(2) information from the message header. The RFC 5424 protocol has been the default for logger since version 2.26. -s, --stderr Output the message to standard error as well as to the system log. --sd-id name[@digits] Specifies a structured data element ID for an RFC 5424 message header. The option has to be used before --sd-param to introduce a new element. The number of structured data elements is unlimited. The ID (name plus possibly @digits) is case-sensitive and uniquely identifies the type and purpose of the element. The same ID must not exist more than once in a message. The @digits part is required for user-defined non-standardized IDs. logger currently generates the timeQuality standardized element only. RFC 5424 also describes the elements origin (with parameters ip, enterpriseId, software and swVersion) and meta (with parameters sequenceId, sysUpTime and language). These element IDs may be specified without the @digits suffix. --sd-param name=value Specifies a structured data element parameter, a name and value pair. The option has to be used after --sd-id and may be specified more than once for the same element. Note that the quotation marks around value are required and must be escaped on the command line. logger --rfc5424 --sd-id zoo@123 \ --sd-param tiger="hungry" \ --sd-param zebra="running" \ --sd-id manager@123 \ --sd-param onMeeting="yes" \ "this is message" produces: <13>1 2015-10-01T14:07:59.168662+02:00 ws kzak - - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="218616"][zoo@123 tiger="hungry" zebra="running"][manager@123 onMeeting="yes"] this is message -S, --size size Sets the maximum permitted message size to size. The default is 1KiB characters, which is the limit traditionally used and specified in RFC 3164. With RFC 5424, this limit has become flexible. A good assumption is that RFC 5424 receivers can at least process 4KiB messages. Most receivers accept messages larger than 1KiB over any type of syslog protocol. As such, the --size option affects logger in all cases (not only when --rfc5424 was used). Note: the message-size limit limits the overall message size, including the syslog header. Header sizes vary depending on the selected options and the hostname length. As a rule of thumb, headers are usually not longer than 50 to 80 characters. When selecting a maximum message size, it is important to ensure that the receiver supports the max size as well, otherwise messages may become truncated. Again, as a rule of thumb two to four KiB message size should generally be OK, whereas anything larger should be verified to work. --socket-errors[=mode] Print errors about Unix socket connections. The mode can be a value of off, on, or auto. When the mode is auto, then logger will detect if the init process is systemd(1), and if so assumption is made /dev/log can be used early at boot. Other init systems lack of /dev/log will not cause errors that is identical with messaging using openlog(3) system call. The logger(1) before version 2.26 used openlog(3), and hence was unable to detected loss of messages sent to Unix sockets. The default mode is auto. When errors are not enabled lost messages are not communicated and will result to successful exit status of logger(1) invocation. -T, --tcp Use stream (TCP) only. By default the connection is tried to the syslog-conn port defined in /etc/services, which is often 601. See also --server and --socket to specify where to connect. -t, --tag tag Mark every line to be logged with the specified tag. The default tag is the name of the user logged in on the terminal (or a user name based on effective user ID). -u, --socket socket Write to the specified socket instead of to the system log socket. -- End the argument list. This allows the message to start with a hyphen (-). -h, --help Display help text and exit. -V, --version Print version and exit. EXIT STATUS top The logger utility exits 0 on success, and >0 if an error occurs. FACILITIES AND LEVELS top Valid facility names are: auth authpriv for security information of a sensitive nature cron daemon ftp kern cannot be generated from userspace process, automatically converted to user lpr mail news syslog user uucp local0 to local7 security deprecated synonym for auth Valid level names are: emerg alert crit err warning notice info debug panic deprecated synonym for emerg error deprecated synonym for err warn deprecated synonym for warning For the priority order and intended purposes of these facilities and levels, see syslog(3). CONFORMING TO top The logger command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible. EXAMPLES top logger System rebooted logger -p local0.notice -t HOSTIDM -f /dev/idmc logger -n loghost.example.com System rebooted AUTHORS top The logger command was originally written by University of California in 1983-1993 and later rewritten by Karel Zak <[email protected]>, Rainer Gerhards <[email protected]>, and Sami Kerola <[email protected]>. SEE ALSO top journalctl(1), syslog(3), systemd.journal-fields(7) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The logger command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 LOGGER(1) Pages that refer to this page: logger(1), pmie(1), pmpost(1), systemd-cat(1), syslog(3), rsyslog.conf(5), rsyslogd(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# logger\n\n> Add messages to syslog (/var/log/syslog).\n> More information: <https://manned.org/logger>.\n\n- Log a message to syslog:\n\n`logger {{message}}`\n\n- Take input from `stdin` and log to syslog:\n\n`echo {{log_entry}} | logger`\n\n- Send the output to a remote syslog server running at a given port. Default port is 514:\n\n`echo {{log_entry}} | logger --server {{hostname}} --port {{port}}`\n\n- Use a specific tag for every line logged. Default is the name of logged in user:\n\n`echo {{log_entry}} | logger --tag {{tag}}`\n\n- Log messages with a given priority. Default is `user.notice`. See `man logger` for all priority options:\n\n`echo {{log_entry}} | logger --priority {{user.warning}}`\n
login
login(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training Another version of this page is provided by the shadow-utils project login(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | CONFIG FILE ITEMS | FILES | CREDENTIALS | BUGS | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY LOGIN(1) User Commands LOGIN(1) NAME top login - begin session on the system SYNOPSIS top login [-p] [-h host] [-H] [-f username|username] DESCRIPTION top login is used when signing onto a system. If no argument is given, login prompts for the username. The user is then prompted for a password, where appropriate. Echoing is disabled to prevent revealing the password. Only a number of password failures are permitted before login exits and the communications link is severed. See LOGIN_RETRIES in the CONFIG FILE ITEMS section. If password aging has been enabled for the account, the user may be prompted for a new password before proceeding. In such case old password must be provided and the new password entered before continuing. Please refer to passwd(1) for more information. The user and group ID will be set according to their values in the /etc/passwd file. There is one exception if the user ID is zero. In this case, only the primary group ID of the account is set. This should allow the system administrator to login even in case of network problems. The environment variable values for $HOME, $USER, $SHELL, $PATH, $LOGNAME, and $MAIL are set according to the appropriate fields in the password entry. $PATH defaults to /usr/local/bin:/bin:/usr/bin for normal users, and to /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin for root, if not otherwise configured. The environment variable $TERM will be preserved, if it exists, else it will be initialized to the terminal type on your tty. Other environment variables are preserved if the -p option is given. The environment variables defined by PAM are always preserved. Then the users shell is started. If no shell is specified for the user in /etc/passwd, then /bin/sh is used. If there is no home directory specified in /etc/passwd, then / is used, followed by .hushlogin check as described below. If the file .hushlogin exists, then a "quiet" login is performed. This disables the checking of mail and the printing of the last login time and message of the day. Otherwise, if /var/log/lastlog exists, the last login time is printed, and the current login is recorded. OPTIONS top -p Used by getty(8) to tell login to preserve the environment. -f Used to skip a login authentication. This option is usually used by the getty(8) autologin feature. -h Used by other servers (such as telnetd(8) to pass the name of the remote host to login so that it can be placed in utmp and wtmp. Only the superuser is allowed use this option. Note that the -h option has an impact on the PAM service name. The standard service name is login, but with the -h option, the name is remote. It is necessary to create proper PAM config files (for example, /etc/pam.d/login and /etc/pam.d/remote). -H Used by other servers (for example, telnetd(8)) to tell login that printing the hostname should be suppressed in the login: prompt. See also LOGIN_PLAIN_PROMPT below. -h, --help Display help text and exit. -V, --version Print version and exit. CONFIG FILE ITEMS top login reads the /etc/login.defs configuration file (see login.defs(5)). Note that the configuration file could be distributed with another package (usually shadow-utils). The following configuration items are relevant for login: MOTD_FILE (string) Specifies a ":" delimited list of "message of the day" files and directories to be displayed upon login. If the specified path is a directory then displays all files with .motd file extension in version-sort order from the directory. The default value is /usr/share/misc/motd:/run/motd:/etc/motd. If the MOTD_FILE item is empty or a quiet login is enabled, then the message of the day is not displayed. Note that the same functionality is also provided by the pam_motd(8) PAM module. The directories in the MOTD_FILE are supported since version 2.36. Note that login does not implement any filenames overriding behavior like pam_motd (see also MOTD_FIRSTONLY), but all content from all files is displayed. It is recommended to keep extra logic in content generators and use /run/motd.d rather than rely on overriding behavior hardcoded in system tools. MOTD_FIRSTONLY (boolean) Forces login to stop display content specified by MOTD_FILE after the first accessible item in the list. Note that a directory is one item in this case. This option allows login semantics to be configured to be more compatible with pam_motd. The default value is no. LOGIN_PLAIN_PROMPT (boolean) Tell login that printing the hostname should be suppressed in the login: prompt. This is an alternative to the -H command line option. The default value is no. LOGIN_TIMEOUT (number) Maximum time in seconds for login. The default value is 60. LOGIN_RETRIES (number) Maximum number of login retries in case of a bad password. The default value is 3. LOGIN_KEEP_USERNAME (boolean) Tell login to only re-prompt for the password if authentication failed, but the username is valid. The default value is no. FAIL_DELAY (number) Delay in seconds before being allowed another three tries after a login failure. The default value is 5. TTYPERM (string) The terminal permissions. The default value is 0600 or 0620 if tty group is used. TTYGROUP (string) The login tty will be owned by the TTYGROUP. The default value is tty. If the TTYGROUP does not exist, then the ownership of the terminal is set to the users primary group. The TTYGROUP can be either the name of a group or a numeric group identifier. HUSHLOGIN_FILE (string) If defined, this file can inhibit all the usual chatter during the login sequence. If a full pathname (for example, /etc/hushlogins) is specified, then hushed mode will be enabled if the users name or shell are found in the file. If this global hush login file is empty then the hushed mode will be enabled for all users. If a full pathname is not specified, then hushed mode will be enabled if the file exists in the users home directory. The default is to check /etc/hushlogins and if it does not exist then ~/.hushlogin. If the HUSHLOGIN_FILE item is empty, then all the checks are disabled. DEFAULT_HOME (boolean) Indicate if login is allowed if we cannot change directory to the home directory. If set to yes, the user will login in the root (/) directory if it is not possible to change directory to their home. The default value is yes. LASTLOG_UID_MAX (unsigned number) Highest user ID number for which the lastlog entries should be updated. As higher user IDs are usually tracked by remote user identity and authentication services there is no need to create a huge sparse lastlog file for them. No LASTLOG_UID_MAX option present in the configuration means that there is no user ID limit for writing lastlog entries. The default value is ULONG_MAX. LOG_UNKFAIL_ENAB (boolean) Enable display of unknown usernames when login failures are recorded. The default value is no. Note that logging unknown usernames may be a security issue if a user enters their password instead of their login name. ENV_PATH (string) If set, it will be used to define the PATH environment variable when a regular user logs in. The default value is /usr/local/bin:/bin:/usr/bin. ENV_ROOTPATH (string), ENV_SUPATH (string) If set, it will be used to define the PATH environment variable when the superuser logs in. ENV_ROOTPATH takes precedence. The default value is /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin. FILES top /var/run/utmp, /var/log/wtmp, /var/log/lastlog, /var/spool/mail/*, /etc/motd, /etc/passwd, /etc/nologin, /etc/pam.d/login, /etc/pam.d/remote, /etc/hushlogins, $HOME/.hushlogin CREDENTIALS top login supports configuration via systemd credentials (see https://systemd.io/CREDENTIALS/). login reads the following systemd credentials: login.noauth (boolean) If set, configures login to skip login authentication, similarly to the -f option. BUGS top The undocumented BSD -r option is not supported. This may be required by some rlogind(8) programs. A recursive login, as used to be possible in the good old days, no longer works; for most purposes su(1) is a satisfactory substitute. Indeed, for security reasons, login does a vhangup(2) system call to remove any possible listening processes on the tty. This is to avoid password sniffing. If one uses the command login, then the surrounding shell gets killed by vhangup(2) because its no longer the true owner of the tty. This can be avoided by using exec login in a top-level shell or xterm. AUTHORS top Derived from BSD login 5.40 (5/9/89) by Michael Glad <[email protected]> for HP-UX. Ported to Linux 0.12: Peter Orbaek <[email protected]>. Rewritten to a PAM-only version by Karel Zak <[email protected]> SEE ALSO top mail(1), passwd(1), passwd(5), utmp(5), environ(7), getty(8), init(8), lastlog(8), shutdown(8) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The login command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 LOGIN(1) Pages that refer to this page: ac(1), bash(1), chsh(1), intro(1), last(1@@util-linux), mesg(1), newgrp(1), openvt(1), sg(1), su(1@@shadow-utils), ul(1), crypt(3), pam(3), ttyslot(3), group(5), login.defs(5), motd(5), nologin(5), passwd(5), passwd(5@@shadow-utils), proc(5), securetty(5), shadow(5), systemd.exec(5), utmp(5), environ(7), agetty(8), faillog(8), nologin(8), nologin(8@@shadow-utils), PAM(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# login\n\n> Initiates a session for a user.\n> More information: <https://manned.org/login>.\n\n- Log in as a user:\n\n`login {{user}}`\n\n- Log in as user without authentication if user is preauthenticated:\n\n`login -f {{user}}`\n\n- Log in as user and preserve environment:\n\n`login -p {{user}}`\n\n- Log in as a user on a remote host:\n\n`login -h {{host}} {{user}}`\n
loginctl
loginctl(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training loginctl(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | COMMANDS | OPTIONS | EXIT STATUS | EXAMPLES | ENVIRONMENT | SEE ALSO | COLOPHON LOGINCTL(1) loginctl LOGINCTL(1) NAME top loginctl - Control the systemd login manager SYNOPSIS top loginctl [OPTIONS...] {COMMAND} [NAME...] DESCRIPTION top loginctl may be used to introspect and control the state of the systemd(1) login manager systemd-logind.service(8). COMMANDS top The following commands are understood: Session Commands list-sessions List current sessions. session-status [ID...] Show terse runtime status information about one or more sessions, followed by the most recent log data from the journal. Takes one or more session identifiers as parameters. If no session identifiers are passed, the status of the caller's session is shown. This function is intended to generate human-readable output. If you are looking for computer-parsable output, use show-session instead. Added in version 233. show-session [ID...] Show properties of one or more sessions or the manager itself. If no argument is specified, properties of the manager will be shown. If a session ID is specified, properties of the session are shown. By default, empty properties are suppressed. Use --all to show those too. To select specific properties to show, use --property=. This command is intended to be used whenever computer-parsable output is required. Use session-status if you are looking for formatted human-readable output. Added in version 233. activate [ID] Activate a session. This brings a session into the foreground if another session is currently in the foreground on the respective seat. Takes a session identifier as argument. If no argument is specified, the session of the caller is put into foreground. Added in version 219. lock-session [ID...], unlock-session [ID...] Activates/deactivates the screen lock on one or more sessions, if the session supports it. Takes one or more session identifiers as arguments. If no argument is specified, the session of the caller is locked/unlocked. Added in version 233. lock-sessions, unlock-sessions Activates/deactivates the screen lock on all current sessions supporting it. Added in version 188. terminate-session ID... Terminates a session. This kills all processes of the session and deallocates all resources attached to the session. If the argument is specified as empty string the session invoking the command is terminated. Added in version 233. kill-session ID... Send a signal to one or more processes of the session. Use --kill-whom= to select which process to kill. Use --signal= to select the signal to send. If the argument is specified as empty string the signal is sent to the session invoking the command. Added in version 233. User Commands list-users List currently logged in users. user-status [USER...] Show terse runtime status information about one or more logged in users, followed by the most recent log data from the journal. Takes one or more user names or numeric user IDs as parameters. If no parameters are passed, the status is shown for the user of the session of the caller. This function is intended to generate human-readable output. If you are looking for computer-parsable output, use show-user instead. Added in version 233. show-user [USER...] Show properties of one or more users or the manager itself. If no argument is specified, properties of the manager will be shown. If a user is specified, properties of the user are shown. By default, empty properties are suppressed. Use --all to show those too. To select specific properties to show, use --property=. This command is intended to be used whenever computer-parsable output is required. Use user-status if you are looking for formatted human-readable output. Added in version 233. enable-linger [USER...], disable-linger [USER...] Enable/disable user lingering for one or more users. If enabled for a specific user, a user manager is spawned for the user at boot and kept around after logouts. This allows users who are not logged in to run long-running services. Takes one or more user names or numeric UIDs as argument. If no argument is specified, enables/disables lingering for the user of the session of the caller. See also KillUserProcesses= setting in logind.conf(5). Added in version 233. terminate-user USER... Terminates all sessions of a user. This kills all processes of all sessions of the user and deallocates all runtime resources attached to the user. If the argument is specified as empty string the sessions of the user invoking the command are terminated. Added in version 233. kill-user USER... Send a signal to all processes of a user. Use --signal= to select the signal to send. If the argument is specified as empty string the signal is sent to the sessions of the user invoking the command. Added in version 233. Seat Commands list-seats List currently available seats on the local system. seat-status [NAME...] Show terse runtime status information about one or more seats. Takes one or more seat names as parameters. If no seat names are passed the status of the caller's session's seat is shown. This function is intended to generate human-readable output. If you are looking for computer-parsable output, use show-seat instead. Added in version 233. show-seat [NAME...] Show properties of one or more seats or the manager itself. If no argument is specified, properties of the manager will be shown. If a seat is specified, properties of the seat are shown. By default, empty properties are suppressed. Use --all to show those too. To select specific properties to show, use --property=. This command is intended to be used whenever computer-parsable output is required. Use seat-status if you are looking for formatted human-readable output. Added in version 233. attach NAME DEVICE... Persistently attach one or more devices to a seat. The devices should be specified via device paths in the /sys/ file system. To create a new seat, attach at least one graphics card to a previously unused seat name. Seat names may consist only of az, AZ, 09, "-" and "_" and must be prefixed with "seat". To drop assignment of a device to a specific seat, just reassign it to a different seat, or use flush-devices. Added in version 233. flush-devices Removes all device assignments previously created with attach. After this call, only automatically generated seats will remain, and all seat hardware is assigned to them. terminate-seat NAME... Terminates all sessions on a seat. This kills all processes of all sessions on the seat and deallocates all runtime resources attached to them. Added in version 233. OPTIONS top The following options are understood: --no-ask-password Do not query the user for authentication for privileged operations. -p, --property= When showing session/user/seat properties, limit display to certain properties as specified as argument. If not specified, all set properties are shown. The argument should be a property name, such as "Sessions". If specified more than once, all properties with the specified names are shown. --value When showing session/user/seat properties, only print the value, and skip the property name and "=". Added in version 230. -a, --all When showing session/user/seat properties, show all properties regardless of whether they are set or not. -l, --full Do not ellipsize process tree entries. Added in version 198. --kill-whom= When used with kill-session, choose which processes to kill. Must be one of leader, or all to select whether to kill only the leader process of the session or all processes of the session. If omitted, defaults to all. Added in version 252. -s, --signal= When used with kill-session or kill-user, choose which signal to send to selected processes. Must be one of the well known signal specifiers, such as SIGTERM, SIGINT or SIGSTOP. If omitted, defaults to SIGTERM. The special value "help" will list the known values and the program will exit immediately, and the special value "list" will list known values along with the numerical signal numbers and the program will exit immediately. -n, --lines= When used with user-status and session-status, controls the number of journal lines to show, counting from the most recent ones. Takes a positive integer argument. Defaults to 10. Added in version 219. -o, --output= When used with user-status and session-status, controls the formatting of the journal entries that are shown. For the available choices, see journalctl(1). Defaults to "short". Added in version 219. -H, --host= Execute the operation remotely. Specify a hostname, or a username and hostname separated by "@", to connect to. The hostname may optionally be suffixed by a port ssh is listening on, separated by ":", and then a container name, separated by "/", which connects directly to a specific container on the specified host. This will use SSH to talk to the remote machine manager instance. Container names may be enumerated with machinectl -H HOST. Put IPv6 addresses in brackets. -M, --machine= Execute operation on a local container. Specify a container name to connect to, optionally prefixed by a user name to connect as and a separating "@" character. If the special string ".host" is used in place of the container name, a connection to the local system is made (which is useful to connect to a specific user's user bus: "--user [email protected]"). If the "@" syntax is not used, the connection is made as root user. If the "@" syntax is used either the left hand side or the right hand side may be omitted (but not both) in which case the local user name and ".host" are implied. --no-pager Do not pipe output into a pager. --no-legend Do not print the legend, i.e. column headers and the footer with hints. -h, --help Print a short help text and exit. --version Print a short version string and exit. EXIT STATUS top On success, 0 is returned, a non-zero failure code otherwise. EXAMPLES top Example 1. Querying user status $ loginctl user-status fatima (1005) Since: Sat 2016-04-09 14:23:31 EDT; 54min ago State: active Sessions: 5 *3 Unit: user-1005.slice [email protected] ... session-3.scope ... session-5.scope 3473 login -- fatima 3515 -zsh Apr 09 14:40:30 laptop login[2325]: pam_unix(login:session): session opened for user fatima by LOGIN(uid=0) Apr 09 14:40:30 laptop login[2325]: LOGIN ON tty3 BY fatima There are two sessions, 3 and 5. Session 3 is a graphical session, marked with a star. The tree of processing including the two corresponding scope units and the user manager unit are shown. ENVIRONMENT top $SYSTEMD_LOG_LEVEL The maximum log level of emitted messages (messages with a higher log level, i.e. less important ones, will be suppressed). Either one of (in order of decreasing importance) emerg, alert, crit, err, warning, notice, info, debug, or an integer in the range 0...7. See syslog(3) for more information. $SYSTEMD_LOG_COLOR A boolean. If true, messages written to the tty will be colored according to priority. This setting is only useful when messages are written directly to the terminal, because journalctl(1) and other tools that display logs will color messages based on the log level on their own. $SYSTEMD_LOG_TIME A boolean. If true, console log messages will be prefixed with a timestamp. This setting is only useful when messages are written directly to the terminal or a file, because journalctl(1) and other tools that display logs will attach timestamps based on the entry metadata on their own. $SYSTEMD_LOG_LOCATION A boolean. If true, messages will be prefixed with a filename and line number in the source code where the message originates. Note that the log location is often attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs. $SYSTEMD_LOG_TID A boolean. If true, messages will be prefixed with the current numerical thread ID (TID). Note that the this information is attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs. $SYSTEMD_LOG_TARGET The destination for log messages. One of console (log to the attached tty), console-prefixed (log to the attached tty but with prefixes encoding the log level and "facility", see syslog(3), kmsg (log to the kernel circular log buffer), journal (log to the journal), journal-or-kmsg (log to the journal if available, and to kmsg otherwise), auto (determine the appropriate log target automatically, the default), null (disable log output). $SYSTEMD_LOG_RATELIMIT_KMSG Whether to ratelimit kmsg or not. Takes a boolean. Defaults to "true". If disabled, systemd will not ratelimit messages written to kmsg. $SYSTEMD_PAGER Pager to use when --no-pager is not given; overrides $PAGER. If neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known pager implementations are tried in turn, including less(1) and more(1), until one is found. If no pager implementation is discovered no pager is invoked. Setting this environment variable to an empty string or the value "cat" is equivalent to passing --no-pager. Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER (as well as $PAGER) will be silently ignored. $SYSTEMD_LESS Override the options passed to less (by default "FRSXMK"). Users might want to change two options in particular: K This option instructs the pager to exit immediately when Ctrl+C is pressed. To allow less to handle Ctrl+C itself to switch back to the pager command prompt, unset this option. If the value of $SYSTEMD_LESS does not include "K", and the pager that is invoked is less, Ctrl+C will be ignored by the executable, and needs to be handled by the pager. X This option instructs the pager to not send termcap initialization and deinitialization strings to the terminal. It is set by default to allow command output to remain visible in the terminal even after the pager exits. Nevertheless, this prevents some pager functionality from working, in particular paged output cannot be scrolled with the mouse. See less(1) for more discussion. $SYSTEMD_LESSCHARSET Override the charset passed to less (by default "utf-8", if the invoking terminal is determined to be UTF-8 compatible). $SYSTEMD_PAGERSECURE Takes a boolean argument. When true, the "secure" mode of the pager is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set at all, secure mode is enabled if the effective UID is not the same as the owner of the login session, see geteuid(2) and sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set when invoking the pager, and the pager shall disable commands that open or create new files or start new subprocesses. When $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known to implement secure mode will not be used. (Currently only less(1) implements secure mode.) Note: when commands are invoked with elevated privileges, for example under sudo(8) or pkexec(1), care must be taken to ensure that unintended interactive features are not enabled. "Secure" mode for the pager may be enabled automatically as describe above. Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited environment allows the user to invoke arbitrary commands. Note that if the $SYSTEMD_PAGER or $PAGER variables are to be honoured, $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to completely disable the pager using --no-pager instead. $SYSTEMD_COLORS Takes a boolean argument. When true, systemd and related utilities will use colors in their output, otherwise the output will be monochrome. Additionally, the variable can take one of the following special values: "16", "256" to restrict the use of colors to the base 16 or 256 ANSI colors, respectively. This can be specified to override the automatic decision based on $TERM and what the console is connected to. $SYSTEMD_URLIFY The value must be a boolean. Controls whether clickable links should be generated in the output for terminal emulators supporting this. This can be specified to override the decision that systemd makes based on $TERM and other conditions. SEE ALSO top systemd(1), systemctl(1), systemd-logind.service(8), logind.conf(5) COLOPHON top This page is part of the systemd (systemd system and service manager) project. Information about the project can be found at http://www.freedesktop.org/wiki/Software/systemd. If you have a bug report for this manual page, see http://www.freedesktop.org/wiki/Software/systemd/#bugreports. This page was obtained from the project's upstream Git repository https://github.com/systemd/systemd.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-22.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] systemd 255 LOGINCTL(1) Pages that refer to this page: systemctl(1), logind.conf(5), systemd.directives(7), systemd.index(7), pam_systemd(8), systemd-logind.service(8), systemd-machined.service(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# loginctl\n\n> Manage the systemd login manager.\n> More information: <https://www.freedesktop.org/software/systemd/man/loginctl.html>.\n\n- Print all current sessions:\n\n`loginctl list-sessions`\n\n- Print all properties of a specific session:\n\n`loginctl show-session {{session_id}} --all`\n\n- Print all properties of a specific user:\n\n`loginctl show-user {{username}}`\n\n- Print a specific property of a user:\n\n`loginctl show-user {{username}} --property={{property_name}}`\n\n- Execute a `loginctl` operation on a remote host:\n\n`loginctl list-users -H {{hostname}}`\n
logname
logname(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training logname(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | AUTHOR | REPORTING BUGS | COPYRIGHT | SEE ALSO | COLOPHON LOGNAME(1) User Commands LOGNAME(1) NAME top logname - print users login name SYNOPSIS top logname [OPTION] DESCRIPTION top Print the user's login name. --help display this help and exit --version output version information and exit AUTHOR top Written by FIXME: unknown. REPORTING BUGS top GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT top Copyright 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO top getlogin(3) Full documentation <https://www.gnu.org/software/coreutils/logname> or available locally via: info '(coreutils) logname invocation' COLOPHON top This page is part of the coreutils (basic file, shell and text manipulation utilities) project. Information about the project can be found at http://www.gnu.org/software/coreutils/. If you have a bug report for this manual page, see http://www.gnu.org/software/coreutils/. This page was obtained from the tarball coreutils-9.4.tar.xz fetched from http://ftp.gnu.org/gnu/coreutils/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] GNU coreutils 9.4 August 2023 LOGNAME(1) Pages that refer to this page: getlogin(3), utmp(5) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# logname\n\n> Shows the user's login name.\n> More information: <https://www.gnu.org/software/coreutils/logname>.\n\n- Display the currently logged in user's name:\n\n`logname`\n
logrotate
logrotate(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training logrotate(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | CONFIGURATION FILE | CONFIGURATION FILE DIRECTIVES | SCRIPTS | USER AND GROUP | FILES | SEE ALSO | AUTHORS | COLOPHON LOGROTATE(8) System Administrator's Manual LOGROTATE(8) NAME top logrotate rotates, compresses, and mails system logs SYNOPSIS top logrotate [--force] [--debug] [--state file] [--skip-state-lock] [--wait-for-state-lock] [--verbose] [--log file] [--mail command] config_file [config_file2 ...] DESCRIPTION top logrotate is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large. Normally, logrotate is run as a daily cron job. It will not modify a log more than once in one day unless the criterion for that log is based on the log's size and logrotate is being run more than once each day, or unless the -f or --force option is used. Any number of config files may be given on the command line. Later config files may override the options given in earlier files, so the order in which the logrotate config files are listed is important. Normally, a single config file which includes any other config files which are needed should be used. See below for more information on how to use the include directive to accomplish this. If a directory is given on the command line, every file in that directory is used as a config file. If no command line arguments are given, logrotate will print version and copyright information, along with a short usage summary. If any errors occur while rotating logs, logrotate will exit with non-zero status, although the state file will be updated. OPTIONS top -f, --force Tells logrotate to force the rotation, even if it doesn't think this is necessary. Sometimes this is useful after adding new entries to a logrotate config file, or if old log files have been removed by hand, as the new files will be created, and logging will continue correctly. -d, --debug Turn on debug mode, which means that no changes are made to the logs and the logrotate state file is not updated. Only debug messages are printed. -s, --state statefile Tells logrotate to use an alternate state file. This is useful if logrotate is being run as a different user for various sets of log files. To prevent parallel execution logrotate by default acquires a lock on the state file, if it cannot be acquired logrotate will exit with value 3. The default state file is /var/lib/logrotate.status. If /dev/null is given as the state file, then logrotate will not try to lock or write the state file. --skip-state-lock Do not lock the state file, for example if locking is unsupported or prohibited. --wait-for-state-lock Wait until lock on the state file is released by another logrotate process. This option may cause logrotate to wait indefinitely. Use with caution. -v, --verbose Turns on verbose mode, for example to display messages during rotation. -l, --log file Tells logrotate to log verbose output into the log_file. The verbose output logged to that file is the same as when running logrotate with -v switch. The log file is overwritten on every logrotate execution. -m, --mail command Tells logrotate which command to use when mailing logs. This command should accept the following arguments: 1) the subject of the message given with '-s subject' 2) the recipient. The command must then read a message on standard input and mail it to the recipient. The default mail command is /bin/mail. --usage Prints a short usage message. -?, --help Prints help message. --version Display version information. CONFIGURATION FILE top logrotate reads everything about the log files it should be handling from the series of configuration files specified on the command line. Each configuration file can set global options (local definitions override global ones, and later definitions override earlier ones) and specify logfiles to rotate. Global options do not affect preceding include directives. A simple configuration file looks like this: # sample logrotate configuration file compress /var/log/messages { rotate 5 weekly postrotate /usr/bin/killall -HUP syslogd endscript } "/var/log/httpd/access.log" /var/log/httpd/error.log { rotate 5 mail [email protected] size 100k sharedscripts postrotate /usr/bin/killall -HUP httpd endscript } /var/log/news/* { monthly rotate 2 olddir /var/log/news/old missingok sharedscripts postrotate kill -HUP $(cat /var/run/inn.pid) endscript nocompress } ~/log/*.log {} The first few lines set global options; in the example, logs are compressed after they are rotated. Note that comments may appear anywhere in the config file as long as the first non-whitespace character on the line is a #. Values are separated from directives by whitespace and/or an optional =. Numbers must be specified in a format understood by strtoul(3). The next section of the config file defines how to handle the log file /var/log/messages. The log will go through five weekly rotations before being removed. After the log file has been rotated (but before the old version of the log has been compressed), the command /usr/bin/killall -HUP syslogd will be executed. The next section defines the parameters for both /var/log/httpd/access.log and /var/log/httpd/error.log. Each is rotated whenever it grows over 100 kilobytes in size, and the old logs files are mailed (uncompressed) to [email protected] after going through 5 rotations, rather than being removed. The sharedscripts means that the postrotate script will only be run once (after the old logs have been compressed), not once for each log which is rotated. Note that log file names may be enclosed in quotes (and that quotes are required if the name contains spaces). Normal shell quoting rules apply, with ', ", and \ characters supported. The next section defines the parameters for all of the files in /var/log/news. Each file is rotated on a monthly basis. The last section uses tilde expansion to rotate log files in the home directory of the current user. This is only available, if your glob library supports tilde expansion. GNU glob does support this. Please use wildcards with caution. If you specify *, logrotate will rotate all files, including previously rotated ones. A way around this is to use the olddir directive or a more exact wildcard (such as *.log). Please note, by default when using systemd(1), the option ProtectSystem=full is set in the logrotate.service file. This prevents logrotate from modifying logs in /etc and /usr. Here is more information on the directives which may be included in a logrotate configuration file: CONFIGURATION FILE DIRECTIVES top These directives may be included in a logrotate configuration file: Rotation rotate count Log files are rotated count times before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed rather than rotated. If count is -1, old logs are not removed at all, except they are affected by maxage (use with caution, may waste performance and disk space). Default is 0. olddir directory Logs are moved into directory for rotation. The directory must be on the same physical device as the log file being rotated, unless copy, copytruncate or renamecopy option is used. The directory is assumed to be relative to the directory holding the log file unless an absolute path name is specified. When this option is used all old versions of the log end up in directory. This option may be overridden by the noolddir option. noolddir Logs are rotated in the directory they normally reside in (this overrides the olddir option). su user group Rotate log files set under this user and group instead of using default user/group (usually root). user specifies the user used for rotation and group specifies the group used for rotation (see the section USER AND GROUP for details). If the user/group you specify here does not have sufficient privilege to make files with the ownership you've specified in a create directive, it will cause an error. If logrotate runs with root privileges, it is recommended to use the su directive to rotate files in directories that are directly or indirectly in control of non-privileged users. Frequency hourly Log files are rotated every hour. Note that usually logrotate is configured to be run by cron daily (or by logrotate.timer when using systemd(1)). You have to change this configuration and run logrotate hourly to be able to really rotate logs hourly. daily Log files are rotated every day. weekly [weekday] Log files are rotated once each weekday, or if the date is advanced by at least 7 days since the last rotation (while ignoring the exact time). The weekday interpretation is following: 0 means Sunday, 1 means Monday, ..., 6 means Saturday; the special value 7 means each 7 days, irrespectively of weekday. Defaults to 0 if the weekday argument is omitted. monthly Log files are rotated the first time logrotate is run in a month (this is normally on the first day of the month). yearly Log files are rotated if the current year is not the same as the last rotation. size size Log files are rotated only if they grow bigger than size bytes. If size is followed by k, the size is assumed to be in kilobytes. If M is used, the size is in megabytes, and if G is used, the size is in gigabytes. So size 100, size 100k, size 100M and size 100G are all valid. This option is mutually exclusive with the time interval options, and it causes log files to be rotated without regard for the last rotation time, if specified after the time criteria (the last specified option takes the precedence). File selection missingok If the log file is missing, go on to the next one without issuing an error message. See also nomissingok. nomissingok If a log file does not exist, issue an error. This is the default. ignoreduplicates Ignore any following matches of a log file. ifempty Rotate the log file even if it is empty, overriding the notifempty option (ifempty is the default). notifempty Do not rotate the log if it is empty (this overrides the ifempty option). minage count Do not rotate logs which are less than <count> days old. maxage count Remove rotated logs older than <count> days. The age is only checked if the logfile is to be rotated. rotate -1 does not hinder removal. The files are mailed to the configured address if maillast and mail are configured. minsize size Log files are rotated when they grow bigger than size bytes, but not before the additionally specified time interval (daily, weekly, monthly, or yearly). The related size option is similar except that it is mutually exclusive with the time interval options, and it causes log files to be rotated without regard for the last rotation time, if specified after the time criteria (the last specified option takes the precedence). When minsize is used, both the size and timestamp of a log file are considered. maxsize size Log files are rotated when they grow bigger than size bytes even before the additionally specified time interval (daily, weekly, monthly, or yearly). The related size option is similar except that it is mutually exclusive with the time interval options, and it causes log files to be rotated without regard for the last rotation time, if specified after the time criteria (the last specified option takes the precedence). When maxsize is used, both the size and timestamp of a log file are considered. tabooext [+] list The current taboo extension list is changed (see the include directive for information on the taboo extensions). If a + precedes the list of extensions, the current taboo extension list is augmented, otherwise it is replaced. At startup, the taboo extension list ,v, .bak, .cfsaved, .disabled, .dpkg-bak, .dpkg-del, .dpkg-dist, .dpkg-new, .dpkg-old, .dpkg-tmp, .new, .old, .orig, .rhn-cfg-tmp-*, .rpmnew, .rpmorig, .rpmsave, .swp, .ucf-dist, .ucf-new, .ucf-old, ~ taboopat [+] list The current taboo glob pattern list is changed (see the include directive for information on the taboo extensions and patterns). If a + precedes the list of patterns, the current taboo pattern list is augmented, otherwise it is replaced. At startup, the taboo pattern list is empty. Files and Folders create mode owner group, create owner group Immediately after rotation (before the postrotate script is run) the log file is created (with the same name as the log file just rotated). mode specifies the mode for the log file in octal (the same as chmod(2)), owner specifies the user who will own the log file, and group specifies the group the log file will belong to (see the section USER AND GROUP for details). Any of the log file attributes may be omitted, in which case those attributes for the new file will use the same values as the original log file for the omitted attributes. This option can be disabled using the nocreate option. nocreate New log files are not created (this overrides the create option). createolddir mode owner group If the directory specified by olddir directive does not exist, it is created. mode specifies the mode for the olddir directory in octal (the same as chmod(2)), owner specifies the user who will own the olddir directory, and group specifies the group the olddir directory will belong to (see the section USER AND GROUP for details). This option can be disabled using the nocreateolddir option. nocreateolddir olddir directory is not created by logrotate when it does not exist. copy Make a copy of the log file, but don't change the original at all. This option can be used, for instance, to make a snapshot of the current log file, or when some other utility needs to truncate or parse the file. When this option is used, the create option will have no effect, as the old log file stays in place. The copy option allows storing rotated log files on the different devices using olddir directive. nocopy Do not copy the original log file and leave it in place. (this overrides the copy option). copytruncate Truncate the original log file to zero size in place after creating a copy, instead of moving the old log file and optionally creating a new one. It can be used when some program cannot be told to close its logfile and thus might continue writing (appending) to the previous log file forever. Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost. When this option is used, the create option will have no effect, as the old log file stays in place. The copytruncate option allows storing rotated log files on the different devices using olddir directive. The copytruncate option implies norenamecopy. nocopytruncate Do not truncate the original log file in place after creating a copy (this overrides the copytruncate option). renamecopy Log file is renamed to temporary filename in the same directory by adding ".tmp" extension to it. After that, postrotate script is run and log file is copied from temporary filename to final filename. In the end, temporary filename is removed. The renamecopy option allows storing rotated log files on the different devices using olddir directive. The renamecopy option implies nocopytruncate. norenamecopy Do not rename and copy the original log file (this overrides the renamecopy option). shred Delete log files using shred -u instead of unlink(). This should ensure that logs are not readable after their scheduled deletion; this is off by default. See also noshred. noshred Do not use shred when deleting old log files. See also shred. shredcycles count Asks GNU shred(1) to overwrite log files count times before deletion. Without this option, shred's default will be used. allowhardlink Rotate files with multiple hard links; this is off by default. The target file might get emptied, e.g. with shred or copytruncate. Use with caution, especially when the log files are rotated as root. noallowhardlink Do not rotate files with multiple hard links. See also allowhardlink. Compression compress Old versions of log files are compressed with gzip(1) by default. See also nocompress. nocompress Old versions of log files are not compressed. See also compress. compresscmd Specifies which command to use to compress log files. The default is gzip(1). See also compress. uncompresscmd Specifies which command to use to uncompress log files. The default is gunzip(1). compressext Specifies which extension to use on compressed logfiles, if compression is enabled. The default follows that of the configured compression command. compressoptions Command line options may be passed to the compression program, if one is in use. The default, for gzip(1), is "-6" (biased towards high compression at the expense of speed). If you use a different compression command, you may need to change the compressoptions to match. delaycompress Postpone compression of the previous log file to the next rotation cycle. This only has effect when used in combination with compress. It can be used when some program cannot be told to close its logfile and thus might continue writing to the previous log file for some time. nodelaycompress Do not postpone compression of the previous log file to the next rotation cycle (this overrides the delaycompress option). Filenames extension ext Log files with ext extension can keep it after the rotation. If compression is used, the compression extension (normally .gz) appears after ext. For example you have a logfile named mylog.foo and want to rotate it to mylog.1.foo.gz instead of mylog.foo.1.gz. addextension ext Log files are given the final extension ext after rotation. If the original file already ends with ext, the extension is not duplicated, but merely moved to the end, that is both filename and filenameext would get rotated to filename.1ext. If compression is used, the compression extension (normally .gz) appears after ext. start count This is the number to use as the base for rotation. For example, if you specify 0, the logs will be created with a .0 extension as they are rotated from the original log files. If you specify 9, log files will be created with a .9, skipping 08. Files will still be rotated the number of times specified with the rotate directive. dateext Archive old versions of log files adding a date extension like YYYYMMDD instead of simply adding a number. The extension may be configured using the dateformat and dateyesterday options. nodateext Do not archive old versions of log files with date extension (this overrides the dateext option). dateformat format_string Specify the extension for dateext using the notation similar to strftime(3) function. Only %Y %m %d %H %M %S %V and %s specifiers are allowed. The default value is -%Y%m%d except hourly, which uses -%Y%m%d%H as default value. Note that also the character separating log name from the extension is part of the dateformat string. The system clock must be set past Sep 9th 2001 for %s to work correctly. Note that the datestamps generated by this format must be lexically sortable (that is first the year, then the month then the day. For example 2001/12/01 is ok, but 01/12/2001 is not, since 01/11/2002 would sort lower while it is later). This is because when using the rotate option, logrotate sorts all rotated filenames to find out which logfiles are older and should be removed. dateyesterday Use yesterday's instead of today's date to create the dateext extension, so that the rotated log file has a date in its name that is the same as the timestamps within it. datehourago Use hour ago instead of current date to create the dateext extension, so that the rotated log file has a hour in its name that is the same as the timestamps within it. Useful with rotate hourly. Mail mail address When a log is rotated out of existence, it is mailed to address. If no mail should be generated by a particular log, the nomail directive may be used. nomail Do not mail old log files to any address. mailfirst When using the mail command, mail the just-rotated file, instead of the about-to-expire file. maillast When using the mail command, mail the about-to-expire file, instead of the just-rotated file (this is the default). Additional config files include file_or_directory Reads the file given as an argument as if it was included inline where the include directive appears. If a directory is given, most of the files in that directory are read in alphabetic order before processing of the including file continues. The only files which are ignored are files which are not regular files (such as directories and named pipes) and files whose names end with one of the taboo extensions or patterns, as specified by the tabooext or taboopat directives, respectively. The given path may start with ~/ to make it relative to the home directory of the executing user. For security reasons configuration files must not be group-writable nor world-writable. Scripts sharedscripts Normally, prerotate and postrotate scripts are run for each log which is rotated and the absolute path to the log file is passed as first argument to the script. That means a single script may be run multiple times for log file entries which match multiple files (such as the /var/log/news/* example). If sharedscripts is specified, the scripts are only run once, no matter how many logs match the wildcarded pattern, and whole pattern is passed to them. However, if none of the logs in the pattern require rotating, the scripts will not be run at all. If the scripts exit with error (or any log fails to rotate), the remaining actions will not be executed for any logs. This option overrides the nosharedscripts option. nosharedscripts Run prerotate and postrotate scripts for every log file which is rotated (this is the default, and overrides the sharedscripts option). The absolute path to the log file is passed as first argument to the script. The absolute path to the final rotated log file is passed as the second argument to the postrotate script. If the scripts exit with error, the remaining actions will not be executed for the affected log only. firstaction script endscript The script is executed once before all log files that match the wildcarded pattern are rotated, before the prerotate script is run and only if at least one log will actually be rotated. These directives may only appear inside a log file definition. The whole pattern is passed to the script as its first argument. If the script exits with an error, no further processing is done. See also lastaction and the SCRIPTS section. lastaction script endscript The script is executed once after all log files that match the wildcarded pattern are rotated, after the postrotate script is run and only if at least one log is rotated. These directives may only appear inside a log file definition. The whole pattern is passed to the script as its first argument. If the script exits with an error, just an error message is shown (as this is the last action). See also firstaction and the SCRIPTS section. prerotate script endscript The script is executed before the log file and its old logs are rotated and only if the log will actually be rotated. These directives may only appear inside a log file definition. Normally, the absolute path to the log file is passed as the first argument to the script. If sharedscripts is specified, the whole pattern is passed to the script. See also postrotate and the SCRIPTS section. See sharedscripts and nosharedscripts for error handling. postrotate script endscript The script is executed after the log file is rotated. These directives may only appear inside a log file definition. Normally, the absolute path to the log file is passed as the first argument to the script and the absolute path to the final rotated log file is passed as the second argument to the script. If sharedscripts is specified, the whole pattern is passed as the first argument to the script, and the second argument is omitted. See also prerotate and the SCRIPTS section. See sharedscripts and nosharedscripts for error handling. preremove script endscript The script is executed once just before removal of a log file. logrotate will pass the name of file which is soon to be removed as the first argument to the script. See also firstaction and the SCRIPTS section. SCRIPTS top The lines between the starting keyword (e.g. prerotate) and endscript (both of which must appear on lines by themselves) are executed (using /bin/sh). The script inherits some traits from the logrotate process, including stderr, stdout, the current directory, the environment, and the umask. Scripts are run as the invoking user and group, irrespective of any su directive. If the --log flag was specified, file descriptor 3 is the log file. The current working directory is unspecified. USER AND GROUP top User and group identifiers are resolved first by trying the textual representation and, in case it fails, afterwards by the numeric value. FILES top /var/lib/logrotate.status Default state file. /etc/logrotate.conf Configuration options. SEE ALSO top chmod(2), gunzip(1), gzip(1), mail(1), shred(1), strftime(3), strtoul(3), <https://github.com/logrotate/logrotate> AUTHORS top Erik Troan, Preston Brown, Jan Kaluza. <https://github.com/logrotate/logrotate> COLOPHON top This page is part of the logrotate (simplify the administration of log files) project. Information about the project can be found at https://github.com/logrotate/logrotate. If you have a bug report for this manual page, see https://github.com/logrotate/logrotate/issues. This page was obtained from the project's upstream Git repository https://github.com/logrotate/logrotate.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-13.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Linux 3.21.0.65_b227 LOGROTATE(8) Pages that refer to this page: daemon(3) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# logrotate\n\n> Rotates, compresses, and mails system logs.\n> More information: <https://manned.org/logrotate>.\n\n- Trigger a run manually:\n\n`logrotate {{path/to/logrotate.conf}} --force`\n\n- Run using a specific command to mail reports:\n\n`logrotate {{path/to/logrotate.conf}} --mail {{/usr/bin/mail_command}}`\n\n- Run without using a state (lock) file:\n\n`logrotate {{path/to/logrotate.conf}} --state /dev/null`\n\n- Run and skip the state (lock) file check:\n\n`logrotate {{path/to/logrotate.conf}} --skip-state-lock`\n\n- Tell `logrotate` to log verbose output into the log file:\n\n`logrotate {{path/to/logrotate.conf}} --log {{path/to/log_file}}`\n
logsave
logsave(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training logsave(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | AUTHOR | SEE ALSO | COLOPHON LOGSAVE(8) System Manager's Manual LOGSAVE(8) NAME top logsave - save the output of a command in a logfile SYNOPSIS top logsave [ -asv ] logfile cmd_prog [ ... ] DESCRIPTION top The logsave program will execute cmd_prog with the specified argument(s), and save a copy of its output to logfile. If the containing directory for logfile does not exist, logsave will accumulate the output in memory until it can be written out. A copy of the output will also be written to standard output. If cmd_prog is a single hyphen ('-'), then instead of executing a program, logsave will take its input from standard input and save it in logfile logsave is useful for saving the output of initial boot scripts until the /var partition is mounted, so the output can be written to /var/log. OPTIONS top -a This option will cause the output to be appended to logfile, instead of replacing its current contents. -s This option will cause logsave to skip writing to the log file text which is bracketed with a control-A (ASCII 001 or Start of Header) and control-B (ASCII 002 or Start of Text). This allows progress bar information to be visible to the user on the console, while not being written to the log file. -v This option will make logsave to be more verbose in its output to the user. AUTHOR top Theodore Ts'o ([email protected]) SEE ALSO top fsck(8) COLOPHON top This page is part of the e2fsprogs (utilities for ext2/3/4 filesystems) project. Information about the project can be found at http://e2fsprogs.sourceforge.net/. It is not known how to report bugs for this man page; if you know, please send a mail to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-07.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] E2fsprogs version 1.47.0 February 2023 LOGSAVE(8) Pages that refer to this page: e2fsck.conf(5) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# logsave\n\n> Save the output of a command in a logfile.\n> More information: <https://manned.org/logsave>.\n\n- Execute command with specified argument(s) and save its output to log file:\n\n`logsave {{path/to/logfile}} {{command}}`\n\n- Take input from `stdin` and save it in a log file:\n\n`logsave {{logfile}} -`\n\n- Append the output to a log file, instead of replacing its current contents:\n\n`logsave -a {{logfile}} {{command}}`\n\n- Show verbose output:\n\n`logsave -v {{logfile}} {{command}}`\n
look
look(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training look(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | ENVIRONMENT | FILES | HISTORY | EXAMPLES | SEE ALSO | REPORTING BUGS | AVAILABILITY LOOK(1) User Commands LOOK(1) NAME top look - display lines beginning with a given string SYNOPSIS top look [options] string [file] DESCRIPTION top The look utility displays any lines in file which contain string as a prefix. As look performs a binary search, the lines in file must be sorted (where sort(1) was given the same options -d and/or -f that look is invoked with). If file is not specified, the file /usr/share/dict/words is used, only alphanumeric characters are compared and the case of alphabetic characters is ignored. OPTIONS top -a, --alternative Use the alternative dictionary file. -d, --alphanum Use normal dictionary character set and order, i.e., only blanks and alphanumeric characters are compared. This is on by default if no file is specified. Note that blanks have been added to dictionary character set for compatibility with sort -d command since version 2.28. -f, --ignore-case Ignore the case of alphabetic characters. This is on by default if no file is specified. -t, --terminate character Specify a string termination character, i.e., only the characters in string up to and including the first occurrence of character are compared. -h, --help Display help text and exit. -V, --version Print version and exit. The look utility exits 0 if one or more lines were found and displayed, 1 if no lines were found, and >1 if an error occurred. ENVIRONMENT top WORDLIST Path to a dictionary file. The environment variable has greater priority than the dictionary path defined in the FILES segment. FILES top /usr/share/dict/words the dictionary /usr/share/dict/web2 the alternative dictionary HISTORY top The look utility appeared in Version 7 AT&T Unix. EXAMPLES top sort -d /etc/passwd -o /tmp/look.dict look -t: root:foobar /tmp/look.dict SEE ALSO top grep(1), sort(1) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The look command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 LOOK(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# look\n\n> Display lines beginning with a prefix in a file.\n> Note: the lines in the file must be sorted.\n> See also: `grep`, `sort`.\n> More information: <https://manned.org/look>.\n\n- Search for lines beginning with a specific prefix in a specific file:\n\n`look {{prefix}} {{path/to/file}}`\n\n- Case-insensitively search only on blank and alphanumeric characters:\n\n`look -{{f|-ignore-case}} -{{d|-alphanum}} {{prefix}} {{path/to/file}}`\n\n- Specify a string [t]ermination character (space by default):\n\n`look -{t|-terminate} {{,}}`\n\n- Search in `/usr/share/dict/words` (`--ignore-case` and `--alphanum` are assumed):\n\n`look {{prefix}}`\n\n- Search in `/usr/share/dict/web2` (`--ignore-case` and `--alphanum` are assumed):\n\n`look -{{a|-alternative}} {{prefix}}`\n
losetup
losetup(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training losetup(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | ENCRYPTION | EXIT STATUS | NOTES | ENVIRONMENT | FILES | EXAMPLE | AUTHORS | REPORTING BUGS | AVAILABILITY LOSETUP(8) System Administration LOSETUP(8) NAME top losetup - set up and control loop devices SYNOPSIS top Get info: losetup [loopdev] losetup -l [-a] losetup -j file [-o offset] Detach a loop device: losetup -d loopdev ... Detach all associated loop devices: losetup -D Set up a loop device: losetup [-o offset] [--sizelimit size] [--sector-size size] [--loop-ref name] [-Pr] [--show] -f|loopdev file Resize a loop device: losetup -c loopdev DESCRIPTION top losetup is used to associate loop devices with regular files or block devices, to detach loop devices, and to query the status of a loop device. If only the loopdev argument is given, the status of the corresponding loop device is shown. If no option is given, all loop devices are shown. Note that the old output format (i.e., losetup -a) with comma-delimited strings is deprecated in favour of the --list output format. Its possible to create more independent loop devices for the same backing file. This setup may be dangerous, can cause data loss, corruption and overwrites. Use --nooverlap with --find during setup to avoid this problem. The loop device setup is not an atomic operation when used with --find, and losetup does not protect this operation by any lock. The number of attempts is internally restricted to a maximum of 16. It is recommended to use for example flock(1) to avoid a collision in heavily parallel use cases. OPTIONS top The size and offset arguments may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB") or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB. -a, --all Show the status of all loop devices. Note that not all information is accessible for non-root users. See also --list. The old output format (as printed without --list) is deprecated. -d, --detach loopdev... Detach the file or device associated with the specified loop device(s). Note that since Linux v3.7 kernel uses "lazy device destruction". The detach operation does not return EBUSY error anymore if device is actively used by system, but it is marked by autoclear flag and destroyed later. -D, --detach-all Detach all associated loop devices. -f, --find [file] Find the first unused loop device. If a file argument is present, use the found device as loop device. Otherwise, just print its name. --show Display the name of the assigned loop device if the -f option and a file argument are present. -L, --nooverlap Check for conflicts between loop devices to avoid situation when the same backing file is shared between more loop devices. If the file is already used by another device then re-use the device rather than a new one. The option makes sense only with --find. -j, --associated file [-o offset] Show the status of all loop devices associated with the given file. -o, --offset offset The data start is moved offset bytes into the specified file or device. The offset may be followed by the multiplicative suffixes; see above. --loop-ref string Set reference string. The backwardly compatible default is to use the backing filename as a reference in loop setup ioctl (aka lo_file_name). This option can overwrite this default behavior and set the reference to the string. The reference may be used by udevd in /dev/loop/by-ref. Linux kernel does not use the reference at all, but it could be used by some old utils that cannot read the backing file from sysfs. The reference is readable only for the root user (see --output +REF) and it is restricted to 64 bytes. --sizelimit size The data end is set to no more than size bytes after the data start. The size may be followed by the multiplicative suffixes; see above. -b, --sector-size size Set the logical sector size of the loop device in bytes (since Linux 4.14). The option may be used when creating a new loop device as well as a stand-alone command to modify sector size of the already existing loop device. -c, --set-capacity loopdev Force the loop driver to reread the size of the file associated with the specified loop device. -P, --partscan Force the kernel to scan the partition table on a newly created loop device. Note that the partition table parsing depends on sector sizes. The default is sector size is 512 bytes, otherwise you need to use the option --sector-size together with --partscan. -r, --read-only Set up a read-only loop device. --direct-io[=on|off] Enable or disable direct I/O for the backing file. The optional argument can be either on or off. If the optional argument is omitted, it defaults to on. -v, --verbose Verbose mode. -l, --list If a loop device or the -a option is specified, print the default columns for either the specified loop device or all loop devices; the default is to print info about all devices. See also --output, --noheadings, --raw, and --json. -O, --output column[,column]... Specify the columns that are to be printed for the --list output. Use --help to get a list of all supported columns. --output-all Output all available columns. -n, --noheadings Dont print headings for --list output format. --raw Use the raw --list output format. -J, --json Use JSON format for --list output. ENCRYPTION top Cryptoloop is no longer supported in favor of dm-crypt. For more details see cryptsetup(8). EXIT STATUS top losetup returns 0 on success, nonzero on failure. When losetup displays the status of a loop device, it returns 1 if the device is not configured and 2 if an error occurred which prevented determining the status of the device. NOTES top Since version 2.37 losetup uses LOOP_CONFIGURE ioctl to setup a new loop device by one ioctl call. The old versions use LOOP_SET_FD and LOOP_SET_STATUS64 ioctls to do the same. ENVIRONMENT top LOOPDEV_DEBUG=all enables debug output. FILES top /dev/loop[0..N] loop block devices /dev/loop-control loop control device EXAMPLE top The following commands can be used as an example of using the loop device. # dd if=/dev/zero of=~/file.img bs=1024k count=10 # losetup --find --show ~/file.img /dev/loop0 # mkfs -t ext2 /dev/loop0 # mount /dev/loop0 /mnt ... # umount /dev/loop0 # losetup --detach /dev/loop0 AUTHORS top Karel Zak <[email protected]>, based on the original version from Theodore Tso <[email protected]>. REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The losetup command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-08-25 LOSETUP(8) Pages that refer to this page: loop(4), cryptsetup(8), e2image(8), mount(8), umount(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# losetup\n\n> Set up and control loop devices.\n> More information: <https://manned.org/losetup>.\n\n- List loop devices with detailed info:\n\n`losetup -a`\n\n- Attach a file to a given loop device:\n\n`sudo losetup /dev/{{loop}} /{{path/to/file}}`\n\n- Attach a file to a new free loop device and scan the device for partitions:\n\n`sudo losetup --show --partscan -f /{{path/to/file}}`\n\n- Attach a file to a read-only loop device:\n\n`sudo losetup --read-only /dev/{{loop}} /{{path/to/file}}`\n\n- Detach all loop devices:\n\n`sudo losetup -D`\n\n- Detach a given loop device:\n\n`sudo losetup -d /dev/{{loop}}`\n
lp
lp(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lp(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | CONFORMING TO | EXAMPLES | SEE ALSO | COPYRIGHT | COLOPHON lp(1) Apple Inc. lp(1) NAME top lp - print files SYNOPSIS top lp [ -E ] [ -U username ] [ -c ] [ -d destination[/instance] ] [ -h hostname[:port] ] [ -m ] [ -n num-copies ] [ -o option[=value] ] [ -q priority ] [ -s ] [ -t title ] [ -H handling ] [ -P page- list ] [ -- ] [ file(s) ] lp [ -E ] [ -U username ] [ -c ] [ -h hostname[:port] ] [ -i job- id ] [ -n num-copies ] [ -o option[=value] ] [ -q priority ] [ -t title ] [ -H handling ] [ -P page-list ] DESCRIPTION top lp submits files for printing or alters a pending job. Use a filename of "-" to force printing from the standard input. THE DEFAULT DESTINATION CUPS provides many ways to set the default destination. The LPDEST and PRINTER environment variables are consulted first. If neither are set, the current default set using the lpoptions(1) command is used, followed by the default set using the lpadmin(8) command. OPTIONS top The following options are recognized by lp: -- Marks the end of options; use this to print a file whose name begins with a dash (-). -E Forces encryption when connecting to the server. -U username Specifies the username to use when connecting to the server. -c This option is provided for backwards-compatibility only. On systems that support it, this option forces the print file to be copied to the spool directory before printing. In CUPS, print files are always sent to the scheduler via IPP which has the same effect. -d destination Prints files to the named printer. -h hostname[:port] Chooses an alternate server. -i job-id Specifies an existing job to modify. -m Sends an email when the job is completed. -n copies Sets the number of copies to print. -o "name=value [ ... name=value ]" Sets one or more job options. See "COMMON JOB OPTIONS" below. -q priority Sets the job priority from 1 (lowest) to 100 (highest). The default priority is 50. -s Do not report the resulting job IDs (silent mode.) -t "name" Sets the job name. -H hh:mm -H hold -H immediate -H restart -H resume Specifies when the job should be printed. A value of immediate will print the file immediately, a value of hold will hold the job indefinitely, and a UTC time value (HH:MM) will hold the job until the specified UTC (not local) time. Use a value of resume with the -i option to resume a held job. Use a value of restart with the -i option to restart a completed job. -P page-list Specifies which pages to print in the document. The list can contain a list of numbers and ranges (#-#) separated by commas, e.g., "1,3-5,16". The page numbers refer to the output pages and not the document's original pages - options like "number-up" can affect the numbering of the pages. COMMON JOB OPTIONS Aside from the printer-specific options reported by the lpoptions(1) command, the following generic options are available: -o job-sheets=name Prints a cover page (banner) with the document. The "name" can be "classified", "confidential", "secret", "standard", "topsecret", or "unclassified". -o media=size Sets the page size to size. Most printers support at least the size names "a4", "letter", and "legal". -o number-up={2|4|6|9|16} Prints 2, 4, 6, 9, or 16 document (input) pages on each output page. -o orientation-requested=4 Prints the job in landscape (rotated 90 degrees counter- clockwise). -o orientation-requested=5 Prints the job in landscape (rotated 90 degrees clockwise). -o orientation-requested=6 Prints the job in reverse portrait (rotated 180 degrees). -o print-quality=3 -o print-quality=4 -o print-quality=5 Specifies the output quality - draft (3), normal (4), or best (5). -o sides=one-sided Prints on one side of the paper. -o sides=two-sided-long-edge Prints on both sides of the paper for portrait output. -o sides=two-sided-short-edge Prints on both sides of the paper for landscape output. CONFORMING TO top Unlike the System V printing system, CUPS allows printer names to contain any printable character except SPACE, TAB, "/", or "#". Also, printer and class names are not case-sensitive. The -q option accepts a different range of values than the Solaris lp command, matching the IPP job priority values (1-100, 100 is highest priority) instead of the Solaris values (0-39, 0 is highest priority). EXAMPLES top Print two copies of a document to the default printer: lp -n 2 filename Print a double-sided legal document to a printer called "foo": lp -d foo -o media=legal -o sides=two-sided-long-edge filename Print a presentation document 2-up to a printer called "bar": lp -d bar -o number-up=2 filename SEE ALSO top cancel(1), lpadmin(8), lpoptions(1), lpq(1), lpr(1), lprm(1), lpstat(1), CUPS Online Help (http://localhost:631/help) COPYRIGHT top Copyright 2007-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 26 April 2019 CUPS lp(1) Pages that refer to this page: cancel(1), cups(1), lpoptions(1), lpq(1), lpr(1), lprm(1), lpstat(1), backend(7), cupsaccept(8), cupsenable(8), lpadmin(8), lpc(8), lpmove(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lp\n\n> Print files.\n> More information: <https://manned.org/lp>.\n\n- Print the output of a command to the default printer (see `lpstat` command):\n\n`echo "test" | lp`\n\n- Print a file to the default printer:\n\n`lp {{path/to/filename}}`\n\n- Print a file to a named printer (see `lpstat` command):\n\n`lp -d {{printer_name}} {{path/to/filename}}`\n\n- Print N copies of file to default printer (replace N with desired number of copies):\n\n`lp -n {{N}} {{path/to/filename}}`\n\n- Print only certain pages to the default printer (print pages 1, 3-5, and 16):\n\n`lp -P 1,3-5,16 {{path/to/filename}}`\n\n- Resume printing a job:\n\n`lp -i {{job_id}} -H resume`\n
lpadmin
lpadmin(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lpadmin(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | DEPRECATED OPTIONS | CONFORMING TO | NOTES | EXAMPLE | SEE ALSO | COPYRIGHT | COLOPHON lpadmin(8) Apple Inc. lpadmin(8) NAME top lpadmin - configure cups printers and classes SYNOPSIS top lpadmin [ -E ] [ -U username ] [ -h server[:port] ] -d destination lpadmin [ -E ] [ -U username ] [ -h server[:port] ] -p destination [ -R name-default ] option(s) lpadmin [ -E ] [ -U username ] [ -h server[:port] ] -x destination DESCRIPTION top lpadmin configures printer and class queues provided by CUPS. It can also be used to set the server default printer or class. When specified before the -d, -p, or -x options, the -E option forces encryption when connecting to the server. The first form of the command (-d) sets the default printer or class to destination. Subsequent print jobs submitted via the lp(1) or lpr(1) commands will use this destination unless the user specifies otherwise with the lpoptions(1) command. The second form of the command (-p) configures the named printer or class. The additional options are described below. The third form of the command (-x) deletes the printer or class destination. Any jobs that are pending for the destination will be removed and any job that is currently printed will be aborted. OPTIONS top The following options are recognized when configuring a printer queue: -c class Adds the named printer to class. If class does not exist it is created automatically. -m model Sets a standard PPD file for the printer from the model directory or using one of the driver interfaces. Use the -m option with the lpinfo(8) command to get a list of supported models. The model "raw" clears any existing PPD file and the model "everywhere" queries the printer referred to by the specified IPP device-uri. Note: Models other than "everywhere" are deprecated and will not be supported in a future version of CUPS. -o cupsIPPSupplies=true -o cupsIPPSupplies=false Specifies whether IPP supply level values should be reported. -o cupsSNMPSupplies=true -o cupsSNMPSupplies=false Specifies whether SNMP supply level (RFC 3805) values should be reported. -o job-k-limit=value Sets the kilobyte limit for per-user quotas. The value is an integer number of kilobytes; one kilobyte is 1024 bytes. -o job-page-limit=value Sets the page limit for per-user quotas. The value is the integer number of pages that can be printed; double-sided pages are counted as two pages. -o job-quota-period=value Sets the accounting period for per-user quotas. The value is an integer number of seconds; 86,400 seconds are in one day. -o job-sheets-default=banner -o job-sheets-default=banner,banner Sets the default banner page(s) to use for print jobs. -o name=value Sets a PPD option for the printer. PPD options can be listed using the -l option with the lpoptions(1) command. -o name-default=value Sets a default server-side option for the destination. Any print-time option can be defaulted, e.g., "-o number-up- default=2" to set the default "number-up" option value to 2. -o port-monitor=name Sets the binary communications program to use when printing, "none", "bcp", or "tbcp". The default program is "none". The specified port monitor must be listed in the printer's PPD file. -o printer-error-policy=name Sets the policy for errors such as printers that cannot be found or accessed, don't support the format being printed, fail during submission of the print data, or cause one or more filters to crash. The name must be one of "abort-job" (abort the job on error), "retry-job" (retry the job at a future time), "retry-current-job" (retry the current job immediately), or "stop-printer" (stop the printer on error). The default error policy is "stop-printer" for printers and "retry-current-job" for classes. -o printer-is-shared=true -o printer-is-shared=false Sets the destination to shared/published or unshared/unpublished. Shared/published destinations are publicly announced by the server on the LAN based on the browsing configuration in cupsd.conf, while unshared/unpublished destinations are not announced. The default value is "true". -o printer-op-policy=name Sets the IPP operation policy associated with the destination. The name must be defined in the cupsd.conf in a Policy section. The default operation policy is "default". -R name-default Deletes the named option from printer. -r class Removes the named printer from class. If the resulting class becomes empty it is removed. -u allow:{user|@group}{,user|,@group}* -u deny:{user|@group}{,user|,@group}* -u allow:all -u deny:none Sets user-level access control on a destination. Names starting with "@" are interpreted as UNIX groups. The latter two forms turn user-level access control off. Note: The user 'root' is not granted special access - using "-u allow:foo,bar" will allow users 'foo' and 'bar' to access the printer but NOT 'root'. -v "device-uri" Sets the device-uri attribute of the printer queue. Use the -v option with the lpinfo(8) command to get a list of supported device URIs and schemes. -D "info" Provides a textual description of the destination. -E When specified before the -d, -p, or -x options, forces the use of TLS encryption on the connection to the scheduler. Otherwise, enables the destination and accepts jobs; this is the same as running the cupsaccept(8) and cupsenable(8) programs on the destination. -L "location" Provides a textual location of the destination. DEPRECATED OPTIONS top The following lpadmin options are deprecated: -i filename This option historically has been used to provide either a System V interface script or (as an implementation side- effect) a PPD file. Note: Interface scripts are not supported by CUPS. PPD files and printer drivers are deprecated and will not be supported in a future version of CUPS. -P ppd-file Specifies a PostScript Printer Description (PPD) file to use with the printer. Note: PPD files and printer drivers are deprecated and will not be supported in a future version of CUPS. CONFORMING TO top Unlike the System V printing system, CUPS allows printer names to contain any printable character except SPACE, TAB, "/", or "#". Also, printer and class names are not case-sensitive. Finally, the CUPS version of lpadmin may ask the user for an access password depending on the printing system configuration. This differs from the System V version which requires the root user to execute this command. NOTES top CUPS printer drivers and backends are deprecated and will no longer be supported in a future feature release of CUPS. Printers that do not support IPP can be supported using applications such as ippeveprinter(1). The CUPS version of lpadmin does not support all of the System V or Solaris printing system configuration options. Interface scripts are not supported for security reasons. The double meaning of the -E option is an unfortunate historical oddity. The lpadmin command communicates with the scheduler (cupsd) to make changes to the printing system configuration. This configuration information is stored in several files including printers.conf and classes.conf. These files should not be edited directly and are an implementation detail of CUPS that is subject to change at any time. EXAMPLE top Create an IPP Everywhere print queue: lpadmin -p myprinter -E -v ipp://myprinter.local/ipp/print -m everywhere SEE ALSO top cupsaccept(8), cupsenable(8), lpinfo(8), lpoptions(1), CUPS Online Help (http://localhost:631/help) COPYRIGHT top Copyright 2007-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 26 April 2019 CUPS lpadmin(8) Pages that refer to this page: cups(1), cupstestppd(1), lp(1), lpoptions(1), lpr(1), cupsaccept(8), cupsenable(8), lpc(8), lpinfo(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lpadmin\n\n> Configure CUPS printers and classes.\n> See also: `lpoptions`.\n> More information: <https://openprinting.github.io/cups/doc/man-lpadmin.html>.\n\n- Set the default printer:\n\n`lpadmin -d {{printer}}`\n\n- Delete a specific printer or class:\n\n`lpadmin -x {{printer|class}}`\n\n- Add a printer to a class:\n\n`lpadmin -p {{printer}} -c {{class}}`\n\n- Remove a printer from a class:\n\n`lpadmin -p {{printer}} -r {{class}}`\n
lpinfo
lpinfo(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lpinfo(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | CONFORMING TO | EXAMPLES | NOTES | SEE ALSO | COPYRIGHT | COLOPHON lpinfo(8) Apple Inc. lpinfo(8) NAME top lpinfo - show available devices or drivers (deprecated) SYNOPSIS top lpinfo [ -E ] [ -h server[:port] ] [ -l ] [ --device-id device- id-string ] [ --exclude-schemes scheme-list ] [ --include-schemes scheme-list ] [ --language locale ] [ --make-and-model name ] [ --product name ] -m lpinfo [ -E ] [ -h server[:port] ] [ -l ] [ --exclude-schemes scheme-list ] [ --include-schemes scheme-list ] [ --timeout seconds ] -v DESCRIPTION top lpinfo lists the available devices or drivers known to the CUPS server. The first form (-m) lists the available drivers, while the second form (-v) lists the available devices. OPTIONS top lpinfo accepts the following options: -E Forces encryption when connecting to the server. -h server[:port] Selects an alternate server. -l Shows a "long" listing of devices or drivers. --device-id device-id-string Specifies the IEEE-1284 device ID to match when listing drivers with the -m option. --exclude-schemes scheme-list Specifies a comma-delimited list of device or PPD schemes that should be excluded from the results. Static PPD files use the "file" scheme. --include-schemes scheme-list Specifies a comma-delimited list of device or PPD schemes that should be included in the results. Static PPD files use the "file" scheme. --language locale Specifies the language to match when listing drivers with the -m option. --make-and-model name Specifies the make and model to match when listing drivers with the -m option. --product name Specifies the product to match when listing drivers with the -m option. --timeout seconds Specifies the timeout when listing devices with the -v option. CONFORMING TO top The lpinfo command is unique to CUPS. EXAMPLES top List all devices: lpinfo -v List all drivers: lpinfo -m List drivers matching "HP LaserJet": lpinfo --make-and-model "HP LaserJet" -m NOTES top CUPS printer drivers and backends are deprecated and will no longer be supported in a future feature release of CUPS. Printers that do not support IPP can be supported using applications such as ippeveprinter(1). SEE ALSO top lpadmin(8), CUPS Online Help (http://localhost:631/help) COPYRIGHT top Copyright 2007-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 26 April 2019 CUPS lpinfo(8) Pages that refer to this page: cups(1), backend(7), cups-snmp(8), lpadmin(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lpinfo\n\n> List connected printers and installed drivers for the CUPS print server.\n> More information: <https://openprinting.github.io/cups/doc/man-lpinfo.html>.\n\n- List all the currently connected printers:\n\n`lpinfo -v`\n\n- List all the currently installed printer drivers:\n\n`lpinfo -m`\n\n- Search installed printer drivers by make and model:\n\n`lpinfo --make-and-model "{{printer_model}}" -m`\n
lpmove
lpmove(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lpmove(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXAMPLES | SEE ALSO | COPYRIGHT | COLOPHON lpmove(8) Apple Inc. lpmove(8) NAME top lpmove - move a job or all jobs to a new destination SYNOPSIS top lpmove [ -E ] [ -h server[:port] ] [ -U username ] job destination lpmove [ -E ] [ -h server[:port] ] [ -U username ] source destination DESCRIPTION top lpmove moves the specified job or all jobs from source to destination. job can be the job ID number or the old destination and job ID. OPTIONS top The lpmove command supports the following options: -E Forces encryption when connecting to the server. -U username Specifies an alternate username. -h server[:port] Specifies an alternate server. EXAMPLES top Move job 123 from "oldprinter" to "newprinter": lpmove 123 newprinter or lpmove oldprinter-123 newprinter Move all jobs from "oldprinter" to "newprinter": lpmove oldprinter newprinter SEE ALSO top cancel(1), lp(1), lpr(1), lprm(1), CUPS Online Help (http://localhost:631/help) COPYRIGHT top Copyright 2007-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 26 April 2019 CUPS lpmove(8) Pages that refer to this page: cancel(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lpmove\n\n> Move a job or all jobs to another printer.\n> See also: `cancel`, `lp`, `lpr`, `lprm`.\n> More information: <https://openprinting.github.io/cups/doc/man-lpmove.html>.\n\n- Move a specific job to `new_printer`:\n\n`lpmove {{job_id}} {{new_printer}}`\n\n- Move a job from `old_printer` to `new_printer`:\n\n`lpmove {{old_printer}}-{{job_id}} {{new_printer}}`\n\n- Move all jobs from `old_printer` to `new_printer`:\n\n`lpmove {{old_printer}} {{new_printer}}`\n\n- Move a specific job to `new_printer` on a specific server:\n\n`lpmove -h {{server}} {{job_id}} {{new_printer}}`\n
lpoptions
lpoptions(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lpoptions(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | FILES | CONFORMING TO | SEE ALSO | COPYRIGHT | COLOPHON lpoptions(1) Apple Inc. lpoptions(1) NAME top lpoptions - display or set printer options and defaults SYNOPSIS top lpoptions [ -E ] [ -h server[:port] ] -d destination[/instance] [ -l ] lpoptions [ -E ] [ -h server[:port] ] [ -p destination[/instance] ] -o option[=value] ... lpoptions [ -E ] [ -h server[:port] ] [ -p destination[/instance] ] -r option lpoptions [ -E ] [ -h server[:port] ] -x destination[/instance] DESCRIPTION top lpoptions displays or sets printer options and defaults. If no printer is specified using the -p option, the default printer is used as described in lp(1). If no -l, -o, or -r options are specified, the current options are reported on the standard output. Options set with the lpoptions command are used by the lp(1) and lpr(1) commands when submitting jobs. When run by the root user, lpoptions gets and sets default options and instances for all users in the /etc/cups/lpoptions file. Otherwise, the per-user defaults are managed in the ~/.cups/lpoptions file. OPTIONS top lpoptions supports the following options: -E Enables encryption when communicating with the CUPS server. -d destination[/instance] Sets the user default printer to destination. If instance is supplied then that particular instance is used. This option overrides the system default printer for the current user. -h server[:port] Uses an alternate server. -l Lists the printer specific options and their current settings. -o option[=value] Specifies a new option for the named destination. -p destination[/instance] Sets the destination and instance, if specified, for any options that follow. If the named instance does not exist then it is created. Destinations can only be created using the lpadmin(8) program. -r option Removes the specified option from the named destination. -x destination[/instance] Removes the options for the named destination and instance, if specified. If the named instance does not exist then this does nothing. Destinations can only be removed using the lpadmin(8) command. FILES top ~/.cups/lpoptions - user defaults and instances created by non- root users. /etc/cups/lpoptions - system-wide defaults and instances created by the root user. CONFORMING TO top The lpoptions command is unique to CUPS. SEE ALSO top cancel(1), lp(1), lpadmin(8), lpr(1), lprm(1), CUPS Online Help (http://localhost:631/help) COPYRIGHT top Copyright 2007-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 26 April 2019 CUPS lpoptions(1) Pages that refer to this page: cups(1), lp(1), lpr(1), lpadmin(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lpoptions\n\n> Display or set printer options and defaults.\n> See also: `lpadmin`.\n> More information: <https://openprinting.github.io/cups/doc/man-lpoptions.html>.\n\n- Set the default printer:\n\n`lpoptions -d {{printer[/instance]}}`\n\n- List printer-specific options of a specific printer:\n\n`lpoptions -d {{printer}} -l`\n\n- Set a new option on a specific printer:\n\n`lpoptions -d {{printer}} -o {{option}}`\n\n- Remove the options of a specific printer:\n\n`lpoptions -d {{printer}} -x`\n
lpq
lpq(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lpq(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | SEE ALSO | COPYRIGHT | COLOPHON lpq(1) Apple Inc. lpq(1) NAME top lpq - show printer queue status SYNOPSIS top lpq [ -E ] [ -U username ] [ -h server[:port] ] [ -P destination[/instance] ] [ -a ] [ -l ] [ +interval ] DESCRIPTION top lpq shows the current print queue status on the named printer. Jobs queued on the default destination will be shown if no printer or class is specified on the command-line. The +interval option allows you to continuously report the jobs in the queue until the queue is empty; the list of jobs is shown once every interval seconds. OPTIONS top lpq supports the following options: -E Forces encryption when connecting to the server. -P destination[/instance] Specifies an alternate printer or class name. -U username Specifies an alternate username. -a Reports jobs on all printers. -h server[:port] Specifies an alternate server. -l Requests a more verbose (long) reporting format. SEE ALSO top cancel(1), lp(1), lpr(1), lprm(1), lpstat(1), CUPS Online Help (http://localhost:631/help) COPYRIGHT top Copyright 2007-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 26 April 2019 CUPS lpq(1) Pages that refer to this page: cups(1), lp(1), lpr(1), lprm(1), lpstat(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lpq\n\n> Show printer queue status.\n> More information: <https://openprinting.github.io/cups/doc/man-lpq.html>.\n\n- Show the queued jobs of the default destination:\n\n`lpq`\n\n- Show the queued jobs of all printers enforcing encryption:\n\n`lpq -a -E`\n\n- Show the queued jobs in a long format:\n\n`lpq -l`\n\n- Show the queued jobs of a specific printer or class:\n\n`lpq -P {{destination[/instance]}}`\n\n- Show the queued jobs once every n seconds until the queue is empty:\n\n`lpq +{{interval}}`\n
lpr
lpr(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lpr(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | NOTES | EXAMPLES | SEE ALSO | COPYRIGHT | COLOPHON lpr(1) Apple Inc. lpr(1) NAME top lpr - print files SYNOPSIS top lpr [ -E ] [ -H server[:port] ] [ -U username ] [ -P destination[/instance] ] [ -# num-copies [ -h ] [ -l ] [ -m ] [ -o option[=value] ] [ -p ] [ -q ] [ -r ] [ -C title ] [ -J title ] [ -T title ] [ file(s) ] DESCRIPTION top lpr submits files for printing. Files named on the command line are sent to the named printer or the default destination if no destination is specified. If no files are listed on the command- line, lpr reads the print file from the standard input. THE DEFAULT DESTINATION CUPS provides many ways to set the default destination. The LPDEST and PRINTER environment variables are consulted first. If neither are set, the current default set using the lpoptions(1) command is used, followed by the default set using the lpadmin(8) command. OPTIONS top The following options are recognized by lpr: -E Forces encryption when connecting to the server. -H server[:port] Specifies an alternate server. -C "name" -J "name" -T "name" Sets the job name/title. -P destination[/instance] Prints files to the named printer. -U username Specifies an alternate username. -# copies Sets the number of copies to print. -h Disables banner printing. This option is equivalent to -o job-sheets=none. -l Specifies that the print file is already formatted for the destination and should be sent without filtering. This option is equivalent to -o raw. -m Send an email on job completion. -o option[=value] Sets a job option. See "COMMON JOB OPTIONS" below. -p Specifies that the print file should be formatted with a shaded header with the date, time, job name, and page number. This option is equivalent to -o prettyprint and is only useful when printing text files. -q Hold job for printing. -r Specifies that the named print files should be deleted after submitting them. COMMON JOB OPTIONS Aside from the printer-specific options reported by the lpoptions(1) command, the following generic options are available: -o job-sheets=name Prints a cover page (banner) with the document. The "name" can be "classified", "confidential", "secret", "standard", "topsecret", or "unclassified". -o media=size Sets the page size to size. Most printers support at least the size names "a4", "letter", and "legal". -o number-up={2|4|6|9|16} Prints 2, 4, 6, 9, or 16 document (input) pages on each output page. -o orientation-requested=4 Prints the job in landscape (rotated 90 degrees counter- clockwise). -o orientation-requested=5 Prints the job in landscape (rotated 90 degrees clockwise). -o orientation-requested=6 Prints the job in reverse portrait (rotated 180 degrees). -o print-quality=3 -o print-quality=4 -o print-quality=5 Specifies the output quality - draft (3), normal (4), or best (5). -o sides=one-sided Prints on one side of the paper. -o sides=two-sided-long-edge Prints on both sides of the paper for portrait output. -o sides=two-sided-short-edge Prints on both sides of the paper for landscape output. NOTES top The -c, -d, -f, -g, -i, -n, -t, -v, and -w options are not supported by CUPS and produce a warning message if used. EXAMPLES top Print two copies of a document to the default printer: lpr -# 2 filename Print a double-sided legal document to a printer called "foo": lpr -P foo -o media=legal -o sides=two-sided-long-edge filename Print a presentation document 2-up to a printer called "foo": lpr -P foo -o number-up=2 filename SEE ALSO top cancel(1), lp(1), lpadmin(8), lpoptions(1), lpq(1), lprm(1), lpstat(1), CUPS Online Help (http://localhost:631/help) COPYRIGHT top Copyright 2007-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 26 April 2019 CUPS lpr(1) Pages that refer to this page: cups(1), lp(1), lpoptions(1), lpq(1), lprm(1), lpstat(1), backend(7), environ(7), lpadmin(8), lpc(8), lpmove(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lpr\n\n> Print files.\n> See also: `lpstat` and `lpadmin`.\n> More information: <https://openprinting.github.io/cups/doc/man-lpr.html>.\n\n- Print a file to the default printer:\n\n`lpr {{path/to/file}}`\n\n- Print 2 copies:\n\n`lpr -# {{2}} {{path/to/file}}`\n\n- Print to a named printer:\n\n`lpr -P {{printer}} {{path/to/file}}`\n\n- Print either a single page (e.g. 2) or a range of pages (e.g. 216):\n\n`lpr -o page-ranges={{2|2-16}} {{path/to/file}}`\n\n- Print double-sided either in portrait (long) or in landscape (short):\n\n`lpr -o sides={{two-sided-long-edge|two-sided-short-edge}} {{path/to/file}}`\n\n- Set page size (more options may be available depending on setup):\n\n`lpr -o media={{a4|letter|legal}} {{path/to/file}}`\n\n- Print multiple pages per sheet:\n\n`lpr -o number-up={{2|4|6|9|16}} {{path/to/file}}`\n
lprm
lprm(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lprm(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | CONFORMING TO | EXAMPLES | SEE ALSO | COPYRIGHT | COLOPHON lprm(1) Apple Inc. lprm(1) NAME top lprm - cancel print jobs SYNOPSIS top lprm [ -E ] [ -U username ] [ -h server[:port] ] [ -P destination[/instance] ] [ - ] [ job-id(s) ] DESCRIPTION top lprm cancels print jobs that have been queued for printing. If no arguments are supplied, the current job on the default destination is canceled. You can specify one or more job ID numbers to cancel those jobs or use the - option to cancel all jobs. OPTIONS top The lprm command supports the following options: -E Forces encryption when connecting to the server. -P destination[/instance] Specifies the destination printer or class. -U username Specifies an alternate username. -h server[:port] Specifies an alternate server. CONFORMING TO top The CUPS version of lprm is compatible with the standard Berkeley command of the same name. EXAMPLES top Cancel the current job on the default printer: lprm Cancel job 1234: lprm 1234 Cancel all jobs: lprm - SEE ALSO top cancel(1), lp(1), lpq(1), lpr(1), lpstat(1), CUPS Online Help (http://localhost:631/help) COPYRIGHT top Copyright 2007-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 26 April 2019 CUPS lprm(1) Pages that refer to this page: cups(1), lp(1), lpoptions(1), lpq(1), lpr(1), lpstat(1), lpc(8), lpmove(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lprm\n\n> Cancel queued print jobs of a server.\n> See also: `lpq`.\n> More information: <https://openprinting.github.io/cups/doc/man-lprm.html>.\n\n- Cancel current job on the default printer:\n\n`lprm`\n\n- Cancel a job of a specific server:\n\n`lprm -h {{server[:port]}} {{job_id}}`\n\n- Cancel multiple jobs with a encrypted connection to the server:\n\n`lprm -E {{job_id1 job_id2 ...}}`\n\n- Cancel all jobs:\n\n`lprm -`\n\n- Cancel the current job of a specific printer or class:\n\n`lprm -P {{destination[/instance]}}`\n
lpstat
lpstat(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lpstat(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | CONFORMING TO | SEE ALSO | COPYRIGHT | COLOPHON lpstat(1) Apple Inc. lpstat(1) NAME top lpstat - print cups status information SYNOPSIS top lpstat [ -E ] [ -H ] [ -U username ] [ -h hostname[:port] ] [ -l ] [ -W which-jobs ] [ -a [ destination(s) ] ] [ -c [ class(es) ] ] [ -d ] [ -e ] [ -o [ destination(s) ] ] [ -p [ printer(s) ] ] [ -r ] [ -R ] [ -s ] [ -t ] [ -u [ user(s) ] ] [ -v [ printer(s) ] ] DESCRIPTION top lpstat displays status information about the current classes, jobs, and printers. When run with no arguments, lpstat will list active jobs queued by the current user. OPTIONS top The lpstat command supports the following options: -E Forces encryption when connecting to the server. -H Shows the server hostname and port. -R Shows the ranking of print jobs. -U username Specifies an alternate username. -W which-jobs Specifies which jobs to show, "completed" or "not-completed" (the default). This option must appear before the -o option and/or any printer names, otherwise the default ("not- completed") value will be used in the request to the scheduler. -a [printer(s)] Shows the accepting state of printer queues. If no printers are specified then all printers are listed. -c [class(es)] Shows the printer classes and the printers that belong to them. If no classes are specified then all classes are listed. -d Shows the current default destination. -e Shows all available destinations on the local network. -h server[:port] Specifies an alternate server. -l Shows a long listing of printers, classes, or jobs. -o [destination(s)] Shows the jobs queued on the specified destinations. If no destinations are specified all jobs are shown. -p [printer(s)] Shows the printers and whether they are enabled for printing. If no printers are specified then all printers are listed. -r Shows whether the CUPS server is running. -s Shows a status summary, including the default destination, a list of classes and their member printers, and a list of printers and their associated devices. This is equivalent to using the -d, -c, and -v options. -t Shows all status information. This is equivalent to using the -r, -d, -c, -v, -a, -p, and -o options. -u [user(s)] Shows a list of print jobs queued by the specified users. If no users are specified, lists the jobs queued by the current user. -v [printer(s)] Shows the printers and what device they are attached to. If no printers are specified then all printers are listed. CONFORMING TO top Unlike the System V printing system, CUPS allows printer names to contain any printable character except SPACE, TAB, "/", and "#". Also, printer and class names are not case-sensitive. The -h, -e, -E, -U, and -W options are unique to CUPS. The Solaris -f, -P, and -S options are silently ignored. SEE ALSO top cancel(1), lp(1), lpq(1), lpr(1), lprm(1), CUPS Online Help (http://localhost:631/help) COPYRIGHT top Copyright 2007-2019 by Apple Inc. COLOPHON top This page is part of the CUPS (a standards-based, open source printing system) project. Information about the project can be found at http://www.cups.org/. If you have a bug report for this manual page, see http://www.cups.org/. This page was obtained from the project's upstream Git repository https://github.com/apple/cups on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-27.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 26 April 2019 CUPS lpstat(1) Pages that refer to this page: cancel(1), cups(1), lp(1), lpq(1), lpr(1), lprm(1), cupsaccept(8), cupsenable(8), lpc(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lpstat\n\n> Show status information about printers.\n> More information: <https://manned.org/lpstat>.\n\n- List printers present on the machine and whether they are enabled for printing:\n\n`lpstat -p`\n\n- Show the default printer:\n\n`lpstat -d`\n\n- Display all available status information:\n\n`lpstat -t`\n\n- List print jobs queued by a specific user:\n\n`lpstat -u {{user}}`\n
ls
ls(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ls(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | AUTHOR | REPORTING BUGS | COPYRIGHT | SEE ALSO | COLOPHON LS(1) User Commands LS(1) NAME top ls - list directory contents SYNOPSIS top ls [OPTION]... [FILE]... DESCRIPTION top List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print C-style escapes for nongraphic characters --block-size=SIZE with -l, scale sizes by SIZE when printing them; e.g., '--block-size=M'; see SIZE format below -B, --ignore-backups do not list implied entries ending with ~ -c with -lt: sort by, and show, ctime (time of last change of file status information); with -l: show ctime and sort by name; otherwise: sort by ctime, newest first -C list entries by columns --color[=WHEN] color the output WHEN; more info below -d, --directory list directories themselves, not their contents -D, --dired generate output designed for Emacs' dired mode -f list all entries in directory order -F, --classify[=WHEN] append indicator (one of */=>@|) to entries WHEN --file-type likewise, except do not append '*' --format=WORD across -x, commas -m, horizontal -x, long -l, single-column -1, verbose -l, vertical -C --full-time like -l --time-style=full-iso -g like -l, but do not list owner --group-directories-first group directories before files; can be augmented with a --sort option, but any use of --sort=none (-U) disables grouping -G, --no-group in a long listing, don't print group names -h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc. --si likewise, but use powers of 1000 not 1024 -H, --dereference-command-line follow symbolic links listed on the command line --dereference-command-line-symlink-to-dir follow each command line symbolic link that points to a directory --hide=PATTERN do not list implied entries matching shell PATTERN (overridden by -a or -A) --hyperlink[=WHEN] hyperlink file names WHEN --indicator-style=WORD append indicator with style WORD to entry names: none (default), slash (-p), file-type (--file-type), classify (-F) -i, --inode print the index number of each file -I, --ignore=PATTERN do not list implied entries matching shell PATTERN -k, --kibibytes default to 1024-byte blocks for file system usage; used only with -s and per directory totals -l use a long listing format -L, --dereference when showing file information for a symbolic link, show information for the file the link references rather than for the link itself -m fill width with a comma separated list of entries -n, --numeric-uid-gid like -l, but list numeric user and group IDs -N, --literal print entry names without quoting -o like -l, but do not list group information -p, --indicator-style=slash append / indicator to directories -q, --hide-control-chars print ? instead of nongraphic characters --show-control-chars show nongraphic characters as-is (the default, unless program is 'ls' and output is a terminal) -Q, --quote-name enclose entry names in double quotes --quoting-style=WORD use quoting style WORD for entry names: literal, locale, shell, shell-always, shell-escape, shell-escape-always, c, escape (overrides QUOTING_STYLE environment variable) -r, --reverse reverse order while sorting -R, --recursive list subdirectories recursively -s, --size print the allocated size of each file, in blocks -S sort by file size, largest first --sort=WORD sort by WORD instead of name: none (-U), size (-S), time (-t), version (-v), extension (-X), width --time=WORD select which timestamp used to display or sort; access time (-u): atime, access, use; metadata change time (-c): ctime, status; modified time (default): mtime, modification; birth time: birth, creation; with -l, WORD determines which time to show; with --sort=time, sort by WORD (newest first) --time-style=TIME_STYLE time/date format with -l; see TIME_STYLE below -t sort by time, newest first; see --time -T, --tabsize=COLS assume tab stops at each COLS instead of 8 -u with -lt: sort by, and show, access time; with -l: show access time and sort by name; otherwise: sort by access time, newest first -U do not sort; list entries in directory order -v natural sort of (version) numbers within text -w, --width=COLS set output width to COLS. 0 means no limit -x list entries by lines instead of by columns -X sort alphabetically by entry extension -Z, --context print any security context of each file --zero end each output line with NUL, not newline -1 list one file per line --help display this help and exit --version output version information and exit The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y,R,Q (powers of 1024) or KB,MB,... (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and so on. The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or +FORMAT. FORMAT is interpreted like in date(1). If FORMAT is FORMAT1<newline>FORMAT2, then FORMAT1 applies to non-recent files and FORMAT2 to recent files. TIME_STYLE prefixed with 'posix-' takes effect only outside the POSIX locale. Also the TIME_STYLE environment variable sets the default style to use. The WHEN argument defaults to 'always' and can also be 'auto' or 'never'. Using color to distinguish file types is disabled both by default and with --color=never. With --color=auto, ls emits color codes only when standard output is connected to a terminal. The LS_COLORS environment variable can change the settings. Use the dircolors(1) command to set it. Exit status: 0 if OK, 1 if minor problems (e.g., cannot access subdirectory), 2 if serious trouble (e.g., cannot access command-line argument). AUTHOR top Written by Richard M. Stallman and David MacKenzie. REPORTING BUGS top GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT top Copyright 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO top dircolors(1) Full documentation <https://www.gnu.org/software/coreutils/ls> or available locally via: info '(coreutils) ls invocation' COLOPHON top This page is part of the coreutils (basic file, shell and text manipulation utilities) project. Information about the project can be found at http://www.gnu.org/software/coreutils/. If you have a bug report for this manual page, see http://www.gnu.org/software/coreutils/. This page was obtained from the tarball coreutils-9.4.tar.xz fetched from http://ftp.gnu.org/gnu/coreutils/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] GNU coreutils 9.4 August 2023 LS(1) Pages that refer to this page: column(1), find(1), namei(1), stat(2), statx(2), glob(3), strverscmp(3), core(5), dir_colors(5), passwd(5), proc(5), mq_overview(7), symlink(7), lsblk(8), lsof(8), setfiles(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ls\n\n> List directory contents.\n> More information: <https://www.gnu.org/software/coreutils/ls>.\n\n- List files one per line:\n\n`ls -1`\n\n- List all files, including hidden files:\n\n`ls -a`\n\n- List all files, with trailing `/` added to directory names:\n\n`ls -F`\n\n- Long format list (permissions, ownership, size, and modification date) of all files:\n\n`ls -la`\n\n- Long format list with size displayed using human-readable units (KiB, MiB, GiB):\n\n`ls -lh`\n\n- Long format list sorted by size (descending) recursively:\n\n`ls -lSR`\n\n- Long format list of all files, sorted by modification date (oldest first):\n\n`ls -ltr`\n\n- Only list directories:\n\n`ls -d */`\n
lsattr
lsattr(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lsattr(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | AUTHOR | BUGS | AVAILABILITY | SEE ALSO | COLOPHON LSATTR(1) General Commands Manual LSATTR(1) NAME top lsattr - list file attributes on a Linux second extended file system SYNOPSIS top lsattr [ -RVadlpv ] [ files... ] DESCRIPTION top lsattr lists the file attributes on a second extended file system. See chattr(1) for a description of the attributes and what they mean. OPTIONS top -R Recursively list attributes of directories and their contents. -V Display the program version. -a List all files in directories, including files that start with `.'. -d List directories like other files, rather than listing their contents. -l Print the options using long names instead of single character abbreviations. -p List the file's project number. -v List the file's version/generation number. AUTHOR top lsattr was written by Remy Card <[email protected]>. It is currently being maintained by Theodore Ts'o <[email protected]>. BUGS top There are none :-). AVAILABILITY top lsattr is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net. SEE ALSO top chattr(1) COLOPHON top This page is part of the e2fsprogs (utilities for ext2/3/4 filesystems) project. Information about the project can be found at http://e2fsprogs.sourceforge.net/. It is not known how to report bugs for this man page; if you know, please send a mail to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-07.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] E2fsprogs version 1.47.0 February 2023 LSATTR(1) Pages that refer to this page: chattr(1), ioctl_iflags(2), btrfs-property(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lsattr\n\n> List file attributes on a Linux filesystem.\n> More information: <https://manned.org/lsattr>.\n\n- Display the attributes of the files in the current directory:\n\n`lsattr`\n\n- List the attributes of files in a particular path:\n\n`lsattr {{path}}`\n\n- List file attributes recursively in the current and subsequent directories:\n\n`lsattr -R`\n\n- Show attributes of all the files in the current directory, including hidden ones:\n\n`lsattr -a`\n\n- Display attributes of directories in the current directory:\n\n`lsattr -d`\n
lsblk
lsblk(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lsblk(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXIT STATUS | ENVIRONMENT | NOTES | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY LSBLK(8) System Administration LSBLK(8) NAME top lsblk - list block devices SYNOPSIS top lsblk [options] [device...] DESCRIPTION top lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information. If the udev db is not available or lsblk is compiled without udev support, then it tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions are necessary. By default, the command prints all block devices (except RAM disks) in a tree-like format. The same device can be repeated in the tree if it relates to other devices. The --merge option is recommended for more complicated setups to gather groups of devices and describe complex N:M relationships. The tree-like output (or children[] array in the JSON output) is enabled only if NAME column it present in the output or when --tree command line option is used. See also --nodeps and --list to control the tree formatting. The default output, as well as the default output from options like --fs and --topology, is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected columns by using --output columns-list and --list in environments where a stable output is required. Use lsblk --help to get a list of all available columns. Note that lsblk might be executed in time when udev does not have all information about recently added or modified devices yet. In this case it is recommended to use udevadm settle before lsblk to synchronize with udev. The relationship between block devices and filesystems is not always one-to-one. The filesystem may use more block devices, or the same filesystem may be accessible by more paths. This is the reason why lsblk provides MOUNTPOINT and MOUNTPOINTS (pl.) columns. The column MOUNTPOINT displays only one mount point (usually the last mounted instance of the filesystem), and the column MOUNTPOINTS displays by multi-line cell all mount points associated with the device. OPTIONS top -A, --noempty Dont print empty devices. -a, --all Disable all built-in filters and list all empty devices and RAM disk devices too. -b, --bytes Print the sizes in bytes rather than in a human-readable format. By default, the unit, sizes are expressed in, is byte, and unit prefixes are in power of 2^10 (1024). Abbreviations of symbols are exhibited truncated in order to reach a better readability, by exhibiting alone the first letter of them; examples: "1 KiB" and "1 MiB" are respectively exhibited as "1 K" and "1 M", then omitting on purpose the mention "iB", which is part of these abbreviations. -H, --list-columns List the available columns, use with --json or --raw to get output in machine-readable format. -D, --discard Print information about the discarding capabilities (TRIM, UNMAP) for each device. -d, --nodeps Do not print holder devices or slaves. For example, lsblk --nodeps /dev/sda prints information about the sda device only. -E, --dedup column Use column as a de-duplication key to de-duplicate output tree. If the key is not available for the device, or the device is a partition and parental whole-disk device provides the same key than the device is always printed. The usual use case is to de-duplicate output on system multi-path devices, for example by -E WWN. -e, --exclude list Exclude the devices specified by the comma-separated list of major device numbers. Note that RAM disks (major=1) are excluded by default if --all is not specified. The filter is applied to the top-level devices only. This may be confusing for --list output format where hierarchy of the devices is not obvious. -f, --fs Output info about filesystems. This option is equivalent to -o NAME,FSTYPE,FSVER,LABEL,UUID,FSAVAIL,FSUSE%,MOUNTPOINTS. The authoritative information about filesystems and raids is provided by the blkid(8) command. -I, --include list Include devices specified by the comma-separated list of major device numbers. The filter is applied to the top-level devices only. This may be confusing for --list output format where hierarchy of the devices is not obvious. -i, --ascii Use ASCII characters for tree formatting. -J, --json Use JSON output format. Its strongly recommended to use --output and also --tree if necessary. Note that children[] is used only if NAME column or --tree is used. -l, --list Produce output in the form of a list. The output does not provide information about relationships between devices and since version 2.34 every device is printed only once if --pairs or --raw not specified (the parsable outputs are maintained in backwardly compatible way). -M, --merge Group parents of sub-trees to provide more readable output for RAIDs and Multi-path devices. The tree-like output is required. -m, --perms Output info about device owner, group and mode. This option is equivalent to -o NAME,SIZE,OWNER,GROUP,MODE. -N, --nvme Output info about NVMe devices only. -v, --virtio Output info about virtio devices only. -n, --noheadings Do not print a header line. -o, --output list Specify which output columns to print. Use --list-columns to get a list of all supported columns. The columns may affect tree-like output. The default is to use tree for the column 'NAME' (see also --tree). The default list of columns may be extended if list is specified in the format +list (e.g., lsblk -o +UUID). -O, --output-all Output all available columns. -P, --pairs Produce output in the form of key="value" pairs. The output lines are still ordered by dependencies. All potentially unsafe value characters are hex-escaped (\x<code>). See also option --shell. -p, --paths Print full device paths. -r, --raw Produce output in raw format. The output lines are still ordered by dependencies. All potentially unsafe characters are hex-escaped (\x<code>) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT columns. -S, --scsi Output info about SCSI devices only. All partitions, slaves and holder devices are ignored. -s, --inverse Print dependencies in inverse order. If the --list output is requested then the lines are still ordered by dependencies. -T, --tree[=column] Force tree-like output format. If column is specified, then a tree is printed in the column. The default is NAME column. -t, --topology Output info about block-device topology. This option is equivalent to -o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME. -h, --help Display help text and exit. -V, --version Print version and exit. -w, --width number Specifies output width as a number of characters. The default is the number of the terminal columns, and if not executed on a terminal, then output width is not restricted at all by default. This option also forces lsblk to assume that terminal control characters and unsafe characters are not allowed. The expected use-case is for example when lsblk is used by the watch(1) command. -x, --sort column Sort output lines by column. This option enables --list output format by default. It is possible to use the option --tree to force tree-like output and than the tree branches are sorted by the column. -y, --shell The column name will be modified to contain only characters allowed for shell variable identifiers, for example, MIN_IO and FSUSE_PCT instead of MIN-IO and FSUSE%. This is usable, for example, with --pairs. Note that this feature has been automatically enabled for --pairs in version 2.37, but due to compatibility issues, now its necessary to request this behavior by --shell. -z, --zoned Print the zone related information for each device. --sysroot directory Gather data for a Linux instance other than the instance from which the lsblk command is issued. The specified directory is the system root of the Linux instance to be inspected. The real device nodes in the target directory can be replaced by text files with udev attributes. EXIT STATUS top 0 success 1 failure 32 none of specified devices found 64 some specified devices found, some not found ENVIRONMENT top LSBLK_DEBUG=all enables lsblk debug output. LIBBLKID_DEBUG=all enables libblkid debug output. LIBMOUNT_DEBUG=all enables libmount debug output. LIBSMARTCOLS_DEBUG=all enables libsmartcols debug output. LIBSMARTCOLS_DEBUG_PADDING=on use visible padding characters. NOTES top For partitions, some information (e.g., queue attributes) is inherited from the parent device. The lsblk command needs to be able to look up each block device by major:minor numbers, which is done by using /sys/dev/block. This sysfs block directory appeared in kernel 2.6.27 (October 2008). In case of problems with a new enough kernel, check that CONFIG_SYSFS was enabled at the time of the kernel build. AUTHORS top Milan Broz <[email protected]>, Karel Zak <[email protected]> SEE ALSO top ls(1), blkid(8), findmnt(8) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The lsblk command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.1041-8a7c 2023-12-22 LSBLK(8) Pages that refer to this page: eject(1), mount(2), fstab(5), blkdeactivate(8), blkid(8), cfdisk(8), findfs(8), mount(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lsblk\n\n> Lists information about devices.\n> More information: <https://manned.org/lsblk>.\n\n- List all storage devices in a tree-like format:\n\n`lsblk`\n\n- Also list empty devices:\n\n`lsblk -a`\n\n- Print the SIZE column in bytes rather than in a human-readable format:\n\n`lsblk -b`\n\n- Output info about filesystems:\n\n`lsblk -f`\n\n- Use ASCII characters for tree formatting:\n\n`lsblk -i`\n\n- Output info about block-device topology:\n\n`lsblk -t`\n\n- Exclude the devices specified by the comma-separated list of major device numbers:\n\n`lsblk -e {{1,7,...}}`\n\n- Display a customized summary using a comma-separated list of columns:\n\n`lsblk --output {{NAME,SERIAL,MODEL,TRAN,TYPE,SIZE,FSTYPE,MOUNTPOINT,...}}`\n
lscpu
lscpu(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lscpu(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | BUGS | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY LSCPU(1) User Commands LSCPU(1) NAME top lscpu - display information about the CPU architecture SYNOPSIS top lscpu [options] DESCRIPTION top lscpu gathers CPU architecture information from sysfs, /proc/cpuinfo and any applicable architecture-specific libraries (e.g. librtas on Powerpc). The command output can be optimized for parsing or for easy readability by humans. The information includes, for example, the number of CPUs, threads, cores, sockets, and Non-Uniform Memory Access (NUMA) nodes. There is also information about the CPU caches and cache sharing, family, model, bogoMIPS, byte order, and stepping. The default output formatting on terminal is subject to change and maybe optimized for better readability. The output for non-terminals (e.g., pipes) is never affected by this optimization and it is always in "Field: data\n" format. Use for example "lscpu | less" to see the default output without optimizations. In virtualized environments, the CPU architecture information displayed reflects the configuration of the guest operating system which is typically different from the physical (host) system. On architectures that support retrieving physical topology information, lscpu also displays the number of physical sockets, chips, cores in the host system. Options that result in an output table have a list argument. Use this argument to customize the command output. Specify a comma-separated list of column labels to limit the output table to only the specified columns, arranged in the specified order. See COLUMNS for a list of valid column labels. The column labels are not case sensitive. Not all columns are supported on all architectures. If an unsupported column is specified, lscpu prints the column but does not provide any data for it. The cache sizes are reported as summary from all CPUs. The versions before v2.34 reported per-core sizes, but this output was confusing due to complicated CPUs topology and the way how caches are shared between CPUs. For more details about caches see --cache. Since version v2.37 lscpu follows cache IDs as provided by Linux kernel and it does not always start from zero. OPTIONS top -a, --all Include lines for online and offline CPUs in the output (default for -e). This option may only be specified together with option -e or -p. -B, --bytes Print the sizes in bytes rather than in a human-readable format. By default, the unit, sizes are expressed in, is byte, and unit prefixes are in power of 2^10 (1024). Abbreviations of symbols are exhibited truncated in order to reach a better readability, by exhibiting alone the first letter of them; examples: "1 KiB" and "1 MiB" are respectively exhibited as "1 K" and "1 M", then omitting on purpose the mention "iB", which is part of these abbreviations. -b, --online Limit the output to online CPUs (default for -p). This option may only be specified together with option -e or -p. -C, --caches[=list] Display details about CPU caches. For details about available information see --help output. If the list argument is omitted, all columns for which data is available are included in the command output. When specifying the list argument, the string of option, equal sign (=), and list must not contain any blanks or other whitespace. Examples: -C=NAME,ONE-SIZE or --caches=NAME,ONE-SIZE. The default list of columns may be extended if list is specified in the format +list (e.g., lscpu -C=+ALLOC-POLICY). -c, --offline Limit the output to offline CPUs. This option may only be specified together with option -e or -p. --hierarchic[=when] Use subsections in summary output. For backward compatibility, the default is to use subsections only when output on a terminal and flattened output on a non-terminal. The optional argument when can be never, always or auto. If the when argument is omitted, it defaults to "always". -e, --extended[=list] Display the CPU information in human-readable format. If the list argument is omitted, the default columns are included in the command output. The default output is subject to change. When specifying the list argument, the string of option, equal sign (=), and list must not contain any blanks or other whitespace. Examples: '-e=cpu,node' or '--extended=cpu,node'. The default list of columns may be extended if list is specified in the format +list (e.g., lscpu -e=+MHZ). -J, --json Use JSON output format for the default summary or extended output (see --extended). For backward compatibility, JSON output follows the default summary behavior for non-terminals (e.g., pipes) where subsections are missing. See also --hierarchic. -p, --parse[=list] Optimize the command output for easy parsing. If the list argument is omitted, the command output is compatible with earlier versions of lscpu. In this compatible format, two commas are used to separate CPU cache columns. If no CPU caches are identified the cache column is omitted. If the list argument is used, cache columns are separated with a colon (:). When specifying the list argument, the string of option, equal sign (=), and list must not contain any blanks or other whitespace. Examples: '-p=cpu,node' or '--parse=cpu,node'. The default list of columns may be extended if list is specified in the format +list (e.g., lscpu -p=+MHZ). -s, --sysroot directory Gather CPU data for a Linux instance other than the instance from which the lscpu command is issued. The specified directory is the system root of the Linux instance to be inspected. -x, --hex Use hexadecimal masks for CPU sets (for example "ff"). The default is to print the sets in list format (for example 0,1). Note that before version 2.30 the mask has been printed with 0x prefix. -y, --physical Display physical IDs for all columns with topology elements (core, socket, etc.). Other than logical IDs, which are assigned by lscpu, physical IDs are platform-specific values that are provided by the kernel. Physical IDs are not necessarily unique and they might not be arranged sequentially. If the kernel could not retrieve a physical ID for an element lscpu prints the dash (-) character. The CPU logical numbers are not affected by this option. --output-all Output all available columns. This option must be combined with either --extended, --parse or --caches. BUGS top The basic overview of CPU family, model, etc. is always based on the first CPU only. Sometimes in Xen Dom0 the kernel reports wrong data. On virtual hardware the number of cores per socket, etc. can be wrong. AUTHORS top Cai Qian <[email protected]>, Karel Zak <[email protected]>, Heiko Carstens <[email protected]> SEE ALSO top chcpu(8) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The lscpu command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 LSCPU(1) Pages that refer to this page: sched_setaffinity(2), proc(5), sched(7), chcpu(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lscpu\n\n> Displays information about the CPU architecture.\n> More information: <https://manned.org/lscpu>.\n\n- Display information about all CPUs:\n\n`lscpu`\n\n- Display information in a table:\n\n`lscpu --extended`\n\n- Display only information about offline CPUs in a table:\n\n`lscpu --extended --offline`\n
lsinitrd
lsinitrd(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lsinitrd(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | AVAILABILITY | AUTHORS | SEE ALSO | COLOPHON LSINITRD(1) dracut LSINITRD(1) NAME top lsinitrd - tool to show the contents of an initramfs image SYNOPSIS top lsinitrd [OPTION...] [<image> [<filename> [<filename> [...] ]]] lsinitrd [OPTION...] -k <kernel version> DESCRIPTION top lsinitrd shows the contents of an initramfs image. if <image> is omitted, then lsinitrd uses the default image /efi/<machine-id>/<kernel-version>/initrd, /boot/<machine-id>/<kernel-version>/initrd, /boot/efi/<machine-id>/<kernel-version>/initrd, /lib/modules/<kernel-version>/initrd or /boot/initramfs-<kernel-version>.img. OPTIONS top -h, --help print a help message and exit. -s, --size sort the contents of the initramfs by size. -f, --file <filename> print the contents of <filename>. -k, --kver <kernel version> inspect the initramfs of <kernel version>. -m, --mod list dracut modules included of the initramfs image. --unpack unpack the initramfs to the current directory, instead of displaying the contents. If optional filenames are given, will only unpack specified files, else the whole image will be unpacked. Wont unpack anything from early cpio part. --unpackearly unpack the early microcode initramfs to the current directory, instead of displaying the contents. Same as --unpack, but only unpack files from early cpio part. -v, --verbose unpack verbosely AVAILABILITY top The lsinitrd command is part of the dracut package and is available from https://github.com/dracutdevs/dracut AUTHORS top Harald Hoyer Amerigo Wang Nikoli SEE ALSO top dracut(8) COLOPHON top This page is part of the dracut (event driven initramfs infrastructure) project. Information about the project can be found at https://dracut.wiki.kernel.org/index.php/Main_Page. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository https://github.com/dracutdevs/dracut.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-11-18.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] dracut 059-204-g6acfecae 09/13/2023 LSINITRD(1) Pages that refer to this page: dracut(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lsinitrd\n\n> Show the contents of an initramfs image.\n> See also: `dracut`.\n> More information: <https://github.com/dracutdevs/dracut/blob/master/man/lsinitrd.1.asc>.\n\n- Show the contents of the initramfs image for the current kernel:\n\n`lsinitrd`\n\n- Show the contents of the initramfs image for the specified kernel:\n\n`lsinitrd --kver {{kernel_version}}`\n\n- Show the contents of the specified initramfs image:\n\n`lsinitrd {{path/to/initramfs.img}}`\n\n- List modules included in the initramfs image:\n\n`lsinitrd --mod`\n\n- Unpack the initramfs to the current directory:\n\n`lsinitrd --unpack`\n
lslocks
lslocks(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lslocks(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OUTPUT | NOTES | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY LSLOCKS(8) System Administration LSLOCKS(8) NAME top lslocks - list local system locks SYNOPSIS top lslocks [options] DESCRIPTION top lslocks lists information about all the currently held file locks in a Linux system. OPTIONS top -b, --bytes Print the sizes in bytes rather than in a human-readable format. By default, the unit, sizes are expressed in, is byte, and unit prefixes are in power of 2^10 (1024). Abbreviations of symbols are exhibited truncated in order to reach a better readability, by exhibiting alone the first letter of them; examples: "1 KiB" and "1 MiB" are respectively exhibited as "1 K" and "1 M", then omitting on purpose the mention "iB", which is part of these abbreviations. -H, --list-columns List the available columns, use with --json or --raw to get output in machine-readable format. -i, --noinaccessible Ignore lock files which are inaccessible for the current user. -J, --json Use JSON output format. -n, --noheadings Do not print a header line. -o, --output list Specify which output columns to print. Use --help to get a list of all supported columns. The default list of columns may be extended if list is specified in the format +list (e.g., lslocks -o +BLOCKER). --output-all Output all available columns. -p, --pid pid Display only the locks held by the process with this pid. -r, --raw Use the raw output format. -u, --notruncate Do not truncate text in columns. -h, --help Display help text and exit. -V, --version Print version and exit. OUTPUT top COMMAND The command name of the process holding the lock. PID The process ID of the process. TYPE The type of lock; can be LEASE (created with fcntl(2)), FLOCK (created with flock(2)), POSIX (created with fcntl(2) and lockf(3)) or OFDLCK (created with fcntl(2)). SIZE Size of the locked file. INODE The inode number. MAJ:MIN The major:minor device number. MODE The locks access permissions (read, write). If the process is blocked and waiting for the lock, then the mode is postfixed with an '*' (asterisk). M Whether the lock is mandatory; 0 means no (meaning the lock is only advisory), 1 means yes. (See fcntl(2).) START Relative byte offset of the lock. END Ending offset of the lock. PATH Full path of the lock. If none is found, or there are no permissions to read the path, it will fall back to the devices mountpoint and "..." is appended to the path. The path might be truncated; use --notruncate to get the full path. BLOCKER The PID of the process which blocks the lock. HOLDERS The holder(s) of the lock. The format of the holder is PID,COMMAND,FD. If a lock is an open file description-oriented lock, there can be more than one holder for the lock. See the NOTES below. NOTES top The lslocks command is meant to replace the lslk(8) command, originally written by Victor A. Abell <[email protected]> and unmaintained since 2001. "The process holding the lock" for leases, FLOCK locks, and OFD locks is a fake-concept. They are associated with the open file description on which they are acquired. With fork(2) and/or cmsg(3), multiple processes can share an open file description. So the holder process of a lease (or a lock) is not uniquely determined. lslocks shows the one of the holder processes in COMMAND and PID columns. AUTHORS top Davidlohr Bueso <[email protected]> SEE ALSO top flock(1), fcntl(2), lockf(3) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The lslocks command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.1041-8a7c 2023-12-22 LSLOCKS(8) Pages that refer to this page: lsfd(1), fcntl(2), flock(2), proc(5) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lslocks\n\n> List local system locks.\n> More information: <https://manned.org/lslocks>.\n\n- List all local system locks:\n\n`lslocks`\n\n- List locks with defined column headers:\n\n`lslocks --output {{PID}},{{COMMAND}},{{PATH}}`\n\n- List locks producing a raw output (no columns), and without column headers:\n\n`lslocks --raw --noheadings`\n\n- List locks by PID input:\n\n`lslocks --pid {{PID}}`\n\n- List locks with JSON output to `stdout`:\n\n`lslocks --json`\n
lslogins
lslogins(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lslogins(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXIT STATUS | NOTES | HISTORY | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY LSLOGINS(1) User Commands LSLOGINS(1) NAME top lslogins - display information about known users in the system SYNOPSIS top lslogins [options] [-s|-u[=UID]] [-g groups] [-l logins] [username] DESCRIPTION top Examine the wtmp and btmp logs, /etc/shadow (if necessary) and /passwd and output the desired data. The optional argument username forces lslogins to print all available details about the specified user only. In this case the output format is different than in case of -l or -g and unknown is username reported as an error. The default action is to list info about all the users in the system. OPTIONS top Mandatory arguments to long options are mandatory for short options too. -a, --acc-expiration Display data about the date of last password change and the account expiration date (see shadow(5) for more info). (Requires root privileges.) --btmp-file path Alternate path for btmp. -c, --colon-separate Separate info about each user with a colon instead of a newline. -e, --export Output data in the format of NAME=VALUE. See also option --shell. -f, --failed Display data about the users' last failed login attempts. -G, --supp-groups Show information about supplementary groups. -g, --groups=groups Only show data of users belonging to groups. More than one group may be specified; the list has to be comma-separated. Unknown group names are ignored. Note that the relation between user and group may be invisible for the primary group if the user is not explicitly specified as group member (e.g., in /etc/group). If the command lslogins scans for groups then it uses the groups database only, and the user database with primary GID is not used at all. -L, --last Display data containing information about the users' last login sessions. -l, --logins=logins Only show data of users with a login specified in logins (user names or user IDs). More than one login may be specified; the list has to be comma-separated. Unknown login names are ignored. -n, --newline Display each piece of information on a separate line. --noheadings Do not print a header line. --notruncate Dont truncate output. -o, --output list Specify which output columns to print. The default list of columns may be extended if list is specified in the format +list. --output-all Output all available columns. --help to get a list of all supported columns. -p, --pwd Display information related to login by password (see also -afL). -r, --raw Raw output (no columnation). -s, --system-accs Show system accounts. These are by default all accounts with a UID between 101 and 999 (inclusive), with the exception of either nobody or nfsnobody (UID 65534). This hardcoded default may be overwritten by parameters SYS_UID_MIN and SYS_UID_MAX in the file /etc/login.defs. --time-format type Display dates in short, full or iso format. The default is short, this time format is designed to be space efficient and human readable. -u, --user-accs Show user accounts. These are by default all accounts with UID above 1000 (inclusive), with the exception of either nobody or nfsnobody (UID 65534). This hardcoded default maybe overwritten by parameters UID_MIN and UID_MAX in the file /etc/login.defs. -h, --help Display help text and exit. -V, --version Print version and exit. --wtmp-file path Alternate path for wtmp. --lastlog path Alternate path for lastlog(8). -y, --shell The column name will be modified to contain only characters allowed for shell variable identifiers. This is usable, for example, with --export. Note that this feature has been automatically enabled for --export in version 2.37, but due to compatibility issues, now its necessary to request this behavior by --shell. -Z, --context Display the users' security context. -z, --print0 Delimit user entries with a nul character, instead of a newline. EXIT STATUS top 0 if OK, 1 if incorrect arguments specified, 2 if a serious error occurs (e.g., a corrupt log). NOTES top The default UID thresholds are read from /etc/login.defs. Password status Multiple fields describe password status. "Password is locked" The password is prefixed by '!!', and the user cannot login although the password is set or empty. This is common for new accounts without a set password. "Password not required (empty)" The password is not set (hash is missing); this is common for locked system accounts. Not requiring a password does not mean the user can log-in without a password. It depends on the password "lock" status. "Login by password disabled" 'yes' means that there is no valid password. The password hash is missing, or the hash method is unknown or contains invalid chars. HISTORY top The lslogins utility is inspired by the logins utility, which first appeared in FreeBSD 4.10. AUTHORS top Ondrej Oprala <[email protected]>, Karel Zak <[email protected]> SEE ALSO top group(5), passwd(5), shadow(5), utmp(5) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The lslogins command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-09-01 LSLOGINS(1) Pages that refer to this page: utmp(5) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lslogins\n\n> Show information about users on a Linux system.\n> More information: <https://man7.org/linux/man-pages/man1/lslogins.1.html>.\n\n- Display users in the system:\n\n`lslogins`\n\n- Display users belonging to a specific group:\n\n`lslogins --groups={{groups}}`\n\n- Display user accounts:\n\n`lslogins --user-accs`\n\n- Display last logins:\n\n`lslogins --last`\n\n- Display system accounts:\n\n`lslogins --system-accs`\n\n- Display supplementary groups:\n\n`lslogins --supp-groups`\n
lsmod
lsmod(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lsmod(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | COPYRIGHT | SEE ALSO | AUTHORS | COLOPHON LSMOD(8) lsmod LSMOD(8) NAME top lsmod - Show the status of modules in the Linux Kernel SYNOPSIS top lsmod DESCRIPTION top lsmod is a trivial program which nicely formats the contents of the /proc/modules, showing what kernel modules are currently loaded. COPYRIGHT top This manual page originally Copyright 2002, Rusty Russell, IBM Corporation. Maintained by Jon Masters and others. SEE ALSO top insmod(8), modprobe(8), modinfo(8) depmod(8) AUTHORS top Jon Masters <[email protected]> Developer Lucas De Marchi <[email protected]> Developer COLOPHON top This page is part of the kmod (userspace tools for managing kernel modules) project. Information about the project can be found at [unknown -- if you know, please contact man- [email protected]] If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-06.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] kmod 12/22/2023 LSMOD(8) Pages that refer to this page: delete_module(2), init_module(2), query_module(2), proc(5), insmod(8), kmod(8), modprobe(8), rmmod(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lsmod\n\n> Shows the status of Linux kernel modules.\n> See also `modprobe`, which loads kernel modules.\n> More information: <https://manned.org/lsmod>.\n\n- List all currently loaded kernel modules:\n\n`lsmod`\n
lsns
lsns(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lsns(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXIT STATUS | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY LSNS(8) System Administration LSNS(8) NAME top lsns - list namespaces SYNOPSIS top lsns [options] namespace DESCRIPTION top lsns lists information about all the currently accessible namespaces or about the given namespace. The namespace identifier is an inode number. The default output is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected output mode (--tree or --list) and columns by using the --output option together with a columns list in environments where a stable output is required. The NSFS column, printed when net is specified for the --type option, is special; it uses multi-line cells. Use the option --nowrap to switch to ","-separated single-line representation. Note that lsns reads information directly from the /proc filesystem and for non-root users it may return incomplete information. The current /proc filesystem may be unshared and affected by a PID namespace (see unshare --mount-proc for more details). lsns is not able to see persistent namespaces without processes where the namespace instance is held by a bind mount to /proc/pid/ns/type. OPTIONS top -J, --json Use JSON output format. -l, --list Use list output format. -n, --noheadings Do not print a header line. -o, --output list Specify which output columns to print. Use --help to get a list of all supported columns. The default list of columns may be extended if list is specified in the format +list (e.g., lsns -o +PATH). --output-all Output all available columns. -P, --persistent Display only the namespaces without processes (aka persistent namespaces), created by bind mounting /proc/pid/ns/type files to a filesystem path. -p, --task PID Display only the namespaces held by the process with this PID. -r, --raw Use the raw output format. -t, --type type Display the specified type of namespaces only. The supported types are mnt, net, ipc, user, pid, uts, cgroup and time. This option may be given more than once. -u, --notruncate Do not truncate text in columns. -W, --nowrap Do not use multi-line text in columns. -T, --tree rel Use tree-like output format. If process is given as rel, print process tree(s) in each name space. This is default when --tree is not specified. If parent is given, print tree(s) constructed by the parent/child relationship. If owner is given, print tree(s) constructed by the owner/owned relationship. owner is used as default when rel is omitted. -h, --help Display help text and exit. -V, --version Print version and exit. EXIT STATUS top The lsns utility exits with one of the following values: 0 Success. 1 General error. 2 An ioctl was unknown to the kernel. AUTHORS top Karel Zak <[email protected]> SEE ALSO top nsenter(1), unshare(1), clone(2), namespaces(7), ioctl_ns(2), ip-netns(8) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The lsns command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 LSNS(8) Pages that refer to this page: namespaces(7) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lsns\n\n> List information about all namespaces or about the specified namespace.\n> More information: <https://man7.org/linux/man-pages/man8/lsns.8.html>.\n\n- List all namespaces:\n\n`lsns`\n\n- List namespaces in JSON format:\n\n`lsns --json`\n\n- List namespaces associated with the specified process:\n\n`lsns --task {{pid}}`\n\n- List the specified type of namespaces only:\n\n`lsns --type {{mnt|net|ipc|user|pid|uts|cgroup|time}}`\n\n- List namespaces, only showing the namespace ID, type, PID, and command:\n\n`lsns --output {{NS,TYPE,PID,COMMAND}}`\n
lsof
lsof(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lsof(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | AFS | SECURITY | OUTPUT | LOCKS | OUTPUT FOR OTHER PROGRAMS | BLOCKS AND TIMEOUTS | AVOIDING KERNEL BLOCKS | ALTERNATE DEVICE NUMBERS | KERNEL NAME CACHE | DEVICE CACHE FILE | LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS | DEVICE CACHE FILE PATH FROM THE -D OPTION | DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE | SYSTEM-WIDE DEVICE CACHE PATH | PERSONAL DEVICE CACHE PATH (DEFAULT) | MODIFIED PERSONAL DEVICE CACHE PATH | DIAGNOSTICS | EXAMPLES | BUGS | ENVIRONMENT | FAQ | FILES | AUTHORS | DISTRIBUTION | SEE ALSO | COLOPHON LSOF(8) System Manager's Manual LSOF(8) NAME top lsof - list open files SYNOPSIS top lsof [ -?abChlnNOPRtUvVX ] [ -A A ] [ -c c ] [ +c c ] [ +|-d d ] [ +|-D D ] [ +|-e s ] [ +|-E ] [ +|-f [cfgGn] ] [ -F [f] ] [ -g [s] ] [ -i [i] ] [ -k k ] [ -K k ] [ +|-L [l] ] [ +|-m m ] [ +|-M ] [ -o [o] ] [ -p s ] [ +|-r [t[m<fmt>]] ] [ -s [p:s] ] [ -S [t] ] [ -T [t] ] [ -u s ] [ +|-w ] [ -x [fl] ] [ -z [z] ] [ -Z [Z] ] [ -- ] [names] DESCRIPTION top Lsof revision 4.91 lists on its standard output file information about files opened by processes for the following UNIX dialects: Apple Darwin 9 and Mac OS X 10.[567] FreeBSD 8.[234], 9.0 and 1[012].0 for AMD64-based systems Linux 2.1.72 and above for x86-based systems Solaris 9, 10 and 11 (See the DISTRIBUTION section of this manual page for information on how to obtain the latest lsof revision.) An open file may be a regular file, a directory, a block special file, a character special file, an executing text reference, a library, a stream or a network file (Internet socket, NFS file or UNIX domain socket.) A specific file or all the files in a file system may be selected by path. Instead of a formatted display, lsof will produce output that can be parsed by other programs. See the -F, option description, and the OUTPUT FOR OTHER PROGRAMS section for more information. In addition to producing a single output list, lsof will run in repeat mode. In repeat mode it will produce output, delay, then repeat the output operation until stopped with an interrupt or quit signal. See the +|-r [t[m<fmt>]] option description for more information. OPTIONS top In the absence of any options, lsof lists all open files belonging to all active processes. If any list request option is specified, other list requests must be specifically requested - e.g., if -U is specified for the listing of UNIX socket files, NFS files won't be listed unless -N is also specified; or if a user list is specified with the -u option, UNIX domain socket files, belonging to users not in the list, won't be listed unless the -U option is also specified. Normally list options that are specifically stated are ORed - i.e., specifying the -i option without an address and the -ufoo option produces a listing of all network files OR files belonging to processes owned by user ``foo''. The exceptions are: 1) the `^' (negated) login name or user ID (UID), specified with the -u option; 2) the `^' (negated) process ID (PID), specified with the -p option; 3) the `^' (negated) process group ID (PGID), specified with the -g option; 4) the `^' (negated) command, specified with the -c option; 5) the (`^') negated TCP or UDP protocol state names, specified with the -s [p:s] option. Since they represent exclusions, they are applied without ORing or ANDing and take effect before any other selection criteria are applied. The -a option may be used to AND the selections. For example, specifying -a, -U, and -ufoo produces a listing of only UNIX socket files that belong to processes owned by user ``foo''. Caution: the -a option causes all list selection options to be ANDed; it can't be used to cause ANDing of selected pairs of selection options by placing it between them, even though its placement there is acceptable. Wherever -a is placed, it causes the ANDing of all selection options. Items of the same selection set - command names, file descriptors, network addresses, process identifiers, user identifiers, zone names, security contexts - are joined in a single ORed set and applied before the result participates in ANDing. Thus, for example, specifying [email protected], [email protected], -a, and -ufff,ggg will select the listing of files that belong to either login ``fff'' OR ``ggg'' AND have network connections to either host aaa.bbb OR ccc.ddd. Options may be grouped together following a single prefix -- e.g., the option set ``-a -b -C'' may be stated as -abC. However, since values are optional following +|-f, -F, -g, -i, +|-L, -o, +|-r, -s, -S, -T, -x and -z. when you have no values for them be careful that the following character isn't ambiguous. For example, -Fn might represent the -F and -n options, or it might represent the n field identifier character following the -F option. When ambiguity is possible, start a new option with a `-' character - e.g., ``-F -n''. If the next option is a file name, follow the possibly ambiguous option with ``--'' - e.g., ``-F -- name''. Either the `+' or the `-' prefix may be applied to a group of options. Options that don't take on separate meanings for each prefix - e.g., -i - may be grouped under either prefix. Thus, for example, ``+M -i'' may be stated as ``+Mi'' and the group means the same as the separate options. Be careful of prefix grouping when one or more options in the group does take on separate meanings under different prefixes - e.g., +|-M; ``-iM'' is not the same request as ``-i +M''. When in doubt, use separate options with appropriate prefixes. -? -h These two equivalent options select a usage (help) output list. Lsof displays a shortened form of this output when it detects an error in the options supplied to it, after it has displayed messages explaining each error. (Escape the `?' character as your shell requires.) -a causes list selection options to be ANDed, as described above. -A A is available on systems configured for AFS whose AFS kernel code is implemented via dynamic modules. It allows the lsof user to specify A as an alternate name list file where the kernel addresses of the dynamic modules might be found. See the lsof FAQ (The FAQ section gives its location.) for more information about dynamic modules, their symbols, and how they affect lsof. -b causes lsof to avoid kernel functions that might block - lstat(2), readlink(2), and stat(2). See the BLOCKS AND TIMEOUTS and AVOIDING KERNEL BLOCKS sections for information on using this option. -c c selects the listing of files for processes executing the command that begins with the characters of c. Multiple commands may be specified, using multiple -c options. They are joined in a single ORed set before participating in AND option selection. If c begins with a `^', then the following characters specify a command name whose processes are to be ignored (excluded.) If c begins and ends with a slash ('/'), the characters between the slashes are interpreted as a regular expression. Shell meta-characters in the regular expression must be quoted to prevent their interpretation by the shell. The closing slash may be followed by these modifiers: b the regular expression is a basic one. i ignore the case of letters. x the regular expression is an extended one (default). See the lsof FAQ (The FAQ section gives its location.) for more information on basic and extended regular expressions. The simple command specification is tested first. If that test fails, the command regular expression is applied. If the simple command test succeeds, the command regular expression test isn't made. This may result in ``no command found for regex:'' messages when lsof's -V option is specified. +c w defines the maximum number of initial characters of the name, supplied by the UNIX dialect, of the UNIX command associated with a process to be printed in the COMMAND column. (The lsof default is nine.) Note that many UNIX dialects do not supply all command name characters to lsof in the files and structures from which lsof obtains command name. Often dialects limit the number of characters supplied in those sources. For example, Linux 2.4.27 and Solaris 9 both limit command name length to 16 characters. If w is zero ('0'), all command characters supplied to lsof by the UNIX dialect will be printed. If w is less than the length of the column title, ``COMMAND'', it will be raised to that length. -C disables the reporting of any path name components from the kernel's name cache. See the KERNEL NAME CACHE section for more information. +d s causes lsof to search for all open instances of directory s and the files and directories it contains at its top level. +d does NOT descend the directory tree, rooted at s. The +D D option may be used to request a full-descent directory tree search, rooted at directory D. Processing of the +d option does not follow symbolic links within s unless the -x or -x l option is also specified. Nor does it search for open files on file system mount points on subdirectories of s unless the -x or -x f option is also specified. Note: the authority of the user of this option limits it to searching for files that the user has permission to examine with the system stat(2) function. -d s specifies a list of file descriptors (FDs) to exclude from or include in the output listing. The file descriptors are specified in the comma-separated set s - e.g., ``cwd,1,3'', ``^6,^2''. (There should be no spaces in the set.) The list is an exclusion list if all entries of the set begin with `^'. It is an inclusion list if no entry begins with `^'. Mixed lists are not permitted. A file descriptor number range may be in the set as long as neither member is empty, both members are numbers, and the ending member is larger than the starting one - e.g., ``0-7'' or ``3-10''. Ranges may be specified for exclusion if they have the `^' prefix - e.g., ``^0-7'' excludes all file descriptors 0 through 7. Multiple file descriptor numbers are joined in a single ORed set before participating in AND option selection. When there are exclusion and inclusion members in the set, lsof reports them as errors and exits with a non-zero return code. See the description of File Descriptor (FD) output values in the OUTPUT section for more information on file descriptor names. +D D causes lsof to search for all open instances of directory D and all the files and directories it contains to its complete depth. Processing of the +D option does not follow symbolic links within D unless the -x or -x l option is also specified. Nor does it search for open files on file system mount points on subdirectories of D unless the -x or -x f option is also specified. Note: the authority of the user of this option limits it to searching for files that the user has permission to examine with the system stat(2) function. Further note: lsof may process this option slowly and require a large amount of dynamic memory to do it. This is because it must descend the entire directory tree, rooted at D, calling stat(2) for each file and directory, building a list of all the files it finds, and searching that list for a match with every open file. When directory D is large, these steps can take a long time, so use this option prudently. -D D directs lsof's use of the device cache file. The use of this option is sometimes restricted. See the DEVICE CACHE FILE section and the sections that follow it for more information on this option. -D must be followed by a function letter; the function letter may optionally be followed by a path name. Lsof recognizes these function letters: ? - report device cache file paths b - build the device cache file i - ignore the device cache file r - read the device cache file u - read and update the device cache file The b, r, and u functions, accompanied by a path name, are sometimes restricted. When these functions are restricted, they will not appear in the description of the -D option that accompanies -h or -? option output. See the DEVICE CACHE FILE section and the sections that follow it for more information on these functions and when they're restricted. The ? function reports the read-only and write paths that lsof can use for the device cache file, the names of any environment variables whose values lsof will examine when forming the device cache file path, and the format for the personal device cache file path. (Escape the `?' character as your shell requires.) When available, the b, r, and u functions may be followed by the device cache file's path. The standard default is .lsof_hostname in the home directory of the real user ID that executes lsof, but this could have been changed when lsof was configured and compiled. (The output of the -h and -? options show the current default prefix - e.g., ``.lsof''.) The suffix, hostname, is the first component of the host's name returned by gethostname(2). When available, the b function directs lsof to build a new device cache file at the default or specified path. The i function directs lsof to ignore the default device cache file and obtain its information about devices via direct calls to the kernel. The r function directs lsof to read the device cache at the default or specified path, but prevents it from creating a new device cache file when none exists or the existing one is improperly structured. The r function, when specified without a path name, prevents lsof from updating an incorrect or outdated device cache file, or creating a new one in its place. The r function is always available when it is specified without a path name argument; it may be restricted by the permissions of the lsof process. When available, the u function directs lsof to read the device cache file at the default or specified path, if possible, and to rebuild it, if necessary. This is the default device cache file function when no -D option has been specified. +|-e s exempts the file system whose path name is s from being subjected to kernel function calls that might block. The +e option exempts stat(2), lstat(2) and most readlink(2) kernel function calls. The -e option exempts only stat(2) and lstat(2) kernel function calls. Multiple file systems may be specified with separate +|-e specifications and each may have readlink(2) calls exempted or not. This option is currently implemented only for Linux. CAUTION: this option can easily be mis-applied to other than the file system of interest, because it uses path name rather than the more reliable device and inode numbers. (Device and inode numbers are acquired via the potentially blocking stat(2) kernel call and are thus not available, but see the +|-m m option as a possible alternative way to supply device numbers.) Use this option with great care and fully specify the path name of the file system to be exempted. When open files on exempted file systems are reported, it may not be possible to obtain all their information. Therefore, some information columns will be blank, the characters ``UNKN'' preface the values in the TYPE column, and the applicable exemption option is added in parentheses to the end of the NAME column. (Some device number information might be made available via the +|-m m option.) +|-E +E specifies that Linux pipe, Linux UNIX socket and Linux pseudoterminal files should be displayed with endpoint information and the files of the endpoints should also be displayed. Note: UNIX socket file endpoint information is only available when the compile flags line of -v output contains HASUXSOCKEPT, and psudoterminal endpoint information is only available when the compile flags line contains HASPTYEPT. Pipe endpoint information is displayed in the NAME column in the form ``PID,cmd,FDmode'', where PID is the endpoint process ID; cmd is the endpoint process command; FD is the endpoint file's descriptor; and mode is the endpoint file's access mode. Pseudoterminal endpoint information is displayed in the NAME column as ``->/dev/ptsmin PID,cmd,FDmode'' or ``PID,cmd,FDmode''. The first form is for a master device; the second, for a slave device. min is a slave device's minor device number; and PID, cmd, FD and mode are the same as with pipe endpoint information. Note: psudoterminal endpoint information is only available when the compile flags line of -V output contains HASPTYEPT. UNIX socket file endpoint information is displayed in the NAME column in the form ``type=TYPE ->INO=INODE PID,cmd,FDmode'', where TYPE is the socket type; INODE is the i-node number of the connected socket; and PID, cmd, FD and mode are the same as with pipe endpoint information. Note: UNIX socket file endpoint information is available only when the compile flags line of -v output contains HASUXSOCKEPT. Multiple occurrences of this information can appear in a file's NAME column. -E specfies that Linux pipe and Linux UNIX socket files should be displayed with endpoint information, but not the files of the endpoints. +|-f [cfgGn] f by itself clarifies how path name arguments are to be interpreted. When followed by c, f, g, G, or n in any combination it specifies that the listing of kernel file structure information is to be enabled (`+') or inhibited (`-'). Normally a path name argument is taken to be a file system name if it matches a mounted-on directory name reported by mount(8), or if it represents a block device, named in the mount output and associated with a mounted directory name. When +f is specified, all path name arguments will be taken to be file system names, and lsof will complain if any are not. This can be useful, for example, when the file system name (mounted-on device) isn't a block device. This happens for some CD-ROM file systems. When -f is specified by itself, all path name arguments will be taken to be simple files. Thus, for example, the ``-f -- /'' arguments direct lsof to search for open files with a `/' path name, not all open files in the `/' (root) file system. Be careful to make sure +f and -f are properly terminated and aren't followed by a character (e.g., of the file or file system name) that might be taken as a parameter. For example, use ``--'' after +f and -f as in these examples. $ lsof +f -- /file/system/name $ lsof -f -- /file/name The listing of information from kernel file structures, requested with the +f [cfgGn] option form, is normally inhibited, and is not available in whole or part for some dialects - e.g., /proc-based Linux kernels below 2.6.22. When the prefix to f is a plus sign (`+'), these characters request file structure information: c file structure use count (not Linux) f file structure address (not Linux) g file flag abbreviations (Linux 2.6.22 and up) G file flags in hexadecimal (Linux 2.6.22 and up) n file structure node address (not Linux) When the prefix is minus (`-') the same characters disable the listing of the indicated values. File structure addresses, use counts, flags, and node addresses may be used to detect more readily identical files inherited by child processes and identical files in use by different processes. Lsof column output can be sorted by output columns holding the values and listed to identify identical file use, or lsof field output can be parsed by an AWK or Perl post-filter script, or by a C program. -F f specifies a character list, f, that selects the fields to be output for processing by another program, and the character that terminates each output field. Each field to be output is specified with a single character in f. The field terminator defaults to NL, but may be changed to NUL (000). See the OUTPUT FOR OTHER PROGRAMS section for a description of the field identification characters and the field output process. When the field selection character list is empty, all standard fields are selected (except the raw device field, security context and zone field for compatibility reasons) and the NL field terminator is used. When the field selection character list contains only a zero (`0'), all fields are selected (except the raw device field for compatibility reasons) and the NUL terminator character is used. Other combinations of fields and their associated field terminator character must be set with explicit entries in f, as described in the OUTPUT FOR OTHER PROGRAMS section. When a field selection character identifies an item lsof does not normally list - e.g., PPID, selected with -R - specification of the field character - e.g., ``-FR'' - also selects the listing of the item. When the field selection character list contains the single character `?', lsof will display a help list of the field identification characters. (Escape the `?' character as your shell requires.) -g [s] excludes or selects the listing of files for the processes whose optional process group IDentification (PGID) numbers are in the comma-separated set s - e.g., ``123'' or ``123,^456''. (There should be no spaces in the set.) PGID numbers that begin with `^' (negation) represent exclusions. Multiple PGID numbers are joined in a single ORed set before participating in AND option selection. However, PGID exclusions are applied without ORing or ANDing and take effect before other selection criteria are applied. The -g option also enables the output display of PGID numbers. When specified without a PGID set that's all it does. -i [i] selects the listing of files any of whose Internet address matches the address specified in i. If no address is specified, this option selects the listing of all Internet and x.25 (HP-UX) network files. If -i4 or -i6 is specified with no following address, only files of the indicated IP version, IPv4 or IPv6, are displayed. (An IPv6 specification may be used only if the dialects supports IPv6, as indicated by ``[46]'' and ``IPv[46]'' in lsof's -h or -? output.) Sequentially specifying -i4, followed by -i6 is the same as specifying -i, and vice-versa. Specifying -i4, or -i6 after -i is the same as specifying -i4 or -i6 by itself. Multiple addresses (up to a limit of 100) may be specified with multiple -i options. (A port number or service name range is counted as one address.) They are joined in a single ORed set before participating in AND option selection. An Internet address is specified in the form (Items in square brackets are optional.): [46][protocol][@hostname|hostaddr][:service|port] where: 46 specifies the IP version, IPv4 or IPv6 that applies to the following address. '6' may be be specified only if the UNIX dialect supports IPv6. If neither '4' nor '6' is specified, the following address applies to all IP versions. protocol is a protocol name - TCP, UDP hostname is an Internet host name. Unless a specific IP version is specified, open network files associated with host names of all versions will be selected. hostaddr is a numeric Internet IPv4 address in dot form; or an IPv6 numeric address in colon form, enclosed in brackets, if the UNIX dialect supports IPv6. When an IP version is selected, only its numeric addresses may be specified. service is an /etc/services name - e.g., smtp - or a list of them. port is a port number, or a list of them. IPv6 options may be used only if the UNIX dialect supports IPv6. To see if the dialect supports IPv6, run lsof and specify the -h or -? (help) option. If the displayed description of the -i option contains ``[46]'' and ``IPv[46]'', IPv6 is supported. IPv4 host names and addresses may not be specified if network file selection is limited to IPv6 with -i 6. IPv6 host names and addresses may not be specified if network file selection is limited to IPv4 with -i 4. When an open IPv4 network file's address is mapped in an IPv6 address, the open file's type will be IPv6, not IPv4, and its display will be selected by '6', not '4'. At least one address component - 4, 6, protocol, hostname, hostaddr, or service - must be supplied. The `@' character, leading the host specification, is always required; as is the `:', leading the port specification. Specify either hostname or hostaddr. Specify either service name list or port number list. If a service name list is specified, the protocol may also need to be specified if the TCP, UDP and UDPLITE port numbers for the service name are different. Use any case - lower or upper - for protocol. Service names and port numbers may be combined in a list whose entries are separated by commas and whose numeric range entries are separated by minus signs. There may be no embedded spaces, and all service names must belong to the specified protocol. Since service names may contain embedded minus signs, the starting entry of a range can't be a service name; it can be a port number, however. Here are some sample addresses: -i6 - IPv6 only TCP:25 - TCP and port 25 @1.2.3.4 - Internet IPv4 host address 1.2.3.4 @[3ffe:1ebc::1]:1234 - Internet IPv6 host address 3ffe:1ebc::1, port 1234 UDP:who - UDP who service port [email protected]:513 - TCP, port 513 and host name lsof.itap tcp@foo:1-10,smtp,99 - TCP, ports 1 through 10, service name smtp, port 99, host name foo tcp@bar:1-smtp - TCP, ports 1 through smtp, host bar :time - either TCP, UDP or UDPLITE time service port -K k selects the listing of tasks (threads) of processes, on dialects where task (thread) reporting is supported. (If help output - i.e., the output of the -h or -? options - shows this option, then task (thread) reporting is supported by the dialect.) If -K is followed by a value, k, it must be ``i''. That causes lsof to ignore tasks, particularly in the default, list-everything case when no other options are specified. When -K and -a are both specified on Linux, and the tasks of a main process are selected by other options, the main process will also be listed as though it were a task, but without a task ID. (See the description of the TID column in the OUTPUT section.) Where the FreeBSD version supports threads, all threads will be listed with their IDs. In general threads and tasks inherit the files of the caller, but may close some and open others, so lsof always reports all the open files of threads and tasks. -k k specifies a kernel name list file, k, in place of /vmunix, /mach, etc. -k is not available under AIX on the IBM RISC/System 6000. -l inhibits the conversion of user ID numbers to login names. It is also useful when login name lookup is working improperly or slowly. +|-L [l] enables (`+') or disables (`-') the listing of file link counts, where they are available - e.g., they aren't available for sockets, or most FIFOs and pipes. When +L is specified without a following number, all link counts will be listed. When -L is specified (the default), no link counts will be listed. When +L is followed by a number, only files having a link count less than that number will be listed. (No number may follow -L.) A specification of the form ``+L1'' will select open files that have been unlinked. A specification of the form ``+aL1 <file_system>'' will select unlinked open files on the specified file system. For other link count comparisons, use field output (-F) and a post-processing script or program. +|-m m specifies an alternate kernel memory file or activates mount table supplement processing. The option form -m m specifies a kernel memory file, m, in place of /dev/kmem or /dev/mem - e.g., a crash dump file. The option form +m requests that a mount supplement file be written to the standard output file. All other options are silently ignored. There will be a line in the mount supplement file for each mounted file system, containing the mounted file system directory, followed by a single space, followed by the device number in hexadecimal "0x" format - e.g., / 0x801 Lsof can use the mount supplement file to get device numbers for file systems when it can't get them via stat(2) or lstat(2). The option form +m m identifies m as a mount supplement file. Note: the +m and +m m options are not available for all supported dialects. Check the output of lsof's -h or -? options to see if the +m and +m m options are available. +|-M Enables (+) or disables (-) the reporting of portmapper registrations for local TCP, UDP and UDPLITE ports, where port mapping is supported. (See the last paragraph of this option description for information about where portmapper registration reporting is supported.) The default reporting mode is set by the lsof builder with the HASPMAPENABLED #define in the dialect's machine.h header file; lsof is distributed with the HASPMAPENABLED #define deactivated, so portmapper reporting is disabled by default and must be requested with +M. Specifying lsof's -h or -? option will report the default mode. Disabling portmapper registration when it is already disabled or enabling it when already enabled is acceptable. When portmapper registration reporting is enabled, lsof displays the portmapper registration (if any) for local TCP, UDP or UDPLITE ports in square brackets immediately following the port numbers or service names - e.g., ``:1234[name]'' or ``:name[100083]''. The registration information may be a name or number, depending on what the registering program supplied to the portmapper when it registered the port. When portmapper registration reporting is enabled, lsof may run a little more slowly or even become blocked when access to the portmapper becomes congested or stopped. Reverse the reporting mode to determine if portmapper registration reporting is slowing or blocking lsof. For purposes of portmapper registration reporting lsof considers a TCP, UDP or UDPLITE port local if: it is found in the local part of its containing kernel structure; or if it is located in the foreign part of its containing kernel structure and the local and foreign Internet addresses are the same; or if it is located in the foreign part of its containing kernel structure and the foreign Internet address is INADDR_LOOPBACK (127.0.0.1). This rule may make lsof ignore some foreign ports on machines with multiple interfaces when the foreign Internet address is on a different interface from the local one. See the lsof FAQ (The FAQ section gives its location.) for further discussion of portmapper registration reporting issues. Portmapper registration reporting is supported only on dialects that have RPC header files. (Some Linux distributions with GlibC 2.14 do not have them.) When portmapper registration reporting is supported, the -h or -? help output will show the +|-M option. -n inhibits the conversion of network numbers to host names for network files. Inhibiting conversion may make lsof run faster. It is also useful when host name lookup is not working properly. -N selects the listing of NFS files. -o directs lsof to display file offset at all times. It causes the SIZE/OFF output column title to be changed to OFFSET. Note: on some UNIX dialects lsof can't obtain accurate or consistent file offset information from its kernel data sources, sometimes just for particular kinds of files (e.g., socket files.) Consult the lsof FAQ (The FAQ section gives its location.) for more information. The -o and -s options are mutually exclusive; they can't both be specified. When neither is specified, lsof displays whatever value - size or offset - is appropriate and available for the type of the file. -o o defines the number of decimal digits (o) to be printed after the ``0t'' for a file offset before the form is switched to ``0x...''. An o value of zero (unlimited) directs lsof to use the ``0t'' form for all offset output. This option does NOT direct lsof to display offset at all times; specify -o (without a trailing number) to do that. -o o only specifies the number of digits after ``0t'' in either mixed size and offset or offset-only output. Thus, for example, to direct lsof to display offset at all times with a decimal digit count of 10, use: -o -o 10 or -oo10 The default number of digits allowed after ``0t'' is normally 8, but may have been changed by the lsof builder. Consult the description of the -o o option in the output of the -h or -? option to determine the default that is in effect. -O directs lsof to bypass the strategy it uses to avoid being blocked by some kernel operations - i.e., doing them in forked child processes. See the BLOCKS AND TIMEOUTS and AVOIDING KERNEL BLOCKS sections for more information on kernel operations that may block lsof. While use of this option will reduce lsof startup overhead, it may also cause lsof to hang when the kernel doesn't respond to a function. Use this option cautiously. -p s excludes or selects the listing of files for the processes whose optional process IDentification (PID) numbers are in the comma-separated set s - e.g., ``123'' or ``123,^456''. (There should be no spaces in the set.) PID numbers that begin with `^' (negation) represent exclusions. Multiple process ID numbers are joined in a single ORed set before participating in AND option selection. However, PID exclusions are applied without ORing or ANDing and take effect before other selection criteria are applied. -P inhibits the conversion of port numbers to port names for network files. Inhibiting the conversion may make lsof run a little faster. It is also useful when port name lookup is not working properly. +|-r [t[m<fmt>]] puts lsof in repeat mode. There lsof lists open files as selected by other options, delays t seconds (default fifteen), then repeats the listing, delaying and listing repetitively until stopped by a condition defined by the prefix to the option. If the prefix is a `-', repeat mode is endless. Lsof must be terminated with an interrupt or quit signal. If the prefix is `+', repeat mode will end the first cycle no open files are listed - and of course when lsof is stopped with an interrupt or quit signal. When repeat mode ends because no files are listed, the process exit code will be zero if any open files were ever listed; one, if none were ever listed. Lsof marks the end of each listing: if field output is in progress (the -F, option has been specified), the default marker is `m'; otherwise the default marker is ``========''. The marker is followed by a NL character. The optional "m<fmt>" argument specifies a format for the marker line. The <fmt> characters following `m' are interpreted as a format specification to the strftime(3) function, when both it and the localtime(3) function are available in the dialect's C library. Consult the strftime(3) documentation for what may appear in its format specification. Note that when field output is requested with the -F option, <fmt> cannot contain the NL format, ``%n''. Note also that when <fmt> contains spaces or other characters that affect the shell's interpretation of arguments, <fmt> must be quoted appropriately. Repeat mode reduces lsof startup overhead, so it is more efficient to use this mode than to call lsof repetitively from a shell script, for example. To use repeat mode most efficiently, accompany +|-r with specification of other lsof selection options, so the amount of kernel memory access lsof does will be kept to a minimum. Options that filter at the process level - e.g., -c, -g, -p, -u - are the most efficient selectors. Repeat mode is useful when coupled with field output (see the -F, option description) and a supervising awk or Perl script, or a C program. -R directs lsof to list the Parent Process IDentification number in the PPID column. -s [p:s] s alone directs lsof to display file size at all times. It causes the SIZE/OFF output column title to be changed to SIZE. If the file does not have a size, nothing is displayed. The optional -s p:s form is available only for selected dialects, and only when the -h or -? help output lists it. When the optional form is available, the s may be followed by a protocol name (p), either TCP or UDP, a colon (`:') and a comma-separated protocol state name list, the option causes open TCP and UDP files to be excluded if their state name(s) are in the list (s) preceded by a `^'; or included if their name(s) are not preceded by a `^'. Dialects that support this option may support only one protocol. When an unsupported protocol is specified, a message will be displayed indicating state names for the protocol are unavailable. When an inclusion list is defined, only network files with state names in the list will be present in the lsof output. Thus, specifying one state name means that only network files with that lone state name will be listed. Case is unimportant in the protocol or state names, but there may be no spaces and the colon (`:') separating the protocol name (p) and the state name list (s) is required. If only TCP and UDP files are to be listed, as controlled by the specified exclusions and inclusions, the -i option must be specified, too. If only a single protocol's files are to be listed, add its name as an argument to the -i option. For example, to list only network files with TCP state LISTEN, use: -iTCP -sTCP:LISTEN Or, for example, to list network files with all UDP states except Idle, use: -iUDP -sUDP:Idle State names vary with UNIX dialects, so it's not possible to provide a complete list. Some common TCP state names are: CLOSED, IDLE, BOUND, LISTEN, ESTABLISHED, SYN_SENT, SYN_RCDV, ESTABLISHED, CLOSE_WAIT, FIN_WAIT1, CLOSING, LAST_ACK, FIN_WAIT_2, and TIME_WAIT. Two common UDP state names are Unbound and Idle. See the lsof FAQ (The FAQ section gives its location.) for more information on how to use protocol state exclusion and inclusion, including examples. The -o (without a following decimal digit count) and -s option (without a following protocol and state name list) are mutually exclusive; they can't both be specified. When neither is specified, lsof displays whatever value - size or offset - is appropriate and available for the type of file. Since some types of files don't have true sizes - sockets, FIFOs, pipes, etc. - lsof displays for their sizes the content amounts in their associated kernel buffers, if possible. -S [t] specifies an optional time-out seconds value for kernel functions - lstat(2), readlink(2), and stat(2) - that might otherwise deadlock. The minimum for t is two; the default, fifteen; when no value is specified, the default is used. See the BLOCKS AND TIMEOUTS section for more information. -T [t] controls the reporting of some TCP/TPI information, also reported by netstat(1), following the network addresses. In normal output the information appears in parentheses, each item except TCP or TPI state name identified by a keyword, followed by `=', separated from others by a single space: <TCP or TPI state name> QR=<read queue length> QS=<send queue length> SO=<socket options and values> SS=<socket states> TF=<TCP flags and values> WR=<window read length> WW=<window write length> Not all values are reported for all UNIX dialects. Items values (when available) are reported after the item name and '='. When the field output mode is in effect (See OUTPUT FOR OTHER PROGRAMS.) each item appears as a field with a `T' leading character. -T with no following key characters disables TCP/TPI information reporting. -T with following characters selects the reporting of specific TCP/TPI information: f selects reporting of socket options, states and values, and TCP flags and values. q selects queue length reporting. s selects connection state reporting. w selects window size reporting. Not all selections are enabled for some UNIX dialects. State may be selected for all dialects and is reported by default. The -h or -? help output for the -T option will show what selections may be used with the UNIX dialect. When -T is used to select information - i.e., it is followed by one or more selection characters - the displaying of state is disabled by default, and it must be explicitly selected again in the characters following -T. (In effect, then, the default is equivalent to -Ts.) For example, if queue lengths and state are desired, use -Tqs. Socket options, socket states, some socket values, TCP flags and one TCP value may be reported (when available in the UNIX dialect) in the form of the names that commonly appear after SO_, so_, SS_, TCP_ and TF_ in the dialect's header files - most often <sys/socket.h>, <sys/socketvar.h> and <netinet/tcp_var.h>. Consult those header files for the meaning of the flags, options, states and values. ``SO='' precedes socket options and values; ``SS='', socket states; and ``TF='', TCP flags and values. If a flag or option has a value, the value will follow an '=' and the name -- e.g., ``SO=LINGER=5'', ``SO=QLIM=5'', ``TF=MSS=512''. The following seven values may be reported: Name Reported Description (Common Symbol) KEEPALIVE keep alive time (SO_KEEPALIVE) LINGER linger time (SO_LINGER) MSS maximum segment size (TCP_MAXSEG) PQLEN partial listen queue connections QLEN established listen queue connections QLIM established listen queue limit RCVBUF receive buffer length (SO_RCVBUF) SNDBUF send buffer length (SO_SNDBUF) Details on what socket options and values, socket states, and TCP flags and values may be displayed for particular UNIX dialects may be found in the answer to the ``Why doesn't lsof report socket options, socket states, and TCP flags and values for my dialect?'' and ``Why doesn't lsof report the partial listen queue connection count for my dialect?'' questions in the lsof FAQ (The FAQ section gives its location.) -t specifies that lsof should produce terse output with process identifiers only and no header - e.g., so that the output may be piped to kill(1). -t selects the -w option. -u s selects the listing of files for the user whose login names or user ID numbers are in the comma-separated set s - e.g., ``abe'', or ``548,root''. (There should be no spaces in the set.) Multiple login names or user ID numbers are joined in a single ORed set before participating in AND option selection. If a login name or user ID is preceded by a `^', it becomes a negation - i.e., files of processes owned by the login name or user ID will never be listed. A negated login name or user ID selection is neither ANDed nor ORed with other selections; it is applied before all other selections and absolutely excludes the listing of the files of the process. For example, to direct lsof to exclude the listing of files belonging to root processes, specify ``-u^root'' or ``-u^0''. -U selects the listing of UNIX domain socket files. -v selects the listing of lsof version information, including: revision number; when the lsof binary was constructed; who constructed the binary and where; the name of the compiler used to construct the lsof binary; the version number of the compiler when readily available; the compiler and loader flags used to construct the lsof binary; and system information, typically the output of uname's -a option. -V directs lsof to indicate the items it was asked to list and failed to find - command names, file names, Internet addresses or files, login names, NFS files, PIDs, PGIDs, and UIDs. When other options are ANDed to search options, or compile-time options restrict the listing of some files, lsof may not report that it failed to find a search item when an ANDed option or compile-time option prevents the listing of the open file containing the located search item. For example, ``lsof -V -iTCP@foobar -a -d 999'' may not report a failure to locate open files at ``TCP@foobar'' and may not list any, if none have a file descriptor number of 999. A similar situation arises when HASSECURITY and HASNOSOCKSECURITY are defined at compile time and they prevent the listing of open files. +|-w Enables (+) or disables (-) the suppression of warning messages. The lsof builder may choose to have warning messages disabled or enabled by default. The default warning message state is indicated in the output of the -h or -? option. Disabling warning messages when they are already disabled or enabling them when already enabled is acceptable. The -t option selects the -w option. -x [fl] may accompany the +d and +D options to direct their processing to cross over symbolic links and|or file system mount points encountered when scanning the directory (+d) or directory tree (+D). If -x is specified by itself without a following parameter, cross-over processing of both symbolic links and file system mount points is enabled. Note that when -x is specified without a parameter, the next argument must begin with '-' or '+'. The optional 'f' parameter enables file system mount point cross-over processing; 'l', symbolic link cross-over processing. The -x option may not be supplied without also supplying a +d or +D option. -X This is a dialect-specific option. AIX: This IBM AIX RISC/System 6000 option requests the reporting of executed text file and shared library references. WARNING: because this option uses the kernel readx() function, its use on a busy AIX system might cause an application process to hang so completely that it can neither be killed nor stopped. I have never seen this happen or had a report of its happening, but I think there is a remote possibility it could happen. By default use of readx() is disabled. On AIX 5L and above lsof may need setuid-root permission to perform the actions this option requests. The lsof builder may specify that the -X option be restricted to processes whose real UID is root. If that has been done, the -X option will not appear in the -h or -? help output unless the real UID of the lsof process is root. The default lsof distribution allows any UID to specify -X, so by default it will appear in the help output. When AIX readx() use is disabled, lsof may not be able to report information for all text and loader file references, but it may also avoid exacerbating an AIX kernel directory search kernel error, known as the Stale Segment ID bug. The readx() function, used by lsof or any other program to access some sections of kernel virtual memory, can trigger the Stale Segment ID bug. It can cause the kernel's dir_search() function to believe erroneously that part of an in-memory copy of a file system directory has been zeroed. Another application process, distinct from lsof, asking the kernel to search the directory - e.g., by using open(2) - can cause dir_search() to loop forever, thus hanging the application process. Consult the lsof FAQ (The FAQ section gives its location.) and the 00README file of the lsof distribution for a more complete description of the Stale Segment ID bug, its APAR, and methods for defining readx() use when compiling lsof. Linux: This Linux option requests that lsof skip the reporting of information on all open TCP, UDP and UDPLITE IPv4 and IPv6 files. This Linux option is most useful when the system has an extremely large number of open TCP, UDP and UDPLITE files, the processing of whose information in the /proc/net/tcp* and /proc/net/udp* files would take lsof a long time, and whose reporting is not of interest. Use this option with care and only when you are sure that the information you want lsof to display isn't associated with open TCP, UDP or UDPLITE socket files. Solaris 10 and above: This Solaris 10 and above option requests the reporting of cached paths for files that have been deleted - i.e., removed with rm(1) or unlink(2). The cached path is followed by the string `` (deleted)'' to indicate that the path by which the file was opened has been deleted. Because intervening changes made to the path - i.e., renames with mv(1) or rename(2) - are not recorded in the cached path, what lsof reports is only the path by which the file was opened, not its possibly different final path. -z [z] specifies how Solaris 10 and higher zone information is to be handled. Without a following argument - e.g., NO z - the option specifies that zone names are to be listed in the ZONE output column. The -z option may be followed by a zone name, z. That causes lsof to list only open files for processes in that zone. Multiple -z z option and argument pairs may be specified to form a list of named zones. Any open file of any process in any of the zones will be listed, subject to other conditions specified by other options and arguments. -Z [Z] specifies how SELinux security contexts are to be handled. It and 'Z' field output character support are inhibited when SELinux is disabled in the running Linux kernel. See OUTPUT FOR OTHER PROGRAMS for more information on the 'Z' field output character. Without a following argument - e.g., NO Z - the option specifies that security contexts are to be listed in the SECURITY-CONTEXT output column. The -Z option may be followed by a wildcard security context name, Z. That causes lsof to list only open files for processes in that security context. Multiple -Z Z option and argument pairs may be specified to form a list of security contexts. Any open file of any process in any of the security contexts will be listed, subject to other conditions specified by other options and arguments. Note that Z can be A:B:C or *:B:C or A:B:* or *:*:C to match against the A:B:C context. -- The double minus sign option is a marker that signals the end of the keyed options. It may be used, for example, when the first file name begins with a minus sign. It may also be used when the absence of a value for the last keyed option must be signified by the presence of a minus sign in the following option and before the start of the file names. names These are path names of specific files to list. Symbolic links are resolved before use. The first name may be separated from the preceding options with the ``--'' option. If a name is the mounted-on directory of a file system or the device of the file system, lsof will list all the files open on the file system. To be considered a file system, the name must match a mounted-on directory name in mount(8) output, or match the name of a block device associated with a mounted-on directory name. The +|-f option may be used to force lsof to consider a name a file system identifier (+f) or a simple file (-f). If name is a path to a directory that is not the mounted-on directory name of a file system, it is treated just as a regular file is treated - i.e., its listing is restricted to processes that have it open as a file or as a process-specific directory, such as the root or current working directory. To request that lsof look for open files inside a directory name, use the +d s and +D D options. If a name is the base name of a family of multiplexed files - e.g, AIX's /dev/pt[cs] - lsof will list all the associated multiplexed files on the device that are open - e.g., /dev/pt[cs]/1, /dev/pt[cs]/2, etc. If a name is a UNIX domain socket name, lsof will usually search for it by the characters of the name alone - exactly as it is specified and is recorded in the kernel socket structure. (See the next paragraph for an exception to that rule for Linux.) Specifying a relative path - e.g., ./file - in place of the file's absolute path - e.g., /tmp/file - won't work because lsof must match the characters you specify with what it finds in the kernel UNIX domain socket structures. If a name is a Linux UNIX domain socket name, in one case lsof is able to search for it by its device and inode number, allowing name to be a relative path. The case requires that the absolute path -- i.e., one beginning with a slash ('/') be used by the process that created the socket, and hence be stored in the /proc/net/unix file; and it requires that lsof be able to obtain the device and node numbers of both the absolute path in /proc/net/unix and name via successful stat(2) system calls. When those conditions are met, lsof will be able to search for the UNIX domain socket when some path to it is is specified in name. Thus, for example, if the path is /dev/log, and an lsof search is initiated when the working directory is /dev, then name could be ./log. If a name is none of the above, lsof will list any open files whose device and inode match that of the specified path name. If you have also specified the -b option, the only names you may safely specify are file systems for which your mount table supplies alternate device numbers. See the AVOIDING KERNEL BLOCKS and ALTERNATE DEVICE NUMBERS sections for more information. Multiple file names are joined in a single ORed set before participating in AND option selection. AFS top Lsof supports the recognition of AFS files for these dialects (and AFS versions): AIX 4.1.4 (AFS 3.4a) HP-UX 9.0.5 (AFS 3.4a) Linux 1.2.13 (AFS 3.3) Solaris 2.[56] (AFS 3.4a) It may recognize AFS files on other versions of these dialects, but has not been tested there. Depending on how AFS is implemented, lsof may recognize AFS files in other dialects, or may have difficulties recognizing AFS files in the supported dialects. Lsof may have trouble identifying all aspects of AFS files in supported dialects when AFS kernel support is implemented via dynamic modules whose addresses do not appear in the kernel's variable name list. In that case, lsof may have to guess at the identity of AFS files, and might not be able to obtain volume information from the kernel that is needed for calculating AFS volume node numbers. When lsof can't compute volume node numbers, it reports blank in the NODE column. The -A A option is available in some dialect implementations of lsof for specifying the name list file where dynamic module kernel addresses may be found. When this option is available, it will be listed in the lsof help output, presented in response to the -h or -? See the lsof FAQ (The FAQ section gives its location.) for more information about dynamic modules, their symbols, and how they affect lsof options. Because AFS path lookups don't seem to participate in the kernel's name cache operations, lsof can't identify path name components for AFS files. SECURITY top Lsof has three features that may cause security concerns. First, its default compilation mode allows anyone to list all open files with it. Second, by default it creates a user-readable and user-writable device cache file in the home directory of the real user ID that executes lsof. (The list-all-open-files and device cache features may be disabled when lsof is compiled.) Third, its -k and -m options name alternate kernel name list or memory files. Restricting the listing of all open files is controlled by the compile-time HASSECURITY and HASNOSOCKSECURITY options. When HASSECURITY is defined, lsof will allow only the root user to list all open files. The non-root user may list only open files of processes with the same user IDentification number as the real user ID number of the lsof process (the one that its user logged on with). However, if HASSECURITY and HASNOSOCKSECURITY are both defined, anyone may list open socket files, provided they are selected with the -i option. When HASSECURITY is not defined, anyone may list all open files. Help output, presented in response to the -h or -? option, gives the status of the HASSECURITY and HASNOSOCKSECURITY definitions. See the Security section of the 00README file of the lsof distribution for information on building lsof with the HASSECURITY and HASNOSOCKSECURITY options enabled. Creation and use of a user-readable and user-writable device cache file is controlled by the compile-time HASDCACHE option. See the DEVICE CACHE FILE section and the sections that follow it for details on how its path is formed. For security considerations it is important to note that in the default lsof distribution, if the real user ID under which lsof is executed is root, the device cache file will be written in root's home directory - e.g., / or /root. When HASDCACHE is not defined, lsof does not write or attempt to read a device cache file. When HASDCACHE is defined, the lsof help output, presented in response to the -h, -D?, or -? options, will provide device cache file handling information. When HASDCACHE is not defined, the -h or -? output will have no -D option description. Before you decide to disable the device cache file feature - enabling it improves the performance of lsof by reducing the startup overhead of examining all the nodes in /dev (or /devices) - read the discussion of it in the 00DCACHE file of the lsof distribution and the lsof FAQ (The FAQ section gives its location.) WHEN IN DOUBT, YOU CAN TEMPORARILY DISABLE THE USE OF THE DEVICE CACHE FILE WITH THE -Di OPTION. When lsof user declares alternate kernel name list or memory files with the -k and -m options, lsof checks the user's authority to read them with access(2). This is intended to prevent whatever special power lsof's modes might confer on it from letting it read files not normally accessible via the authority of the real user ID. OUTPUT top This section describes the information lsof lists for each open file. See the OUTPUT FOR OTHER PROGRAMS section for additional information on output that can be processed by another program. Lsof only outputs printable (declared so by isprint(3)) 8 bit characters. Non-printable characters are printed in one of three forms: the C ``\[bfrnt]'' form; the control character `^' form (e.g., ``^@''); or hexadecimal leading ``\x'' form (e.g., ``\xab''). Space is non-printable in the COMMAND column (``\x20'') and printable elsewhere. For some dialects - if HASSETLOCALE is defined in the dialect's machine.h header file - lsof will print the extended 8 bit characters of a language locale. The lsof process must be supplied a language locale environment variable (e.g., LANG) whose value represents a known language locale in which the extended characters are considered printable by isprint(3). Otherwise lsof considers the extended characters non-printable and prints them according to its rules for non-printable characters, stated above. Consult your dialect's setlocale(3) man page for the names of other environment variables that may be used in place of LANG - e.g., LC_ALL, LC_CTYPE, etc. Lsof's language locale support for a dialect also covers wide characters - e.g., UTF-8 - when HASSETLOCALE and HASWIDECHAR are defined in the dialect's machine.h header file, and when a suitable language locale has been defined in the appropriate environment variable for the lsof process. Wide characters are printable under those conditions if iswprint(3) reports them to be. If HASSETLOCALE, HASWIDECHAR and a suitable language locale aren't defined, or if iswprint(3) reports wide characters that aren't printable, lsof considers the wide characters non-printable and prints each of their 8 bits according to its rules for non-printable characters, stated above. Consult the answers to the "Language locale support" questions in the lsof FAQ (The FAQ section gives its location.) for more information. Lsof dynamically sizes the output columns each time it runs, guaranteeing that each column is a minimum size. It also guarantees that each column is separated from its predecessor by at least one space. COMMAND contains the first nine characters of the name of the UNIX command associated with the process. If a non-zero w value is specified to the +c w option, the column contains the first w characters of the name of the UNIX command associated with the process up to the limit of characters supplied to lsof by the UNIX dialect. (See the description of the +c w command or the lsof FAQ for more information. The FAQ section gives its location.) If w is less than the length of the column title, ``COMMAND'', it will be raised to that length. If a zero w value is specified to the +c w option, the column contains all the characters of the name of the UNIX command associated with the process. All command name characters maintained by the kernel in its structures are displayed in field output when the command name descriptor (`c') is specified. See the OUTPUT FOR OTHER COMMANDS section for information on selecting field output and the associated command name descriptor. PID is the Process IDentification number of the process. TID is the task (thread) IDentification number, if task (thread) reporting is supported by the dialect and a task (thread) is being listed. (If help output - i.e., the output of the -h or -? options - shows this option, then task (thread) reporting is supported by the dialect.) A blank TID column in Linux indicates a process - i.e., a non-task. TASKCMD is the task command name. Generally this will be the same as the process named in the COMMAND column, but some task implementations (e.g., Linux) permit a task to change its command name. The TASKCMD column width is subject to the same size limitation as the COMMAND column. ZONE is the Solaris 10 and higher zone name. This column must be selected with the -z option. SECURITY-CONTEXT is the SELinux security context. This column must be selected with the -Z option. Note that the -Z option is inhibited when SELinux is disabled in the running Linux kernel. PPID is the Parent Process IDentification number of the process. It is only displayed when the -R option has been specified. PGID is the process group IDentification number associated with the process. It is only displayed when the -g option has been specified. USER is the user ID number or login name of the user to whom the process belongs, usually the same as reported by ps(1). However, on Linux USER is the user ID number or login that owns the directory in /proc where lsof finds information about the process. Usually that is the same value reported by ps(1), but may differ when the process has changed its effective user ID. (See the -l option description for information on when a user ID number or login name is displayed.) FD is the File Descriptor number of the file or: cwd current working directory; Lnn library references (AIX); err FD information error (see NAME column); jld jail directory (FreeBSD); ltx shared library text (code and data); Mxx hex memory-mapped type number xx. m86 DOS Merge mapped file; mem memory-mapped file; mmap memory-mapped device; pd parent directory; rtd root directory; tr kernel trace file (OpenBSD); txt program text (code and data); v86 VP/ix mapped file; FD is followed by one of these characters, describing the mode under which the file is open: r for read access; w for write access; u for read and write access; space if mode unknown and no lock character follows; `-' if mode unknown and lock character follows. The mode character is followed by one of these lock characters, describing the type of lock applied to the file: N for a Solaris NFS lock of unknown type; r for read lock on part of the file; R for a read lock on the entire file; w for a write lock on part of the file; W for a write lock on the entire file; u for a read and write lock of any length; U for a lock of unknown type; x for an SCO OpenServer Xenix lock on part of the file; X for an SCO OpenServer Xenix lock on the entire file; space if there is no lock. See the LOCKS section for more information on the lock information character. The FD column contents constitutes a single field for parsing in post-processing scripts. TYPE is the type of the node associated with the file - e.g., GDIR, GREG, VDIR, VREG, etc. or ``IPv4'' for an IPv4 socket; or ``IPv6'' for an open IPv6 network file - even if its address is IPv4, mapped in an IPv6 address; or ``ax25'' for a Linux AX.25 socket; or ``inet'' for an Internet domain socket; or ``lla'' for a HP-UX link level access file; or ``rte'' for an AF_ROUTE socket; or ``sock'' for a socket of unknown domain; or ``unix'' for a UNIX domain socket; or ``x.25'' for an HP-UX x.25 socket; or ``BLK'' for a block special file; or ``CHR'' for a character special file; or ``DEL'' for a Linux map file that has been deleted; or ``DIR'' for a directory; or ``DOOR'' for a VDOOR file; or ``FIFO'' for a FIFO special file; or ``KQUEUE'' for a BSD style kernel event queue file; or ``LINK'' for a symbolic link file; or ``MPB'' for a multiplexed block file; or ``MPC'' for a multiplexed character file; or ``NOFD'' for a Linux /proc/<PID>/fd directory that can't be opened -- the directory path appears in the NAME column, followed by an error message; or ``PAS'' for a /proc/as file; or ``PAXV'' for a /proc/auxv file; or ``PCRE'' for a /proc/cred file; or ``PCTL'' for a /proc control file; or ``PCUR'' for the current /proc process; or ``PCWD'' for a /proc current working directory; or ``PDIR'' for a /proc directory; or ``PETY'' for a /proc executable type (etype); or ``PFD'' for a /proc file descriptor; or ``PFDR'' for a /proc file descriptor directory; or ``PFIL'' for an executable /proc file; or ``PFPR'' for a /proc FP register set; or ``PGD'' for a /proc/pagedata file; or ``PGID'' for a /proc group notifier file; or ``PIPE'' for pipes; or ``PLC'' for a /proc/lwpctl file; or ``PLDR'' for a /proc/lpw directory; or ``PLDT'' for a /proc/ldt file; or ``PLPI'' for a /proc/lpsinfo file; or ``PLST'' for a /proc/lstatus file; or ``PLU'' for a /proc/lusage file; or ``PLWG'' for a /proc/gwindows file; or ``PLWI'' for a /proc/lwpsinfo file; or ``PLWS'' for a /proc/lwpstatus file; or ``PLWU'' for a /proc/lwpusage file; or ``PLWX'' for a /proc/xregs file; or ``PMAP'' for a /proc map file (map); or ``PMEM'' for a /proc memory image file; or ``PNTF'' for a /proc process notifier file; or ``POBJ'' for a /proc/object file; or ``PODR'' for a /proc/object directory; or ``POLP'' for an old format /proc light weight process file; or ``POPF'' for an old format /proc PID file; or ``POPG'' for an old format /proc page data file; or ``PORT'' for a SYSV named pipe; or ``PREG'' for a /proc register file; or ``PRMP'' for a /proc/rmap file; or ``PRTD'' for a /proc root directory; or ``PSGA'' for a /proc/sigact file; or ``PSIN'' for a /proc/psinfo file; or ``PSTA'' for a /proc status file; or ``PSXSEM'' for a POSIX semaphore file; or ``PSXSHM'' for a POSIX shared memory file; or ``PTS'' for a /dev/pts file; or ``PUSG'' for a /proc/usage file; or ``PW'' for a /proc/watch file; or ``PXMP'' for a /proc/xmap file; or ``REG'' for a regular file; or ``SMT'' for a shared memory transport file; or ``STSO'' for a stream socket; or ``UNNM'' for an unnamed type file; or ``XNAM'' for an OpenServer Xenix special file of unknown type; or ``XSEM'' for an OpenServer Xenix semaphore file; or ``XSD'' for an OpenServer Xenix shared data file; or the four type number octets if the corresponding name isn't known. FILE-ADDR contains the kernel file structure address when f has been specified to +f; FCT contains the file reference count from the kernel file structure when c has been specified to +f; FILE-FLAG when g or G has been specified to +f, this field contains the contents of the f_flag[s] member of the kernel file structure and the kernel's per-process open file flags (if available); `G' causes them to be displayed in hexadecimal; `g', as short-hand names; two lists may be displayed with entries separated by commas, the lists separated by a semicolon (`;'); the first list may contain short-hand names for f_flag[s] values from the following table: AIO asynchronous I/O (e.g., FAIO) AP append ASYN asynchronous I/O (e.g., FASYNC) BAS block, test, and set in use BKIU block if in use BL use block offsets BSK block seek CA copy avoid CIO concurrent I/O CLON clone CLRD CL read CR create DF defer DFI defer IND DFLU data flush DIR direct DLY delay DOCL do clone DSYN data-only integrity DTY must be a directory EVO event only EX open for exec EXCL exclusive open FSYN synchronous writes GCDF defer during unp_gc() (AIX) GCMK mark during unp_gc() (AIX) GTTY accessed via /dev/tty HUP HUP in progress KERN kernel KIOC kernel-issued ioctl LCK has lock LG large file MBLK stream message block MK mark MNT mount MSYN multiplex synchronization NATM don't update atime NB non-blocking I/O NBDR no BDRM check NBIO SYSV non-blocking I/O NBF n-buffering in effect NC no cache ND no delay NDSY no data synchronization NET network NFLK don't follow links NMFS NM file system NOTO disable background stop NSH no share NTTY no controlling TTY OLRM OLR mirror PAIO POSIX asynchronous I/O PP POSIX pipe R read RC file and record locking cache REV revoked RSH shared read RSYN read synchronization RW read and write access SL shared lock SNAP cooked snapshot SOCK socket SQSH Sequent shared set on open SQSV Sequent SVM set on open SQR Sequent set repair on open SQS1 Sequent full shared open SQS2 Sequent partial shared open STPI stop I/O SWR synchronous read SYN file integrity while writing TCPM avoid TCP collision TR truncate W write WKUP parallel I/O synchronization WTG parallel I/O synchronization VH vhangup pending VTXT virtual text XL exclusive lock this list of names was derived from F* #define's in dialect header files <fcntl.h>, <linux</fs.h>, <sys/fcntl.c>, <sys/fcntlcom.h>, and <sys/file.h>; see the lsof.h header file for a list showing the correspondence between the above short-hand names and the header file definitions; the second list (after the semicolon) may contain short-hand names for kernel per-process open file flags from this table: ALLC allocated BR the file has been read BHUP activity stopped by SIGHUP BW the file has been written CLSG closing CX close-on-exec (see fcntl(F_SETFD)) LCK lock was applied MP memory-mapped OPIP open pending - in progress RSVW reserved wait SHMT UF_FSHMAT set (AIX) USE in use (multi-threaded) NODE-ID (or INODE-ADDR for some dialects) contains a unique identifier for the file node (usually the kernel vnode or inode address, but also occasionally a concatenation of device and node number) when n has been specified to +f; DEVICE contains the device numbers, separated by commas, for a character special, block special, regular, directory or NFS file; or ``memory'' for a memory file system node under Tru64 UNIX; or the address of the private data area of a Solaris socket stream; or a kernel reference address that identifies the file (The kernel reference address may be used for FIFO's, for example.); or the base address or device name of a Linux AX.25 socket device. Usually only the lower thirty two bits of Tru64 UNIX kernel addresses are displayed. SIZE, SIZE/OFF, or OFFSET is the size of the file or the file offset in bytes. A value is displayed in this column only if it is available. Lsof displays whatever value - size or offset - is appropriate for the type of the file and the version of lsof. On some UNIX dialects lsof can't obtain accurate or consistent file offset information from its kernel data sources, sometimes just for particular kinds of files (e.g., socket files.) In other cases, files don't have true sizes - e.g., sockets, FIFOs, pipes - so lsof displays for their sizes the content amounts it finds in their kernel buffer descriptors (e.g., socket buffer size counts or TCP/IP window sizes.) Consult the lsof FAQ (The FAQ section gives its location.) for more information. The file size is displayed in decimal; the offset is normally displayed in decimal with a leading ``0t'' if it contains 8 digits or less; in hexadecimal with a leading ``0x'' if it is longer than 8 digits. (Consult the -o o option description for information on when 8 might default to some other value.) Thus the leading ``0t'' and ``0x'' identify an offset when the column may contain both a size and an offset (i.e., its title is SIZE/OFF). If the -o option is specified, lsof always displays the file offset (or nothing if no offset is available) and labels the column OFFSET. The offset always begins with ``0t'' or ``0x'' as described above. The lsof user can control the switch from ``0t'' to ``0x'' with the -o o option. Consult its description for more information. If the -s option is specified, lsof always displays the file size (or nothing if no size is available) and labels the column SIZE. The -o and -s options are mutually exclusive; they can't both be specified. For files that don't have a fixed size - e.g., don't reside on a disk device - lsof will display appropriate information about the current size or position of the file if it is available in the kernel structures that define the file. NLINK contains the file link count when +L has been specified; NODE is the node number of a local file; or the inode number of an NFS file in the server host; or the Internet protocol type - e.g, ``TCP''; or ``STR'' for a stream; or ``CCITT'' for an HP-UX x.25 socket; or the IRQ or inode number of a Linux AX.25 socket device. NAME is the name of the mount point and file system on which the file resides; or the name of a file specified in the names option (after any symbolic links have been resolved); or the name of a character special or block special device; or the local and remote Internet addresses of a network file; the local host name or IP number is followed by a colon (':'), the port, ``->'', and the two-part remote address; IP addresses may be reported as numbers or names, depending on the +|-M, -n, and -P options; colon-separated IPv6 numbers are enclosed in square brackets; IPv4 INADDR_ANY and IPv6 IN6_IS_ADDR_UNSPECIFIED addresses, and zero port numbers are represented by an asterisk ('*'); a UDP destination address may be followed by the amount of time elapsed since the last packet was sent to the destination; TCP, UDP and UDPLITE remote addresses may be followed by TCP/TPI information in parentheses - state (e.g., ``(ESTABLISHED)'', ``(Unbound)''), queue sizes, and window sizes (not all dialects) - in a fashion similar to what netstat(1) reports; see the -T option description or the description of the TCP/TPI field in OUTPUT FOR OTHER PROGRAMS for more information on state, queue size, and window size; or the address or name of a UNIX domain socket, possibly including a stream clone device name, a file system object's path name, local and foreign kernel addresses, socket pair information, and a bound vnode address; or the local and remote mount point names of an NFS file; or ``STR'', followed by the stream name; or a stream character device name, followed by ``->'' and the stream name or a list of stream module names, separated by ``->''; or ``STR:'' followed by the SCO OpenServer stream device and module names, separated by ``->''; or system directory name, `` -- '', and as many components of the path name as lsof can find in the kernel's name cache for selected dialects (See the KERNEL NAME CACHE section for more information.); or ``PIPE->'', followed by a Solaris kernel pipe destination address; or ``COMMON:'', followed by the vnode device information structure's device name, for a Solaris common vnode; or the address family, followed by a slash (`/'), followed by fourteen comma-separated bytes of a non-Internet raw socket address; or the HP-UX x.25 local address, followed by the virtual connection number (if any), followed by the remote address (if any); or ``(dead)'' for disassociated Tru64 UNIX files - typically terminal files that have been flagged with the TIOCNOTTY ioctl and closed by daemons; or ``rd=<offset>'' and ``wr=<offset>'' for the values of the read and write offsets of a FIFO; or ``clone n:/dev/event'' for SCO OpenServer file clones of the /dev/event device, where n is the minor device number of the file; or ``(socketpair: n)'' for a Solaris 2.6, 8, 9 or 10 UNIX domain socket, created by the socketpair(3N) network function; or ``no PCB'' for socket files that do not have a protocol block associated with them, optionally followed by ``, CANTSENDMORE'' if sending on the socket has been disabled, or ``, CANTRCVMORE'' if receiving on the socket has been disabled (e.g., by the shutdown(2) function); or the local and remote addresses of a Linux IPX socket file in the form <net>:[<node>:]<port>, followed in parentheses by the transmit and receive queue sizes, and the connection state; or ``dgram'' or ``stream'' for the type UnixWare 7.1.1 and above in-kernel UNIX domain sockets, followed by a colon (':') and the local path name when available, followed by ``->'' and the remote path name or kernel socket address in hexadecimal when available; or the association value, association index, endpoint value, local address, local port, remote address and remote port for Linux SCTP sockets; or ``protocol: '' followed by the Linux socket's protocol attribute. For dialects that support a ``namefs'' file system, allowing one file to be attached to another with fattach(3C), lsof will add ``(FA:<address1><direction><address2>)'' to the NAME column. <address1> and <address2> are hexadecimal vnode addresses. <direction> will be ``<-'' if <address2> has been fattach'ed to this vnode whose address is <address1>; and ``->'' if <address1>, the vnode address of this vnode, has been fattach'ed to <address2>. <address1> may be omitted if it already appears in the DEVICE column. Lsof may add two parenthetical notes to the NAME column for open Solaris 10 files: ``(?)'' if lsof considers the path name of questionable accuracy; and ``(deleted)'' if the -X option has been specified and lsof detects the open file's path name has been deleted. Consult the lsof FAQ (The FAQ section gives its location.) for more information on these NAME column additions. LOCKS top Lsof can't adequately report the wide variety of UNIX dialect file locks in a single character. What it reports in a single character is a compromise between the information it finds in the kernel and the limitations of the reporting format. Moreover, when a process holds several byte level locks on a file, lsof only reports the status of the first lock it encounters. If it is a byte level lock, then the lock character will be reported in lower case - i.e., `r', `w', or `x' - rather than the upper case equivalent reported for a full file lock. Generally lsof can only report on locks held by local processes on local files. When a local process sets a lock on a remotely mounted (e.g., NFS) file, the remote server host usually records the lock state. One exception is Solaris - at some patch levels of 2.3, and in all versions above 2.4, the Solaris kernel records information on remote locks in local structures. Lsof has trouble reporting locks for some UNIX dialects. Consult the BUGS section of this manual page or the lsof FAQ (The FAQ section gives its location.) for more information. OUTPUT FOR OTHER PROGRAMS top When the -F option is specified, lsof produces output that is suitable for processing by another program - e.g, an awk or Perl script, or a C program. Each unit of information is output in a field that is identified with a leading character and terminated by a NL (012) (or a NUL (000) if the 0 (zero) field identifier character is specified.) The data of the field follows immediately after the field identification character and extends to the field terminator. It is possible to think of field output as process and file sets. A process set begins with a field whose identifier is `p' (for process IDentifier (PID)). It extends to the beginning of the next PID field or the beginning of the first file set of the process, whichever comes first. Included in the process set are fields that identify the command, the process group IDentification (PGID) number, the task (thread) ID (TID), and the user ID (UID) number or login name. A file set begins with a field whose identifier is `f' (for file descriptor). It is followed by lines that describe the file's access mode, lock state, type, device, size, offset, inode, protocol, name and stream module names. It extends to the beginning of the next file or process set, whichever comes first. When the NUL (000) field terminator has been selected with the 0 (zero) field identifier character, lsof ends each process and file set with a NL (012) character. Lsof always produces one field, the PID (`p') field. All other fields may be declared optionally in the field identifier character list that follows the -F option. When a field selection character identifies an item lsof does not normally list - e.g., PPID, selected with -R - specification of the field character - e.g., ``-FR'' - also selects the listing of the item. It is entirely possible to select a set of fields that cannot easily be parsed - e.g., if the field descriptor field is not selected, it may be difficult to identify file sets. To help you avoid this difficulty, lsof supports the -F option; it selects the output of all fields with NL terminators (the -F0 option pair selects the output of all fields with NUL terminators). For compatibility reasons neither -F nor -F0 select the raw device field. These are the fields that lsof will produce. The single character listed first is the field identifier. a file access mode c process command name (all characters from proc or user structure) C file structure share count d file's device character code D file's major/minor device number (0x<hexadecimal>) f file descriptor (always selected) F file structure address (0x<hexadecimal>) G file flaGs (0x<hexadecimal>; names if +fg follows) g process group ID i file's inode number K tasK ID k link count l file's lock status L process login name m marker between repeated output M the task comMand name n file name, comment, Internet address N node identifier (ox<hexadecimal> o file's offset (decimal) p process ID (always selected) P protocol name r raw device number (0x<hexadecimal>) R parent process ID s file's size (decimal) S file's stream identification t file's type T TCP/TPI information, identified by prefixes (the `=' is part of the prefix): QR=<read queue size> QS=<send queue size> SO=<socket options and values> (not all dialects) SS=<socket states> (not all dialects) ST=<connection state> TF=<TCP flags and values> (not all dialects) WR=<window read size> (not all dialects) WW=<window write size> (not all dialects) (TCP/TPI information isn't reported for all supported UNIX dialects. The -h or -? help output for the -T option will show what TCP/TPI reporting can be requested.) u process user ID z Solaris 10 and higher zone name Z SELinux security context (inhibited when SELinux is disabled) 0 use NUL field terminator character in place of NL 1-9 dialect-specific field identifiers (The output of -F? identifies the information to be found in dialect-specific fields.) You can get on-line help information on these characters and their descriptions by specifying the -F? option pair. (Escape the `?' character as your shell requires.) Additional information on field content can be found in the OUTPUT section. As an example, ``-F pcfn'' will select the process ID (`p'), command name (`c'), file descriptor (`f') and file name (`n') fields with an NL field terminator character; ``-F pcfn0'' selects the same output with a NUL (000) field terminator character. Lsof doesn't produce all fields for every process or file set, only those that are available. Some fields are mutually exclusive: file device characters and file major/minor device numbers; file inode number and protocol name; file name and stream identification; file size and offset. One or the other member of these mutually exclusive sets will appear in field output, but not both. Normally lsof ends each field with a NL (012) character. The 0 (zero) field identifier character may be specified to change the field terminator character to a NUL (000). A NUL terminator may be easier to process with xargs(1), for example, or with programs whose quoting mechanisms may not easily cope with the range of characters in the field output. When the NUL field terminator is in use, lsof ends each process and file set with a NL (012). Three aids to producing programs that can process lsof field output are included in the lsof distribution. The first is a C header file, lsof_fields.h, that contains symbols for the field identification characters, indexes for storing them in a table, and explanation strings that may be compiled into programs. Lsof uses this header file. The second aid is a set of sample scripts that process field output, written in awk, Perl 4, and Perl 5. They're located in the scripts subdirectory of the lsof distribution. The third aid is the C library used for the lsof test suite. The test suite is written in C and uses field output to validate the correct operation of lsof. The library can be found in the tests/LTlib.c file of the lsof distribution. The library uses the first aid, the lsof_fields.h header file. BLOCKS AND TIMEOUTS top Lsof can be blocked by some kernel functions that it uses - lstat(2), readlink(2), and stat(2). These functions are stalled in the kernel, for example, when the hosts where mounted NFS file systems reside become inaccessible. Lsof attempts to break these blocks with timers and child processes, but the techniques are not wholly reliable. When lsof does manage to break a block, it will report the break with an error message. The messages may be suppressed with the -t and -w options. The default timeout value may be displayed with the -h or -? option, and it may be changed with the -S [t] option. The minimum for t is two seconds, but you should avoid small values, since slow system responsiveness can cause short timeouts to expire unexpectedly and perhaps stop lsof before it can produce any output. When lsof has to break a block during its access of mounted file system information, it normally continues, although with less information available to display about open files. Lsof can also be directed to avoid the protection of timers and child processes when using the kernel functions that might block by specifying the -O option. While this will allow lsof to start up with less overhead, it exposes lsof completely to the kernel situations that might block it. Use this option cautiously. AVOIDING KERNEL BLOCKS top You can use the -b option to tell lsof to avoid using kernel functions that would block. Some cautions apply. First, using this option usually requires that your system supply alternate device numbers in place of the device numbers that lsof would normally obtain with the lstat(2) and stat(2) kernel functions. See the ALTERNATE DEVICE NUMBERS section for more information on alternate device numbers. Second, you can't specify names for lsof to locate unless they're file system names. This is because lsof needs to know the device and inode numbers of files listed with names in the lsof options, and the -b option prevents lsof from obtaining them. Moreover, since lsof only has device numbers for the file systems that have alternates, its ability to locate files on file systems depends completely on the availability and accuracy of the alternates. If no alternates are available, or if they're incorrect, lsof won't be able to locate files on the named file systems. Third, if the names of your file system directories that lsof obtains from your system's mount table are symbolic links, lsof won't be able to resolve the links. This is because the -b option causes lsof to avoid the kernel readlink(2) function it uses to resolve symbolic links. Finally, using the -b option causes lsof to issue warning messages when it needs to use the kernel functions that the -b option directs it to avoid. You can suppress these messages by specifying the -w option, but if you do, you won't see the alternate device numbers reported in the warning messages. ALTERNATE DEVICE NUMBERS top On some dialects, when lsof has to break a block because it can't get information about a mounted file system via the lstat(2) and stat(2) kernel functions, or because you specified the -b option, lsof can obtain some of the information it needs - the device number and possibly the file system type - from the system mount table. When that is possible, lsof will report the device number it obtained. (You can suppress the report by specifying the -w option.) You can assist this process if your mount table is supported with an /etc/mtab or /etc/mnttab file that contains an options field by adding a ``dev=xxxx'' field for mount points that do not have one in their options strings. Note: you must be able to edit the file - i.e., some mount tables like recent Solaris /etc/mnttab or Linux /proc/mounts are read-only and can't be modified. You may also be able to supply device numbers using the +m and +m m options, provided they are supported by your dialect. Check the output of lsof's -h or -? options to see if the +m and +m m options are available. The ``xxxx'' portion of the field is the hexadecimal value of the file system's device number. (Consult the st_dev field of the output of the lstat(2) and stat(2) functions for the appropriate values for your file systems.) Here's an example from a Sun Solaris 2.6 /etc/mnttab for a file system remotely mounted via NFS: nfs ignore,noquota,dev=2a40001 There's an advantage to having ``dev=xxxx'' entries in your mount table file, especially for file systems that are mounted from remote NFS servers. When a remote server crashes and you want to identify its users by running lsof on one of its clients, lsof probably won't be able to get output from the lstat(2) and stat(2) functions for the file system. If it can obtain the file system's device number from the mount table, it will be able to display the files open on the crashed NFS server. Some dialects that do not use an ASCII /etc/mtab or /etc/mnttab file for the mount table may still provide an alternative device number in their internal mount tables. This includes AIX, Apple Darwin, FreeBSD, NetBSD, OpenBSD, and Tru64 UNIX. Lsof knows how to obtain the alternative device number for these dialects and uses it when its attempt to lstat(2) or stat(2) the file system is blocked. If you're not sure your dialect supplies alternate device numbers for file systems from its mount table, use this lsof incantation to see if it reports any alternate device numbers: lsof -b Look for standard error file warning messages that begin ``assuming "dev=xxxx" from ...''. KERNEL NAME CACHE top Lsof is able to examine the kernel's name cache or use other kernel facilities (e.g., the ADVFS 4.x tag_to_path() function under Tru64 UNIX) on some dialects for most file system types, excluding AFS, and extract recently used path name components from it. (AFS file system path lookups don't use the kernel's name cache; some Solaris VxFS file system operations apparently don't use it, either.) Lsof reports the complete paths it finds in the NAME column. If lsof can't report all components in a path, it reports in the NAME column the file system name, followed by a space, two `-' characters, another space, and the name components it has located, separated by the `/' character. When lsof is run in repeat mode - i.e., with the -r option specified - the extent to which it can report path name components for the same file may vary from cycle to cycle. That's because other running processes can cause the kernel to remove entries from its name cache and replace them with others. Lsof's use of the kernel name cache to identify the paths of files can lead it to report incorrect components under some circumstances. This can happen when the kernel name cache uses device and node number as a key (e.g., SCO OpenServer) and a key on a rapidly changing file system is reused. If the UNIX dialect's kernel doesn't purge the name cache entry for a file when it is unlinked, lsof may find a reference to the wrong entry in the cache. The lsof FAQ (The FAQ section gives its location.) has more information on this situation. Lsof can report path name components for these dialects: FreeBSD HP-UX Linux NetBSD NEXTSTEP OpenBSD OPENSTEP SCO OpenServer SCO|Caldera UnixWare Solaris Tru64 UNIX Lsof can't report path name components for these dialects: AIX If you want to know why lsof can't report path name components for some dialects, see the lsof FAQ (The FAQ section gives its location.) DEVICE CACHE FILE top Examining all members of the /dev (or /devices) node tree with stat(2) functions can be time consuming. What's more, the information that lsof needs - device number, inode number, and path - rarely changes. Consequently, lsof normally maintains an ASCII text file of cached /dev (or /devices) information (exception: the /proc-based Linux lsof where it's not needed.) The local system administrator who builds lsof can control the way the device cache file path is formed, selecting from these options: Path from the -D option; Path from an environment variable; System-wide path; Personal path (the default); Personal path, modified by an environment variable. Consult the output of the -h, -D? , or -? help options for the current state of device cache support. The help output lists the default read-mode device cache file path that is in effect for the current invocation of lsof. The -D? option output lists the read-only and write device cache file paths, the names of any applicable environment variables, and the personal device cache path format. Lsof can detect that the current device cache file has been accidentally or maliciously modified by integrity checks, including the computation and verification of a sixteen bit Cyclic Redundancy Check (CRC) sum on the file's contents. When lsof senses something wrong with the file, it issues a warning and attempts to remove the current cache file and create a new copy, but only to a path that the process can legitimately write. The path from which a lsof process may attempt to read a device cache file may not be the same as the path to which it can legitimately write. Thus when lsof senses that it needs to update the device cache file, it may choose a different path for writing it from the path from which it read an incorrect or outdated version. If available, the -Dr option will inhibit the writing of a new device cache file. (It's always available when specified without a path name argument.) When a new device is added to the system, the device cache file may need to be recreated. Since lsof compares the mtime of the device cache file with the mtime and ctime of the /dev (or /devices) directory, it usually detects that a new device has been added; in that case lsof issues a warning message and attempts to rebuild the device cache file. Whenever lsof writes a device cache file, it sets its ownership to the real UID of the executing process, and its permission modes to 0600, this restricting its reading and writing to the file's owner. LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS top Two permissions of the lsof executable affect its ability to access device cache files. The permissions are set by the local system administrator when lsof is installed. The first and rarer permission is setuid-root. It comes into effect when lsof is executed; its effective UID is then root, while its real (i.e., that of the logged-on user) UID is not. The lsof distribution recommends that versions for these dialects run setuid-root. HP-UX 11.11 and 11.23 Linux The second and more common permission is setgid. It comes into effect when the effective group IDentification number (GID) of the lsof process is set to one that can access kernel memory devices - e.g., ``kmem'', ``sys'', or ``system''. An lsof process that has setgid permission usually surrenders the permission after it has accessed the kernel memory devices. When it does that, lsof can allow more liberal device cache path formations. The lsof distribution recommends that versions for these dialects run setgid and be allowed to surrender setgid permission. AIX 5.[12] and 5.3-ML1 Apple Darwin 7.x Power Macintosh systems FreeBSD 4.x, 4.1x, 5.x and [6789].x for x86-based systems FreeBSD 5.x, [6789].x and 1[012].8for Alpha, AMD64 and Sparc64 based systems HP-UX 11.00 NetBSD 1.[456], 2.x and 3.x for Alpha, x86, and SPARC-based systems NEXTSTEP 3.[13] for NEXTSTEP architectures OpenBSD 2.[89] and 3.[0-9] for x86-based systems OPENSTEP 4.x SCO OpenServer Release 5.0.6 for x86-based systems SCO|Caldera UnixWare 7.1.4 for x86-based systems Solaris 2.6, 8, 9 and 10 Tru64 UNIX 5.1 (Note: lsof for AIX 5L and above needs setuid-root permission if its -X option is used.) Lsof for these dialects does not support a device cache, so the permissions given to the executable don't apply to the device cache file. Linux DEVICE CACHE FILE PATH FROM THE -D OPTION top The -D option provides limited means for specifying the device cache file path. Its ? function will report the read-only and write device cache file paths that lsof will use. When the -D b, r, and u functions are available, you can use them to request that the cache file be built in a specific location (b[path]); read but not rebuilt (r[path]); or read and rebuilt (u[path]). The b, r, and u functions are restricted under some conditions. They are restricted when the lsof process is setuid-root. The path specified with the r function is always read-only, even when it is available. The b, r, and u functions are also restricted when the lsof process runs setgid and lsof doesn't surrender the setgid permission. (See the LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS section for a list of implementations that normally don't surrender their setgid permission.) A further -D function, i (for ignore), is always available. When available, the b function tells lsof to read device information from the kernel with the stat(2) function and build a device cache file at the indicated path. When available, the r function tells lsof to read the device cache file, but not update it. When a path argument accompanies -Dr, it names the device cache file path. The r function is always available when it is specified without a path name argument. If lsof is not running setuid-root and surrenders its setgid permission, a path name argument may accompany the r function. When available, the u function tells lsof to attempt to read and use the device cache file. If it can't read the file, or if it finds the contents of the file incorrect or outdated, it will read information from the kernel, and attempt to write an updated version of the device cache file, but only to a path it considers legitimate for the lsof process effective and real UIDs. DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE top Lsof's second choice for the device cache file is the contents of the LSOFDEVCACHE environment variable. It avoids this choice if the lsof process is setuid-root, or the real UID of the process is root. A further restriction applies to a device cache file path taken from the LSOFDEVCACHE environment variable: lsof will not write a device cache file to the path if the lsof process doesn't surrender its setgid permission. (See the LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS section for information on implementations that don't surrender their setgid permission.) The local system administrator can disable the use of the LSOFDEVCACHE environment variable or change its name when building lsof. Consult the output of -D? for the environment variable's name. SYSTEM-WIDE DEVICE CACHE PATH top The local system administrator may choose to have a system-wide device cache file when building lsof. That file will generally be constructed by a special system administration procedure when the system is booted or when the contents of /dev or /devices) changes. If defined, it is lsof's third device cache file path choice. You can tell that a system-wide device cache file is in effect for your local installation by examining the lsof help option output - i.e., the output from the -h or -? option. Lsof will never write to the system-wide device cache file path by default. It must be explicitly named with a -D function in a root-owned procedure. Once the file has been written, the procedure must change its permission modes to 0644 (owner-read and owner-write, group-read, and other-read). PERSONAL DEVICE CACHE PATH (DEFAULT) top The default device cache file path of the lsof distribution is one recorded in the home directory of the real UID that executes lsof. Added to the home directory is a second path component of the form .lsof_hostname. This is lsof's fourth device cache file path choice, and is usually the default. If a system-wide device cache file path was defined when lsof was built, this fourth choice will be applied when lsof can't find the system-wide device cache file. This is the only time lsof uses two paths when reading the device cache file. The hostname part of the second component is the base name of the executing host, as returned by gethostname(2). The base name is defined to be the characters preceding the first `.' in the gethostname(2) output, or all the gethostname(2) output if it contains no `.'. The device cache file belongs to the user ID and is readable and writable by the user ID alone - i.e., its modes are 0600. Each distinct real user ID on a given host that executes lsof has a distinct device cache file. The hostname part of the path distinguishes device cache files in an NFS-mounted home directory into which device cache files are written from several different hosts. The personal device cache file path formed by this method represents a device cache file that lsof will attempt to read, and will attempt to write should it not exist or should its contents be incorrect or outdated. The -Dr option without a path name argument will inhibit the writing of a new device cache file. The -D? option will list the format specification for constructing the personal device cache file. The conversions used in the format specification are described in the 00DCACHE file of the lsof distribution. MODIFIED PERSONAL DEVICE CACHE PATH top If this option is defined by the local system administrator when lsof is built, the LSOFPERSDCPATH environment variable contents may be used to add a component of the personal device cache file path. The LSOFPERSDCPATH variable contents are inserted in the path at the place marked by the local system administrator with the ``%p'' conversion in the HASPERSDC format specification of the dialect's machine.h header file. (It's placed right after the home directory in the default lsof distribution.) Thus, for example, if LSOFPERSDCPATH contains ``LSOF'', the home directory is ``/Homes/abe'', the host name is ``lsof.itap.purdue.edu'', and the HASPERSDC format is the default (``%h/%p.lsof_%L''), the modified personal device cache file path is: /Homes/abe/LSOF/.lsof_vic The LSOFPERSDCPATH environment variable is ignored when the lsof process is setuid-root or when the real UID of the process is root. Lsof will not write to a modified personal device cache file path if the lsof process doesn't surrender setgid permission. (See the LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS section for a list of implementations that normally don't surrender their setgid permission.) If, for example, you want to create a sub-directory of personal device cache file paths by using the LSOFPERSDCPATH environment variable to name it, and lsof doesn't surrender its setgid permission, you will have to allow lsof to create device cache files at the standard personal path and move them to your subdirectory with shell commands. The local system administrator may: disable this option when lsof is built; change the name of the environment variable from LSOFPERSDCPATH to something else; change the HASPERSDC format to include the personal path component in another place; or exclude the personal path component entirely. Consult the output of the -D? option for the environment variable's name and the HASPERSDC format specification. DIAGNOSTICS top Errors are identified with messages on the standard error file. Lsof returns a one (1) if any error was detected, including the failure to locate command names, file names, Internet addresses or files, login names, NFS files, PIDs, PGIDs, or UIDs it was asked to list. If the -V option is specified, lsof will indicate the search items it failed to list. It returns a zero (0) if no errors were detected and if it was able to list some information about all the specified search arguments. When lsof cannot open access to /dev (or /devices) or one of its subdirectories, or get information on a file in them with stat(2), it issues a warning message and continues. That lsof will issue warning messages about inaccessible files in /dev (or /devices) is indicated in its help output - requested with the -h or >B -? options - with the message: Inaccessible /dev warnings are enabled. The warning message may be suppressed with the -w option. It may also have been suppressed by the system administrator when lsof was compiled by the setting of the WARNDEVACCESS definition. In this case, the output from the help options will include the message: Inaccessible /dev warnings are disabled. Inaccessible device warning messages usually disappear after lsof has created a working device cache file. EXAMPLES top For a more extensive set of examples, documented more fully, see the 00QUICKSTART file of the lsof distribution. To list all open files, use: lsof To list all open Internet, x.25 (HP-UX), and UNIX domain files, use: lsof -i -U To list all open IPv4 network files in use by the process whose PID is 1234, use: lsof -i 4 -a -p 1234 Presuming the UNIX dialect supports IPv6, to list only open IPv6 network files, use: lsof -i 6 To list all files using any protocol on ports 513, 514, or 515 of host wonderland.cc.purdue.edu, use: lsof -i @wonderland.cc.purdue.edu:513-515 To list all files using any protocol on any port of mace.cc.purdue.edu (cc.purdue.edu is the default domain), use: lsof -i @mace To list all open files for login name ``abe'', or user ID 1234, or process 456, or process 123, or process 789, use: lsof -p 456,123,789 -u 1234,abe To list all open files on device /dev/hd4, use: lsof /dev/hd4 To find the process that has /u/abe/foo open, use: lsof /u/abe/foo To send a SIGHUP to the processes that have /u/abe/bar open, use: kill -HUP `lsof -t /u/abe/bar` To find any open file, including an open UNIX domain socket file, with the name /dev/log, use: lsof /dev/log To find processes with open files on the NFS file system named /nfs/mount/point whose server is inaccessible, and presuming your mount table supplies the device number for /nfs/mount/point, use: lsof -b /nfs/mount/point To do the preceding search with warning messages suppressed, use: lsof -bw /nfs/mount/point To ignore the device cache file, use: lsof -Di To obtain PID and command name field output for each process, file descriptor, file device number, and file inode number for each file of each process, use: lsof -FpcfDi To list the files at descriptors 1 and 3 of every process running the lsof command for login ID ``abe'' every 10 seconds, use: lsof -c lsof -a -d 1 -d 3 -u abe -r10 To list the current working directory of processes running a command that is exactly four characters long and has an 'o' or 'O' in character three, use this regular expression form of the -c c option: lsof -c /^..o.$/i -a -d cwd To find an IP version 4 socket file by its associated numeric dot-form address, use: lsof [email protected] To find an IP version 6 socket file (when the UNIX dialect supports IPv6) by its associated numeric colon-form address, use: lsof -i@[0:1:2:3:4:5:6:7] To find an IP version 6 socket file (when the UNIX dialect supports IPv6) by an associated numeric colon-form address that has a run of zeroes in it - e.g., the loop-back address - use: lsof -i@[::1] To obtain a repeat mode marker line that contains the current time, use: lsof -rm====%T==== To add spaces to the previous marker line, use: lsof -r "m==== %T ====" BUGS top Since lsof reads kernel memory in its search for open files, rapid changes in kernel memory may produce unpredictable results. When a file has multiple record locks, the lock status character (following the file descriptor) is derived from a test of the first lock structure, not from any combination of the individual record locks that might be described by multiple lock structures. Lsof can't search for files with restrictive access permissions by name unless it is installed with root set-UID permission. Otherwise it is limited to searching for files to which its user or its set-GID group (if any) has access permission. The display of the destination address of a raw socket (e.g., for ping) depends on the UNIX operating system. Some dialects store the destination address in the raw socket's protocol control block, some do not. Lsof can't always represent Solaris device numbers in the same way that ls(1) does. For example, the major and minor device numbers that the lstat(2) and stat(2) functions report for the directory on which CD-ROM files are mounted (typically /cdrom) are not the same as the ones that it reports for the device on which CD-ROM files are mounted (typically /dev/sr0). (Lsof reports the directory numbers.) The support for /proc file systems is available only for BSD and Tru64 UNIX dialects, Linux, and dialects derived from SYSV R4 - e.g., FreeBSD, NetBSD, OpenBSD, Solaris, UnixWare. Some /proc file items - device number, inode number, and file size - are unavailable in some dialects. Searching for files in a /proc file system may require that the full path name be specified. No text (txt) file descriptors are displayed for Linux processes. All entries for files other than the current working directory, the root directory, and numerical file descriptors are labeled mem descriptors. Lsof can't search for Tru64 UNIX named pipes by name, because their kernel implementation of lstat(2) returns an improper device number for a named pipe. Lsof can't report fully or correctly on HP-UX 9.01, 10.20, and 11.00 locks because of insufficient access to kernel data or errors in the kernel data. See the lsof FAQ (The FAQ section gives its location.) for details. The AIX SMT file type is a fabrication. It's made up for file structures whose type (15) isn't defined in the AIX /usr/include/sys/file.h header file. One way to create such file structures is to run X clients with the DISPLAY variable set to ``:0.0''. The +|-f[cfgGn] option is not supported under /proc-based Linux lsof, because it doesn't read kernel structures from kernel memory. ENVIRONMENT top Lsof may access these environment variables. LANG defines a language locale. See setlocale(3) for the names of other variables that can be used in place of LANG - e.g., LC_ALL, LC_TYPE, etc. LSOFDEVCACHE defines the path to a device cache file. See the DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE section for more information. LSOFPERSDCPATH defines the middle component of a modified personal device cache file path. See the MODIFIED PERSONAL DEVICE CACHE PATH section for more information. FAQ top Frequently-asked questions and their answers (an FAQ) are available in the 00FAQ file of the lsof distribution. That file is also available via anonymous ftp from lsof.itap.purdue.edu at pub/tools/unix/lsofFAQ. The URL is: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ FILES top /dev/kmem kernel virtual memory device /dev/mem physical memory device /dev/swap system paging device .lsof_hostname lsof's device cache file (The suffix, hostname, is the first component of the host's name returned by gethostname(2).) AUTHORS top Lsof was written by Victor A.Abell <[email protected]> of Purdue University. Many others have contributed to lsof. They're listed in the 00CREDITS file of the lsof distribution. DISTRIBUTION top The latest distribution of lsof is available via anonymous ftp from the host lsof.itap.purdue.edu. You'll find the lsof distribution in the pub/tools/unix/lsof directory. You can also use this URL: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof Lsof is also mirrored elsewhere. When you access lsof.itap.purdue.edu and change to its pub/tools/unix/lsof directory, you'll be given a list of some mirror sites. The pub/tools/unix/lsof directory also contains a more complete list in its mirrors file. Use mirrors with caution - not all mirrors always have the latest lsof revision. Some pre-compiled Lsof executables are available on lsof.itap.purdue.edu, but their use is discouraged - it's better that you build your own from the sources. If you feel you must use a pre-compiled executable, please read the cautions that appear in the README files of the pub/tools/unix/lsof/binaries subdirectories and in the 00* files of the distribution. More information on the lsof distribution can be found in its README.lsof_<version> file. If you intend to get the lsof distribution and build it, please read README.lsof_<version> and the other 00* files of the distribution before sending questions to the author. SEE ALSO top Not all the following manual pages may exist in every UNIX dialect to which lsof has been ported. access(2), awk(1), crash(1), fattach(3C), ff(1), fstat(8), fuser(1), gethostname(2), isprint(3), kill(1), localtime(3), lstat(2), modload(8), mount(8), netstat(1), ofiles(8L), perl(1), ps(1), readlink(2), setlocale(3), stat(2), strftime(3), time(2), uname(1). COLOPHON top This page is part of the lsof (LiSt Open Files) project. Information about the project can be found at http://people.freebsd.org/~abe/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the tarball lsof_4.91_src.tar fetched from ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/lsof.tar.gz on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up- to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Revision-4.91 LSOF(8) Pages that refer to this page: fuser(1), lsfd(1), csysdig(8), sysdig(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lsof\n\n> Lists open files and the corresponding processes.\n> Note: Root privileges (or sudo) is required to list files opened by others.\n> More information: <https://manned.org/lsof>.\n\n- Find the processes that have a given file open:\n\n`lsof {{path/to/file}}`\n\n- Find the process that opened a local internet port:\n\n`lsof -i :{{port}}`\n\n- Only output the process ID (PID):\n\n`lsof -t {{path/to/file}}`\n\n- List files opened by the given user:\n\n`lsof -u {{username}}`\n\n- List files opened by the given command or process:\n\n`lsof -c {{process_or_command_name}}`\n\n- List files opened by a specific process, given its PID:\n\n`lsof -p {{PID}}`\n\n- List open files in a directory:\n\n`lsof +D {{path/to/directory}}`\n\n- Find the process that is listening on a local IPv6 TCP port and don't convert network or port numbers:\n\n`lsof -i6TCP:{{port}} -sTCP:LISTEN -n -P`\n
lspci
lspci(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lspci(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | MACHINE READABLE OUTPUT | FILES | BUGS | SEE ALSO | AUTHOR | COLOPHON lspci(8) The PCI Utilities lspci(8) NAME top lspci - list all PCI devices SYNOPSIS top lspci [options] DESCRIPTION top lspci is a utility for displaying information about PCI buses in the system and devices connected to them. By default, it shows a brief list of devices. Use the options described below to request either a more verbose output or output intended for parsing by other programs. If you are going to report bugs in PCI device drivers or in lspci itself, please include output of "lspci -vvx" or even better "lspci -vvxxx" (however, see below for possible caveats). Some parts of the output, especially in the highly verbose modes, are probably intelligible only to experienced PCI hackers. For exact definitions of the fields, please consult either the PCI specifications or the header.h and /usr/include/linux/pci.h include files. Access to some parts of the PCI configuration space is restricted to root on many operating systems, so the features of lspci available to normal users are limited. However, lspci tries its best to display as much as available and mark all other information with <access denied> text. OPTIONS top Basic display modes -m Dump PCI device data in a backward-compatible machine readable form. See below for details. -mm Dump PCI device data in a machine readable form for easy parsing by scripts. See below for details. -t Show a tree-like diagram containing all buses, bridges, devices and connections between them. Display options -v Be verbose and display detailed information about all devices. -vv Be very verbose and display more details. This level includes everything deemed useful. -vvv Be even more verbose and display everything we are able to parse, even if it doesn't look interesting at all (e.g., undefined memory regions). -k Show kernel drivers handling each device and also kernel modules capable of handling it. Turned on by default when -v is given in the normal mode of output. (Currently works only on Linux with kernel 2.6 or newer.) -x Show hexadecimal dump of the standard part of the configuration space (the first 64 bytes or 128 bytes for CardBus bridges). -xxx Show hexadecimal dump of the whole PCI configuration space. It is available only to root as several PCI devices crash when you try to read some parts of the config space (this behavior probably doesn't violate the PCI standard, but it's at least very stupid). However, such devices are rare, so you needn't worry much. -xxxx Show hexadecimal dump of the extended (4096-byte) PCI configuration space available on PCI-X 2.0 and PCI Express buses. -b Bus-centric view. Show all IRQ numbers and addresses as seen by the cards on the PCI bus instead of as seen by the kernel. -D Always show PCI domain numbers. By default, lspci suppresses them on machines which have only domain 0. -P Identify PCI devices by path through each bridge, instead of by bus number. -PP Identify PCI devices by path through each bridge, showing the bus number as well as the device number. Options to control resolving ID's to names -n Show PCI vendor and device codes as numbers instead of looking them up in the PCI ID list. -nn Show PCI vendor and device codes as both numbers and names. -q Use DNS to query the central PCI ID database if a device is not found in the local pci.ids file. If the DNS query succeeds, the result is cached in ~/.pciids-cache and it is recognized in subsequent runs even if -q is not given any more. Please use this switch inside automated scripts only with caution to avoid overloading the database servers. -qq Same as -q, but the local cache is reset. -Q Query the central database even for entries which are recognized locally. Use this if you suspect that the displayed entry is wrong. Options for selection of devices -s [[[[<domain>]:]<bus>]:][<device>][.[<func>]] Show only devices in the specified domain (in case your machine has several host bridges, they can either share a common bus number space or each of them can address a PCI domain of its own; domains are numbered from 0 to ffff), bus (0 to ff), device (0 to 1f) and function (0 to 7). Each component of the device address can be omitted or set to "*", both meaning "any value". All numbers are hexadecimal. E.g., "0:" means all devices on bus 0, "0" means all functions of device 0 on any bus, "0.3" selects third function of device 0 on all buses and ".4" shows only the fourth function of each device. -d [<vendor>]:[<device>][:<class>[:<prog-if>]] Show only devices with specified vendor, device, class ID, and programming interface. The ID's are given in hexadecimal and may be omitted or given as "*", both meaning "any value". The class ID can contain "x" characters which stand for "any digit". Other options -i <file> Use <file> as the PCI ID list instead of /usr/local/share/pci.ids. -p <file> Use <file> as the map of PCI ID's handled by kernel modules. By default, lspci uses /lib/modules/kernel_version/modules.pcimap. Applies only to Linux systems with recent enough module tools. -M Invoke bus mapping mode which performs a thorough scan of all PCI devices, including those behind misconfigured bridges, etc. This option gives meaningful results only with a direct hardware access mode, which usually requires root privileges. By default, the bus mapper scans domain. You can use the -s option to select a different domain. --version Shows lspci version. This option should be used stand- alone. PCI access options The PCI utilities use the PCI library to talk to PCI devices (see pcilib(7) for details). You can use the following options to influence its behavior: -A <method> The library supports a variety of methods to access the PCI hardware. By default, it uses the first access method available, but you can use this option to override this decision. See -A help for a list of available methods and their descriptions. -O <param>=<value> The behavior of the library is controlled by several named parameters. This option allows one to set the value of any of the parameters. Use -O help for a list of known parameters and their default values. -H1 Use direct hardware access via Intel configuration mechanism 1. (This is a shorthand for -A intel-conf1.) -H2 Use direct hardware access via Intel configuration mechanism 2. (This is a shorthand for -A intel-conf2.) -F <file> Instead of accessing real hardware, read the list of devices and values of their configuration registers from the given file produced by an earlier run of lspci -x. This is very useful for analysis of user-supplied bug reports, because you can display the hardware configuration in any way you want without disturbing the user with requests for more dumps. -G Increase debug level of the library. MACHINE READABLE OUTPUT top If you intend to process the output of lspci automatically, please use one of the machine-readable output formats (-m, -vm, -vmm) described in this section. All other formats are likely to change between versions of lspci. All numbers are always printed in hexadecimal. If you want to process numeric ID's instead of names, please add the -n switch. Simple format (-m) In the simple format, each device is described on a single line, which is formatted as parameters suitable for passing to a shell script, i.e., values separated by whitespaces, quoted and escaped if necessary. Some of the arguments are positional: slot, class, vendor name, device name, subsystem vendor name and subsystem name (the last two are empty if the device has no subsystem); the remaining arguments are option-like: -rrev Revision number. -pprogif Programming interface. The relative order of positional arguments and options is undefined. New options can be added in future versions, but they will always have a single argument not separated from the option by any spaces, so they can be easily ignored if not recognized. Verbose format (-vmm) The verbose output is a sequence of records separated by blank lines. Each record describes a single device by a sequence of lines, each line containing a single `tag: value' pair. The tag and the value are separated by a single tab character. Neither the records nor the lines within a record are in any particular order. Tags are case-sensitive. The following tags are defined: Slot The name of the slot where the device resides ([domain:]bus:device.function). This tag is always the first in a record. Class Name of the class. Vendor Name of the vendor. Device Name of the device. SVendor Name of the subsystem vendor (optional). SDevice Name of the subsystem (optional). PhySlot The physical slot where the device resides (optional, Linux only). Rev Revision number (optional). ProgIf Programming interface (optional). Driver Kernel driver currently handling the device (optional, Linux only). Module Kernel module reporting that it is capable of handling the device (optional, Linux only). Multiple lines with this tag can occur. NUMANode NUMA node this device is connected to (optional, Linux only). IOMMUGroup IOMMU group that this device is part of (optional, Linux only). New tags can be added in future versions, so you should silently ignore any tags you don't recognize. Backward-compatible verbose format (-vm) In this mode, lspci tries to be perfectly compatible with its old versions. It's almost the same as the regular verbose format, but the Device tag is used for both the slot and the device name, so it occurs twice in a single record. Please avoid using this format in any new code. FILES top /usr/local/share/pci.ids A list of all known PCI ID's (vendors, devices, classes and subclasses). Maintained at https://pci-ids.ucw.cz/, use the update-pciids utility to download the most recent version. /usr/local/share/pci.ids.gz If lspci is compiled with support for compression, this file is tried before pci.ids. ~/.pciids-cache All ID's found in the DNS query mode are cached in this file. BUGS top Sometimes, lspci is not able to decode the configuration registers completely. This usually happens when not enough documentation was available to the authors. In such cases, it at least prints the <?> mark to signal that there is potentially something more to say. If you know the details, patches will be of course welcome. Access to the extended configuration space is currently supported only by the linux_sysfs back-end. SEE ALSO top setpci(8), pci.ids(5), update-pciids(8), pcilib(7) AUTHOR top The PCI Utilities are maintained by Martin Mares <[email protected]>. COLOPHON top This page is part of the pciutils (PCI utilities) project. Information about the project can be found at http://mj.ucw.cz/sw/pciutils/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/pciutils/pciutils.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-08.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] pciutils-3.9.0 20 November 2022 lspci(8) Pages that refer to this page: pci.ids(5), proc(5), pcilib(7), lsusb(8), setpci(8), update-pciids(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lspci\n\n> List all PCI devices.\n> More information: <https://manned.org/lspci>.\n\n- Show a brief list of devices:\n\n`lspci`\n\n- Display additional info:\n\n`lspci -v`\n\n- Display drivers and modules handling each device:\n\n`lspci -k`\n\n- Show a specific device:\n\n`lspci -s {{00:18.3}}`\n\n- Dump info in a readable form:\n\n`lspci -vm`\n
lsusb
lsusb(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lsusb(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | RETURN VALUE | SEE ALSO | AUTHOR | COLOPHON lsusb(8) Linux USB Utilities lsusb(8) NAME top lsusb - list USB devices SYNOPSIS top lsusb [ options ] DESCRIPTION top lsusb is a utility for displaying information about USB buses in the system and the devices connected to them. It uses udev's hardware database to associate a full human-readable name to the vendor ID and the product ID. OPTIONS top -v, --verbose Tells lsusb to be verbose and display detailed information about the devices shown. This includes configuration descriptors for the device's current speed. Class descriptors will be shown, when available, for USB device classes including hub, audio, HID, communications, and chipcard. Can be used with the -t option. -s [[bus]:][devnum] Show only devices in specified bus and/or devnum. Both IDs are given in decimal and may be omitted. -d [vendor]:[product] Show only devices with the specified vendor and product ID. Both IDs are given in hexadecimal. -D device Do not scan the /dev/bus/usb directory, instead display only information about the device whose device file is given. The device file should be something like /dev/bus/usb/001/001. This option displays detailed information like the -v option; you must be root to do this. -t, --tree Tells lsusb to dump the physical USB device hierarchy as a tree. Verbosity can be increased twice with the -v option. -V, --version Print version information on standard output, then exit successfully. RETURN VALUE top If the specified device is not found, a non-zero exit code is returned. SEE ALSO top lspci(8), usbview(8). AUTHOR top Thomas Sailer, <[email protected]>. COLOPHON top This page is part of the usbutils (USB utilities for Linux) project. Information about the project can be found at http://www.linux-usb.org/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository https://github.com/gregkh/usbutils.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-11-28.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] usbutils-015 11 February 2019 lsusb(8) Pages that refer to this page: usb-devices(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lsusb\n\n> Display information about USB buses and devices connected to them.\n> More information: <https://manned.org/lsusb>.\n\n- List all the USB devices available:\n\n`lsusb`\n\n- List the USB hierarchy as a tree:\n\n`lsusb -t`\n\n- List verbose information about USB devices:\n\n`lsusb --verbose`\n\n- List detailed information about a USB device:\n\n`lsusb --verbose -s {{bus}}:{{device number}}`\n\n- List devices with a specified vendor and product ID only:\n\n`lsusb -d {{vendor}}:{{product}}`\n
ltrace
ltrace(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training ltrace(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | FILTER SPECIFICATIONS | FILTER EXPRESSIONS | PROTOTYPE LIBRARY DISCOVERY | BUGS | FILES | AUTHOR | SEE ALSO | COLOPHON LTRACE(1) User Commands LTRACE(1) NAME top ltrace - A library call tracer SYNOPSIS top ltrace [-e filter|-L] [-l|--library=library_pattern] [-x filter] [-S] [-b|--no-signals] [-i] [-w|--where=nr] [-r|-t|-tt|-ttt] [-T] [[-F|--config] pathlist] [-A maxelts] [-s strsize] [-C|--demangle] [-a|--align column] [-n|--indent nr] [-o|--output filename] [-D|--debug mask] [-u username] [-f] [-p pid] [[--] command [arg ...]] ltrace -c [-e filter|-L] [-l|--library=library_pattern] [-x filter] [-S] [-o|--output filename] [-f] [-p pid] [[--] command [arg ...]] ltrace -V|--version ltrace -h|--help DESCRIPTION top ltrace is a program that simply runs the specified command until it exits. It intercepts and records the dynamic library calls which are called by the executed process and the signals which are received by that process. It can also intercept and print the system calls executed by the program. Its use is very similar to strace(1). ltrace shows parameters of invoked functions and system calls. To determine what arguments each function has, it needs external declaration of function prototypes. Those are stored in files called prototype libraries--see ltrace.conf(5) for details on the syntax of these files. See the section PROTOTYPE LIBRARY DISCOVERY to learn how ltrace finds prototype libraries. OPTIONS top -a, --align column Align return values in a specific column (default column is 5/8 of screen width). -A maxelts Maximum number of array elements to print before suppressing the rest with an ellipsis ("..."). This also limits number of recursive structure expansions. -b, --no-signals Disable printing of signals received by the traced process. -c Count time and calls for each library call and report a summary on program exit. -C, --demangle Decode (demangle) low-level symbol names into user-level names. Besides removing any initial underscore prefix used by the system, this makes C++ function names readable. -D, --debug mask Show debugging output of ltrace itself. mask is a number describing which debug messages should be displayed. Use the option -Dh to see what can be used, but note that currently the only reliable debugmask is 77, which shows all debug messages. -e filter A qualifying expression which modifies which library calls (i.e. calls done through PLT slots, which are typically calls from the main binary to a library, or inter-library calls) to trace. Usage examples and the syntax description appear below in sections FILTER SPECIFICATIONS and FILTER EXPRESSIONS. If more than one -e option appears on the command line, the library calls that match any of them are traced. If no -e is given, @MAIN is assumed as a default. -f Trace child processes as they are created by currently traced processes as a result of the fork(2) or clone(2) system calls. The new process is attached immediately. -F, --config pathlist Contains a colon-separated list of paths. If a path refers to a directory, that directory is considered when prototype libraries are searched (see the section PROTOTYPE LIBRARY DISCOVERY). If it refers to a file, that file is imported implicitly to all loaded prototype libraries. -h, --help Show a summary of the options to ltrace and exit. -i Print the instruction pointer at the time of the library call. -l, --library library_pattern Display only calls to functions implemented by libraries that match library_pattern. This is as if you specified one -e for every symbol implemented in a library specified by library_pattern. Multiple library patters can be specified with several instances of this option. Usage examples and the syntax description of library_pattern appear below in sections FILTER SPECIFICATIONS and FILTER EXPRESSIONS. Note that while this option selects calls that might be directed to the selected libraries, there's no actual guarantee that the call won't be directed elsewhere due to e.g. LD_PRELOAD or simply dependency ordering. If you want to make sure that symbols in given library are actually called, use -x @library_pattern instead. -L When no -e option is given, don't assume the default action of @MAIN. In practice this means that library calls will not be traced. -n, --indent nr Indent trace output by nr spaces for each level of call nesting. Using this option makes the program flow visualization easy to follow. This indents uselessly also functions that never return, such as service functions for throwing exceptions in the C++ runtime. -o, --output filename Write the trace output to the file filename rather than to stderr. -p pid Attach to the process with the process ID pid and begin tracing. This option can be used together with passing a command to execute. It is possible to attach to several processes by passing more than one option -p. -r Print a relative timestamp with each line of the trace. This records the time difference between the beginning of successive lines. -s strsize Specify the maximum string size to print (the default is 32). -S Display system calls as well as library calls -t Prefix each line of the trace with the time of day. -tt If given twice, the time printed will include the microseconds. -ttt If given thrice, the time printed will include the microseconds and the leading portion will be printed as the number of seconds since the epoch. -T Show the time spent inside each call. This records the time difference between the beginning and the end of each call. -u username Run command with the userid, groupid and supplementary groups of username. This option is only useful when running as root and enables the correct execution of setuid and/or setgid binaries. -w, --where nr Show backtrace of nr stack frames for each traced function. This option enabled only if elfutils or libunwind support was enabled at compile time. -x filter A qualifying expression which modifies which symbol table entry points to trace (those are typically calls inside a library or main binary, though PLT calls, traced by -e, land on entry points as well). Usage examples and the syntax description appear below in sections FILTER SPECIFICATIONS and FILTER EXPRESSIONS. If more than one -x option appears on the command line, the symbols that match any of them are traced. No entry points are traced if no -x is given. -V, --version Show the version number of ltrace and exit. FILTER SPECIFICATIONS top Filters are specified with the -l, -e and -x options. In short they mean: -x is show me what calls these symbols (including local calls) -e is show me what calls these symbols (inter-library calls only) -l is show me what calls into this library Suppose I have a library defined with this header tstlib.h: void func_f_lib(void); void func_g_lib(void); and this implementation tstlib.c: #include "tstlib.h" void func_f_lib(void) { func_g_lib(); } void func_g_lib(void) { } Suppose I have an executable that uses this library defined like this tst.c: #include "tstlib.h" void func_f_main(void) { } void main(void) { func_f_main(); func_f_lib(); } If linking without -Bsymbolic, the internal func_g_lib() call uses the PLT like external calls, and thus ltrace says: $ ltrace -x 'func*' -L ./tst func_f_main() = <void> [email protected]( <unfinished ...> [email protected]() = <void> <... func_f_lib resumed> ) = <void> +++ exited (status 163) +++ $ ltrace -e 'func*' ./tst tst->func_f_lib( <unfinished ...> tstlib.so->func_g_lib() = <void> <... func_f_lib resumed> ) = <void> +++ exited (status 163) +++ $ ltrace -l tstlib.so ./tst tst->func_f_lib( <unfinished ...> tstlib.so->func_g_lib() = <void> <... func_f_lib resumed> ) = <void> +++ exited (status 163) +++ By contrast, if linking with -Bsymbolic, then the internal func_g_lib() call bypasses the PLT, and ltrace says: $ ltrace -x 'func*' -L ./tst func_f_main() = <void> [email protected]( <unfinished ...> [email protected]() = <void> <... func_f_lib resumed> ) = <void> +++ exited (status 163) +++ $ ltrace -e 'func*' ./tst tst->func_f_lib() = <void> +++ exited (status 163) +++ $ ltrace -l tstlib.so ./tst tst->func_f_lib() = <void> +++ exited (status 163) +++ FILTER EXPRESSIONS top Filter expression is a chain of glob- or regexp-based rules that are used to pick symbols for tracing from libraries that the process uses. Most of it is intuitive, so as an example, the following would trace calls to malloc and free, except those done by libc: -e [email protected]* This reads: trace malloc and free, but don't trace anything that comes from libc. Semi-formally, the syntax of the above example looks approximately like this: {[+-][symbol_pattern][@library_pattern]} Symbol_pattern is used to match symbol names, library_pattern to match library SONAMEs. Both are implicitly globs, but can be regular expressions as well (see below). The glob syntax supports meta-characters * and ? and character classes, similarly to what basic bash globs support. ^ and $ are recognized to mean, respectively, start and end of given name. Both symbol_pattern and library_pattern have to match the whole name. If you want to match only part of the name, surround it with one or two *'s as appropriate. The exception is if the pattern is not mentioned at all, in which case it's as if the corresponding pattern were *. (So malloc is really malloc@* and @libc.* is really *@libc.*.) In libraries that don't have an explicit SONAME, basename is taken for SONAME. That holds for main binary as well: /bin/echo has an implicit SONAME of echo. In addition to that, special library pattern MAIN always matches symbols in the main binary and never a library with actual SONAME MAIN (use e.g. ^MAIN or [M]AIN for that). If the symbol or library pattern is surrounded in slashes (/like this/), then it is considered a regular expression instead. As a shorthand, instead of writing /x/@/y/, you can write /x@y/. If the library pattern starts with a slash, it is not a SONAME expression, but a path expression, and is matched against the library path name. The first rule may lack a sign, in which case + is assumed. If, on the other hand, the first rule has a - sign, it is as if there was another rule @ in front of it, which has the effect of tracing complement of given rule. The above rules are used to construct the set of traced symbols. Each candidate symbol is passed through the chain of above rules. Initially, the symbol is unmarked. If it matches a + rule, it becomes marked, if it matches a - rule, it becomes unmarked again. If, after applying all rules, the symbol is marked, it will be traced. PROTOTYPE LIBRARY DISCOVERY top When a library is mapped into the address space of a traced process, ltrace needs to know what the prototypes are of functions that this library implements. For purposes of ltrace, prototype really is a bit more than just type signature: it's also formatting of individual parameters and of return value. These prototypes are stored in files called prototype libraries. After a library is mapped, ltrace finds out what its SONAME is. It then looks for a file named SONAME.conf--e.g. protolib for libc.so.6 would be in a file called libc.so.6.conf. When such file is found (more about where ltrace looks for these files is below), ltrace reads all prototypes stored therein. When a symbol table entry point (such as those traced by -x) is hit, the prototype is looked up in a prototype library corresponding to the library where the hit occurred. When a library call (such as those traced by -e and -l) is hit, the prototype is looked up in all prototype libraries loaded for given process. That is necessary, because a library call is traced in a PLT table of a caller library, but the prototype is described at callee library. If a library has no SONAME, basename of library file is considered instead. For the main program binary, basename is considered as well (e.g. protolib for /bin/echo would be called echo.conf). If a name corresponding to soname (e.g. libc.so.6.conf) is not found, and the module under consideration is a shared library, ltrace also tries partial matches. Ltrace snips one period after another, retrying the search, until either a protolib is found, or X.so is all that's left. Thus libc.so.conf would be considered, but libc.conf not. When looking for a prototype library, ltrace potentially looks into several directories. On Linux, those are $XDG_CONFIG_HOME/ltrace, $HOME/.ltrace, X/ltrace for each X in $XDG_CONFIG_DIRS and /usr/share/ltrace. If the environment variable XDG_CONFIG_HOME is not defined, ltrace looks into $HOME/.config/ltrace instead. There's also a mechanism for loading legacy config files. If $HOME/.ltrace.conf exists it is imported to every loaded prototype library. Similarly for /etc/ltrace.conf. If both exist, both are imported, and $HOME/.ltrace.conf is consulted before /etc/ltrace.conf. If -F contains any directories, those are searched in precedence to the above system directories, in the same order in which they are mentioned in -F. Any files passed in -F are imported similarly to above legacy config files, before them. See ltrace.conf(5) for details on the syntax of ltrace prototype library files. BUGS top It has most of the bugs stated in strace(1). It only works on Linux and in some architectures. If you would like to report a bug, send a message to the mailing list ([email protected]), or use the reportbug(1) program if you are under the Debian GNU/Linux distribution. FILES top /etc/ltrace.conf System configuration file ~/.ltrace.conf Personal config file, overrides /etc/ltrace.conf AUTHOR top Juan Cespedes <[email protected]> Petr Machata <[email protected]> SEE ALSO top ltrace.conf(5), strace(1), ptrace(2) COLOPHON top This page is part of the ltrace (library call tracer) project. Information about the project can be found at http://ltrace.org/. If you have a bug report for this manual page, see http://ltrace.org/. This page was obtained from the project's upstream Git repository https://gitlab.com/cespedes/ltrace.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-07-05.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] January 2013 LTRACE(1) Pages that refer to this page: strace(1), ptrace(2), ltrace.conf(5) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# ltrace\n\n> Display dynamic library calls of a process.\n> More information: <https://manned.org/ltrace>.\n\n- Print (trace) library calls of a program binary:\n\n`ltrace ./{{program}}`\n\n- Count library calls. Print a handy summary at the bottom:\n\n`ltrace -c {{path/to/program}}`\n\n- Trace calls to malloc and free, omit those done by libc:\n\n`ltrace -e [email protected]* {{path/to/program}}`\n\n- Write to file instead of terminal:\n\n`ltrace -o {{file}} {{path/to/program}}`\n
lvcreate
lvcreate(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lvcreate(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | USAGE | OPTIONS | VARIABLES | ENVIRONMENT VARIABLES | ADVANCED USAGE | EXAMPLES | SEE ALSO | COLOPHON LVCREATE(8) System Manager's Manual LVCREATE(8) NAME top lvcreate Create a logical volume SYNOPSIS top lvcreate option_args position_args [ option_args ] [ position_args ] -a|--activate y|n|ay --addtag Tag --alloc contiguous|cling|cling_by_tags|normal|anywhere| inherit -A|--autobackup y|n -H|--cache --cachedevice PV --cachemetadataformat auto|1|2 --cachemode writethrough|writeback|passthrough --cachepolicy String --cachepool LV --cachesettings String --cachesize Size[m|UNIT] --cachevol LV -c|--chunksize Size[k|UNIT] --commandprofile String --compression y|n --config String -C|--contiguous y|n -d|--debug --deduplication y|n --devices PV --devicesfile String --discards passdown|nopassdown|ignore --driverloaded y|n --errorwhenfull y|n -l|--extents Number[PERCENT] -h|--help -K|--ignoreactivationskip --ignoremonitoring --journal String --lockopt String --longhelp -j|--major Number --[raid]maxrecoveryrate Size[k|UNIT] --metadataprofile String --minor Number --[raid]minrecoveryrate Size[k|UNIT] --mirrorlog core|disk -m|--mirrors Number --monitor y|n -n|--name String --nohints --nolocking --nosync --noudevsync -p|--permission rw|r -M|--persistent y|n --poolmetadatasize Size[m|UNIT] --poolmetadataspare y|n --profile String -q|--quiet --raidintegrity y|n --raidintegrityblocksize Number --raidintegritymode String -r|--readahead auto|none|Number -R|--regionsize Size[m|UNIT] --reportformat basic|json -k|--setactivationskip y|n --setautoactivation y|n -L|--size Size[m|UNIT] -s|--snapshot -i|--stripes Number -I|--stripesize Size[k|UNIT] -t|--test -T|--thin --thinpool LV --type linear|striped|snapshot|raid|mirror|thin|thin-pool| vdo|vdo-pool|cache|cache-pool|writecache --vdo --vdopool LV -v|--verbose --version -V|--virtualsize Size[m|UNIT] -W|--wipesignatures y|n -y|--yes -Z|--zero y|n DESCRIPTION top lvcreate creates a new LV in a VG. For standard LVs, this requires allocating logical extents from the VG's free physical extents. If there is not enough free space, the VG can be extended with other PVs (vgextend(8)), or existing LVs can be reduced or removed (lvremove(8), lvreduce(8)). To control which PVs a new LV will use, specify one or more PVs as position args at the end of the command line. lvcreate will allocate physical extents only from the specified PVs. lvcreate can also create snapshots of existing LVs, e.g. for backup purposes. The data in a new snapshot LV represents the content of the original LV from the time the snapshot was created. RAID LVs can be created by specifying an LV type when creating the LV (see lvmraid(7)). Different RAID levels require different numbers of unique PVs be available in the VG for allocation. Thin pools (for thin provisioning) and cache pools (for caching) are represented by special LVs with types thin-pool and cache-pool (see lvmthin(7) and lvmcache(7)). The pool LVs are not usable as standard block devices, but the LV names act as references to the pools. Thin LVs are thinly provisioned from a thin pool, and are created with a virtual size rather than a physical size. A cache LV is the combination of a standard LV with a cache pool, used to cache active portions of the LV to improve performance. VDO LVs are also provisioned volumes from a VDO pool, and are created with a virtual size rather than a physical size (see lvmvdo(7)). Usage notes In the usage section below, --size Size can be replaced with --extents Number. See descriptions in the options section. In the usage section below, --name is omitted from the required options, even though it is typically used. When the name is not specified, a new LV name is generated with the "lvol" prefix and a unique numeric suffix. In the usage section below, when creating a pool and the name is omitted the new LV pool name is generated with the "vpool" for vdo-pools for prefix and a unique numeric suffix. Pool name can be specified together with VG name i.e.: vg00/mythinpool. USAGE top Create a linear LV. lvcreate -L|--size Size[m|UNIT] VG [ --type linear ] (implied) [ -l|--extents Number[PERCENT] ] [ COMMON_OPTIONS ] [ PV ... ] Create a striped LV. lvcreate -i|--stripes Number -L|--size Size[m|UNIT] VG [ --type striped ] (implied) [ -l|--extents Number[PERCENT] ] [ -I|--stripesize Size[k|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ] Create a raid1 or mirror LV. lvcreate -m|--mirrors Number -L|--size Size[m|UNIT] VG [ --type raid1|mirror ] (implied) [ -l|--extents Number[PERCENT] ] [ -I|--stripesize Size[k|UNIT] ] [ -R|--regionsize Size[m|UNIT] ] [ --mirrorlog core|disk ] [ --[raid]minrecoveryrate Size[k|UNIT] ] [ --[raid]maxrecoveryrate Size[k|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ] Create a raid LV (a specific raid level must be used, e.g. raid1). lvcreate --type raid -L|--size Size[m|UNIT] VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -m|--mirrors Number ] [ -R|--regionsize Size[m|UNIT] ] [ --[raid]minrecoveryrate Size[k|UNIT] ] [ --[raid]maxrecoveryrate Size[k|UNIT] ] [ --raidintegrity y|n ] [ --raidintegritymode String ] [ --raidintegrityblocksize Number ] [ COMMON_OPTIONS ] [ PV ... ] Create a raid10 LV. lvcreate -m|--mirrors Number -i|--stripes Number -L|--size Size[m|UNIT] VG [ --type raid10 ] (implied) [ -l|--extents Number[PERCENT] ] [ -I|--stripesize Size[k|UNIT] ] [ -R|--regionsize Size[m|UNIT] ] [ --[raid]minrecoveryrate Size[k|UNIT] ] [ --[raid]maxrecoveryrate Size[k|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ] Create a COW snapshot LV of an origin LV. lvcreate -s|--snapshot -L|--size Size[m|UNIT] LV [ --type snapshot ] (implied) [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -c|--chunksize Size[k|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ] Create a thin pool. lvcreate --type thin-pool -L|--size Size[m|UNIT] VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -T|--thin ] [ -c|--chunksize Size[k|UNIT] ] [ --thinpool LV_new ] [ --discards passdown|nopassdown|ignore ] [ --errorwhenfull y|n ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a cache pool. lvcreate --type cache-pool -L|--size Size[m|UNIT] VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -H|--cache ] [ -c|--chunksize Size[k|UNIT] ] [ --cachemode writethrough|writeback|passthrough ] [ --cachepolicy String ] [ --cachesettings String ] [ --cachemetadataformat auto|1|2 ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a thin LV in a thin pool. lvcreate -V|--virtualsize Size[m|UNIT] --thinpool LV VG [ --type thin ] (implied) [ -T|--thin ] [ COMMON_OPTIONS ] Create a thin LV that is a snapshot of an existing thin LV. lvcreate -s|--snapshot LV1 [ --type thin ] (implied) [ COMMON_OPTIONS ] LV1 types: thin Create a thin LV that is a snapshot of an external origin LV. lvcreate --type thin --thinpool LV LV [ -T|--thin ] [ COMMON_OPTIONS ] Create a LV that returns VDO when used. lvcreate --type vdo -L|--size Size[m|UNIT] VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -V|--virtualsize Size[m|UNIT] ] [ --vdo ] [ --vdopool LV_new ] [ --compression y|n ] [ --deduplication y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a new LV, then attach the specified cachepool which converts the new LV to type cache. lvcreate --type cache -L|--size Size[m|UNIT] --cachepool LV VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -H|--cache ] [ -c|--chunksize Size[k|UNIT] ] [ --cachemode writethrough|writeback|passthrough ] [ --cachepolicy String ] [ --cachesettings String ] [ --cachemetadataformat auto|1|2 ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a new LV, then attach the specified cachevol which converts the new LV to type cache. lvcreate --type cache -L|--size Size[m|UNIT] --cachevol LV VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -c|--chunksize Size[k|UNIT] ] [ --cachemode writethrough|writeback|passthrough ] [ --cachepolicy String ] [ --cachesettings String ] [ --cachemetadataformat auto|1|2 ] [ COMMON_OPTIONS ] [ PV ... ] Create a new LV, then attach a cachevol created from the specified cache device, which converts the new LV to type cache. lvcreate --type cache -L|--size Size[m|UNIT] --cachedevice PV VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -c|--chunksize Size[k|UNIT] ] [ --cachesize Size[m|UNIT] ] [ --cachemode writethrough|writeback|passthrough ] [ --cachepolicy String ] [ --cachesettings String ] [ --cachemetadataformat auto|1|2 ] [ COMMON_OPTIONS ] [ PV ... ] Create a new LV, then attach the specified cachevol which converts the new LV to type writecache. lvcreate --type writecache -L|--size Size[m|UNIT] --cachevol LV VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ --cachesettings String ] [ COMMON_OPTIONS ] [ PV ... ] Create a new LV, then attach a cachevol created from the specified cache device, which converts the new LV to type writecache. lvcreate --type writecache -L|--size Size[m|UNIT] --cachedevice PV VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ --cachesize Size[m|UNIT] ] [ --cachesettings String ] [ COMMON_OPTIONS ] [ PV ... ] Common options for command: [ -a|--activate y|n|ay ] [ -A|--autobackup y|n ] [ -C|--contiguous y|n ] [ -K|--ignoreactivationskip ] [ -j|--major Number ] [ -n|--name String ] [ -p|--permission rw|r ] [ -M|--persistent y|n ] [ -r|--readahead auto|none|Number ] [ -k|--setactivationskip y|n ] [ -W|--wipesignatures y|n ] [ -Z|--zero y|n ] [ --addtag Tag ] [ --alloc contiguous|cling|cling_by_tags|normal|anywhere| inherit ] [ --ignoremonitoring ] [ --metadataprofile String ] [ --minor Number ] [ --monitor y|n ] [ --nosync ] [ --noudevsync ] [ --reportformat basic|json ] [ --setautoactivation y|n ] Common options for lvm: [ -d|--debug ] [ -h|--help ] [ -q|--quiet ] [ -t|--test ] [ -v|--verbose ] [ -y|--yes ] [ --commandprofile String ] [ --config String ] [ --devices PV ] [ --devicesfile String ] [ --driverloaded y|n ] [ --journal String ] [ --lockopt String ] [ --longhelp ] [ --nohints ] [ --nolocking ] [ --profile String ] [ --version ] OPTIONS top -a|--activate y|n|ay Controls the active state of the new LV. y makes the LV active, or available. New LVs are made active by default. n makes the LV inactive, or unavailable, only when possible. In some cases, creating an LV requires it to be active. For example, COW snapshots of an active origin LV can only be created in the active state (this does not apply to thin snapshots). The --zero option normally requires the LV to be active. If autoactivation ay is used, the LV is only activated if it matches an item in lvm.conf(5) activation/auto_activation_volume_list. ay implies --zero n and --wipesignatures n. See lvmlockd(8) for more information about activation options for shared VGs. --addtag Tag Adds a tag to a PV, VG or LV. This option can be repeated to add multiple tags at once. See lvm(8) for information about tags. --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit Determines the allocation policy when a command needs to allocate Physical Extents (PEs) from the VG. Each VG and LV has an allocation policy which can be changed with vgchange/lvchange, or overridden on the command line. normal applies common sense rules such as not placing parallel stripes on the same PV. inherit applies the VG policy to an LV. contiguous requires new PEs be placed adjacent to existing PEs. cling places new PEs on the same PV as existing PEs in the same stripe of the LV. If there are sufficient PEs for an allocation, but normal does not use them, anywhere will use them even if it reduces performance, e.g. by placing two stripes on the same PV. Optional positional PV args on the command line can also be used to limit which PVs the command will use for allocation. See lvm(8) for more information about allocation. -A|--autobackup y|n Specifies if metadata should be backed up automatically after a change. Enabling this is strongly advised! See vgcfgbackup(8) for more information. -H|--cache Specifies the command is handling a cache LV or cache pool. See --type cache and --type cache-pool. See lvmcache(7) for more information about LVM caching. --cachedevice PV The name of a device to use for a cache. --cachemetadataformat auto|1|2 Specifies the cache metadata format used by cache target. --cachemode writethrough|writeback|passthrough Specifies when writes to a cache LV should be considered complete. writeback considers a write complete as soon as it is stored in the cache pool. writethough considers a write complete only when it has been stored in both the cache pool and on the origin LV. While writethrough may be slower for writes, it is more resilient if something should happen to a device associated with the cache pool LV. With passthrough, all reads are served from the origin LV (all reads miss the cache) and all writes are forwarded to the origin LV; additionally, write hits cause cache block invalidates. See lvmcache(7) for more information. --cachepolicy String Specifies the cache policy for a cache LV. See lvmcache(7) for more information. --cachepool LV The name of a cache pool. --cachesettings String Specifies tunable values for a cache LV in "Key = Value" form. Repeat this option to specify multiple values. (The default values should usually be adequate.) The special string value default switches settings back to their default kernel values and removes them from the list of settings stored in LVM metadata. See lvmcache(7) for more information. --cachesize Size[m|UNIT] The size of cache to use. --cachevol LV The name of a cache volume. -c|--chunksize Size[k|UNIT] The size of chunks in a snapshot, cache pool or thin pool. For snapshots, the value must be a power of 2 between 4KiB and 512KiB and the default value is 4. For a cache pool the value must be between 32KiB and 1GiB and the default value is 64. For a thin pool the value must be between 64KiB and 1GiB and the default value starts with 64 and scales up to fit the pool metadata size within 128MiB, if the pool metadata size is not specified. The value must be a multiple of 64KiB. See lvmthin(7) and lvmcache(7) for more information. --commandprofile String The command profile to use for command configuration. See lvm.conf(5) for more information about profiles. --compression y|n Controls whether compression is enabled or disable for VDO volume. See lvmvdo(7) for more information about VDO usage. --config String Config settings for the command. These override lvm.conf(5) settings. The String arg uses the same format as lvm.conf(5), or may use section/field syntax. See lvm.conf(5) for more information about config. -C|--contiguous y|n Sets or resets the contiguous allocation policy for LVs. Default is no contiguous allocation based on a next free principle. It is only possible to change a non-contiguous allocation policy to contiguous if all of the allocated physical extents in the LV are already contiguous. -d|--debug ... Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log file and/or syslog (if configured). --deduplication y|n Controls whether deduplication is enabled or disable for VDO volume. See lvmvdo(7) for more information about VDO usage. --devices PV Devices that the command can use. This option can be repeated or accepts a comma separated list of devices. This overrides the devices file. --devicesfile String A file listing devices that LVM should use. The file must exist in /etc/lvm/devices/ and is managed with the lvmdevices(8) command. This overrides the lvm.conf(5) devices/devicesfile and devices/use_devicesfile settings. --discards passdown|nopassdown|ignore Specifies how the device-mapper thin pool layer in the kernel should handle discards. ignore causes the thin pool to ignore discards. nopassdown causes the thin pool to process discards itself to allow reuse of unneeded extents in the thin pool. passdown causes the thin pool to process discards itself (like nopassdown) and pass the discards to the underlying device. See lvmthin(7) for more information. --driverloaded y|n If set to no, the command will not attempt to use device- mapper. For testing and debugging. --errorwhenfull y|n Specifies thin pool behavior when data space is exhausted. When yes, device-mapper will immediately return an error when a thin pool is full and an I/O request requires space. When no, device-mapper will queue these I/O requests for a period of time to allow the thin pool to be extended. Errors are returned if no space is available after the timeout. (Also see dm-thin-pool kernel module option no_space_timeout.) See lvmthin(7) for more information. -l|--extents Number[PERCENT] Specifies the size of the new LV in logical extents. The --size and --extents options are alternate methods of specifying size. The total number of physical extents used will be greater when redundant data is needed for RAID levels. An alternate syntax allows the size to be determined indirectly as a percentage of the size of a related VG, LV, or set of PVs. The suffix %VG denotes the total size of the VG, the suffix %FREE the remaining free space in the VG, and the suffix %PVS the free space in the specified PVs. For a snapshot, the size can be expressed as a percentage of the total size of the origin LV with the suffix %ORIGIN (100%ORIGIN provides space for the whole origin). When expressed as a percentage, the size defines an upper limit for the number of logical extents in the new LV. The precise number of logical extents in the new LV is not determined until the command has completed. -h|--help Display help text. -K|--ignoreactivationskip Ignore the "activation skip" LV flag during activation to allow LVs with the flag set to be activated. --ignoremonitoring Do not interact with dmeventd unless --monitor is specified. Do not use this if dmeventd is already monitoring a device. --journal String Record information in the systemd journal. This information is in addition to information enabled by the lvm.conf log/journal setting. command: record information about the command. output: record the default command output. debug: record full command debugging. --lockopt String Used to pass options for special cases to lvmlockd. See lvmlockd(8) for more information. --longhelp Display long help text. -j|--major Number Sets the major number of an LV block device. --[raid]maxrecoveryrate Size[k|UNIT] Sets the maximum recovery rate for a RAID LV. The rate value is an amount of data per second for each device in the array. Setting the rate to 0 means it will be unbounded. See lvmraid(7) for more information. --metadataprofile String The metadata profile to use for command configuration. See lvm.conf(5) for more information about profiles. --minor Number Sets the minor number of an LV block device. --[raid]minrecoveryrate Size[k|UNIT] Sets the minimum recovery rate for a RAID LV. The rate value is an amount of data per second for each device in the array. Setting the rate to 0 means it will be unbounded. See lvmraid(7) for more information. --mirrorlog core|disk Specifies the type of mirror log for LVs with the "mirror" type (does not apply to the "raid1" type.) disk is a persistent log and requires a small amount of storage space, usually on a separate device from the data being mirrored. core is not persistent; the log is kept only in memory. In this case, the mirror must be synchronized (by copying LV data from the first device to others) each time the LV is activated, e.g. after reboot. mirrored is a persistent log that is itself mirrored, but should be avoided. Instead, use the raid1 type for log redundancy. -m|--mirrors Number Specifies the number of mirror images in addition to the original LV image, e.g. --mirrors 1 means there are two images of the data, the original and one mirror image. Optional positional PV args on the command line can specify the devices the images should be placed on. There are two mirroring implementations: "raid1" and "mirror". These are the names of the corresponding LV types, or "segment types". Use the --type option to specify which to use (raid1 is default, and mirror is legacy) Use lvm.conf(5) global/mirror_segtype_default and global/raid10_segtype_default to configure the default types. See the --nosync option for avoiding initial image synchronization. See lvmraid(7) for more information. --monitor y|n Start (yes) or stop (no) monitoring an LV with dmeventd. dmeventd monitors kernel events for an LV, and performs automated maintenance for the LV in reponse to specific events. See dmeventd(8) for more information. -n|--name String Specifies the name of a new LV. When unspecified, a default name of "lvol#" is generated, where # is a number generated by LVM. --nohints Do not use the hints file to locate devices for PVs. A command may read more devices to find PVs when hints are not used. The command will still perform standard hint file invalidation where appropriate. --nolocking Disable locking. --nosync Causes the creation of mirror, raid1, raid4, raid5 and raid10 to skip the initial synchronization. In case of mirror, raid1 and raid10, any data written afterwards will be mirrored, but the original contents will not be copied. In case of raid4 and raid5, no parity blocks will be written, though any data written afterwards will cause parity blocks to be stored. This is useful for skipping a potentially long and resource intensive initial sync of an empty mirror/raid1/raid4/raid5 and raid10 LV. This option is not valid for raid6, because raid6 relies on proper parity (P and Q Syndromes) being created during initial synchronization in order to reconstruct proper user date in case of device failures. raid0 and raid0_meta do not provide any data copies or parity support and thus do not support initial synchronization. --noudevsync Disables udev synchronisation. The process will not wait for notification from udev. It will continue irrespective of any possible udev processing in the background. Only use this if udev is not running or has rules that ignore the devices LVM creates. -p|--permission rw|r Set access permission to read only r or read and write rw. -M|--persistent y|n When yes, makes the specified minor number persistent. --poolmetadatasize Size[m|UNIT] Specifies the size of the new pool metadata LV. --poolmetadataspare y|n Enable or disable the automatic creation and management of a spare pool metadata LV in the VG. A spare metadata LV is reserved space that can be used when repairing a pool. --profile String An alias for --commandprofile or --metadataprofile, depending on the command. -q|--quiet ... Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress any prompts with answer 'no'. --raidintegrity y|n Enable or disable data integrity checksums for raid images. --raidintegrityblocksize Number The block size to use for dm-integrity on raid images. The integrity block size should usually match the device logical block size, or the file system block size. It may be less than the file system block size, but not less than the device logical block size. Possible values: 512, 1024, 2048, 4096. --raidintegritymode String Use a journal (default) or bitmap for keeping integrity checksums consistent in case of a crash. The bitmap areas are recalculated after a crash, so corruption in those areas would not be detected. A journal does not have this problem. The journal mode doubles writes to storage, but can improve performance for scattered writes packed into a single journal write. bitmap mode can in theory achieve full write throughput of the device, but would not benefit from the potential scattered write optimization. -r|--readahead auto|none|Number Sets read ahead sector count of an LV. auto is the default which allows the kernel to choose a suitable value automatically. none is equivalent to zero. -R|--regionsize Size[m|UNIT] Size of each raid or mirror synchronization region. lvm.conf(5) activation/raid_region_size can be used to configure a default. --reportformat basic|json Overrides current output format for reports which is defined globally by the report/output_format setting in lvm.conf(5). basic is the original format with columns and rows. If there is more than one report per command, each report is prefixed with the report name for identification. json produces report output in JSON format. See lvmreport(7) for more information. -k|--setactivationskip y|n Persistently sets (yes) or clears (no) the "activation skip" flag on an LV. An LV with this flag set is not activated unless the --ignoreactivationskip option is used by the activation command. This flag is set by default on new thin snapshot LVs. The flag is not applied to deactivation. The current value of the flag is indicated in the lvs lv_attr bits. --setautoactivation y|n Set the autoactivation property on a VG or LV. Display the property with vgs or lvs "-o autoactivation". When the autoactivation property is disabled, the VG or LV will not be activated by a command doing autoactivation (vgchange, lvchange, or pvscan using -aay.) If autoactivation is disabled on a VG, no LVs will be autoactivated in that VG, and the LV autoactivation property has no effect. If autoactivation is enabled on a VG, autoactivation can be disabled for individual LVs. -L|--size Size[m|UNIT] Specifies the size of the new LV. The --size and --extents options are alternate methods of specifying size. The total number of physical extents used will be greater when redundant data is needed for RAID levels. -s|--snapshot Create a snapshot. Snapshots provide a "frozen image" of an origin LV. The snapshot LV can be used, e.g. for backups, while the origin LV continues to be used. This option can create a COW (copy on write) snapshot, or a thin snapshot (in a thin pool.) Thin snapshots are created when the origin is a thin LV and the size option is NOT specified. Thin snapshots share the same blocks in the thin pool, and do not allocate new space from the VG. Thin snapshots are created with the "activation skip" flag, see --setactivationskip. A thin snapshot of a non- thin "external origin" LV is created when a thin pool is specified. Unprovisioned blocks in the thin snapshot LV are read from the external origin LV. The external origin LV must be read-only. See lvmthin(7) for more information about LVM thin provisioning. COW snapshots are created when a size is specified. The size is allocated from space in the VG, and is the amount of space that can be used for saving COW blocks as writes occur to the origin or snapshot. The size chosen should depend upon the amount of writes that are expected; often 20% of the origin LV is enough. If COW space runs low, it can be extended with lvextend (shrinking is also allowed with lvreduce.) A small amount of the COW snapshot LV size is used to track COW block locations, so the full size is not available for COW data blocks. Use lvs to check how much space is used, and see --monitor to to automatically extend the size to avoid running out of space. -i|--stripes Number Specifies the number of stripes in a striped LV. This is the number of PVs (devices) that a striped LV is spread across. Data that appears sequential in the LV is spread across multiple devices in units of the stripe size (see --stripesize). This does not change existing allocated space, but only applies to space being allocated by the command. When creating a RAID 4/5/6 LV, this number does not include the extra devices that are required for parity. The largest number depends on the RAID type (raid0: 64, raid10: 32, raid4/5: 63, raid6: 62), and when unspecified, the default depends on the RAID type (raid0: 2, raid10: 2, raid4/5: 3, raid6: 5.) To stripe a new raid LV across all PVs by default, see lvm.conf(5) allocation/raid_stripe_all_devices. -I|--stripesize Size[k|UNIT] The amount of data that is written to one device before moving to the next in a striped LV. -t|--test Run in test mode. Commands will not update metadata. This is implemented by disabling all metadata writing but nevertheless returning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but hasn't. -T|--thin Specifies the command is handling a thin LV or thin pool. See --type thin, --type thin-pool, and --virtualsize. See lvmthin(7) for more information about LVM thin provisioning. --thinpool LV The name of a thin pool LV. --type linear|striped|snapshot|raid|mirror|thin|thin-pool|vdo| vdo-pool|cache|cache-pool|writecache The LV type, also known as "segment type" or "segtype". See usage descriptions for the specific ways to use these types. For more information about redundancy and performance (raid<N>, mirror, striped, linear) see lvmraid(7). For thin provisioning (thin, thin-pool) see lvmthin(7). For performance caching (cache, cache-pool) see lvmcache(7). For copy-on-write snapshots (snapshot) see usage definitions. For VDO (vdo) see lvmvdo(7). Several commands omit an explicit type option because the type is inferred from other options or shortcuts (e.g. --stripes, --mirrors, --snapshot, --virtualsize, --thin, --cache, --vdo). Use inferred types with care because it can lead to unexpected results. --vdo Specifies the command is handling VDO LV. See --type vdo. See lvmvdo(7) for more information about VDO usage. --vdopool LV The name of a VDO pool LV. See lvmvdo(7) for more information about VDO usage. -v|--verbose ... Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr. --version Display version information. -V|--virtualsize Size[m|UNIT] The virtual size of a new thin LV. See lvmthin(7) for more information about LVM thin provisioning. Using virtual size (-V) and actual size (-L) together creates a sparse LV. lvm.conf(5) global/sparse_segtype_default determines the default segment type used to create a sparse LV. Anything written to a sparse LV will be returned when reading from it. Reading from other areas of the LV will return blocks of zeros. When using a snapshot to create a sparse LV, a hidden virtual device is created using the zero target, and the LV has the suffix _vorigin. Snapshots are less efficient than thin provisioning when creating large sparse LVs (GiB). -W|--wipesignatures y|n Controls detection and subsequent wiping of signatures on new LVs. There is a prompt for each signature detected to confirm its wiping (unless --yes is used to override confirmations.) When not specified, signatures are wiped whenever zeroing is done (see --zero). This behaviour can be configured with lvm.conf(5) allocation/wipe_signatures_when_zeroing_new_lvs. If blkid wiping is used (lvm.conf(5) allocation/use_blkid_wiping) and LVM is compiled with blkid wiping support, then the blkid(8) library is used to detect the signatures (use blkid -k to list the signatures that are recognized). Otherwise, native LVM code is used to detect signatures (only MD RAID, swap and LUKS signatures are detected in this case.) The LV is not wiped if the read only flag is set. -y|--yes Do not prompt for confirmation interactively but always assume the answer yes. Use with extreme caution. (For automatic no, see -qq.) -Z|--zero y|n Controls zeroing of the first 4KiB of data in the new LV. Default is y. Snapshot COW volumes are always zeroed. For thin pools, this controls zeroing of provisioned blocks. LV is not zeroed if the read only flag is set. Warning: trying to mount an unzeroed LV can cause the system to hang. VARIABLES top VG Volume Group name. See lvm(8) for valid names. For lvcreate, the required VG positional arg may be omitted when the VG name is included in another option, e.g. --name VG/LV. LV Logical Volume name. See lvm(8) for valid names. An LV positional arg generally includes the VG name and LV name, e.g. VG/LV. LV1 indicates the LV must have a specific type, where the accepted LV types are listed. (raid represents raid<N> type). PV Physical Volume name, a device path under /dev. For commands managing physical extents, a PV positional arg generally accepts a suffix indicating a range (or multiple ranges) of physical extents (PEs). When the first PE is omitted, it defaults to the start of the device, and when the last PE is omitted it defaults to end. Start and end range (inclusive): PV[:PE-PE]... Start and length range (counting from 0): PV[:PE+PE]... String See the option description for information about the string content. Size[UNIT] Size is an input number that accepts an optional unit. Input units are always treated as base two values, regardless of capitalization, e.g. 'k' and 'K' both refer to 1024. The default input unit is specified by letter, followed by |UNIT. UNIT represents other possible input units: b|B is bytes, s|S is sectors of 512 bytes, k|K is KiB, m|M is MiB, g|G is GiB, t|T is TiB, p|P is PiB, e|E is EiB. (This should not be confused with the output control --units, where capital letters mean multiple of 1000.) ENVIRONMENT VARIABLES top See lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for a required VG parameter. ADVANCED USAGE top Alternate command forms, advanced command usage, and listing of all valid syntax for completeness. Create an LV that returns errors when used. lvcreate --type error -L|--size Size[m|UNIT] VG [ -l|--extents Number[PERCENT] ] [ COMMON_OPTIONS ] Create an LV that returns zeros when read. lvcreate --type zero -L|--size Size[m|UNIT] VG [ -l|--extents Number[PERCENT] ] [ COMMON_OPTIONS ] Create a linear LV. lvcreate --type linear -L|--size Size[m|UNIT] VG [ -l|--extents Number[PERCENT] ] [ COMMON_OPTIONS ] [ PV ... ] Create a striped LV (also see lvcreate --stripes). lvcreate --type striped -L|--size Size[m|UNIT] VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ] Create a mirror LV (also see --type raid1). lvcreate --type mirror -L|--size Size[m|UNIT] VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -m|--mirrors Number ] [ -R|--regionsize Size[m|UNIT] ] [ --mirrorlog core|disk ] [ COMMON_OPTIONS ] [ PV ... ] Create a COW snapshot LV of an origin LV (also see --snapshot). lvcreate --type snapshot -L|--size Size[m|UNIT] LV [ -l|--extents Number[PERCENT] ] [ -s|--snapshot ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -c|--chunksize Size[k|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ] Create a sparse COW snapshot LV of a virtual origin LV (also see --snapshot). lvcreate --type snapshot -L|--size Size[m|UNIT] -V|--virtualsize Size[m|UNIT] VG [ -l|--extents Number[PERCENT] ] [ -s|--snapshot ] [ -c|--chunksize Size[k|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ] Create a thin pool. lvcreate -T|--thin -L|--size Size[m|UNIT] VG [ --type thin-pool ] (implied) [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -c|--chunksize Size[k|UNIT] ] [ --discards passdown|nopassdown|ignore ] [ --errorwhenfull y|n ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a thin pool named in --thinpool. lvcreate -L|--size Size[m|UNIT] --thinpool LV_new VG [ --type thin-pool ] (implied) [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -T|--thin ] [ -c|--chunksize Size[k|UNIT] ] [ --discards passdown|nopassdown|ignore ] [ --errorwhenfull y|n ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a cache pool named by the --cachepool arg (variant, uses --cachepool in place of --name). lvcreate --type cache-pool -L|--size Size[m|UNIT] --cachepool LV_new VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -H|--cache ] [ -c|--chunksize Size[k|UNIT] ] [ --cachemode writethrough|writeback|passthrough ] [ --cachepolicy String ] [ --cachesettings String ] [ --cachemetadataformat auto|1|2 ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a thin LV in a thin pool. lvcreate --type thin -V|--virtualsize Size[m|UNIT] --thinpool LV VG [ -T|--thin ] [ COMMON_OPTIONS ] Create a thin LV in a thin pool named in the first arg (variant, also see --thinpool for naming pool). lvcreate --type thin -V|--virtualsize Size[m|UNIT] LV1 [ -T|--thin ] [ COMMON_OPTIONS ] LV1 types: thinpool Create a thin LV in the thin pool named in the first arg (also see --thinpool for naming pool.) lvcreate -V|--virtualsize Size[m|UNIT] LV1 [ --type thin ] (implied) [ -T|--thin ] [ COMMON_OPTIONS ] LV1 types: thinpool Create a thin LV that is a snapshot of an existing thin LV. lvcreate --type thin LV1 [ -T|--thin ] [ COMMON_OPTIONS ] LV1 types: thin Create a thin LV that is a snapshot of an existing thin LV. lvcreate -T|--thin LV1 [ --type thin ] (implied) [ COMMON_OPTIONS ] LV1 types: thin Create a thin LV that is a snapshot of an external origin LV. lvcreate -s|--snapshot --thinpool LV LV [ --type thin ] (implied) [ COMMON_OPTIONS ] Create a VDO LV with VDO pool. lvcreate --vdo -L|--size Size[m|UNIT] VG [ --type vdo ] (implied) [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -V|--virtualsize Size[m|UNIT] ] [ --vdopool LV_new ] [ --compression y|n ] [ --deduplication y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a VDO LV with VDO pool. lvcreate --vdopool LV_new -L|--size Size[m|UNIT] VG [ --type vdo ] (implied) [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -V|--virtualsize Size[m|UNIT] ] [ --compression y|n ] [ --deduplication y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a thin LV, first creating a thin pool for it, where the new thin pool is named by the --thinpool arg. lvcreate --type thin -V|--virtualsize Size[m|UNIT] -L|--size Size[m|UNIT] --thinpool LV_new VG [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -T|--thin ] [ -c|--chunksize Size[k|UNIT] ] [ --discards passdown|nopassdown|ignore ] [ --errorwhenfull y|n ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a thin LV, first creating a thin pool for it, where the new thin pool is named by --thinpool. lvcreate -V|--virtualsize Size[m|UNIT] -L|--size Size[m|UNIT] --thinpool LV_new VG [ --type thin ] (implied) [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -T|--thin ] [ -c|--chunksize Size[k|UNIT] ] [ --discards passdown|nopassdown|ignore ] [ --errorwhenfull y|n ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a thin LV, first creating a thin pool for it, where the new thin pool is named in the first arg, or the new thin pool name is generated when the first arg is a VG name. lvcreate --type thin -V|--virtualsize Size[m|UNIT] -L|--size Size[m|UNIT] VG|LV_new [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -T|--thin ] [ -c|--chunksize Size[k|UNIT] ] [ --discards passdown|nopassdown|ignore ] [ --errorwhenfull y|n ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a thin LV, first creating a thin pool for it, where the new thin pool is named in the first arg, or the new thin pool name is generated when the first arg is a VG name. lvcreate -T|--thin -V|--virtualsize Size[m|UNIT] -L|--size Size[m|UNIT] VG|LV_new [ --type thin ] (implied) [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -c|--chunksize Size[k|UNIT] ] [ --discards passdown|nopassdown|ignore ] [ --errorwhenfull y|n ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a thin LV, first creating a thin pool for it. Create a sparse snapshot of a virtual origin LV Chooses type thin or snapshot according to config setting sparse_segtype_default. lvcreate -L|--size Size[m|UNIT] -V|--virtualsize Size[m|UNIT] VG [ --type thin|snapshot ] (implied) [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -s|--snapshot ] [ -T|--thin ] [ -c|--chunksize Size[k|UNIT] ] [ --discards passdown|nopassdown|ignore ] [ --errorwhenfull y|n ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] Create a new LV, then attach the specified cachepool which converts the new LV to type cache. lvcreate -L|--size Size[m|UNIT] --cachepool LV VG [ --type cache ] (implied) [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -H|--cache ] [ -c|--chunksize Size[k|UNIT] ] [ --cachemode writethrough|writeback|passthrough ] [ --cachepolicy String ] [ --cachesettings String ] [ --cachemetadataformat auto|1|2 ] [ COMMON_OPTIONS ] [ PV ... ] Create a new LV, then attach the specified cachepool which converts the new LV to type cache. (variant, also use --cachepool). lvcreate --type cache -L|--size Size[m|UNIT] LV1 [ -l|--extents Number[PERCENT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ -H|--cache ] [ -c|--chunksize Size[k|UNIT] ] [ --cachemode writethrough|writeback|passthrough ] [ --cachepolicy String ] [ --cachesettings String ] [ --cachemetadataformat auto|1|2 ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] LV1 types: cachepool When the LV arg is a cachepool, then create a new LV and attach the cachepool arg to it. (variant, use --type cache and --cachepool.) When the LV arg is not a cachepool, then create a new cachepool and attach it to the LV arg (alternative, use lvconvert.) lvcreate -H|--cache -L|--size Size[m|UNIT] LV [ --type cache ] (implied) [ -l|--extents Number[PERCENT] ] [ -c|--chunksize Size[k|UNIT] ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ --cachemode writethrough|writeback|passthrough ] [ --cachepolicy String ] [ --cachesettings String ] [ --cachemetadataformat auto|1|2 ] [ --poolmetadatasize Size[m|UNIT] ] [ --poolmetadataspare y|n ] [ COMMON_OPTIONS ] [ PV ... ] EXAMPLES top Create a striped LV with 3 stripes, a stripe size of 8 KiB and a size of 100 MiB. The LV name is chosen by lvcreate. lvcreate -i 3 -I 8 -L 100m vg00 Create a raid1 LV with two images, and a usable size of 500 MiB. This operation requires two devices, one for each mirror image. RAID metadata (superblock and bitmap) is also included on the two devices. lvcreate --type raid1 -m1 -L 500m -n mylv vg00 Create a mirror LV with two images, and a usable size of 500 MiB. This operation requires three devices: two for mirror images and one for a disk log. lvcreate --type mirror -m1 -L 500m -n mylv vg00 Create a mirror LV with 2 images, and a usable size of 500 MiB. This operation requires 2 devices because the log is in memory. lvcreate --type mirror -m1 --mirrorlog core -L 500m -n mylv vg00 Create a copy-on-write snapshot of an LV: lvcreate --snapshot --size 100m --name mysnap vg00/mylv Create a copy-on-write snapshot with a size sufficient for overwriting 20% of the size of the original LV. lvcreate -s -l 20%ORIGIN -n mysnap vg00/mylv Create a sparse LV with 1 TiB of virtual space, and actual space just under 100 MiB. lvcreate --snapshot --virtualsize 1t --size 100m --name mylv vg00 Create a linear LV with a usable size of 64 MiB on specific physical extents. lvcreate -L 64m -n mylv vg00 /dev/sda:0-7 /dev/sdb:0-7 Create a RAID5 LV with a usable size of 5 GiB, 3 stripes, a stripe size of 64 KiB, using a total of 4 devices (including one for parity). lvcreate --type raid5 -L 5G -i 3 -I 64 -n mylv vg00 Create a RAID5 LV using all of the free space in the VG and spanning all the PVs in the VG (note that the command will fail if there are more than 8 PVs in the VG, in which case -i 7 must be used to get to the current maximum of 8 devices including parity for RaidLVs). lvcreate --config allocation/raid_stripe_all_devices=1 --type raid5 -l 100%FREE -n mylv vg00 Create RAID10 LV with a usable size of 5 GiB, using 2 stripes, each on a two-image mirror. (Note that the -i and -m arguments behave differently: -i specifies the total number of stripes, but -m specifies the number of images in addition to the first image). lvcreate --type raid10 -L 5G -i 2 -m 1 -n mylv vg00 Create a 1 TiB thin LV mythin, with 256 GiB thinpool tpool0 in vg00. lvcreate -T -V 1T --size 256G --name mythin vg00/tpool0 Create a 1 TiB thin LV, first creating a new thin pool for it, where the thin pool has 100 MiB of space, uses 2 stripes, has a 64 KiB stripe size, and 256 KiB chunk size. lvcreate --type thin --name mylv --thinpool mypool -V 1t -L 100m -i 2 -I 64 -c 256 vg00 Create a thin snapshot of a thin LV (the size option must not be used, otherwise a copy-on-write snapshot would be created). lvcreate --snapshot --name mysnap vg00/thinvol Create a thin snapshot of the read-only inactive LV named "origin" which becomes an external origin for the thin snapshot LV. lvcreate --snapshot --name mysnap --thinpool mypool vg00/origin Create a cache pool from a fast physical device. The cache pool can then be used to cache an LV. lvcreate --type cache-pool -L 1G -n my_cpool vg00 /dev/fast1 Create a cache LV, first creating a new origin LV on a slow physical device, then combining the new origin LV with an existing cache pool. lvcreate --type cache --cachepool my_cpool -L 100G -n mylv vg00 /dev/slow1 Create a VDO LV vdo0 with VDOPoolLV size of 10 GiB and name vpool1. lvcreate --vdo --size 10G --name vdo0 vg00/vpool1 SEE ALSO top lvm(8), lvm.conf(5), lvmconfig(8), lvmdevices(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgcreate(8), vgconvert(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8), lvcreate(8), lvchange(8), lvconvert(8), lvdisplay(8), lvextend(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), lvm-fullreport(8), lvm-lvpoll(8), blkdeactivate(8), lvmdump(8), dmeventd(8), lvmpolld(8), lvmlockd(8), lvmlockctl(8), cmirrord(8), lvmdbusd(8), fsadm(8), lvmsystemid(7), lvmreport(7), lvmcache(7), lvmraid(7), lvmthin(7), lvmvdo(7), lvmautoactivation(7) COLOPHON top This page is part of the lvm2 (Logical Volume Manager 2) project. Information about the project can be found at http://www.sourceware.org/lvm2/. If you have a bug report for this manual page, see https://github.com/lvmteam/lvm2/issues. This page was obtained from the project's upstream Git repository git://sourceware.org/git/lvm2.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-06.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Red Hat, Inc. LVM TOOLS 2.03.24(2)-git (2023-11-21) LVCREATE(8) Pages that refer to this page: lvmcache(7), lvmraid(7), lvmreport(7), lvmthin(7), lvmvdo(7), lvchange(8), lvconvert(8), lvcreate(8), lvdisplay(8), lvextend(8), lvm(8), lvmconfig(8), lvmdevices(8), lvmdiskscan(8), lvm-fullreport(8), lvm-lvpoll(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgconvert(8), vgcreate(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lvcreate\n\n> Create a logical volume in an existing volume group. A volume group is a collection of logical and physical volumes.\n> See also: `lvm`.\n> More information: <https://man7.org/linux/man-pages/man8/lvcreate.8.html>.\n\n- Create a logical volume of 10 gigabytes in the volume group vg1:\n\n`lvcreate -L {{10G}} {{vg1}}`\n\n- Create a 1500 megabyte linear logical volume named mylv in the volume group vg1:\n\n`lvcreate -L {{1500}} -n {{mylv}} {{vg1}}`\n\n- Create a logical volume called mylv that uses 60% of the total space in volume group vg1:\n\n`lvcreate -l {{60%VG}} -n {{mylv}} {{vg1}}`\n\n- Create a logical volume called mylv that uses all the unallocated space in the volume group vg1:\n\n`lvcreate -l {{100%FREE}} -n {{mylv}} {{vg1}}`\n
lvdisplay
lvdisplay(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lvdisplay(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | USAGE | OPTIONS | VARIABLES | ENVIRONMENT VARIABLES | SEE ALSO | COLOPHON LVDISPLAY(8) System Manager's Manual LVDISPLAY(8) NAME top lvdisplay Display information about a logical volume SYNOPSIS top lvdisplay [ option_args ] [ position_args ] DESCRIPTION top lvdisplay shows the attributes of LVs, like size, read/write status, snapshot information, etc. lvs(8) is a preferred alternative that shows the same information and more, using a more compact and configurable output format. USAGE top lvdisplay [ -a|--all ] [ -c|--colon ] [ -C|--columns ] [ -H|--history ] [ -m|--maps ] [ -o|--options String ] [ -O|--sort String ] [ -S|--select String ] [ --aligned ] [ --binary ] [ --configreport log|vg|lv|pv|pvseg|seg ] [ --foreign ] [ --ignorelockingfailure ] [ --logonly ] [ --noheadings ] [ --nosuffix ] [ --readonly ] [ --segments ] [ --separator String ] [ --shared ] [ --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|LV|Tag ... ] Common options for lvm: [ -d|--debug ] [ -h|--help ] [ -q|--quiet ] [ -t|--test ] [ -v|--verbose ] [ -y|--yes ] [ --commandprofile String ] [ --config String ] [ --devices PV ] [ --devicesfile String ] [ --driverloaded y|n ] [ --journal String ] [ --lockopt String ] [ --longhelp ] [ --nohints ] [ --nolocking ] [ --profile String ] [ --version ] OPTIONS top --aligned Use with --separator to align the output columns -a|--all Show information about internal LVs. These are components of normal LVs, such as mirrors, which are not independently accessible, e.g. not mountable. --binary Use binary values "0" or "1" instead of descriptive literal values for columns that have exactly two valid values to report (not counting the "unknown" value which denotes that the value could not be determined). -c|--colon Generate colon separated output for easier parsing in scripts or programs. Also see vgs(8) which provides considerably more control over the output. -C|--columns Display output in columns, the equivalent of vgs(8). Options listed are the same as options given in vgs(8). --commandprofile String The command profile to use for command configuration. See lvm.conf(5) for more information about profiles. --config String Config settings for the command. These override lvm.conf(5) settings. The String arg uses the same format as lvm.conf(5), or may use section/field syntax. See lvm.conf(5) for more information about config. --configreport log|vg|lv|pv|pvseg|seg See lvmreport(7). -d|--debug ... Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log file and/or syslog (if configured). --devices PV Devices that the command can use. This option can be repeated or accepts a comma separated list of devices. This overrides the devices file. --devicesfile String A file listing devices that LVM should use. The file must exist in /etc/lvm/devices/ and is managed with the lvmdevices(8) command. This overrides the lvm.conf(5) devices/devicesfile and devices/use_devicesfile settings. --driverloaded y|n If set to no, the command will not attempt to use device- mapper. For testing and debugging. --foreign Report/display foreign VGs that would otherwise be skipped. See lvmsystemid(7) for more information about foreign VGs. -h|--help Display help text. -H|--history Include historical LVs in the output. (This has no effect unless LVs were removed while lvm.conf(5) metadata/record_lvs_history was enabled. --ignorelockingfailure Allows a command to continue with read-only metadata operations after locking failures. --journal String Record information in the systemd journal. This information is in addition to information enabled by the lvm.conf log/journal setting. command: record information about the command. output: record the default command output. debug: record full command debugging. --lockopt String Used to pass options for special cases to lvmlockd. See lvmlockd(8) for more information. --logonly Suppress command report and display only log report. --longhelp Display long help text. -m|--maps Display the mapping of logical extents to PVs and physical extents. To map physical extents to logical extents use: pvs --segments -o+lv_name,seg_start_pe,segtype --noheadings Suppress the headings line that is normally the first line of output. Useful if grepping the output. --nohints Do not use the hints file to locate devices for PVs. A command may read more devices to find PVs when hints are not used. The command will still perform standard hint file invalidation where appropriate. --nolocking Disable locking. --nosuffix Suppress the suffix on output sizes. Use with --units (except h and H) if processing the output. -o|--options String Comma-separated, ordered list of fields to display in columns. String arg syntax is: [+|-|#]Field1[,Field2 ...] The prefix + will append the specified fields to the default fields, - will remove the specified fields from the default fields, and # will compact specified fields (removing them when empty for all rows.) Use -o help to view the list of all available fields. Use separate lists of fields to add, remove or compact by repeating the -o option: -o+field1,field2 -o-field3,field4 -o#field5. These lists are evaluated from left to right. Use field name lv_all to view all LV fields, vg_all all VG fields, pv_all all PV fields, pvseg_all all PV segment fields, seg_all all LV segment fields, and pvseg_all all PV segment columns. See the lvm.conf(5) report section for more config options. See lvmreport(7) for more information about reporting. --profile String An alias for --commandprofile or --metadataprofile, depending on the command. -q|--quiet ... Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress any prompts with answer 'no'. --readonly Run the command in a special read-only mode which will read on-disk metadata without needing to take any locks. This can be used to peek inside metadata used by a virtual machine image while the virtual machine is running. No attempt will be made to communicate with the device-mapper kernel driver, so this option is unable to report whether or not LVs are actually in use. --segments -S|--select String Select objects for processing and reporting based on specified criteria. The criteria syntax is described by --select help and lvmreport(7). For reporting commands, one row is displayed for each object matching the criteria. See --options help for selectable object fields. Rows can be displayed with an additional "selected" field (-o selected) showing 1 if the row matches the selection and 0 otherwise. For non-reporting commands which process LVM entities, the selection is used to choose items to process. --separator String String to use to separate each column. Useful if grepping the output. --shared Report/display shared VGs that would otherwise be skipped when lvmlockd is not being used on the host. See lvmlockd(8) for more information about shared VGs. -O|--sort String Comma-separated ordered list of columns to sort by. Replaces the default selection. Precede any column with - for a reverse sort on that column. -t|--test Run in test mode. Commands will not update metadata. This is implemented by disabling all metadata writing but nevertheless returning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but hasn't. --unbuffered Produce output immediately without sorting or aligning the columns properly. --units [Number]r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E All sizes are output in these units: human-(r)eadable with '<' rounding indicator, (h)uman-readable, (b)ytes, (s)ectors, (k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes. Capitalise to use multiples of 1000 (S.I.) instead of 1024. Custom units can be specified, e.g. --units 3M. -v|--verbose ... Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr. --version Display version information. -y|--yes Do not prompt for confirmation interactively but always assume the answer yes. Use with extreme caution. (For automatic no, see -qq.) VARIABLES top VG Volume Group name. See lvm(8) for valid names. LV Logical Volume name. See lvm(8) for valid names. An LV positional arg generally includes the VG name and LV name, e.g. VG/LV. Tag Tag name. See lvm(8) for information about tag names and using tags in place of a VG, LV or PV. String See the option description for information about the string content. Size[UNIT] Size is an input number that accepts an optional unit. Input units are always treated as base two values, regardless of capitalization, e.g. 'k' and 'K' both refer to 1024. The default input unit is specified by letter, followed by |UNIT. UNIT represents other possible input units: b|B is bytes, s|S is sectors of 512 bytes, k|K is KiB, m|M is MiB, g|G is GiB, t|T is TiB, p|P is PiB, e|E is EiB. (This should not be confused with the output control --units, where capital letters mean multiple of 1000.) ENVIRONMENT VARIABLES top See lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for a required VG parameter. SEE ALSO top lvm(8), lvm.conf(5), lvmconfig(8), lvmdevices(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgcreate(8), vgconvert(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8), lvcreate(8), lvchange(8), lvconvert(8), lvdisplay(8), lvextend(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), lvm-fullreport(8), lvm-lvpoll(8), blkdeactivate(8), lvmdump(8), dmeventd(8), lvmpolld(8), lvmlockd(8), lvmlockctl(8), cmirrord(8), lvmdbusd(8), fsadm(8), lvmsystemid(7), lvmreport(7), lvmcache(7), lvmraid(7), lvmthin(7), lvmvdo(7), lvmautoactivation(7) COLOPHON top This page is part of the lvm2 (Logical Volume Manager 2) project. Information about the project can be found at http://www.sourceware.org/lvm2/. If you have a bug report for this manual page, see https://github.com/lvmteam/lvm2/issues. This page was obtained from the project's upstream Git repository git://sourceware.org/git/lvm2.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-06.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Red Hat, Inc. LVM TOOLS 2.03.24(2)-git (2023-11-21) LVDISPLAY(8) Pages that refer to this page: lvmcache(7), lvchange(8), lvconvert(8), lvcreate(8), lvdisplay(8), lvextend(8), lvm(8), lvmconfig(8), lvmdevices(8), lvmdiskscan(8), lvm-fullreport(8), lvm-lvpoll(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgconvert(8), vgcreate(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lvdisplay\n\n> Display information about Logical Volume Manager (LVM) logical volumes.\n> See also: `lvm`.\n> More information: <https://man7.org/linux/man-pages/man8/lvdisplay.8.html>.\n\n- Display information about all logical volumes:\n\n`sudo lvdisplay`\n\n- Display information about all logical volumes in volume group vg1:\n\n`sudo lvdisplay {{vg1}}`\n\n- Display information about logical volume lv1 in volume group vg1:\n\n`sudo lvdisplay {{vg1/lv1}}`\n
lvextend
lvextend(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lvextend(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | USAGE | OPTIONS | VARIABLES | ENVIRONMENT VARIABLES | EXAMPLES | SEE ALSO | COLOPHON LVEXTEND(8) System Manager's Manual LVEXTEND(8) NAME top lvextend Add space to a logical volume SYNOPSIS top lvextend option_args position_args [ option_args ] [ position_args ] --alloc contiguous|cling|cling_by_tags|normal|anywhere| inherit -A|--autobackup y|n --commandprofile String --config String -d|--debug --devices PV --devicesfile String --driverloaded y|n -l|--extents [+]Number[PERCENT] -f|--force -h|--help --journal String --lockopt String --longhelp -m|--mirrors Number -n|--nofsck --nohints --nolocking --nosync --noudevsync --poolmetadatasize [+]Size[m|UNIT] --profile String -q|--quiet --reportformat basic|json -r|--resizefs -L|--size [+]Size[m|UNIT] -i|--stripes Number -I|--stripesize Size[k|UNIT] -t|--test --type linear|striped|snapshot|raid|mirror|thin|thin-pool| vdo|vdo-pool|cache|cache-pool|writecache --usepolicies -v|--verbose --version -y|--yes DESCRIPTION top lvextend extends the size of an LV. This requires allocating logical extents from the VG's free physical extents. If the extension adds a new LV segment, the new segment will use the existing segment type of the LV. Extending a copy-on-write snapshot LV adds space for COW blocks. Use lvconvert(8) to change the number of data images in a RAID or mirrored LV. In the usage section below, --size Size can be replaced with --extents Number. See both descriptions the options section. USAGE top Extend an LV by a specified size. lvextend -L|--size [+]Size[m|UNIT] LV [ -l|--extents [+]Number[PERCENT] ] [ -r|--resizefs ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ --poolmetadatasize [+]Size[m|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ] Extend an LV by specified PV extents. lvextend LV PV ... [ -r|--resizefs ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ COMMON_OPTIONS ] Extend a pool metadata SubLV by a specified size. lvextend --poolmetadatasize [+]Size[m|UNIT] LV1 [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ] LV1 types: thinpool Extend an LV according to a predefined policy. lvextend --usepolicies LV1 [ -r|--resizefs ] [ COMMON_OPTIONS ] [ PV ... ] LV1 types: snapshot thinpool Common options for command: [ -A|--autobackup y|n ] [ -f|--force ] [ -m|--mirrors Number ] [ -n|--nofsck ] [ --alloc contiguous|cling|cling_by_tags|normal|anywhere| inherit ] [ --nosync ] [ --noudevsync ] [ --reportformat basic|json ] [ --type linear|striped|snapshot|raid|mirror|thin| thin-pool|vdo|vdo-pool|cache|cache-pool|writecache ] Common options for lvm: [ -d|--debug ] [ -h|--help ] [ -q|--quiet ] [ -t|--test ] [ -v|--verbose ] [ -y|--yes ] [ --commandprofile String ] [ --config String ] [ --devices PV ] [ --devicesfile String ] [ --driverloaded y|n ] [ --journal String ] [ --lockopt String ] [ --longhelp ] [ --nohints ] [ --nolocking ] [ --profile String ] [ --version ] OPTIONS top --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit Determines the allocation policy when a command needs to allocate Physical Extents (PEs) from the VG. Each VG and LV has an allocation policy which can be changed with vgchange/lvchange, or overridden on the command line. normal applies common sense rules such as not placing parallel stripes on the same PV. inherit applies the VG policy to an LV. contiguous requires new PEs be placed adjacent to existing PEs. cling places new PEs on the same PV as existing PEs in the same stripe of the LV. If there are sufficient PEs for an allocation, but normal does not use them, anywhere will use them even if it reduces performance, e.g. by placing two stripes on the same PV. Optional positional PV args on the command line can also be used to limit which PVs the command will use for allocation. See lvm(8) for more information about allocation. -A|--autobackup y|n Specifies if metadata should be backed up automatically after a change. Enabling this is strongly advised! See vgcfgbackup(8) for more information. --commandprofile String The command profile to use for command configuration. See lvm.conf(5) for more information about profiles. --config String Config settings for the command. These override lvm.conf(5) settings. The String arg uses the same format as lvm.conf(5), or may use section/field syntax. See lvm.conf(5) for more information about config. -d|--debug ... Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log file and/or syslog (if configured). --devices PV Devices that the command can use. This option can be repeated or accepts a comma separated list of devices. This overrides the devices file. --devicesfile String A file listing devices that LVM should use. The file must exist in /etc/lvm/devices/ and is managed with the lvmdevices(8) command. This overrides the lvm.conf(5) devices/devicesfile and devices/use_devicesfile settings. --driverloaded y|n If set to no, the command will not attempt to use device- mapper. For testing and debugging. -l|--extents [+]Number[PERCENT] Specifies the new size of the LV in logical extents. The --size and --extents options are alternate methods of specifying size. The total number of physical extents used will be greater when redundant data is needed for RAID levels. An alternate syntax allows the size to be determined indirectly as a percentage of the size of a related VG, LV, or set of PVs. The suffix %VG denotes the total size of the VG, the suffix %FREE the remaining free space in the VG, and the suffix %PVS the free space in the specified PVs. For a snapshot, the size can be expressed as a percentage of the total size of the origin LV with the suffix %ORIGIN (100%ORIGIN provides space for the whole origin). When expressed as a percentage, the size defines an upper limit for the number of logical extents in the new LV. The precise number of logical extents in the new LV is not determined until the command has completed. When the plus + or minus - prefix is used, the value is not an absolute size, but is relative and added or subtracted from the current size. -f|--force ... Override various checks, confirmations and protections. Use with extreme caution. -h|--help Display help text. --journal String Record information in the systemd journal. This information is in addition to information enabled by the lvm.conf log/journal setting. command: record information about the command. output: record the default command output. debug: record full command debugging. --lockopt String Used to pass options for special cases to lvmlockd. See lvmlockd(8) for more information. --longhelp Display long help text. -m|--mirrors Number Not used. -n|--nofsck Do not perform fsck before resizing filesystem when filesystem requires it. You may need to use --force to proceed with this option. --nohints Do not use the hints file to locate devices for PVs. A command may read more devices to find PVs when hints are not used. The command will still perform standard hint file invalidation where appropriate. --nolocking Disable locking. --nosync Causes the creation of mirror, raid1, raid4, raid5 and raid10 to skip the initial synchronization. In case of mirror, raid1 and raid10, any data written afterwards will be mirrored, but the original contents will not be copied. In case of raid4 and raid5, no parity blocks will be written, though any data written afterwards will cause parity blocks to be stored. This is useful for skipping a potentially long and resource intensive initial sync of an empty mirror/raid1/raid4/raid5 and raid10 LV. This option is not valid for raid6, because raid6 relies on proper parity (P and Q Syndromes) being created during initial synchronization in order to reconstruct proper user date in case of device failures. raid0 and raid0_meta do not provide any data copies or parity support and thus do not support initial synchronization. --noudevsync Disables udev synchronisation. The process will not wait for notification from udev. It will continue irrespective of any possible udev processing in the background. Only use this if udev is not running or has rules that ignore the devices LVM creates. --poolmetadatasize [+]Size[m|UNIT] Specifies the new size of the pool metadata LV. The plus prefix + can be used, in which case the value is added to the current size. --profile String An alias for --commandprofile or --metadataprofile, depending on the command. -q|--quiet ... Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress any prompts with answer 'no'. --reportformat basic|json Overrides current output format for reports which is defined globally by the report/output_format setting in lvm.conf(5). basic is the original format with columns and rows. If there is more than one report per command, each report is prefixed with the report name for identification. json produces report output in JSON format. See lvmreport(7) for more information. -r|--resizefs Resize underlying filesystem together with the LV using fsadm(8). -L|--size [+]Size[m|UNIT] Specifies the new size of the LV. The --size and --extents options are alternate methods of specifying size. The total number of physical extents used will be greater when redundant data is needed for RAID levels. When the plus + or minus - prefix is used, the value is not an absolute size, but is relative and added or subtracted from the current size. -i|--stripes Number Specifies the number of stripes in a striped LV. This is the number of PVs (devices) that a striped LV is spread across. Data that appears sequential in the LV is spread across multiple devices in units of the stripe size (see --stripesize). This does not change existing allocated space, but only applies to space being allocated by the command. When creating a RAID 4/5/6 LV, this number does not include the extra devices that are required for parity. The largest number depends on the RAID type (raid0: 64, raid10: 32, raid4/5: 63, raid6: 62), and when unspecified, the default depends on the RAID type (raid0: 2, raid10: 2, raid4/5: 3, raid6: 5.) To stripe a new raid LV across all PVs by default, see lvm.conf(5) allocation/raid_stripe_all_devices. -I|--stripesize Size[k|UNIT] The amount of data that is written to one device before moving to the next in a striped LV. -t|--test Run in test mode. Commands will not update metadata. This is implemented by disabling all metadata writing but nevertheless returning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but hasn't. --type linear|striped|snapshot|raid|mirror|thin|thin-pool|vdo| vdo-pool|cache|cache-pool|writecache The LV type, also known as "segment type" or "segtype". See usage descriptions for the specific ways to use these types. For more information about redundancy and performance (raid<N>, mirror, striped, linear) see lvmraid(7). For thin provisioning (thin, thin-pool) see lvmthin(7). For performance caching (cache, cache-pool) see lvmcache(7). For copy-on-write snapshots (snapshot) see usage definitions. For VDO (vdo) see lvmvdo(7). Several commands omit an explicit type option because the type is inferred from other options or shortcuts (e.g. --stripes, --mirrors, --snapshot, --virtualsize, --thin, --cache, --vdo). Use inferred types with care because it can lead to unexpected results. --usepolicies Perform an operation according to the policy configured in lvm.conf(5) or a profile. -v|--verbose ... Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr. --version Display version information. -y|--yes Do not prompt for confirmation interactively but always assume the answer yes. Use with extreme caution. (For automatic no, see -qq.) VARIABLES top LV Logical Volume name. See lvm(8) for valid names. An LV positional arg generally includes the VG name and LV name, e.g. VG/LV. LV1 indicates the LV must have a specific type, where the accepted LV types are listed. (raid represents raid<N> type). PV Physical Volume name, a device path under /dev. For commands managing physical extents, a PV positional arg generally accepts a suffix indicating a range (or multiple ranges) of physical extents (PEs). When the first PE is omitted, it defaults to the start of the device, and when the last PE is omitted it defaults to end. Start and end range (inclusive): PV[:PE-PE]... Start and length range (counting from 0): PV[:PE+PE]... String See the option description for information about the string content. Size[UNIT] Size is an input number that accepts an optional unit. Input units are always treated as base two values, regardless of capitalization, e.g. 'k' and 'K' both refer to 1024. The default input unit is specified by letter, followed by |UNIT. UNIT represents other possible input units: b|B is bytes, s|S is sectors of 512 bytes, k|K is KiB, m|M is MiB, g|G is GiB, t|T is TiB, p|P is PiB, e|E is EiB. (This should not be confused with the output control --units, where capital letters mean multiple of 1000.) ENVIRONMENT VARIABLES top See lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for a required VG parameter. EXAMPLES top Extend the size of an LV by 54MiB, using a specific PV. lvextend -L +54 vg01/lvol10 /dev/sdk3 Extend the size of an LV by the amount of free space on PV /dev/sdk3. This is equivalent to specifying "-l +100%PVS" on the command line. lvextend vg01/lvol01 /dev/sdk3 Extend an LV by 16MiB using specific physical extents. lvextend -L+16m vg01/lvol01 /dev/sda:8-9 /dev/sdb:8-9 Extend an LV to use all remaining free space in volume group and all resize its filesystem with fsadm(8). lvextend -l+100%FREE -r vg01/lvol01 SEE ALSO top lvm(8), lvm.conf(5), lvmconfig(8), lvmdevices(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgcreate(8), vgconvert(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8), lvcreate(8), lvchange(8), lvconvert(8), lvdisplay(8), lvextend(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), lvm-fullreport(8), lvm-lvpoll(8), blkdeactivate(8), lvmdump(8), dmeventd(8), lvmpolld(8), lvmlockd(8), lvmlockctl(8), cmirrord(8), lvmdbusd(8), fsadm(8), lvmsystemid(7), lvmreport(7), lvmcache(7), lvmraid(7), lvmthin(7), lvmvdo(7), lvmautoactivation(7) COLOPHON top This page is part of the lvm2 (Logical Volume Manager 2) project. Information about the project can be found at http://www.sourceware.org/lvm2/. If you have a bug report for this manual page, see https://github.com/lvmteam/lvm2/issues. This page was obtained from the project's upstream Git repository git://sourceware.org/git/lvm2.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-06.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Red Hat, Inc. LVM TOOLS 2.03.24(2)-git (2023-11-21) LVEXTEND(8) Pages that refer to this page: lvmcache(7), lvmraid(7), lvmthin(7), lvmvdo(7), dmeventd(8), lvchange(8), lvconvert(8), lvcreate(8), lvdisplay(8), lvextend(8), lvm(8), lvmconfig(8), lvmdevices(8), lvmdiskscan(8), lvm-fullreport(8), lvm-lvpoll(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), resize2fs(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgconvert(8), vgcreate(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lvextend\n\n> Increase the size of a logical volume.\n> See also: `lvm`.\n> More information: <https://manned.org/lvextend.8>.\n\n- Increase a volume's size to 120 GB:\n\n`lvextend --size {{120G}} {{logical_volume}}`\n\n- Increase a volume's size by 40 GB as well as the underlying filesystem:\n\n`lvextend --size +{{40G}} -r {{logical_volume}}`\n\n- Increase a volume's size to 100% of the free physical volume space:\n\n`lvextend --size +{{100}}%FREE {{logical_volume}}`\n
lvm
lvm(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lvm(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | BUILT-IN COMMANDS | COMMANDS | VALID NAMES | UNIQUE NAMES | ALLOCATION | LOGICAL VOLUME TYPES | DIAGNOSTICS | ENVIRONMENT VARIABLES | FILES | SEE ALSO | COLOPHON LVM(8) System Manager's Manual LVM(8) NAME top lvm LVM2 tools SYNOPSIS top lvm [command|file] DESCRIPTION top The Logical Volume Manager (LVM) provides tools to create virtual block devices from physical devices. Virtual devices may be easier to manage than physical devices, and can have capabilities beyond what the physical devices provide themselves. A Volume Group (VG) is a collection of one or more physical devices, each called a Physical Volume (PV). A Logical Volume (LV) is a virtual block device that can be used by the system or applications. Each block of data in an LV is stored on one or more PV in the VG, according to algorithms implemented by Device Mapper (DM) in the kernel. The lvm command, and other commands listed below, are the command-line tools for LVM. A separate manual page describes each command in detail. If lvm is invoked with no arguments it presents a readline prompt (assuming it was compiled with readline support). LVM commands may be entered interactively at this prompt with readline facilities including history and command name and option completion. Refer to readline(3) for details. If lvm is invoked with argv[0] set to the name of a specific LVM command (for example by using a hard or soft link) it acts as that command. On invocation, lvm requires that only the standard file descriptors stdin, stdout and stderr are available. If others are found, they get closed and messages are issued warning about the leak. This warning can be suppressed by setting the environment variable LVM_SUPPRESS_FD_WARNINGS. Where commands take VG or LV names as arguments, the full path name is optional. An LV called "lvol0" in a VG called "vg0" can be specified as "vg0/lvol0". Where a list of VGs is required but is left empty, a list of all VGs will be substituted. Where a list of LVs is required but a VG is given, a list of all the LVs in that VG will be substituted. So lvdisplay vg0 will display all the LVs in "vg0". Tags can also be used - see --addtag below. One advantage of using the built-in shell is that configuration information gets cached internally between commands. A file containing a simple script with one command per line can also be given on the command line. The script can also be executed directly if the first line is #! followed by the absolute path of lvm. Additional hyphens within option names are ignored. For example, --readonly and --read-only are both accepted. BUILT-IN COMMANDS top The following commands are built into lvm without links normally being created in the filesystem for them. config The same as lvmconfig(8) below. devtypes Display the recognised built-in block device types. dumpconfig The same as lvmconfig(8) below. formats Display recognised metadata formats. fullreport Report information about PVs, PV segments, VGs, LVs and LV segments, all at once. help Display the help text. lastlog Display log report of last command run in LVM shell if command log reporting is enabled. lvpoll Complete lvmpolld operations (Internal command). segtypes Display recognised Logical Volume segment types. systemid Display any system ID currently set on this host. tags Display any tags defined on this host. version Display version information. COMMANDS top The following commands implement the core LVM functionality. pvchange Change attributes of a Physical Volume. pvck Check Physical Volume metadata. pvcreate Initialize a disk or partition for use by LVM. pvdisplay Display attributes of a Physical Volume. pvmove Move Physical Extents. pvremove Remove a Physical Volume. pvresize Resize a disk or partition in use by LVM2. pvs Report information about Physical Volumes. pvscan Scan all disks for Physical Volumes. vgcfgbackup Backup Volume Group descriptor area. vgcfgrestore Restore Volume Group descriptor area. vgchange Change attributes of a Volume Group. vgck Check Volume Group metadata. vgconvert Convert Volume Group metadata format. vgcreate Create a Volume Group. vgdisplay Display attributes of Volume Groups. vgexport Make volume Groups unknown to the system. vgextend Add Physical Volumes to a Volume Group. vgimport Make exported Volume Groups known to the system. vgimportclone Import and rename duplicated Volume Group (e.g. a hardware snapshot). vgimportdevices Add PVs from a VG to the devices file. vgmerge Merge two Volume Groups. vgmknodes Recreate Volume Group directory and Logical Volume special files vgreduce Reduce a Volume Group by removing one or more Physical Volumes. vgremove Remove a Volume Group. vgrename Rename a Volume Group. vgs Report information about Volume Groups. vgscan Scan all disks for Volume Groups. vgsplit Split a Volume Group into two, moving any logical volumes from one Volume Group to another by moving entire Physical Volumes. lvchange Change attributes of a Logical Volume. lvconvert Convert a Logical Volume from linear to mirror or snapshot. lvcreate Create a Logical Volume in an existing Volume Group. lvdisplay Display attributes of a Logical Volume. lvextend Extend the size of a Logical Volume. lvmconfig Display the configuration information after loading lvm.conf(5) and any other configuration files. lvmdevices Manage the devices file. lvmdiskscan Scan for all devices visible to LVM2. lvmdump Create lvm2 information dumps for diagnostic purposes. lvreduce Reduce the size of a Logical Volume. lvremove Remove a Logical Volume. lvrename Rename a Logical Volume. lvresize Resize a Logical Volume. lvs Report information about Logical Volumes. lvscan Scan (all disks) for Logical Volumes. The following LVM1 commands are not implemented in LVM2: lvmchange, lvmsadc, lvmsar, pvdata. For performance metrics, use dmstats(8) or to manipulate the kernel device-mapper driver used by LVM2 directly, use dmsetup(8). VALID NAMES top The valid characters for VG and LV names are: a-z A-Z 0-9 + _ . - VG names cannot begin with a hyphen. The name of a new LV also cannot begin with a hyphen. However, if the configuration setting metadata/record_lvs_history is enabled then an LV name with a hyphen as a prefix indicates that, although the LV was removed, it is still being tracked because it forms part of the history of at least one LV that is still present. This helps to record the ancestry of thin snapshots even after some links in the chain have been removed. A reference to the historical LV 'lvol1' in VG 'vg00' would be 'vg00/-lvol1' or just '-lvol1' if the VG is already set. (The latter form must be preceded by '--' to terminate command line option processing before reaching this argument.) There are also various reserved names that are used internally by lvm that can not be used as LV or VG names. A VG cannot be called anything that exists in /dev/ at the time of creation, nor can it be called '.' or '..'. An LV cannot be called '.', '..', 'snapshot' or 'pvmove'. The LV name may also not contain any of the following strings: '_cdata', '_cmeta', '_corig', '_iorig', '_mimage', '_mlog', '_pmspare', '_rimage', '_rmeta', '_tdata', '_tmeta', '_vdata', '_vorigin' or '_wcorig'. A directory bearing the name of each Volume Group is created under /dev when any of its Logical Volumes are activated. Each active Logical Volume is accessible from this directory as a symbolic link leading to a device node. Links or nodes in /dev/mapper are intended only for internal use and the precise format and escaping might change between releases and distributions. Other software and scripts should use the /dev/VolumeGroupName/LogicalVolumeName format to reduce the chance of needing amendment when the software is updated. Should you need to process the node names in /dev/mapper, you may use dmsetup splitname to separate out the original VG, LV and internal layer names. UNIQUE NAMES top VG names should be unique. vgcreate will produce an error if the specified VG name matches an existing VG name. However, there are cases where different VGs with the same name can appear to LVM, e.g. after moving disks or changing filters. When VGs with the same name exist, commands operating on all VGs will include all of the VGs with the same name. If the ambiguous VG name is specified on the command line, the command will produce an error. The error states that multiple VGs exist with the specified name. To process one of the VGs specifically, the --select option should be used with the UUID of the intended VG: --select vg_uuid=<uuid> An exception is if all but one of the VGs with the shared name is foreign (see lvmsystemid(7)). In this case, the one VG that is not foreign is assumed to be the intended VG and is processed. LV names are unique within a VG. The name of an historical LV cannot be reused until the historical LV has itself been removed or renamed. ALLOCATION top When an operation needs to allocate Physical Extents for one or more Logical Volumes, the tools proceed as follows: First of all, they generate the complete set of unallocated Physical Extents in the Volume Group. If any ranges of Physical Extents are supplied at the end of the command line, only unallocated Physical Extents within those ranges on the specified Physical Volumes are considered. Then they try each allocation policy in turn, starting with the strictest policy (contiguous) and ending with the allocation policy specified using --alloc or set as the default for the particular Logical Volume or Volume Group concerned. For each policy, working from the lowest-numbered Logical Extent of the empty Logical Volume space that needs to be filled, they allocate as much space as possible according to the restrictions imposed by the policy. If more space is needed, they move on to the next policy. The restrictions are as follows: Contiguous requires that the physical location of any Logical Extent that is not the first Logical Extent of a Logical Volume is adjacent to the physical location of the Logical Extent immediately preceding it. Cling requires that the Physical Volume used for any Logical Extent to be added to an existing Logical Volume is already in use by at least one Logical Extent earlier in that Logical Volume. If the configuration parameter allocation/cling_tag_list is defined, then two Physical Volumes are considered to match if any of the listed tags is present on both Physical Volumes. This allows groups of Physical Volumes with similar properties (such as their physical location) to be tagged and treated as equivalent for allocation purposes. When a Logical Volume is striped or mirrored, the above restrictions are applied independently to each stripe or mirror image (leg) that needs space. Normal will not choose a Physical Extent that shares the same Physical Volume as a Logical Extent already allocated to a parallel Logical Volume (i.e. a different stripe or mirror image/leg) at the same offset within that parallel Logical Volume. When allocating a mirror log at the same time as Logical Volumes to hold the mirror data, Normal will first try to select different Physical Volumes for the log and the data. If that's not possible and the allocation/mirror_logs_require_separate_pvs configuration parameter is set to 0, it will then allow the log to share Physical Volume(s) with part of the data. When allocating thin pool metadata, similar considerations to those of a mirror log in the last paragraph apply based on the value of the allocation/thin_pool_metadata_require_separate_pvs configuration parameter. If you rely upon any layout behaviour beyond that documented here, be aware that it might change in future versions of the code. For example, if you supply on the command line two empty Physical Volumes that have an identical number of free Physical Extents available for allocation, the current code considers using each of them in the order they are listed, but there is no guarantee that future releases will maintain that property. If it is important to obtain a specific layout for a particular Logical Volume, then you should build it up through a sequence of lvcreate(8) and lvconvert(8) steps such that the restrictions described above applied to each step leave the tools no discretion over the layout. To view the way the allocation process currently works in any specific case, read the debug logging output, for example by adding -vvvv to a command. LOGICAL VOLUME TYPES top Some logical volume types are simple to create and can be done with a single lvcreate(8) command. The linear and striped logical volume types are an example of this. Other logical volume types may require more than one command to create. The cache (lvmcache(7)) and thin provisioning (lvmthin(7)) types are examples of this. DIAGNOSTICS top All tools return a status code of zero on success or non-zero on failure. The non-zero codes distinguish only between the broad categories of unrecognised commands, problems processing the command line arguments and any other failures. As LVM remains under active development, the code used in a specific case occasionally changes between releases. Message text may also change. ENVIRONMENT VARIABLES top HOME Directory containing .lvm_history if the internal readline shell is invoked. LVM_OUT_FD File descriptor to use for common output from LVM commands. LVM_ERR_FD File descriptor to use for error output from LVM commands. LVM_REPORT_FD File descriptor to use for report output from LVM commands. LVM_COMMAND_PROFILE Name of default command profile to use for LVM commands. This profile is overridden by direct use of --commandprofile command line option. LVM_RUN_BY_DMEVENTD This variable is normally set by dmeventd plugin to inform lvm2 command it is running from dmeventd plugin so lvm2 takes some extra action to avoid communication and deadlocks with dmeventd. LVM_SYSTEM_DIR Directory containing lvm.conf(5) and other LVM system files. Defaults to "/etc/lvm". LVM_SUPPRESS_FD_WARNINGS Suppress warnings about unexpected file descriptors passed into LVM. LVM_SUPPRESS_SYSLOG Suppress contacting syslog. LVM_VG_NAME The Volume Group name that is assumed for any reference to a Logical Volume that doesn't specify a path. Not set by default. LVM_LVMPOLLD_PIDFILE Path to the file that stores the lvmpolld process ID. LVM_LVMPOLLD_SOCKET Path to the socket used to communicate with lvmpolld.. LVM_LOG_FILE_EPOCH A string of up to 32 letters appended to the log filename and followed by the process ID and a startup timestamp using this format string "_%s_%d_%llu". When set, each process logs to a separate file. LVM_LOG_FILE_MAX_LINES If more than this number of lines are sent to the log file, the command gets aborted. Automated tests use this to terminate looping commands. LVM_EXPECTED_EXIT_STATUS The status anticipated when the process exits. Use ">N" to match any status greater than N. If the actual exit status matches and a log file got produced, it is deleted. LVM_LOG_FILE_EPOCH and LVM_EXPECTED_EXIT_STATUS together allow automated test scripts to discard uninteresting log data. LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES Used to suppress warning messages when the configured locking is known to be unavailable. DM_ABORT_ON_INTERNAL_ERRORS Abort processing if the code detects a non-fatal internal error. DM_DISABLE_UDEV Avoid interaction with udev. LVM will manage the relevant nodes in /dev directly. DM_DEBUG_WITH_LINE_NUMBERS Prepends source file name and code line number with libdm debugging. FILES top /etc/lvm/lvm.conf $HOME/.lvm_history SEE ALSO top lvm(8), lvm.conf(5), lvmconfig(8), lvmdevices(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgcreate(8), vgconvert(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8), lvcreate(8), lvchange(8), lvconvert(8), lvdisplay(8), lvextend(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), lvm-fullreport(8), lvm-lvpoll(8), blkdeactivate(8), lvmdump(8), dmeventd(8), lvmpolld(8), lvmlockd(8), lvmlockctl(8), cmirrord(8), lvmdbusd(8), fsadm(8), lvmsystemid(7), lvmreport(7), lvmcache(7), lvmraid(7), lvmthin(7), lvmvdo(7), lvmautoactivation(7), dmsetup(8), dmstats(8), readline(3) COLOPHON top This page is part of the lvm2 (Logical Volume Manager 2) project. Information about the project can be found at http://www.sourceware.org/lvm2/. If you have a bug report for this manual page, see https://github.com/lvmteam/lvm2/issues. This page was obtained from the project's upstream Git repository git://sourceware.org/git/lvm2.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-06.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Red Hat, Inc. LVM TOOLS 2.03.24(2)-git (2023-11-21) LVM(8) Pages that refer to this page: lvm.conf(5), lvmcache(7), lvmraid(7), lvmreport(7), lvmsystemid(7), lvmthin(7), lvmvdo(7), blkdeactivate(8), cmirrord(8), dmeventd(8), fsadm(8), lvchange(8), lvconvert(8), lvcreate(8), lvdisplay(8), lvextend(8), lvm(8), lvmconfig(8), lvmdbusd(8), lvmdevices(8), lvmdiskscan(8), lvmdump(8), lvm-fullreport(8), lvm_import_vdo(8), lvmlockctl(8), lvmlockd(8), lvm-lvpoll(8), lvmpolld(8), lvmsadc(8), lvmsar(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), resize2fs(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgconvert(8), vgcreate(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8), xfs_freeze(8), xfs_growfs(8), xfs_info(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lvm\n\n> Manage physical volumes, volume groups, and logical volumes using the Logical Volume Manager (LVM) interactive shell.\n> More information: <https://man7.org/linux/man-pages/man8/lvm.8.html>.\n\n- Start the Logical Volume Manager interactive shell:\n\n`sudo lvm`\n\n- Initialize a drive or partition to be used as a physical volume:\n\n`sudo lvm pvcreate {{/dev/sdXY}}`\n\n- Display information about physical volumes:\n\n`sudo lvm pvdisplay`\n\n- Create a volume group called vg1 from the physical volume on `/dev/sdXY`:\n\n`sudo lvm vgcreate {{vg1}} {{/dev/sdXY}}`\n\n- Display information about volume groups:\n\n`sudo lvm vgdisplay`\n\n- Create a logical volume with size 10G from volume group vg1:\n\n`sudo lvm lvcreate -L {{10G}} {{vg1}}`\n\n- Display information about logical volumes:\n\n`sudo lvm lvdisplay`\n\n- Display help for a specific command:\n\n`lvm help {{command}}`\n
lvreduce
lvreduce(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lvreduce(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | USAGE | OPTIONS | VARIABLES | ENVIRONMENT VARIABLES | EXAMPLES | SEE ALSO | COLOPHON LVREDUCE(8) System Manager's Manual LVREDUCE(8) NAME top lvreduce Reduce the size of a logical volume SYNOPSIS top lvreduce option_args position_args [ option_args ] DESCRIPTION top lvreduce reduces the size of an LV. The freed logical extents are returned to the VG to be used by other LVs. A copy-on-write snapshot LV can also be reduced if less space is needed to hold COW blocks. Use lvconvert(8) to change the number of data images in a RAID or mirrored LV. Be careful when reducing an LV's size, because data in the reduced area is lost. Ensure that any file system on the LV is resized before running lvreduce so that the removed extents are not in use by the file system. Sizes will be rounded if necessary. For example, the LV size must be an exact number of extents, and the size of a striped segment must be a multiple of the number of stripes. In the usage section below, --size Size can be replaced with --extents Number. See both descriptions the options section. USAGE top lvreduce -L|--size [-]Size[m|UNIT] LV [ -l|--extents [-]Number[PERCENT] ] [ -A|--autobackup y|n ] [ -f|--force ] [ -n|--nofsck ] [ -r|--resizefs ] [ --noudevsync ] [ --reportformat basic|json ] [ COMMON_OPTIONS ] Common options for lvm: [ -d|--debug ] [ -h|--help ] [ -q|--quiet ] [ -t|--test ] [ -v|--verbose ] [ -y|--yes ] [ --commandprofile String ] [ --config String ] [ --devices PV ] [ --devicesfile String ] [ --driverloaded y|n ] [ --journal String ] [ --lockopt String ] [ --longhelp ] [ --nohints ] [ --nolocking ] [ --profile String ] [ --version ] OPTIONS top -A|--autobackup y|n Specifies if metadata should be backed up automatically after a change. Enabling this is strongly advised! See vgcfgbackup(8) for more information. --commandprofile String The command profile to use for command configuration. See lvm.conf(5) for more information about profiles. --config String Config settings for the command. These override lvm.conf(5) settings. The String arg uses the same format as lvm.conf(5), or may use section/field syntax. See lvm.conf(5) for more information about config. -d|--debug ... Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log file and/or syslog (if configured). --devices PV Devices that the command can use. This option can be repeated or accepts a comma separated list of devices. This overrides the devices file. --devicesfile String A file listing devices that LVM should use. The file must exist in /etc/lvm/devices/ and is managed with the lvmdevices(8) command. This overrides the lvm.conf(5) devices/devicesfile and devices/use_devicesfile settings. --driverloaded y|n If set to no, the command will not attempt to use device- mapper. For testing and debugging. -l|--extents [-]Number[PERCENT] Specifies the new size of the LV in logical extents. The --size and --extents options are alternate methods of specifying size. The total number of physical extents used will be greater when redundant data is needed for RAID levels. An alternate syntax allows the size to be determined indirectly as a percentage of the size of a related VG, LV, or set of PVs. The suffix %VG denotes the total size of the VG, the suffix %FREE the remaining free space in the VG, and the suffix %PVS the free space in the specified PVs. For a snapshot, the size can be expressed as a percentage of the total size of the origin LV with the suffix %ORIGIN (100%ORIGIN provides space for the whole origin). When expressed as a percentage, the size defines an upper limit for the number of logical extents in the new LV. The precise number of logical extents in the new LV is not determined until the command has completed. When the plus + or minus - prefix is used, the value is not an absolute size, but is relative and added or subtracted from the current size. -f|--force ... Override various checks, confirmations and protections. Use with extreme caution. -h|--help Display help text. --journal String Record information in the systemd journal. This information is in addition to information enabled by the lvm.conf log/journal setting. command: record information about the command. output: record the default command output. debug: record full command debugging. --lockopt String Used to pass options for special cases to lvmlockd. See lvmlockd(8) for more information. --longhelp Display long help text. -n|--nofsck Do not perform fsck before resizing filesystem when filesystem requires it. You may need to use --force to proceed with this option. --nohints Do not use the hints file to locate devices for PVs. A command may read more devices to find PVs when hints are not used. The command will still perform standard hint file invalidation where appropriate. --nolocking Disable locking. --noudevsync Disables udev synchronisation. The process will not wait for notification from udev. It will continue irrespective of any possible udev processing in the background. Only use this if udev is not running or has rules that ignore the devices LVM creates. --profile String An alias for --commandprofile or --metadataprofile, depending on the command. -q|--quiet ... Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress any prompts with answer 'no'. --reportformat basic|json Overrides current output format for reports which is defined globally by the report/output_format setting in lvm.conf(5). basic is the original format with columns and rows. If there is more than one report per command, each report is prefixed with the report name for identification. json produces report output in JSON format. See lvmreport(7) for more information. -r|--resizefs Resize underlying filesystem together with the LV using fsadm(8). -L|--size [-]Size[m|UNIT] Specifies the new size of the LV. The --size and --extents options are alternate methods of specifying size. The total number of physical extents used will be greater when redundant data is needed for RAID levels. When the plus + or minus - prefix is used, the value is not an absolute size, but is relative and added or subtracted from the current size. -t|--test Run in test mode. Commands will not update metadata. This is implemented by disabling all metadata writing but nevertheless returning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but hasn't. -v|--verbose ... Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr. --version Display version information. -y|--yes Do not prompt for confirmation interactively but always assume the answer yes. Use with extreme caution. (For automatic no, see -qq.) VARIABLES top LV Logical Volume name. See lvm(8) for valid names. An LV positional arg generally includes the VG name and LV name, e.g. VG/LV. String See the option description for information about the string content. Size[UNIT] Size is an input number that accepts an optional unit. Input units are always treated as base two values, regardless of capitalization, e.g. 'k' and 'K' both refer to 1024. The default input unit is specified by letter, followed by |UNIT. UNIT represents other possible input units: b|B is bytes, s|S is sectors of 512 bytes, k|K is KiB, m|M is MiB, g|G is GiB, t|T is TiB, p|P is PiB, e|E is EiB. (This should not be confused with the output control --units, where capital letters mean multiple of 1000.) ENVIRONMENT VARIABLES top See lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for a required VG parameter. EXAMPLES top Reduce the size of an LV by 3 logical extents: lvreduce -l -3 vg00/lvol1 SEE ALSO top lvm(8), lvm.conf(5), lvmconfig(8), lvmdevices(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgcreate(8), vgconvert(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8), lvcreate(8), lvchange(8), lvconvert(8), lvdisplay(8), lvextend(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), lvm-fullreport(8), lvm-lvpoll(8), blkdeactivate(8), lvmdump(8), dmeventd(8), lvmpolld(8), lvmlockd(8), lvmlockctl(8), cmirrord(8), lvmdbusd(8), fsadm(8), lvmsystemid(7), lvmreport(7), lvmcache(7), lvmraid(7), lvmthin(7), lvmvdo(7), lvmautoactivation(7) COLOPHON top This page is part of the lvm2 (Logical Volume Manager 2) project. Information about the project can be found at http://www.sourceware.org/lvm2/. If you have a bug report for this manual page, see https://github.com/lvmteam/lvm2/issues. This page was obtained from the project's upstream Git repository git://sourceware.org/git/lvm2.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-06.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Red Hat, Inc. LVM TOOLS 2.03.24(2)-git (2023-11-21) LVREDUCE(8) Pages that refer to this page: lvmvdo(7), lvchange(8), lvconvert(8), lvcreate(8), lvdisplay(8), lvextend(8), lvm(8), lvmconfig(8), lvmdevices(8), lvmdiskscan(8), lvm-fullreport(8), lvm-lvpoll(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgconvert(8), vgcreate(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lvreduce\n\n> Reduce the size of a logical volume.\n> See also: `lvm`.\n> More information: <https://man7.org/linux/man-pages/man8/lvreduce.8.html>.\n\n- Reduce a volume's size to 120 GB:\n\n`lvreduce --size {{120G}} {{logical_volume}}`\n\n- Reduce a volume's size by 40 GB as well as the underlying filesystem:\n\n`lvreduce --size -{{40G}} -r {{logical_volume}}`\n
lvremove
lvremove(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lvremove(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | USAGE | OPTIONS | VARIABLES | ENVIRONMENT VARIABLES | EXAMPLES | SEE ALSO | COLOPHON LVREMOVE(8) System Manager's Manual LVREMOVE(8) NAME top lvremove Remove logical volume(s) from the system SYNOPSIS top lvremove position_args [ option_args ] DESCRIPTION top lvremove removes one or more LVs. For standard LVs, this returns the logical extents that were used by the LV to the VG for use by other LVs. Confirmation will be requested before deactivating any active LV prior to removal. LVs cannot be deactivated or removed while they are open (e.g. if they contain a mounted filesystem). Removing an origin LV will also remove all dependent snapshots. When a single force option is used, LVs are removed without confirmation, and the command will try to deactivate unused LVs. To remove damaged LVs, two force options may be required (-ff). Historical LVs If the configuration setting metadata/record_lvs_history is enabled and the LV being removed forms part of the history of at least one LV that is still present, then a simplified representation of the LV will be retained. This includes the time of removal (lv_time_removed reporting field), creation time (lv_time), name (lv_name), LV uuid (lv_uuid) and VG name (vg_name). This allows later reporting to see the ancestry chain of thin snapshot volumes, even after some intermediate LVs have been removed. The names of such historical LVs acquire a hyphen as a prefix (e.g. '-lvol1') and cannot be reactivated. Use lvremove a second time, with the hyphen, to remove the record of the former LV completely. USAGE top lvremove VG|LV|Tag|Select ... [ -A|--autobackup y|n ] [ -f|--force ] [ -S|--select String ] [ --nohistory ] [ --noudevsync ] [ --reportformat basic|json ] [ COMMON_OPTIONS ] Common options for lvm: [ -d|--debug ] [ -h|--help ] [ -q|--quiet ] [ -t|--test ] [ -v|--verbose ] [ -y|--yes ] [ --commandprofile String ] [ --config String ] [ --devices PV ] [ --devicesfile String ] [ --driverloaded y|n ] [ --journal String ] [ --lockopt String ] [ --longhelp ] [ --nohints ] [ --nolocking ] [ --profile String ] [ --version ] OPTIONS top -A|--autobackup y|n Specifies if metadata should be backed up automatically after a change. Enabling this is strongly advised! See vgcfgbackup(8) for more information. --commandprofile String The command profile to use for command configuration. See lvm.conf(5) for more information about profiles. --config String Config settings for the command. These override lvm.conf(5) settings. The String arg uses the same format as lvm.conf(5), or may use section/field syntax. See lvm.conf(5) for more information about config. -d|--debug ... Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log file and/or syslog (if configured). --devices PV Devices that the command can use. This option can be repeated or accepts a comma separated list of devices. This overrides the devices file. --devicesfile String A file listing devices that LVM should use. The file must exist in /etc/lvm/devices/ and is managed with the lvmdevices(8) command. This overrides the lvm.conf(5) devices/devicesfile and devices/use_devicesfile settings. --driverloaded y|n If set to no, the command will not attempt to use device- mapper. For testing and debugging. -f|--force ... Override various checks, confirmations and protections. Use with extreme caution. -h|--help Display help text. --journal String Record information in the systemd journal. This information is in addition to information enabled by the lvm.conf log/journal setting. command: record information about the command. output: record the default command output. debug: record full command debugging. --lockopt String Used to pass options for special cases to lvmlockd. See lvmlockd(8) for more information. --longhelp Display long help text. --nohints Do not use the hints file to locate devices for PVs. A command may read more devices to find PVs when hints are not used. The command will still perform standard hint file invalidation where appropriate. --nohistory Do not record history of LVs being removed. This has no effect unless the configuration setting metadata/record_lvs_history is enabled. --nolocking Disable locking. --noudevsync Disables udev synchronisation. The process will not wait for notification from udev. It will continue irrespective of any possible udev processing in the background. Only use this if udev is not running or has rules that ignore the devices LVM creates. --profile String An alias for --commandprofile or --metadataprofile, depending on the command. -q|--quiet ... Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress any prompts with answer 'no'. --reportformat basic|json Overrides current output format for reports which is defined globally by the report/output_format setting in lvm.conf(5). basic is the original format with columns and rows. If there is more than one report per command, each report is prefixed with the report name for identification. json produces report output in JSON format. See lvmreport(7) for more information. -S|--select String Select objects for processing and reporting based on specified criteria. The criteria syntax is described by --select help and lvmreport(7). For reporting commands, one row is displayed for each object matching the criteria. See --options help for selectable object fields. Rows can be displayed with an additional "selected" field (-o selected) showing 1 if the row matches the selection and 0 otherwise. For non-reporting commands which process LVM entities, the selection is used to choose items to process. -t|--test Run in test mode. Commands will not update metadata. This is implemented by disabling all metadata writing but nevertheless returning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but hasn't. -v|--verbose ... Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr. --version Display version information. -y|--yes Do not prompt for confirmation interactively but always assume the answer yes. Use with extreme caution. (For automatic no, see -qq.) VARIABLES top VG Volume Group name. See lvm(8) for valid names. LV Logical Volume name. See lvm(8) for valid names. An LV positional arg generally includes the VG name and LV name, e.g. VG/LV. Tag Tag name. See lvm(8) for information about tag names and using tags in place of a VG, LV or PV. Select Select indicates that a required positional parameter can be omitted if the --select option is used. No arg appears in this position. String See the option description for information about the string content. Size[UNIT] Size is an input number that accepts an optional unit. Input units are always treated as base two values, regardless of capitalization, e.g. 'k' and 'K' both refer to 1024. The default input unit is specified by letter, followed by |UNIT. UNIT represents other possible input units: b|B is bytes, s|S is sectors of 512 bytes, k|K is KiB, m|M is MiB, g|G is GiB, t|T is TiB, p|P is PiB, e|E is EiB. (This should not be confused with the output control --units, where capital letters mean multiple of 1000.) ENVIRONMENT VARIABLES top See lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for a required VG parameter. EXAMPLES top Remove an active LV without asking for confirmation. lvremove -f vg00/lvol1 Remove all LVs the specified VG. lvremove vg00 SEE ALSO top lvm(8), lvm.conf(5), lvmconfig(8), lvmdevices(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgcreate(8), vgconvert(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8), lvcreate(8), lvchange(8), lvconvert(8), lvdisplay(8), lvextend(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), lvm-fullreport(8), lvm-lvpoll(8), blkdeactivate(8), lvmdump(8), dmeventd(8), lvmpolld(8), lvmlockd(8), lvmlockctl(8), cmirrord(8), lvmdbusd(8), fsadm(8), lvmsystemid(7), lvmreport(7), lvmcache(7), lvmraid(7), lvmthin(7), lvmvdo(7), lvmautoactivation(7) COLOPHON top This page is part of the lvm2 (Logical Volume Manager 2) project. Information about the project can be found at http://www.sourceware.org/lvm2/. If you have a bug report for this manual page, see https://github.com/lvmteam/lvm2/issues. This page was obtained from the project's upstream Git repository git://sourceware.org/git/lvm2.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-06.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Red Hat, Inc. LVM TOOLS 2.03.24(2)-git (2023-11-21) LVREMOVE(8) Pages that refer to this page: lvmcache(7), lvmthin(7), lvmvdo(7), lvchange(8), lvconvert(8), lvcreate(8), lvdisplay(8), lvextend(8), lvm(8), lvmconfig(8), lvmdevices(8), lvmdiskscan(8), lvm-fullreport(8), lvm-lvpoll(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgconvert(8), vgcreate(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lvremove\n\n> Remove logical volumes.\n> See also: `lvm`.\n> More information: <https://man7.org/linux/man-pages/man8/lvremove.8.html>.\n\n- Remove a logical volume in a volume group:\n\n`sudo lvremove {{volume_group}}/{{logical_volume}}`\n\n- Remove all logical volumes in a volume group:\n\n`sudo lvremove {{volume_group}}`\n
lvresize
lvresize(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lvresize(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | USAGE | OPTIONS | VARIABLES | ENVIRONMENT VARIABLES | EXAMPLES | SEE ALSO | COLOPHON LVRESIZE(8) System Manager's Manual LVRESIZE(8) NAME top lvresize Resize a logical volume SYNOPSIS top lvresize option_args position_args [ option_args ] [ position_args ] --alloc contiguous|cling|cling_by_tags|normal|anywhere| inherit -A|--autobackup y|n --commandprofile String --config String -d|--debug --devices PV --devicesfile String --driverloaded y|n -l|--extents [+|-]Number[PERCENT] -f|--force -h|--help --journal String --lockopt String --longhelp -n|--nofsck --nohints --nolocking --nosync --noudevsync --poolmetadatasize [+]Size[m|UNIT] --profile String -q|--quiet --reportformat basic|json -r|--resizefs -L|--size [+|-]Size[m|UNIT] -i|--stripes Number -I|--stripesize Size[k|UNIT] -t|--test --type linear|striped|snapshot|raid|mirror|thin|thin-pool| vdo|vdo-pool|cache|cache-pool|writecache -v|--verbose --version -y|--yes DESCRIPTION top lvresize resizes an LV in the same way as lvextend and lvreduce. See lvextend(8) and lvreduce(8) for more information. In the usage section below, --size Size can be replaced with --extents Number. See both descriptions the options section. USAGE top Resize an LV by a specified size. lvresize -L|--size [+|-]Size[m|UNIT] LV [ -l|--extents [+|-]Number[PERCENT] ] [ -r|--resizefs ] [ --poolmetadatasize [+]Size[m|UNIT] ] [ COMMON_OPTIONS ] [ PV ... ] Resize an LV by specified PV extents. lvresize LV PV ... [ -r|--resizefs ] [ COMMON_OPTIONS ] Resize a pool metadata SubLV by a specified size. lvresize --poolmetadatasize [+]Size[m|UNIT] LV1 [ COMMON_OPTIONS ] [ PV ... ] LV1 types: thinpool Common options for command: [ -A|--autobackup y|n ] [ -f|--force ] [ -n|--nofsck ] [ -i|--stripes Number ] [ -I|--stripesize Size[k|UNIT] ] [ --alloc contiguous|cling|cling_by_tags|normal|anywhere| inherit ] [ --nosync ] [ --noudevsync ] [ --reportformat basic|json ] [ --type linear|striped|snapshot|raid|mirror|thin| thin-pool|vdo|vdo-pool|cache|cache-pool|writecache ] Common options for lvm: [ -d|--debug ] [ -h|--help ] [ -q|--quiet ] [ -t|--test ] [ -v|--verbose ] [ -y|--yes ] [ --commandprofile String ] [ --config String ] [ --devices PV ] [ --devicesfile String ] [ --driverloaded y|n ] [ --journal String ] [ --lockopt String ] [ --longhelp ] [ --nohints ] [ --nolocking ] [ --profile String ] [ --version ] OPTIONS top --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit Determines the allocation policy when a command needs to allocate Physical Extents (PEs) from the VG. Each VG and LV has an allocation policy which can be changed with vgchange/lvchange, or overridden on the command line. normal applies common sense rules such as not placing parallel stripes on the same PV. inherit applies the VG policy to an LV. contiguous requires new PEs be placed adjacent to existing PEs. cling places new PEs on the same PV as existing PEs in the same stripe of the LV. If there are sufficient PEs for an allocation, but normal does not use them, anywhere will use them even if it reduces performance, e.g. by placing two stripes on the same PV. Optional positional PV args on the command line can also be used to limit which PVs the command will use for allocation. See lvm(8) for more information about allocation. -A|--autobackup y|n Specifies if metadata should be backed up automatically after a change. Enabling this is strongly advised! See vgcfgbackup(8) for more information. --commandprofile String The command profile to use for command configuration. See lvm.conf(5) for more information about profiles. --config String Config settings for the command. These override lvm.conf(5) settings. The String arg uses the same format as lvm.conf(5), or may use section/field syntax. See lvm.conf(5) for more information about config. -d|--debug ... Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log file and/or syslog (if configured). --devices PV Devices that the command can use. This option can be repeated or accepts a comma separated list of devices. This overrides the devices file. --devicesfile String A file listing devices that LVM should use. The file must exist in /etc/lvm/devices/ and is managed with the lvmdevices(8) command. This overrides the lvm.conf(5) devices/devicesfile and devices/use_devicesfile settings. --driverloaded y|n If set to no, the command will not attempt to use device- mapper. For testing and debugging. -l|--extents [+|-]Number[PERCENT] Specifies the new size of the LV in logical extents. The --size and --extents options are alternate methods of specifying size. The total number of physical extents used will be greater when redundant data is needed for RAID levels. An alternate syntax allows the size to be determined indirectly as a percentage of the size of a related VG, LV, or set of PVs. The suffix %VG denotes the total size of the VG, the suffix %FREE the remaining free space in the VG, and the suffix %PVS the free space in the specified PVs. For a snapshot, the size can be expressed as a percentage of the total size of the origin LV with the suffix %ORIGIN (100%ORIGIN provides space for the whole origin). When expressed as a percentage, the size defines an upper limit for the number of logical extents in the new LV. The precise number of logical extents in the new LV is not determined until the command has completed. When the plus + or minus - prefix is used, the value is not an absolute size, but is relative and added or subtracted from the current size. -f|--force ... Override various checks, confirmations and protections. Use with extreme caution. -h|--help Display help text. --journal String Record information in the systemd journal. This information is in addition to information enabled by the lvm.conf log/journal setting. command: record information about the command. output: record the default command output. debug: record full command debugging. --lockopt String Used to pass options for special cases to lvmlockd. See lvmlockd(8) for more information. --longhelp Display long help text. -n|--nofsck Do not perform fsck before resizing filesystem when filesystem requires it. You may need to use --force to proceed with this option. --nohints Do not use the hints file to locate devices for PVs. A command may read more devices to find PVs when hints are not used. The command will still perform standard hint file invalidation where appropriate. --nolocking Disable locking. --nosync Causes the creation of mirror, raid1, raid4, raid5 and raid10 to skip the initial synchronization. In case of mirror, raid1 and raid10, any data written afterwards will be mirrored, but the original contents will not be copied. In case of raid4 and raid5, no parity blocks will be written, though any data written afterwards will cause parity blocks to be stored. This is useful for skipping a potentially long and resource intensive initial sync of an empty mirror/raid1/raid4/raid5 and raid10 LV. This option is not valid for raid6, because raid6 relies on proper parity (P and Q Syndromes) being created during initial synchronization in order to reconstruct proper user date in case of device failures. raid0 and raid0_meta do not provide any data copies or parity support and thus do not support initial synchronization. --noudevsync Disables udev synchronisation. The process will not wait for notification from udev. It will continue irrespective of any possible udev processing in the background. Only use this if udev is not running or has rules that ignore the devices LVM creates. --poolmetadatasize [+]Size[m|UNIT] Specifies the new size of the pool metadata LV. The plus prefix + can be used, in which case the value is added to the current size. --profile String An alias for --commandprofile or --metadataprofile, depending on the command. -q|--quiet ... Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress any prompts with answer 'no'. --reportformat basic|json Overrides current output format for reports which is defined globally by the report/output_format setting in lvm.conf(5). basic is the original format with columns and rows. If there is more than one report per command, each report is prefixed with the report name for identification. json produces report output in JSON format. See lvmreport(7) for more information. -r|--resizefs Resize underlying filesystem together with the LV using fsadm(8). -L|--size [+|-]Size[m|UNIT] Specifies the new size of the LV. The --size and --extents options are alternate methods of specifying size. The total number of physical extents used will be greater when redundant data is needed for RAID levels. When the plus + or minus - prefix is used, the value is not an absolute size, but is relative and added or subtracted from the current size. -i|--stripes Number Specifies the number of stripes in a striped LV. This is the number of PVs (devices) that a striped LV is spread across. Data that appears sequential in the LV is spread across multiple devices in units of the stripe size (see --stripesize). This does not change existing allocated space, but only applies to space being allocated by the command. When creating a RAID 4/5/6 LV, this number does not include the extra devices that are required for parity. The largest number depends on the RAID type (raid0: 64, raid10: 32, raid4/5: 63, raid6: 62), and when unspecified, the default depends on the RAID type (raid0: 2, raid10: 2, raid4/5: 3, raid6: 5.) To stripe a new raid LV across all PVs by default, see lvm.conf(5) allocation/raid_stripe_all_devices. -I|--stripesize Size[k|UNIT] The amount of data that is written to one device before moving to the next in a striped LV. -t|--test Run in test mode. Commands will not update metadata. This is implemented by disabling all metadata writing but nevertheless returning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but hasn't. --type linear|striped|snapshot|raid|mirror|thin|thin-pool|vdo| vdo-pool|cache|cache-pool|writecache The LV type, also known as "segment type" or "segtype". See usage descriptions for the specific ways to use these types. For more information about redundancy and performance (raid<N>, mirror, striped, linear) see lvmraid(7). For thin provisioning (thin, thin-pool) see lvmthin(7). For performance caching (cache, cache-pool) see lvmcache(7). For copy-on-write snapshots (snapshot) see usage definitions. For VDO (vdo) see lvmvdo(7). Several commands omit an explicit type option because the type is inferred from other options or shortcuts (e.g. --stripes, --mirrors, --snapshot, --virtualsize, --thin, --cache, --vdo). Use inferred types with care because it can lead to unexpected results. -v|--verbose ... Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr. --version Display version information. -y|--yes Do not prompt for confirmation interactively but always assume the answer yes. Use with extreme caution. (For automatic no, see -qq.) VARIABLES top LV Logical Volume name. See lvm(8) for valid names. An LV positional arg generally includes the VG name and LV name, e.g. VG/LV. LV1 indicates the LV must have a specific type, where the accepted LV types are listed. (raid represents raid<N> type). PV Physical Volume name, a device path under /dev. For commands managing physical extents, a PV positional arg generally accepts a suffix indicating a range (or multiple ranges) of physical extents (PEs). When the first PE is omitted, it defaults to the start of the device, and when the last PE is omitted it defaults to end. Start and end range (inclusive): PV[:PE-PE]... Start and length range (counting from 0): PV[:PE+PE]... String See the option description for information about the string content. Size[UNIT] Size is an input number that accepts an optional unit. Input units are always treated as base two values, regardless of capitalization, e.g. 'k' and 'K' both refer to 1024. The default input unit is specified by letter, followed by |UNIT. UNIT represents other possible input units: b|B is bytes, s|S is sectors of 512 bytes, k|K is KiB, m|M is MiB, g|G is GiB, t|T is TiB, p|P is PiB, e|E is EiB. (This should not be confused with the output control --units, where capital letters mean multiple of 1000.) ENVIRONMENT VARIABLES top See lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for a required VG parameter. EXAMPLES top Extend an LV by 16MB using specific physical extents. lvresize -L+16M vg1/lv1 /dev/sda:0-1 /dev/sdb:0-1 Resize an LV to use 50% of the size volume group. lvresize -l50%VG vg1/lv1 SEE ALSO top lvm(8), lvm.conf(5), lvmconfig(8), lvmdevices(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgcreate(8), vgconvert(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8), lvcreate(8), lvchange(8), lvconvert(8), lvdisplay(8), lvextend(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), lvm-fullreport(8), lvm-lvpoll(8), blkdeactivate(8), lvmdump(8), dmeventd(8), lvmpolld(8), lvmlockd(8), lvmlockctl(8), cmirrord(8), lvmdbusd(8), fsadm(8), lvmsystemid(7), lvmreport(7), lvmcache(7), lvmraid(7), lvmthin(7), lvmvdo(7), lvmautoactivation(7) COLOPHON top This page is part of the lvm2 (Logical Volume Manager 2) project. Information about the project can be found at http://www.sourceware.org/lvm2/. If you have a bug report for this manual page, see https://github.com/lvmteam/lvm2/issues. This page was obtained from the project's upstream Git repository git://sourceware.org/git/lvm2.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-06.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Red Hat, Inc. LVM TOOLS 2.03.24(2)-git (2023-11-21) LVRESIZE(8) Pages that refer to this page: lvmcache(7), lvmvdo(7), fsadm(8), lvchange(8), lvconvert(8), lvcreate(8), lvdisplay(8), lvextend(8), lvm(8), lvmconfig(8), lvmdevices(8), lvmdiskscan(8), lvm-fullreport(8), lvm-lvpoll(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgconvert(8), vgcreate(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lvresize\n\n> Change the size of a logical volume.\n> See also: `lvm`.\n> More information: <https://man7.org/linux/man-pages/man8/lvresize.8.html>.\n\n- Change the size of a logical volume to 120 GB:\n\n`lvresize --size {{120G}} {{volume_group}}/{{logical_volume}}`\n\n- Extend the size of a logical volume as well as the underlying filesystem by 120 GB:\n\n`lvresize --size +{{120G}} --resizefs {{volume_group}}/{{logical_volume}}`\n\n- Extend the size of a logical volume to 100% of the free physical volume space:\n\n`lvresize --size {{100}}%FREE {{volume_group}}/{{logical_volume}}`\n\n- Reduce the size of a logical volume as well as the underlying filesystem by 120 GB:\n\n`lvresize --size -{{120G}} --resizefs {{volume_group}}/{{logical_volume}}`\n
lvs
lvs(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training lvs(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | USAGE | OPTIONS | VARIABLES | ENVIRONMENT VARIABLES | NOTES | SEE ALSO | COLOPHON LVS(8) System Manager's Manual LVS(8) NAME top lvs Display information about logical volumes SYNOPSIS top lvs [ option_args ] [ position_args ] DESCRIPTION top lvs produces formatted output about LVs. USAGE top lvs [ -H|--history ] [ -a|--all ] [ -o|--options String ] [ -S|--select String ] [ -O|--sort String ] [ --segments ] [ --aligned ] [ --binary ] [ --configreport log|vg|lv|pv|pvseg|seg ] [ --foreign ] [ --ignorelockingfailure ] [ --logonly ] [ --nameprefixes ] [ --noheadings ] [ --nosuffix ] [ --readonly ] [ --reportformat basic|json ] [ --rows ] [ --separator String ] [ --shared ] [ --unbuffered ] [ --units [Number]r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] [ --unquoted ] [ COMMON_OPTIONS ] [ VG|LV|Tag ... ] Common options for lvm: [ -d|--debug ] [ -h|--help ] [ -q|--quiet ] [ -t|--test ] [ -v|--verbose ] [ -y|--yes ] [ --commandprofile String ] [ --config String ] [ --devices PV ] [ --devicesfile String ] [ --driverloaded y|n ] [ --journal String ] [ --lockopt String ] [ --longhelp ] [ --nohints ] [ --nolocking ] [ --profile String ] [ --version ] OPTIONS top --aligned Use with --separator to align the output columns -a|--all Show information about internal LVs. These are components of normal LVs, such as mirrors, which are not independently accessible, e.g. not mountable. --binary Use binary values "0" or "1" instead of descriptive literal values for columns that have exactly two valid values to report (not counting the "unknown" value which denotes that the value could not be determined). --commandprofile String The command profile to use for command configuration. See lvm.conf(5) for more information about profiles. --config String Config settings for the command. These override lvm.conf(5) settings. The String arg uses the same format as lvm.conf(5), or may use section/field syntax. See lvm.conf(5) for more information about config. --configreport log|vg|lv|pv|pvseg|seg See lvmreport(7). -d|--debug ... Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log file and/or syslog (if configured). --devices PV Devices that the command can use. This option can be repeated or accepts a comma separated list of devices. This overrides the devices file. --devicesfile String A file listing devices that LVM should use. The file must exist in /etc/lvm/devices/ and is managed with the lvmdevices(8) command. This overrides the lvm.conf(5) devices/devicesfile and devices/use_devicesfile settings. --driverloaded y|n If set to no, the command will not attempt to use device- mapper. For testing and debugging. --foreign Report/display foreign VGs that would otherwise be skipped. See lvmsystemid(7) for more information about foreign VGs. -h|--help Display help text. -H|--history Include historical LVs in the output. (This has no effect unless LVs were removed while lvm.conf(5) metadata/record_lvs_history was enabled. --ignorelockingfailure Allows a command to continue with read-only metadata operations after locking failures. --journal String Record information in the systemd journal. This information is in addition to information enabled by the lvm.conf log/journal setting. command: record information about the command. output: record the default command output. debug: record full command debugging. --lockopt String Used to pass options for special cases to lvmlockd. See lvmlockd(8) for more information. --logonly Suppress command report and display only log report. --longhelp Display long help text. --nameprefixes Add an "LVM2_" prefix plus the field name to the output. Useful with --noheadings to produce a list of field=value pairs that can be used to set environment variables (for example, in udev rules). --noheadings Suppress the headings line that is normally the first line of output. Useful if grepping the output. --nohints Do not use the hints file to locate devices for PVs. A command may read more devices to find PVs when hints are not used. The command will still perform standard hint file invalidation where appropriate. --nolocking Disable locking. --nosuffix Suppress the suffix on output sizes. Use with --units (except h and H) if processing the output. -o|--options String Comma-separated, ordered list of fields to display in columns. String arg syntax is: [+|-|#]Field1[,Field2 ...] The prefix + will append the specified fields to the default fields, - will remove the specified fields from the default fields, and # will compact specified fields (removing them when empty for all rows.) Use -o help to view the list of all available fields. Use separate lists of fields to add, remove or compact by repeating the -o option: -o+field1,field2 -o-field3,field4 -o#field5. These lists are evaluated from left to right. Use field name lv_all to view all LV fields, vg_all all VG fields, pv_all all PV fields, pvseg_all all PV segment fields, seg_all all LV segment fields, and pvseg_all all PV segment columns. See the lvm.conf(5) report section for more config options. See lvmreport(7) for more information about reporting. --profile String An alias for --commandprofile or --metadataprofile, depending on the command. -q|--quiet ... Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress any prompts with answer 'no'. --readonly Run the command in a special read-only mode which will read on-disk metadata without needing to take any locks. This can be used to peek inside metadata used by a virtual machine image while the virtual machine is running. No attempt will be made to communicate with the device-mapper kernel driver, so this option is unable to report whether or not LVs are actually in use. --reportformat basic|json Overrides current output format for reports which is defined globally by the report/output_format setting in lvm.conf(5). basic is the original format with columns and rows. If there is more than one report per command, each report is prefixed with the report name for identification. json produces report output in JSON format. See lvmreport(7) for more information. --rows Output columns as rows. --segments Use default columns that emphasize segment information. -S|--select String Select objects for processing and reporting based on specified criteria. The criteria syntax is described by --select help and lvmreport(7). For reporting commands, one row is displayed for each object matching the criteria. See --options help for selectable object fields. Rows can be displayed with an additional "selected" field (-o selected) showing 1 if the row matches the selection and 0 otherwise. For non-reporting commands which process LVM entities, the selection is used to choose items to process. --separator String String to use to separate each column. Useful if grepping the output. --shared Report/display shared VGs that would otherwise be skipped when lvmlockd is not being used on the host. See lvmlockd(8) for more information about shared VGs. -O|--sort String Comma-separated ordered list of columns to sort by. Replaces the default selection. Precede any column with - for a reverse sort on that column. -t|--test Run in test mode. Commands will not update metadata. This is implemented by disabling all metadata writing but nevertheless returning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relies on reading back metadata it believes has changed but hasn't. --unbuffered Produce output immediately without sorting or aligning the columns properly. --units [Number]r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E All sizes are output in these units: human-(r)eadable with '<' rounding indicator, (h)uman-readable, (b)ytes, (s)ectors, (k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes. Capitalise to use multiples of 1000 (S.I.) instead of 1024. Custom units can be specified, e.g. --units 3M. --unquoted When used with --nameprefixes, output values in the field=value pairs are not quoted. -v|--verbose ... Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr. --version Display version information. -y|--yes Do not prompt for confirmation interactively but always assume the answer yes. Use with extreme caution. (For automatic no, see -qq.) VARIABLES top VG Volume Group name. See lvm(8) for valid names. LV Logical Volume name. See lvm(8) for valid names. An LV positional arg generally includes the VG name and LV name, e.g. VG/LV. Tag Tag name. See lvm(8) for information about tag names and using tags in place of a VG, LV or PV. String See the option description for information about the string content. Size[UNIT] Size is an input number that accepts an optional unit. Input units are always treated as base two values, regardless of capitalization, e.g. 'k' and 'K' both refer to 1024. The default input unit is specified by letter, followed by |UNIT. UNIT represents other possible input units: b|B is bytes, s|S is sectors of 512 bytes, k|K is KiB, m|M is MiB, g|G is GiB, t|T is TiB, p|P is PiB, e|E is EiB. (This should not be confused with the output control --units, where capital letters mean multiple of 1000.) ENVIRONMENT VARIABLES top See lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for a required VG parameter. NOTES top The lv_attr bits are: 1 Volume type: (C)ache, (m)irrored, (M)irrored without initial sync, (o)rigin, (O)rigin with merging snapshot, inte(g)rity, (r)aid, (R)aid without initial sync, (s)napshot, merging (S)napshot, (p)vmove, (v)irtual, mirror or raid (i)mage, mirror or raid (I)mage out-of-sync, mirror (l)og device, under (c)onversion, thin (V)olume, (t)hin pool, (T)hin pool data, v(d)o pool, v(D)o pool data, raid or pool m(e)tadata or pool metadata spare. 2 Permissions: (w)riteable, (r)ead-only, (R)ead-only activation of non-read-only volume 3 Allocation policy: (a)nywhere, (c)ontiguous, (i)nherited, c(l)ing, (n)ormal This is capitalised if the volume is currently locked against allocation changes, for example during pvmove(8). 4 fixed (m)inor 5 State: (a)ctive, (h)istorical, (s)uspended, (I)nvalid snapshot, invalid (S)uspended snapshot, snapshot (m)erge failed, suspended snapshot (M)erge failed, mapped (d)evice present without tables, mapped device present with (i)nactive table, thin-pool (c)heck needed, suspended thin-pool (C)heck needed, (X) unknown 6 device (o)pen, (X) unknown 7 Target type: (C)ache, (m)irror, (r)aid, (s)napshot, (t)hin, (u)nknown, (v)irtual. This groups logical volumes related to the same kernel target together. So, for example, mirror images, mirror logs as well as mirrors themselves appear as (m) if they use the original device-mapper mirror kernel driver; whereas the raid equivalents using the md raid kernel driver all appear as (r). Snapshots using the original device-mapper driver appear as (s); whereas snapshots of thin volumes using the new thin provisioning driver appear as (t). 8 Newly-allocated data blocks are overwritten with blocks of (z)eroes before use. 9 Volume Health, where there are currently three groups of attributes identified: Common ones for all Logical Volumes: (p)artial, (X) unknown. (p)artial signifies that one or more of the Physical Volumes this Logical Volume uses is missing from the system. (X) unknown signifies the status is unknown. Related to RAID Logical Volumes: (r)efresh needed, (m)ismatches exist, (w)ritemostly. (r)efresh signifies that one or more of the Physical Volumes this RAID Logical Volume uses had suffered a write error. The write error could be due to a temporary failure of that Physical Volume or an indication that it is failing. The device should be refreshed or replaced. (m)ismatches signifies that the RAID logical volume has portions of the array that are not coherent. Inconsistencies are detected by initiating a "check" on a RAID logical volume. (The scrubbing operations, "check" and "repair", can be performed on a RAID logical volume via the 'lvchange' command.) (w)ritemostly signifies the devices in a RAID 1 logical volume that have been marked write-mostly. Re(s)haping signifies a RAID Logical Volume is either undergoing a stripe addition/removal, a stripe size or RAID algorithm change. (R)emove after reshape signifies freed striped raid images to be removed. Related to Thin pool Logical Volumes: (F)ailed, out of (D)ata space, (M)etadata read only. (F)ailed is set if thin pool encounters serious failures and hence no further I/O is permitted at all. The out of (D)ata space is set if thin pool has run out of data space. (M)etadata read only signifies that thin pool encounters certain types of failures but it's still possible to do reads at least, but no metadata changes are allowed. Related to Thin Logical Volumes: (F)ailed. (F)ailed is set when related thin pool enters Failed state and no further I/O is permitted at all. Related to writecache logical volumes: (E)rror. (E)rror is set dm-writecache reports an error. 10 s(k)ip activation: this volume is flagged to be skipped during activation. SEE ALSO top lvm(8), lvm.conf(5), lvmconfig(8), lvmdevices(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgcreate(8), vgconvert(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8), lvcreate(8), lvchange(8), lvconvert(8), lvdisplay(8), lvextend(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), lvm-fullreport(8), lvm-lvpoll(8), blkdeactivate(8), lvmdump(8), dmeventd(8), lvmpolld(8), lvmlockd(8), lvmlockctl(8), cmirrord(8), lvmdbusd(8), fsadm(8), lvmsystemid(7), lvmreport(7), lvmcache(7), lvmraid(7), lvmthin(7), lvmvdo(7), lvmautoactivation(7) COLOPHON top This page is part of the lvm2 (Logical Volume Manager 2) project. Information about the project can be found at http://www.sourceware.org/lvm2/. If you have a bug report for this manual page, see https://github.com/lvmteam/lvm2/issues. This page was obtained from the project's upstream Git repository git://sourceware.org/git/lvm2.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-06.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Red Hat, Inc. LVM TOOLS 2.03.24(2)-git (2023-11-21) LVS(8) Pages that refer to this page: lvmcache(7), lvmreport(7), lvmthin(7), lvmvdo(7), dmeventd(8), lvchange(8), lvconvert(8), lvcreate(8), lvdisplay(8), lvextend(8), lvm(8), lvmconfig(8), lvmdevices(8), lvmdiskscan(8), lvm-fullreport(8), lvm-lvpoll(8), lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8), pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8), pvremove(8), pvresize(8), pvs(8), pvscan(8), vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgconvert(8), vgcreate(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8), vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8), vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# lvs\n\n> Display information about logical volumes.\n> See also: `lvm`.\n> More information: <https://man7.org/linux/man-pages/man8/lvs.8.html>.\n\n- Display information about logical volumes:\n\n`lvs`\n\n- Display all logical volumes:\n\n`lvs -a`\n\n- Change default display to show more details:\n\n`lvs -v`\n\n- Display only specific fields:\n\n`lvs -o {{field_name_1}},{{field_name_2}}`\n\n- Append field to default display:\n\n`lvs -o +{{field_name}}`\n\n- Suppress heading line:\n\n`lvs --noheadings`\n\n- Use a separator to separate fields:\n\n`lvs --separator {{=}}`\n
m4
m4(1p) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training m4(1p) Linux manual page PROLOG | NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OPERANDS | STDIN | INPUT FILES | ENVIRONMENT VARIABLES | ASYNCHRONOUS EVENTS | STDOUT | STDERR | OUTPUT FILES | EXTENDED DESCRIPTION | EXIT STATUS | CONSEQUENCES OF ERRORS | APPLICATION USAGE | EXAMPLES | RATIONALE | FUTURE DIRECTIONS | SEE ALSO | COPYRIGHT M4(1P) POSIX Programmer's Manual M4(1P) PROLOG top This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME top m4 macro processor SYNOPSIS top m4 [-s] [-D name[=val]]... [-U name]... file... DESCRIPTION top The m4 utility is a macro processor that shall read one or more text files, process them according to their included macro statements, and write the results to standard output. OPTIONS top The m4 utility shall conform to the Base Definitions volume of POSIX.12017, Section 12.2, Utility Syntax Guidelines, except that the order of the -D and -U options shall be significant, and options can be interspersed with operands. The following options shall be supported: -s Enable line synchronization output for the c99 preprocessor phase (that is, #line directives). -D name[=val] Define name to val or to null if =val is omitted. -U name Undefine name. OPERANDS top The following operand shall be supported: file A pathname of a text file to be processed. If no file is given, or if it is '-', the standard input shall be read. STDIN top The standard input shall be a text file that is used if no file operand is given, or if it is '-'. INPUT FILES top The input file named by the file operand shall be a text file. ENVIRONMENT VARIABLES top The following environment variables shall affect the execution of m4: LANG Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.12017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files). LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES. ASYNCHRONOUS EVENTS top Default. STDOUT top The standard output shall be the same as the input files, after being processed for macro expansion. STDERR top The standard error shall be used to display strings with the errprint macro, macro tracing enabled by the traceon macro, the defined text for macros written by the dumpdef macro, or for diagnostic messages. OUTPUT FILES top None. EXTENDED DESCRIPTION top The m4 utility shall compare each token from the input against the set of built-in and user-defined macros. If the token matches the name of a macro, then the token shall be replaced by the macro's defining text, if any, and rescanned for matching macro names. Once no portion of the token matches the name of a macro, it shall be written to standard output. Macros may have arguments, in which case the arguments shall be substituted into the defining text before it is rescanned. Macro calls have the form: name(arg1, arg2, ..., argn) Macro names shall consist of letters, digits, and underscores, where the first character is not a digit. Tokens not of this form shall not be treated as macros. The application shall ensure that the <left-parenthesis> immediately follows the name of the macro. If a token matching the name of a macro is not followed by a <left-parenthesis>, it is handled as a use of that macro without arguments. If a macro name is followed by a <left-parenthesis>, its arguments are the <comma>-separated tokens between the <left- parenthesis> and the matching <right-parenthesis>. Unquoted white-space characters preceding each argument shall be ignored. All other characters, including trailing white-space characters, are retained. <comma> characters enclosed between <left- parenthesis> and <right-parenthesis> characters do not delimit arguments. Arguments are positionally defined and referenced. The string "$1" in the defining text shall be replaced by the first argument. Systems shall support at least nine arguments; only the first nine can be referenced, using the strings "$1" to "$9", inclusive. The string "$0" is replaced with the name of the macro. The string "$#" is replaced by the number of arguments as a string. The string "$*" is replaced by a list of all of the arguments, separated by <comma> characters. The string "$@" is replaced by a list of all of the arguments separated by <comma> characters, and each argument is quoted using the current left and right quoting strings. The string "${" produces unspecified behavior. If fewer arguments are supplied than are in the macro definition, the omitted arguments are taken to be null. It is not an error if more arguments are supplied than are in the macro definition. No special meaning is given to any characters enclosed between matching left and right quoting strings, but the quoting strings are themselves discarded. By default, the left quoting string consists of a grave accent (backquote) and the right quoting string consists of an acute accent (single-quote); see also the changequote macro. Comments are written but not scanned for matching macro names; by default, the begin-comment string consists of the <number-sign> character and the end-comment string consists of a <newline>. See also the changecom and dnl macros. The m4 utility shall make available the following built-in macros. They can be redefined, but once this is done the original meaning is lost. Their values shall be null unless otherwise stated. In the descriptions below, the term defining text refers to the value of the macro: the second argument to the define macro, among other things. Except for the first argument to the eval macro, all numeric arguments to built-in macros shall be interpreted as decimal values. The string values produced as the defining text of the decr, divnum, incr, index, len, and sysval built-in macros shall be in the form of a decimal-constant as defined in the C language. changecom The changecom macro shall set the begin-comment and end-comment strings. With no arguments, the comment mechanism shall be disabled. With a single non-null argument, that argument shall become the begin-comment and the <newline> shall become the end-comment string. With two non-null arguments, the first argument shall become the begin-comment string and the second argument shall become the end-comment string. The behavior is unspecified if either argument is provided but null. Systems shall support comment strings of at least five characters. changequote The changequote macro shall set the begin-quote and end-quote strings. With no arguments, the quote strings shall be set to the default values (that is, `'). The behavior is unspecified if there is a single argument or either argument is null. With two non-null arguments, the first argument shall become the begin- quote string and the second argument shall become the end-quote string. Systems shall support quote strings of at least five characters. decr The defining text of the decr macro shall be its first argument decremented by 1. It shall be an error to specify an argument containing any non-numeric characters. The behavior is unspecified if decr is not immediately followed by a <left-parenthesis>. define The second argument shall become the defining text of the macro whose name is the first argument. It is unspecified whether the define macro deletes all prior definitions of the macro named by its first argument or preserves all but the current definition of the macro. The behavior is unspecified if define is not immediately followed by a <left-parenthesis>. defn The defining text of the defn macro shall be the quoted definition (using the current quoting strings) of its arguments. The behavior is unspecified if defn is not immediately followed by a <left-parenthesis>. divert The m4 utility maintains nine temporary buffers, numbered 1 to 9, inclusive. When the last of the input has been processed, any output that has been placed in these buffers shall be written to standard output in buffer-numerical order. The divert macro shall divert future output to the buffer specified by its argument. Specifying no argument or an argument of 0 shall resume the normal output process. Output diverted to a stream with a negative number shall be discarded. Behavior is implementation-defined if a stream number larger than 9 is specified. It shall be an error to specify an argument containing any non-numeric characters. divnum The defining text of the divnum macro shall be the number of the current output stream as a string. dnl The dnl macro shall cause m4 to discard all input characters up to and including the next <newline>. dumpdef The dumpdef macro shall write the defined text to standard error for each of the macros specified as arguments, or, if no arguments are specified, for all macros. errprint The errprint macro shall write its arguments to standard error. The behavior is unspecified if errprint is not immediately followed by a <left-parenthesis>. eval The eval macro shall evaluate its first argument as an arithmetic expression, using signed integer arithmetic with at least 32-bit precision. At least the following C-language operators shall be supported, with precedence, associativity, and behavior as described in Section 1.1.2.1, Arithmetic Precision and Operations: () unary + unary - ~ ! binary * / % binary + binary - << >> < <= > >= == != binary & ^ | && || Systems shall support octal and hexadecimal numbers as in the ISO C standard. The second argument, if specified, shall set the radix for the result; if the argument is blank or unspecified, the default is 10. Behavior is unspecified if the radix falls outside the range 2 to 36, inclusive. The third argument, if specified, sets the minimum number of digits in the result. Behavior is unspecified if the third argument is less than zero. It shall be an error to specify the second or third argument containing any non-numeric characters. The behavior is unspecified if eval is not immediately followed by a <left-parenthesis>. ifdef If the first argument to the ifdef macro is defined, the defining text shall be the second argument. Otherwise, the defining text shall be the third argument, if specified, or the null string, if not. The behavior is unspecified if ifdef is not immediately followed by a <left-parenthesis>. ifelse The ifelse macro takes three or more arguments. If the first two arguments compare as equal strings (after macro expansion of both arguments), the defining text shall be the third argument. If the first two arguments do not compare as equal strings and there are three arguments, the defining text shall be null. If the first two arguments do not compare as equal strings and there are four or five arguments, the defining text shall be the fourth argument. If the first two arguments do not compare as equal strings and there are six or more arguments, the first three arguments shall be discarded and processing shall restart with the remaining arguments. The behavior is unspecified if ifelse is not immediately followed by a <left- parenthesis>. include The defining text for the include macro shall be the contents of the file named by the first argument. It shall be an error if the file cannot be read. The behavior is unspecified if include is not immediately followed by a <left-parenthesis>. incr The defining text of the incr macro shall be its first argument incremented by 1. It shall be an error to specify an argument containing any non-numeric characters. The behavior is unspecified if incr is not immediately followed by a <left-parenthesis>. index The defining text of the index macro shall be the first character position (as a string) in the first argument where a string matching the second argument begins (zero origin), or -1 if the second argument does not occur. The behavior is unspecified if index is not immediately followed by a <left-parenthesis>. len The defining text of the len macro shall be the length (as a string) of the first argument. The behavior is unspecified if len is not immediately followed by a <left-parenthesis>. m4exit Exit from the m4 utility. If the first argument is specified, it shall be the exit code. If no argument is specified, the exit code shall be zero. It shall be an error to specify an argument containing any non-numeric characters. If the first argument is zero or no argument is specified, and an error has previously occurred (for example, a file operand that could not be opened), it is unspecified whether the exit status is zero or non-zero. m4wrap The first argument shall be processed when EOF is reached. If the m4wrap macro is used multiple times, the arguments specified shall be processed in the order in which the m4wrap macros were processed. The behavior is unspecified if m4wrap is not immediately followed by a <left-parenthesis>. maketemp The defining text shall be the first argument, with any trailing 'X' characters replaced with the current process ID as a string. The behavior is unspecified if maketemp is not immediately followed by a <left- parenthesis>. mkstemp The defining text shall be as if it were the resulting pathname after a successful call to the mkstemp() function defined in the System Interfaces volume of POSIX.12017 called with the first argument to the macro invocation. If a file is created, that file shall be closed. If a file could not be created, the m4 utility shall write a diagnostic message to standard error and shall continue processing input but its final exit status shall be non-zero; the defining text of the macro shall be the empty string. The behavior is unspecified if mkstemp is not immediately followed by a <left-parenthesis>. popdef The popdef macro shall delete the current definition of its arguments, replacing that definition with the previous one. If there is no previous definition, the macro is undefined. The behavior is unspecified if popdef is not immediately followed by a <left- parenthesis>. pushdef The pushdef macro shall be equivalent to the define macro with the exception that it shall preserve any current definition for future retrieval using the popdef macro. The behavior is unspecified if pushdef is not immediately followed by a <left-parenthesis>. shift The defining text for the shift macro shall be a comma- separated list of its arguments except the first one. Each argument shall be quoted using the current quoting strings. The behavior is unspecified if shift is not immediately followed by a <left-parenthesis>. sinclude The sinclude macro shall be equivalent to the include macro, except that it shall not be an error if the file is inaccessible. The behavior is unspecified if sinclude is not immediately followed by a <left- parenthesis>. substr The defining text for the substr macro shall be the substring of the first argument beginning at the zero- offset character position specified by the second argument. The third argument, if specified, shall be the number of characters to select; if not specified, the characters from the starting point to the end of the first argument shall become the defining text. It shall not be an error to specify a starting point beyond the end of the first argument and the defining text shall be null. It shall be an error to specify an argument containing any non-numeric characters. The behavior is unspecified if substr is not immediately followed by a <left-parenthesis>. syscmd The syscmd macro shall interpret its first argument as a shell command line. The defining text shall be the string result of that command. The string result shall not be rescanned for macros while setting the defining text. No output redirection shall be performed by the m4 utility. The exit status value from the command can be retrieved using the sysval macro. The behavior is unspecified if syscmd is not immediately followed by a <left-parenthesis>. sysval The defining text of the sysval macro shall be the exit value of the utility last invoked by the syscmd macro (as a string). traceon The traceon macro shall enable tracing for the macros specified as arguments, or, if no arguments are specified, for all macros. The trace output shall be written to standard error in an unspecified format. traceoff The traceoff macro shall disable tracing for the macros specified as arguments, or, if no arguments are specified, for all macros. translit The defining text of the translit macro shall be the first argument with every character that occurs in the second argument replaced with the corresponding character from the third argument. If no replacement character is specified for some source character because the second argument is longer than the third argument, that character shall be deleted from the first argument in translit's defining text. The behavior is unspecified if the '-' character appears within the second or third argument anywhere besides the first or last character. The behavior is unspecified if the same character appears more than once in the second argument. The behavior is unspecified if translit is not immediately followed by a <left-parenthesis>. undefine The undefine macro shall delete all definitions (including those preserved using the pushdef macro) of the macros named by its arguments. The behavior is unspecified if undefine is not immediately followed by a <left-parenthesis>. undivert The undivert macro shall cause immediate output of any text in temporary buffers named as arguments, or all temporary buffers if no arguments are specified. Buffers can be undiverted into other temporary buffers. Undiverting shall discard the contents of the temporary buffer. The behavior is unspecified if an argument contains any non-numeric characters. EXIT STATUS top The following exit values shall be returned: 0 Successful completion. >0 An error occurred If the m4exit macro is used, the exit value can be specified by the input file. CONSEQUENCES OF ERRORS top Default. The following sections are informative. APPLICATION USAGE top The defn macro is useful for renaming macros, especially built- ins. Since eval defers to the ISO C standard, some operations have undefined behavior. In some implementations, division or remainder by zero cause a fatal signal, even if the division occurs on the short-circuited branch of "&&" or "||". Any operation that overflows in signed arithmetic produces undefined behavior. Likewise, using the shift operators with a shift amount that is not positive and smaller than the precision is undefined, as is shifting a negative number to the right. Historically, not all implementations obeyed C-language precedence rules: '~' and '!' were lower than '=='; '==' and '!=' were not lower than '<'; and '|' was not lower than '^'; the liberal use of "()" can force the desired precedence even with these non-compliant implementations. Furthermore, some traditional implementations treated '^' as an exponentiation operator, although most implementations now use "**" as an extension for this purpose. When a macro has been multiply defined via the pushdef macro, it is unspecified whether the define macro will alter only the most recent definition (as though by popdef and pushdef), or replace the entire stack of definitions with a single definition (as though by undefine and pushdef). An application desiring particular behavior for the define macro in this case can redefine it accordingly. Applications should use the mkstemp macro instead of the obsolescent maketemp macro for creating temporary files. EXAMPLES top If the file m4src contains the lines: The value of `VER' is "VER". ifdef(`VER', ``VER'' is defined to be VER., VER is not defined.) ifelse(VER, 1, ``VER'' is `VER'.) ifelse(VER, 2, ``VER'' is `VER'., ``VER'' is not 2.) end then the command m4 m4src or the command: m4 -U VER m4src produces the output: The value of VER is "VER". VER is not defined. VER is not 2. end The command: m4 -D VER m4src produces the output: The value of VER is "". VER is defined to be . VER is not 2. end The command: m4 -D VER=1 m4src produces the output: The value of VER is "1". VER is defined to be 1. VER is 1. VER is not 2. end The command: m4 -D VER=2 m4src produces the output: The value of VER is "2". VER is defined to be 2. VER is 2. end RATIONALE top Historic System V-based behavior treated "${" in a macro definition as two literal characters. However, this sequence is left unspecified so that implementations may offer extensions such as "${11}" meaning the eleventh positional parameter. Macros can still be defined with appropriate uses of nested quoting to result in a literal "${" in the output after rescanning removes the nested quotes. In the translit built-in, historic System V-based behavior treated '-' as a literal; GNU behavior treats it as a range. This version of the standard allows either behavior. FUTURE DIRECTIONS top None. SEE ALSO top c99(1p) The Base Definitions volume of POSIX.12017, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines COPYRIGHT top Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE/The Open Group 2017 M4(1P) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# m4\n\n> Macro processor.\n> More information: <https://www.gnu.org/software/m4>.\n\n- Process macros in a file:\n\n`m4 {{path/to/file}}`\n\n- Define a macro before processing files:\n\n`m4 -D{{macro_name}}={{macro_value}} {{path/to/file}}`\n
machinectl
machinectl(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training machinectl(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | COMMANDS | OPTIONS | MACHINE AND IMAGE NAMES | FILES AND DIRECTORIES | EXAMPLES | EXIT STATUS | ENVIRONMENT | SEE ALSO | COLOPHON MACHINECTL(1) machinectl MACHINECTL(1) NAME top machinectl - Control the systemd machine manager SYNOPSIS top machinectl [OPTIONS...] {COMMAND} [NAME...] DESCRIPTION top machinectl may be used to introspect and control the state of the systemd(1) virtual machine and container registration manager systemd-machined.service(8). machinectl may be used to execute operations on machines and images. Machines in this sense are considered running instances of: Virtual Machines (VMs) that virtualize hardware to run full operating system (OS) instances (including their kernels) in a virtualized environment on top of the host OS. Containers that share the hardware and OS kernel with the host OS, in order to run OS userspace instances on top the host OS. The host system itself. Machines are identified by names that follow the same rules as UNIX and DNS hostnames. For details, see below. Machines are instantiated from disk or file system images that frequently but not necessarily carry the same name as machines running from them. Images in this sense may be: Directory trees containing an OS, including the top-level directories /usr/, /etc/, and so on. btrfs subvolumes containing OS trees, similar to regular directory trees. Binary "raw" disk image files containing MBR or GPT partition tables and Linux file systems. Similarly, block devices containing MBR or GPT partition tables and file systems. The file system tree of the host OS itself. COMMANDS top The following commands are understood: Machine Commands list List currently running (online) virtual machines and containers. To enumerate machine images that can be started, use list-images (see below). Note that this command hides the special ".host" machine by default. Use the --all switch to show it. Added in version 206. status NAME... Show runtime status information about one or more virtual machines and containers, followed by the most recent log data from the journal. This function is intended to generate human-readable output. If you are looking for computer-parsable output, use show instead. Note that the log data shown is reported by the virtual machine or container manager, and frequently contains console output of the machine, but not necessarily journal contents of the machine itself. Added in version 206. show [NAME...] Show properties of one or more registered virtual machines or containers or the manager itself. If no argument is specified, properties of the manager will be shown. If a NAME is specified, properties of this virtual machine or container are shown. By default, empty properties are suppressed. Use --all to show those too. To select specific properties to show, use --property=. This command is intended to be used whenever computer-parsable output is required, and does not print the control group tree or journal entries. Use status if you are looking for formatted human-readable output. Added in version 206. start NAME... Start a container as a system service, using systemd-nspawn(1). This starts [email protected], instantiated for the specified machine name, similar to the effect of systemctl start on the service name. systemd-nspawn looks for a container image by the specified name in /var/lib/machines/ (and other search paths, see below) and runs it. Use list-images (see below) for listing available container images to start. Note that systemd-machined.service(8) also interfaces with a variety of other container and VM managers, systemd-nspawn is just one implementation of it. Most of the commands available in machinectl may be used on containers or VMs controlled by other managers, not just systemd-nspawn. Starting VMs and container images on those managers requires manager-specific tools. To interactively start a container on the command line with full access to the container's console, please invoke systemd-nspawn directly. To stop a running container use machinectl poweroff. Added in version 219. login [NAME] Open an interactive terminal login session in a container or on the local host. If an argument is supplied, it refers to the container machine to connect to. If none is specified, or the container name is specified as the empty string, or the special machine name ".host" (see below) is specified, the connection is made to the local host instead. This will create a TTY connection to a specific container or the local host and asks for the execution of a getty on it. Note that this is only supported for containers running systemd(1) as init system. This command will open a full login prompt on the container or the local host, which then asks for username and password. Use shell (see below) or systemd-run(1) with the --machine= switch to directly invoke a single command, either interactively or in the background. Added in version 209. shell [[NAME@]NAME [PATH [ARGUMENTS...]]] Open an interactive shell session in a container or on the local host. The first argument refers to the container machine to connect to. If none is specified, or the machine name is specified as the empty string, or the special machine name ".host" (see below) is specified, the connection is made to the local host instead. This works similarly to login, but immediately invokes a user process. This command runs the specified executable with the specified arguments, or the default shell for the user if none is specified, or /bin/sh if no default shell is found. By default, --uid=, or by prefixing the machine name with a username and an "@" character, a different user may be selected. Use --setenv= to set environment variables for the executed process. Note that machinectl shell does not propagate the exit code/status of the invoked shell process. Use systemd-run instead if that information is required (see below). Using the shell command without arguments (thus invoking the executed shell or command on the local host), is in many ways similar to a su(1) session, but, unlike su, completely isolates the new session from the originating session, so that it shares no process or session properties and is in a clean well-defined state. It will be tracked in a new utmp, login, audit, security, and keyring sessions, and will not inherit any environment variables or resource limits, among other properties. Note that systemd-run(1) with its --machine= switch may be used in place of the machinectl shell command, and allows non-interactive operation, more detailed and low-level configuration of the invoked unit, as well as access to runtime and exit code/status information of the invoked shell process. In particular, use systemd-run's --wait switch to propagate exit status information of the invoked process. Use systemd-run's --pty switch to acquire an interactive shell, similarly to machinectl shell. In general, systemd-run is preferable for scripting purposes. However, note that systemd-run might require higher privileges than machinectl shell. Added in version 225. enable NAME..., disable NAME... Enable or disable a container as a system service to start at system boot, using systemd-nspawn(1). This enables or disables [email protected], instantiated for the specified machine name, similarly to the effect of systemctl enable or systemctl disable on the service name. This command implicitly reloads the system manager configuration after completing the operation. Note that this command does not implicitly start or power off the containers that are being operated on. If this is desired, combine the command with the --now switch. Added in version 219. poweroff NAME... Power off one or more containers. This will trigger a reboot by sending SIGRTMIN+4 to the container's init process, which causes systemd-compatible init systems to shut down cleanly. Use stop as alias for poweroff. This operation does not work on containers that do not run a systemd(1)-compatible init system, such as sysvinit. Use terminate (see below) to immediately terminate a container or VM, without cleanly shutting it down. Added in version 212. reboot NAME... Reboot one or more containers. This will trigger a reboot by sending SIGINT to the container's init process, which is roughly equivalent to pressing Ctrl+Alt+Del on a non-containerized system, and is compatible with containers running any system manager. Added in version 209. terminate NAME... Immediately terminates a virtual machine or container, without cleanly shutting it down. This kills all processes of the virtual machine or container and deallocates all resources attached to that instance. Use poweroff to issue a clean shutdown request. Added in version 206. kill NAME... Send a signal to one or more processes of the virtual machine or container. This means processes as seen by the host, not the processes inside the virtual machine or container. Use --kill-whom= to select which process to kill. Use --signal= to select the signal to send. Added in version 206. bind NAME PATH [PATH] Bind mounts a file or directory from the host into the specified container. The first path argument is the source file or directory on the host, the second path argument is the destination file or directory in the container. When the latter is omitted, the destination path in the container is the same as the source path on the host. When combined with the --read-only switch, a ready-only bind mount is created. When combined with the --mkdir switch, the destination path is first created before the mount is applied. Note that this option is currently only supported for systemd-nspawn(1) containers, and only if user namespacing (--private-users) is not used. This command supports bind mounting directories, regular files, device nodes, AF_UNIX socket nodes, as well as FIFOs. Added in version 219. copy-to NAME PATH [PATH] --force Copies files or directories from the host system into a running container. Takes a container name, followed by the source path on the host and the destination path in the container. If the destination path is omitted, the same as the source path is used. If host and container share the same user and group namespace, file ownership by numeric user ID and group ID is preserved for the copy, otherwise all files and directories in the copy will be owned by the root user and group (UID/GID 0). Added in version 219. copy-from NAME PATH [PATH] --force Copies files or directories from a container into the host system. Takes a container name, followed by the source path in the container and the destination path on the host. If the destination path is omitted, the same as the source path is used. If host and container share the same user and group namespace, file ownership by numeric user ID and group ID is preserved for the copy, otherwise all files and directories in the copy will be owned by the root user and group (UID/GID 0). Added in version 219. Image Commands list-images Show a list of locally installed container and VM images. This enumerates all raw disk images and container directories and subvolumes in /var/lib/machines/ (and other search paths, see below). Use start (see above) to run a container off one of the listed images. Note that, by default, containers whose name begins with a dot (".") are not shown. To show these too, specify --all. Note that a special image ".host" always implicitly exists and refers to the image the host itself is booted from. Added in version 219. image-status [NAME...] Show terse status information about one or more container or VM images. This function is intended to generate human-readable output. Use show-image (see below) to generate computer-parsable output instead. Added in version 219. show-image [NAME...] Show properties of one or more registered virtual machine or container images, or the manager itself. If no argument is specified, properties of the manager will be shown. If a NAME is specified, properties of this virtual machine or container image are shown. By default, empty properties are suppressed. Use --all to show those too. To select specific properties to show, use --property=. This command is intended to be used whenever computer-parsable output is required. Use image-status if you are looking for formatted human-readable output. Added in version 219. edit NAME|FILE Edit the settings file of the specified machines. For the format of the settings file, refer to systemd.nspawn(5). If an existing settings file of the given machine can't be found, edit automatically create a new settings file from scratch under /etc/systemd/nspawn/. Added in version 254. cat NAME|FILE Show the settings file of the specified machines. Added in version 254. clone NAME NAME Clones a container or VM image. The arguments specify the name of the image to clone and the name of the newly cloned image. Note that plain directory container images are cloned into btrfs subvolume images with this command, if the underlying file system supports this. Note that cloning a container or VM image is optimized for file systems that support copy-on-write, and might not be efficient on others, due to file system limitations. Note that this command leaves hostname, machine ID and all other settings that could identify the instance unmodified. The original image and the cloned copy will hence share these credentials, and it might be necessary to manually change them in the copy. If combined with the --read-only switch a read-only cloned image is created. Added in version 219. rename NAME NAME Renames a container or VM image. The arguments specify the name of the image to rename and the new name of the image. Added in version 219. read-only NAME [BOOL] Marks or (unmarks) a container or VM image read-only. Takes a VM or container image name, followed by a boolean as arguments. If the boolean is omitted, positive is implied, i.e. the image is marked read-only. Added in version 219. remove NAME... Removes one or more container or VM images. The special image ".host", which refers to the host's own directory tree, may not be removed. Added in version 219. set-limit [NAME] BYTES Sets the maximum size in bytes that a specific container or VM image, or all images, may grow up to on disk (disk quota). Takes either one or two parameters. The first, optional parameter refers to a container or VM image name. If specified, the size limit of the specified image is changed. If omitted, the overall size limit of the sum of all images stored locally is changed. The final argument specifies the size limit in bytes, possibly suffixed by the usual K, M, G, T units. If the size limit shall be disabled, specify "-" as size. Note that per-container size limits are only supported on btrfs file systems. Added in version 220. clean Remove hidden VM or container images (or all). This command removes all hidden machine images from /var/lib/machines/, i.e. those whose name begins with a dot. Use machinectl list-images --all to see a list of all machine images, including the hidden ones. When combined with the --all switch removes all images, not just hidden ones. This command effectively empties /var/lib/machines/. Note that commands such as machinectl pull-tar or machinectl pull-raw usually create hidden, read-only, unmodified machine images from the downloaded image first, before cloning a writable working copy of it, in order to avoid duplicate downloads in case of images that are reused multiple times. Use machinectl clean to remove old, hidden images created this way. Added in version 230. Image Transfer Commands pull-tar URL [NAME] Downloads a .tar container image from the specified URL, and makes it available under the specified local machine name. The URL must be of type "http://" or "https://", and must refer to a .tar, .tar.gz, .tar.xz or .tar.bz2 archive file. If the local machine name is omitted, it is automatically derived from the last component of the URL, with its suffix removed. The image is verified before it is made available, unless --verify=no is specified. Verification is done either via an inline signed file with the name of the image and the suffix .sha256 or via separate SHA256SUMS and SHA256SUMS.gpg files. The signature files need to be made available on the same web server, under the same URL as the .tar file. With --verify=checksum, only the SHA256 checksum for the file is verified, based on the .sha256 suffixed file or the SHA256SUMS file. With --verify=signature, the sha checksum file is first verified with the inline signature in the .sha256 file or the detached GPG signature file SHA256SUMS.gpg. The public key for this verification step needs to be available in /usr/lib/systemd/import-pubring.gpg or /etc/systemd/import-pubring.gpg. The container image will be downloaded and stored in a read-only subvolume in /var/lib/machines/ that is named after the specified URL and its HTTP etag. A writable snapshot is then taken from this subvolume, and named after the specified local name. This behavior ensures that creating multiple container instances of the same URL is efficient, as multiple downloads are not necessary. In order to create only the read-only image, and avoid creating its writable snapshot, specify "-" as local machine name. Note that the read-only subvolume is prefixed with .tar-, and is thus not shown by list-images, unless --all is passed. Note that pressing C-c during execution of this command will not abort the download. Use cancel-transfer, described below. Added in version 219. pull-raw URL [NAME] Downloads a .raw container or VM disk image from the specified URL, and makes it available under the specified local machine name. The URL must be of type "http://" or "https://". The container image must either be a .qcow2 or raw disk image, optionally compressed as .gz, .xz, or .bz2. If the local machine name is omitted, it is automatically derived from the last component of the URL, with its suffix removed. Image verification is identical for raw and tar images (see above). If the downloaded image is in .qcow2 format it is converted into a raw image file before it is made available. Downloaded images of this type will be placed as read-only .raw file in /var/lib/machines/. A local, writable (reflinked) copy is then made under the specified local machine name. To omit creation of the local, writable copy pass "-" as local machine name. Similarly to the behavior of pull-tar, the read-only image is prefixed with .raw-, and thus not shown by list-images, unless --all is passed. Note that pressing C-c during execution of this command will not abort the download. Use cancel-transfer, described below. Added in version 219. import-tar FILE [NAME], import-raw FILE [NAME] Imports a TAR or RAW container or VM image, and places it under the specified name in /var/lib/machines/. When import-tar is used, the file specified as the first argument should be a tar archive, possibly compressed with xz, gzip or bzip2. It will then be unpacked into its own subvolume in /var/lib/machines/. When import-raw is used, the file should be a qcow2 or raw disk image, possibly compressed with xz, gzip or bzip2. If the second argument (the resulting image name) is not specified, it is automatically derived from the file name. If the filename is passed as "-", the image is read from standard input, in which case the second argument is mandatory. Optionally, the --read-only switch may be used to create a read-only container or VM image. No cryptographic validation is done when importing the images. Much like image downloads, ongoing imports may be listed with list-transfers and aborted with cancel-transfer. Added in version 220. import-fs DIRECTORY [NAME] Imports a container image stored in a local directory into /var/lib/machines/, operates similarly to import-tar or import-raw, but the first argument is the source directory. If supported, this command will create a btrfs snapshot or subvolume for the new image. Added in version 240. export-tar NAME [FILE], export-raw NAME [FILE] Exports a TAR or RAW container or VM image and stores it in the specified file. The first parameter should be a VM or container image name. The second parameter should be a file path the TAR or RAW image is written to. If the path ends in ".gz", the file is compressed with gzip, if it ends in ".xz", with xz, and if it ends in ".bz2", with bzip2. If the path ends in neither, the file is left uncompressed. If the second argument is missing, the image is written to standard output. The compression may also be explicitly selected with the --format= switch. This is in particular useful if the second parameter is left unspecified. Much like image downloads and imports, ongoing exports may be listed with list-transfers and aborted with cancel-transfer. Note that, currently, only directory and subvolume images may be exported as TAR images, and only raw disk images as RAW images. Added in version 220. list-transfers Shows a list of container or VM image downloads, imports and exports that are currently in progress. Added in version 219. cancel-transfer ID... Aborts a download, import or export of the container or VM image with the specified ID. To list ongoing transfers and their IDs, use list-transfers. Added in version 219. OPTIONS top The following options are understood: -p, --property= When showing machine or image properties, limit the output to certain properties as specified by the argument. If not specified, all set properties are shown. The argument should be a property name, such as "Name". If specified more than once, all properties with the specified names are shown. Added in version 206. -a, --all When showing machine or image properties, show all properties regardless of whether they are set or not. When listing VM or container images, do not suppress images beginning in a dot character ("."). When cleaning VM or container images, remove all images, not just hidden ones. Added in version 206. --value When printing properties with show, only print the value, and skip the property name and "=". Added in version 230. -l, --full Do not ellipsize process tree entries or table. This implies --max-addresses=full. Added in version 206. --kill-whom= When used with kill, choose which processes to kill. Must be one of leader, or all to select whether to kill only the leader process of the machine or all processes of the machine. If omitted, defaults to all. Added in version 206. -s, --signal= When used with kill, choose which signal to send to selected processes. Must be one of the well-known signal specifiers such as SIGTERM, SIGINT or SIGSTOP. If omitted, defaults to SIGTERM. The special value "help" will list the known values and the program will exit immediately, and the special value "list" will list known values along with the numerical signal numbers and the program will exit immediately. --uid= When used with the shell command, chooses the user ID to open the interactive shell session as. If the argument to the shell command also specifies a user name, this option is ignored. If the name is not specified in either way, "root" will be used by default. Note that this switch is not supported for the login command (see below). Added in version 225. -E NAME[=VALUE], --setenv=NAME[=VALUE] When used with the shell command, sets an environment variable for the executed shell. This option may be used more than once to set multiple variables. When "=" and VALUE are omitted, the value of the variable with the same name in the program environment will be used. Note that this option is not supported for the login command. Added in version 230. --mkdir When used with bind, creates the destination file or directory before applying the bind mount. Note that even though the name of this option suggests that it is suitable only for directories, this option also creates the destination file node to mount over if the object to mount is not a directory, but a regular file, device node, socket or FIFO. Added in version 219. --read-only When used with bind, creates a read-only bind mount. When used with clone, import-raw or import-tar a read-only container or VM image is created. Added in version 219. -n, --lines= When used with status, controls the number of journal lines to show, counting from the most recent ones. Takes a positive integer argument. Defaults to 10. Added in version 219. -o, --output= When used with status, controls the formatting of the journal entries that are shown. For the available choices, see journalctl(1). Defaults to "short". Added in version 219. --verify= When downloading a container or VM image, specify whether the image shall be verified before it is made available. Takes one of "no", "checksum" and "signature". If "no", no verification is done. If "checksum" is specified, the download is checked for integrity after the transfer is complete, but no signatures are verified. If "signature" is specified, the checksum is verified and the image's signature is checked against a local keyring of trustable vendors. It is strongly recommended to set this option to "signature" if the server and protocol support this. Defaults to "signature". Added in version 219. --now When used with enable or disable, the containers will also be started or powered off. The start or poweroff operation is only carried out when the respective enable or disable operation has been successful. Added in version 253. --force When downloading a container or VM image, and a local copy by the specified local machine name already exists, delete it first and replace it by the newly downloaded image. Added in version 219. --format= When used with the export-tar or export-raw commands, specifies the compression format to use for the resulting file. Takes one of "uncompressed", "xz", "gzip", "bzip2". By default, the format is determined automatically from the image file name passed. Added in version 220. --max-addresses= When used with the list-machines command, limits the number of IP addresses shown for every machine. Defaults to 1. All addresses can be requested with "all". If the limit is 0, the address column is not shown. Otherwise, if the machine has more addresses than shown, "..." follows the last address. Added in version 232. -q, --quiet Suppresses additional informational output while running. Added in version 236. -H, --host= Execute the operation remotely. Specify a hostname, or a username and hostname separated by "@", to connect to. The hostname may optionally be suffixed by a port ssh is listening on, separated by ":", and then a container name, separated by "/", which connects directly to a specific container on the specified host. This will use SSH to talk to the remote machine manager instance. Container names may be enumerated with machinectl -H HOST. Put IPv6 addresses in brackets. -M, --machine= Connect to systemd-machined.service(8) running in a local container, to perform the specified operation within the container. Added in version 235. --no-pager Do not pipe output into a pager. --no-legend Do not print the legend, i.e. column headers and the footer with hints. --no-ask-password Do not query the user for authentication for privileged operations. -h, --help Print a short help text and exit. --version Print a short version string and exit. MACHINE AND IMAGE NAMES top The machinectl tool operates on machines and images whose names must be chosen following strict rules. Machine names must be suitable for use as hostnames following a conservative subset of DNS and UNIX/Linux semantics. Specifically, they must consist of one or more non-empty label strings, separated by dots. No leading or trailing dots are allowed. No sequences of multiple dots are allowed. The label strings may only consist of alphanumeric characters as well as the dash and underscore. The maximum length of a machine name is 64 characters. A special machine with the name ".host" refers to the running host system itself. This is useful for execution operations or inspecting the host system as well. Note that machinectl list will not show this special machine unless the --all switch is specified. Requirements on image names are less strict, however, they must be valid UTF-8, must be suitable as file names (hence not be the single or double dot, and not include a slash), and may not contain control characters. Since many operations search for an image by the name of a requested machine, it is recommended to name images in the same strict fashion as machines. A special image with the name ".host" refers to the image of the running host system. It hence conceptually maps to the special ".host" machine name described above. Note that machinectl list-images will not show this special image either, unless --all is specified. FILES AND DIRECTORIES top Machine images are preferably stored in /var/lib/machines/, but are also searched for in /usr/local/lib/machines/ and /usr/lib/machines/. For compatibility reasons, the directory /var/lib/container/ is searched, too. Note that images stored below /usr/ are always considered read-only. It is possible to symlink machines images from other directories into /var/lib/machines/ to make them available for control with machinectl. Note that some image operations are only supported, efficient or atomic on btrfs file systems. Disk images are understood by systemd-nspawn(1) and machinectl in three formats: A simple directory tree, containing the files and directories of the container to boot. Subvolumes (on btrfs file systems), which are similar to the simple directories, described above. However, they have additional benefits, such as efficient cloning and quota reporting. "Raw" disk images, i.e. binary images of disks with a GPT or MBR partition table. Images of this type are regular files with the suffix ".raw". See systemd-nspawn(1) for more information on image formats, in particular its --directory= and --image= options. EXAMPLES top Example 1. Download a Ubuntu image and open a shell in it # machinectl pull-tar https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-root.tar.gz # systemd-nspawn -M trusty-server-cloudimg-amd64-root This downloads and verifies the specified .tar image, and then uses systemd-nspawn(1) to open a shell in it. Example 2. Download a Fedora image, set a root password in it, start it as a service # machinectl pull-raw --verify=no \ https://download.fedoraproject.org/pub/fedora/linux/releases/38/Cloud/x86_64/images/Fedora-Cloud-Base-38-1.6.x86_64.raw.xz \ Fedora-Cloud-Base-38-1.6.x86-64 # systemd-nspawn -M Fedora-Cloud-Base-38-1.6.x86-64 # passwd # exit # machinectl start Fedora-Cloud-Base-38-1.6.x86-64 # machinectl login Fedora-Cloud-Base-38-1.6.x86-64 This downloads the specified .raw image with verification disabled. Then, a shell is opened in it and a root password is set. Afterwards the shell is left, and the machine started as system service. With the last command a login prompt into the container is requested. Example 3. Exports a container image as tar file # machinectl export-tar fedora myfedora.tar.xz Exports the container "fedora" as an xz-compressed tar file myfedora.tar.xz into the current directory. Example 4. Create a new shell session # machinectl shell --uid=lennart This creates a new shell session on the local host for the user ID "lennart", in a su(1)-like fashion. EXIT STATUS top On success, 0 is returned, a non-zero failure code otherwise. ENVIRONMENT top $SYSTEMD_LOG_LEVEL The maximum log level of emitted messages (messages with a higher log level, i.e. less important ones, will be suppressed). Either one of (in order of decreasing importance) emerg, alert, crit, err, warning, notice, info, debug, or an integer in the range 0...7. See syslog(3) for more information. $SYSTEMD_LOG_COLOR A boolean. If true, messages written to the tty will be colored according to priority. This setting is only useful when messages are written directly to the terminal, because journalctl(1) and other tools that display logs will color messages based on the log level on their own. $SYSTEMD_LOG_TIME A boolean. If true, console log messages will be prefixed with a timestamp. This setting is only useful when messages are written directly to the terminal or a file, because journalctl(1) and other tools that display logs will attach timestamps based on the entry metadata on their own. $SYSTEMD_LOG_LOCATION A boolean. If true, messages will be prefixed with a filename and line number in the source code where the message originates. Note that the log location is often attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs. $SYSTEMD_LOG_TID A boolean. If true, messages will be prefixed with the current numerical thread ID (TID). Note that the this information is attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs. $SYSTEMD_LOG_TARGET The destination for log messages. One of console (log to the attached tty), console-prefixed (log to the attached tty but with prefixes encoding the log level and "facility", see syslog(3), kmsg (log to the kernel circular log buffer), journal (log to the journal), journal-or-kmsg (log to the journal if available, and to kmsg otherwise), auto (determine the appropriate log target automatically, the default), null (disable log output). $SYSTEMD_LOG_RATELIMIT_KMSG Whether to ratelimit kmsg or not. Takes a boolean. Defaults to "true". If disabled, systemd will not ratelimit messages written to kmsg. $SYSTEMD_PAGER Pager to use when --no-pager is not given; overrides $PAGER. If neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known pager implementations are tried in turn, including less(1) and more(1), until one is found. If no pager implementation is discovered no pager is invoked. Setting this environment variable to an empty string or the value "cat" is equivalent to passing --no-pager. Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER (as well as $PAGER) will be silently ignored. $SYSTEMD_LESS Override the options passed to less (by default "FRSXMK"). Users might want to change two options in particular: K This option instructs the pager to exit immediately when Ctrl+C is pressed. To allow less to handle Ctrl+C itself to switch back to the pager command prompt, unset this option. If the value of $SYSTEMD_LESS does not include "K", and the pager that is invoked is less, Ctrl+C will be ignored by the executable, and needs to be handled by the pager. X This option instructs the pager to not send termcap initialization and deinitialization strings to the terminal. It is set by default to allow command output to remain visible in the terminal even after the pager exits. Nevertheless, this prevents some pager functionality from working, in particular paged output cannot be scrolled with the mouse. See less(1) for more discussion. $SYSTEMD_LESSCHARSET Override the charset passed to less (by default "utf-8", if the invoking terminal is determined to be UTF-8 compatible). $SYSTEMD_PAGERSECURE Takes a boolean argument. When true, the "secure" mode of the pager is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set at all, secure mode is enabled if the effective UID is not the same as the owner of the login session, see geteuid(2) and sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set when invoking the pager, and the pager shall disable commands that open or create new files or start new subprocesses. When $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known to implement secure mode will not be used. (Currently only less(1) implements secure mode.) Note: when commands are invoked with elevated privileges, for example under sudo(8) or pkexec(1), care must be taken to ensure that unintended interactive features are not enabled. "Secure" mode for the pager may be enabled automatically as describe above. Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited environment allows the user to invoke arbitrary commands. Note that if the $SYSTEMD_PAGER or $PAGER variables are to be honoured, $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to completely disable the pager using --no-pager instead. $SYSTEMD_COLORS Takes a boolean argument. When true, systemd and related utilities will use colors in their output, otherwise the output will be monochrome. Additionally, the variable can take one of the following special values: "16", "256" to restrict the use of colors to the base 16 or 256 ANSI colors, respectively. This can be specified to override the automatic decision based on $TERM and what the console is connected to. $SYSTEMD_URLIFY The value must be a boolean. Controls whether clickable links should be generated in the output for terminal emulators supporting this. This can be specified to override the decision that systemd makes based on $TERM and other conditions. SEE ALSO top systemd(1), systemd-machined.service(8), systemd-nspawn(1), systemd.special(7), tar(1), xz(1), gzip(1), bzip2(1) COLOPHON top This page is part of the systemd (systemd system and service manager) project. Information about the project can be found at http://www.freedesktop.org/wiki/Software/systemd. If you have a bug report for this manual page, see http://www.freedesktop.org/wiki/Software/systemd/#bugreports. This page was obtained from the project's upstream Git repository https://github.com/systemd/systemd.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-22.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] systemd 255 MACHINECTL(1) Pages that refer to this page: busctl(1), systemctl(1), systemd-nspawn(1), systemd-run(1), systemd-vmspawn(1), uid0(1), sd_bus_default(3), sd_bus_set_address(3), systemd.directives(7), systemd.index(7), nss-mymachines(8), systemd-importd.service(8), systemd-machined.service(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# machinectl\n\n> Control the systemd machine manager.\n> Execute operations on virtual machines, containers and images.\n> More information: <https://www.freedesktop.org/software/systemd/man/machinectl.html>.\n\n- Start a machine as a service using `systemd-nspawn`:\n\n`sudo machinectl start {{machine_name}}`\n\n- Stop a running machine:\n\n`sudo machinectl stop {{machine_name}}`\n\n- Display a list of running machines:\n\n`machinectl list`\n\n- Open an interactive shell inside the machine:\n\n`sudo machinectl shell {{machine_name}}`\n
mailx
mailx(1p) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mailx(1p) Linux manual page PROLOG | NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OPERANDS | STDIN | INPUT FILES | ENVIRONMENT VARIABLES | ASYNCHRONOUS EVENTS | STDOUT | STDERR | OUTPUT FILES | EXTENDED DESCRIPTION | EXIT STATUS | CONSEQUENCES OF ERRORS | APPLICATION USAGE | EXAMPLES | RATIONALE | FUTURE DIRECTIONS | SEE ALSO | COPYRIGHT MAILX(1P) POSIX Programmer's Manual MAILX(1P) PROLOG top This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME top mailx process messages SYNOPSIS top Send Mode mailx [-s subject] address... Receive Mode mailx -e mailx [-HiNn] [-F] [-u user] mailx -f [-HiNn] [-F] [file] DESCRIPTION top The mailx utility provides a message sending and receiving facility. It has two major modes, selected by the options used: Send Mode and Receive Mode. On systems that do not support the User Portability Utilities option, an application using mailx shall have the ability to send messages in an unspecified manner (Send Mode). Unless the first character of one or more lines is <tilde> ('~'), all characters in the input message shall appear in the delivered message, but additional characters may be inserted in the message before it is retrieved. On systems supporting the User Portability Utilities option, mail-receiving capabilities and other interactive features, Receive Mode, described below, also shall be enabled. Send Mode Send Mode can be used by applications or users to send messages from the text in standard input. Receive Mode Receive Mode is more oriented towards interactive users. Mail can be read and sent in this interactive mode. When reading mail, mailx provides commands to facilitate saving, deleting, and responding to messages. When sending mail, mailx allows editing, reviewing, and other modification of the message as it is entered. Incoming mail shall be stored in one or more unspecified locations for each user, collectively called the system mailbox for that user. When mailx is invoked in Receive Mode, the system mailbox shall be the default place to find new mail. As messages are read, they shall be marked to be moved to a secondary file for storage, unless specific action is taken. This secondary file is called the mbox and is normally located in the directory referred to by the HOME environment variable (see MBOX in the ENVIRONMENT VARIABLES section for a description of this file). Messages shall remain in this file until explicitly removed. When the -f option is used to read mail messages from secondary files, messages shall be retained in those files unless specifically removed. All three of these locationssystem mailbox, mbox, and secondary fileare referred to in this section as simply ``mailboxes'', unless more specific identification is required. OPTIONS top The mailx utility shall conform to the Base Definitions volume of POSIX.12017, Section 12.2, Utility Syntax Guidelines. The following options shall be supported. (Only the -s subject option shall be required on all systems. The other options are required only on systems supporting the User Portability Utilities option.) -e Test for the presence of mail in the system mailbox. The mailx utility shall write nothing and exit with a successful return code if there is mail to read. -f Read messages from the file named by the file operand instead of the system mailbox. (See also folder.) If no file operand is specified, read messages from mbox instead of the system mailbox. -F Record the message in a file named after the first recipient. The name is the login-name portion of the address found first on the To: line in the mail header. Overrides the record variable, if set (see Internal Variables in mailx). -H Write a header summary only. -i Ignore interrupts. (See also ignore.) -n Do not initialize from the system default start-up file. See the EXTENDED DESCRIPTION section. -N Do not write an initial header summary. -s subject Set the Subject header field to subject. All characters in the subject string shall appear in the delivered message. The results are unspecified if subject is longer than {LINE_MAX} - 10 bytes or contains a <newline>. -u user Read the system mailbox of the login name user. This shall only be successful if the invoking user has appropriate privileges to read the system mailbox of that user. OPERANDS top The following operands shall be supported: address Addressee of message. When -n is specified and no user start-up files are accessed (see the EXTENDED DESCRIPTION section), the user or application shall ensure this is an address to pass to the mail delivery system. Any system or user start-up files may enable aliases (see alias under Commands in mailx) that may modify the form of address before it is passed to the mail delivery system. file A pathname of a file to be read instead of the system mailbox when -f is specified. The meaning of the file option-argument shall be affected by the contents of the folder internal variable; see Internal Variables in mailx. STDIN top When mailx is invoked in Send Mode (the first synopsis line), standard input shall be the message to be delivered to the specified addresses. When in Receive Mode, user commands shall be accepted from stdin. If the User Portability Utilities option is not supported, standard input lines beginning with a <tilde> ('~') character produce unspecified results. If the User Portability Utilities option is supported, then in both Send and Receive Modes, standard input lines beginning with the escape character (usually <tilde> ('~')) shall affect processing as described in Command Escapes in mailx. INPUT FILES top When mailx is used as described by this volume of POSIX.12017, the file option-argument (see the -f option) and the mbox shall be text files containing mail messages, formatted as described in the OUTPUT FILES section. The nature of the system mailbox is unspecified; it need not be a file. ENVIRONMENT VARIABLES top Some of the functionality described in this section shall be provided on implementations that support the User Portability Utilities option as described in the text, and is not further shaded for this option. The following environment variables shall affect the execution of mailx: DEAD Determine the pathname of the file in which to save partial messages in case of interrupts or delivery errors. The default shall be dead.letter in the directory named by the HOME variable. The behavior of mailx in saving partial messages is unspecified if the User Portability Utilities option is not supported and DEAD is not defined with the value /dev/null. EDITOR Determine the name of a utility to invoke when the edit (see Commands in mailx) or ~e (see Command Escapes in mailx) command is used. The default editor is unspecified. On XSI-conformant systems it is ed. The effects of this variable are unspecified if the User Portability Utilities option is not supported. HOME Determine the pathname of the user's home directory. LANG Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.12017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files) and the handling of case-insensitive address and header-field comparisons. LC_TIME This variable may determine the format and contents of the date and time strings written by mailx. This volume of POSIX.12017 specifies the effects of this variable only for systems supporting the User Portability Utilities option. LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output. LISTER Determine a string representing the command for writing the contents of the folder directory to standard output when the folders command is given (see folders in Commands in mailx). Any string acceptable as a command_string operand to the sh -c command shall be valid. If this variable is null or not set, the output command shall be ls. The effects of this variable are unspecified if the User Portability Utilities option is not supported. MAILRC Determine the pathname of the user start-up file. The default shall be .mailrc in the directory referred to by the HOME environment variable. The behavior of mailx is unspecified if the User Portability Utilities option is not supported and MAILRC is not defined with the value /dev/null. MBOX Determine a pathname of the file to save messages from the system mailbox that have been read. The exit command shall override this function, as shall saving the message explicitly in another file. The default shall be mbox in the directory named by the HOME variable. The effects of this variable are unspecified if the User Portability Utilities option is not supported. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES. PAGER Determine a string representing an output filtering or pagination command for writing the output to the terminal. Any string acceptable as a command_string operand to the sh -c command shall be valid. When standard output is a terminal device, the message output shall be piped through the command if the mailx internal variable crt is set to a value less the number of lines in the message; see Internal Variables in mailx. If the PAGER variable is null or not set, the paginator shall be either more or another paginator utility documented in the system documentation. The effects of this variable are unspecified if the User Portability Utilities option is not supported. SHELL Determine the name of a preferred command interpreter. The default shall be sh. The effects of this variable are unspecified if the User Portability Utilities option is not supported. TERM If the internal variable screen is not specified, determine the name of the terminal type to indicate in an unspecified manner the number of lines in a screenful of headers. If TERM is not set or is set to null, an unspecified default terminal type shall be used and the value of a screenful is unspecified. The effects of this variable are unspecified if the User Portability Utilities option is not supported. TZ This variable may determine the timezone used to calculate date and time strings written by mailx. If TZ is unset or null, an unspecified default timezone shall be used. VISUAL Determine a pathname of a utility to invoke when the visual command (see Commands in mailx) or ~v command- escape (see Command Escapes in mailx) is used. If this variable is null or not set, the full-screen editor shall be vi. The effects of this variable are unspecified if the User Portability Utilities option is not supported. ASYNCHRONOUS EVENTS top When mailx is in Send Mode and standard input is not a terminal, it shall take the standard action for all signals. In Receive Mode, or in Send Mode when standard input is a terminal, if a SIGINT signal is received: 1. If in command mode, the current command, if there is one, shall be aborted, and a command-mode prompt shall be written. 2. If in input mode: a. If ignore is set, mailx shall write "@\n", discard the current input line, and continue processing, bypassing the message-abort mechanism described in item 2b. b. If the interrupt was received while sending mail, either when in Receive Mode or in Send Mode, a message shall be written, and another subsequent interrupt, with no other intervening characters typed, shall be required to abort the mail message. If in Receive Mode and another interrupt is received, a command-mode prompt shall be written. If in Send Mode and another interrupt is received, mailx shall terminate with a non-zero status. In both cases listed in item b, if the message is not empty: i. If save is enabled and the file named by DEAD can be created, the message shall be written to the file named by DEAD. If the file exists, the message shall be written to replace the contents of the file. ii. If save is not enabled, or the file named by DEAD cannot be created, the message shall not be saved. The mailx utility shall take the standard action for all other signals. STDOUT top In command and input modes, all output, including prompts and messages, shall be written to standard output. STDERR top The standard error shall be used only for diagnostic messages. OUTPUT FILES top Various mailx commands and command escapes can create or add to files, including the mbox, the dead-letter file, and secondary mailboxes. When mailx is used as described in this volume of POSIX.12017, these files shall be text files, formatted as follows: line beginning with From<space> [one or more header-lines; see Commands in mailx] empty line [zero or more body lines empty line] [line beginning with From<space>...] where each message begins with the From <space> line shown, preceded by the beginning of the file or an empty line. (The From <space> line is considered to be part of the message header, but not one of the header-lines referred to in Commands in mailx; thus, it shall not be affected by the discard, ignore, or retain commands.) The formats of the remainder of the From <space> line and any additional header lines are unspecified, except that none shall be empty. The format of a message body line is also unspecified, except that no line following an empty line shall start with From <space>; mailx shall modify any such user-entered message body lines (following an empty line and beginning with From <space>) by adding one or more characters to precede the 'F'; it may add these characters to From <space> lines that are not preceded by an empty line. When a message from the system mailbox or entered by the user is not a text file, it is implementation-defined how such a message is stored in files written by mailx. EXTENDED DESCRIPTION top The functionality in the entire EXTENDED DESCRIPTION section shall be provided on implementations supporting the User Portability Utilities option. The functionality described in this section shall be provided on implementations that support the User Portability Utilities option (and the rest of this section is not further shaded for this option). The mailx utility need not support for all character encodings in all circumstances. For example, inter-system mail may be restricted to 7-bit data by the underlying network, 8-bit data need not be portable to non-internationalized systems, and so on. Under these circumstances, it is recommended that only characters defined in the ISO/IEC 646:1991 standard International Reference Version (equivalent to ASCII) 7-bit range of characters be used. When mailx is invoked using one of the Receive Mode synopsis forms, it shall write a page of header-summary lines (if -N was not specified and there are messages, see below), followed by a prompt indicating that mailx can accept regular commands (see Commands in mailx); this is termed command mode. The page of header-summary lines shall contain the first new message if there are new messages, or the first unread message if there are unread messages, or the first message. When mailx is invoked using the Send Mode synopsis and standard input is a terminal, if no subject is specified on the command line and the asksub variable is set, a prompt for the subject shall be written. At this point, mailx shall be in input mode. This input mode shall also be entered when using one of the Receive Mode synopsis forms and a reply or new message is composed using the reply, Reply, followup, Followup, or mail commands and standard input is a terminal. When the message is typed and the end of the message is encountered, the message shall be passed to the mail delivery software. Commands can be entered by beginning a line with the escape character (by default, <tilde> ('~')) followed by a single command letter and optional arguments. See Commands in mailx for a summary of these commands. It is unspecified what effect these commands will have if standard input is not a terminal when a message is entered using either the Send Mode synopsis, or the Read Mode commands reply, Reply, followup, Followup, or mail. Note: For notational convenience, this section uses the default escape character, <tilde>, in all references and examples. At any time, the behavior of mailx shall be governed by a set of environmental and internal variables. These are flags and valued parameters that can be set and cleared via the mailx set and unset commands. Regular commands are of the form: [command] [msglist] [argument ...] If no command is specified in command mode, next shall be assumed. In input mode, commands shall be recognized by the escape character, and lines not treated as commands shall be taken as input for the message. In command mode, each message shall be assigned a sequential number, starting with 1. All messages have a state that shall affect how they are displayed in the header summary and how they are retained or deleted upon termination of mailx. There is at any time the notion of a current message, which shall be marked by a '>' at the beginning of a line in the header summary. When mailx is invoked using one of the Receive Mode synopsis forms, the current message shall be the first new message, if there is a new message, or the first unread message if there is an unread message, or the first message if there are any messages, or unspecified if there are no messages in the mailbox. Each command that takes an optional list of messages (msglist) or an optional single message (message) on which to operate shall leave the current message set to the highest-numbered message of the messages specified, unless the command deletes messages, in which case the current message shall be set to the first undeleted message (that is, a message not in the deleted state) after the highest-numbered message deleted by the command, if one exists, or the first undeleted message before the highest-numbered message deleted by the command, if one exists, or to an unspecified value if there are no remaining undeleted messages. All messages shall be in one of the following states: new The message is present in the system mailbox and has not been viewed by the user or moved to any other state. Messages in state new when mailx quits shall be retained in the system mailbox. unread The message has been present in the system mailbox for more than one invocation of mailx and has not been viewed by the user or moved to any other state. Messages in state unread when mailx quits shall be retained in the system mailbox. read The message has been processed by one of the following commands: ~f, ~m, ~F, ~M, copy, mbox, next, pipe, print, Print, top, type, Type, undelete. The delete, dp, and dt commands may also cause the next message to be marked as read, depending on the value of the autoprint variable. Messages that are in the system mailbox and in state read when mailx quits shall be saved in the mbox, unless the internal variable hold was set. Messages that are in the mbox or in a secondary mailbox and in state read when mailx quits shall be retained in their current location. deleted The message has been processed by one of the following commands: delete, dp, dt. Messages in state deleted when mailx quits shall be deleted. Deleted messages shall be ignored until mailx quits or changes mailboxes or they are specified to the undelete command; for example, the message specification /string shall only search the subject lines of messages that have not yet been deleted, unless the command operating on the list of messages is undelete. No deleted message or deleted message header shall be displayed by any mailx command other than undelete. preserved The message has been processed by a preserve command. When mailx quits, the message shall be retained in its current location. saved The message has been processed by one of the following commands: save or write. If the current mailbox is the system mailbox, and the internal variable keepsave is set, messages in the state saved shall be saved to the file designated by the MBOX variable (see the ENVIRONMENT VARIABLES section). If the current mailbox is the system mailbox, messages in the state saved shall be deleted from the current mailbox, when the quit or file command is used to exit the current mailbox. The header-summary line for each message shall indicate the state of the message. Many commands take an optional list of messages (msglist) on which to operate, which defaults to the current message. A msglist is a list of message specifications separated by <blank> characters, which can include: n Message number n. + The next undeleted message, or the next deleted message for the undelete command. - The next previous undeleted message, or the next previous deleted message for the undelete command. . The current message. ^ The first undeleted message, or the first deleted message for the undelete command. $ The last message. * All messages. nm An inclusive range of message numbers. address All messages from address; any address as shown in a header summary shall be matchable in this form. /string All messages with string in the subject line (case ignored). :c All messages of type c, where c shall be one of: d Deleted messages. n New messages. o Old messages (any not in state read or new). r Read messages. u Unread messages. Other commands take an optional message (message) on which to operate, which defaults to the current message. All of the forms allowed for msglist are also allowed for message, but if more than one message is specified, only the first shall be operated on. Other arguments are usually arbitrary strings whose usage depends on the command involved. Start-Up in mailx At start-up time, mailx shall take the following steps in sequence: 1. Establish all variables at their stated default values. 2. Process command line options, overriding corresponding default values. 3. Import any of the DEAD, EDITOR, MBOX, LISTER, PAGER, SHELL, or VISUAL variables that are present in the environment, overriding the corresponding default values. 4. Read mailx commands from an unspecified system start-up file, unless the -n option is given, to initialize any internal mailx variables and aliases. 5. Process the user start-up file of mailx commands named in the user MAILRC variable. Most regular mailx commands are valid inside start-up files, the most common use being to set up initial display options and alias lists. The following commands shall be invalid in a start-up file: !, edit, hold, mail, preserve, reply, Reply, shell, visual, Copy, followup, and Followup. Any errors in a start-up file shall either cause mailx to terminate with a diagnostic message and a non-zero status or to continue after writing a diagnostic message, ignoring the remainder of the lines in the file. A blank line in a start-up file shall be ignored. Internal Variables in mailx The following variables are internal mailx variables. Each internal variable can be set via the mailx set command at any time. The unset and set no name commands can be used to erase variables. In the following list, variables shown as: variable represent Boolean values. Variables shown as: variable=value shall be assigned string or numeric values. For string values, the rules in Commands in mailx concerning filenames and quoting shall also apply. The defaults specified here may be changed by the unspecified system start-up file unless the user specifies the -n option. allnet All network names whose login name components match shall be treated as identical. This shall cause the msglist message specifications to behave similarly. The default shall be noallnet. See also the alternates command and the metoo variable. append Append messages to the end of the mbox file upon termination instead of placing them at the beginning. The default shall be noappend. This variable shall not affect the save command when saving to mbox. ask, asksub Prompt for a subject line on outgoing mail if one is not specified on the command line with the -s option. The ask and asksub forms are synonyms; the system shall refer to asksub and noasksub in its messages, but shall accept ask and noask as user input to mean asksub and noasksub. It shall not be possible to set both ask and noasksub, or noask and asksub. The default shall be asksub, but no prompting shall be done if standard input is not a terminal. askbcc Prompt for the blind copy list. The default shall be noaskbcc. askcc Prompt for the copy list. The default shall be noaskcc. autoprint Enable automatic writing of messages after delete and undelete commands. The default shall be noautoprint. bang Enable the special-case treatment of <exclamation-mark> characters ('!') in escape command lines; see the escape command and Command Escapes in mailx. The default shall be nobang, disabling the expansion of '!' in the command argument to the ~! command and the ~<!command escape. cmd=command Set the default command to be invoked by the pipe command. The default shall be nocmd. crt=number Pipe messages having more than number lines through the command specified by the value of the PAGER variable. The default shall be nocrt. If it is set to null, the value used is implementation-defined. debug Enable verbose diagnostics for debugging. Messages are not delivered. The default shall be nodebug. dot When dot is set, a <period> on a line by itself during message input from a terminal shall also signify end- of-file (in addition to normal end-of-file). The default shall be nodot. If ignoreeof is set (see below), a setting of nodot shall be ignored and the <period> is the only method to terminate input mode. escape=c Set the command escape character to be the character 'c'. By default, the command escape character shall be <tilde>. If escape is unset, <tilde> shall be used; if it is set to null, command escaping shall be disabled. flipr Reverse the meanings of the R and r commands. The default shall be noflipr. folder=directory The default directory for saving mail files. User- specified filenames beginning with a <plus-sign> ('+') shall be expanded by preceding the filename with this directory name to obtain the real pathname. If directory does not start with a <slash> ('/'), the contents of HOME shall be prefixed to it. The default shall be nofolder. If folder is unset or set to null, user-specified filenames beginning with '+' shall refer to files in the current directory that begin with the literal '+' character. See also outfolder below. The folder value need not affect the processing of the files named in MBOX and DEAD. header Enable writing of the header summary when entering mailx in Receive Mode. The default shall be header. hold Preserve all messages that are read in the system mailbox instead of putting them in the mbox save file. The default shall be nohold. ignore Ignore interrupts while entering messages. The default shall be noignore. ignoreeof Ignore normal end-of-file during message input. Input can be terminated only by entering a <period> ('.') on a line by itself or by the ~. command escape. The default shall be noignoreeof. See also dot above. indentprefix=string A string that shall be added as a prefix to each line that is inserted into the message by the ~m command escape. This variable shall default to one <tab>. keep When a system mailbox, secondary mailbox, or mbox is empty, truncate it to zero length instead of removing it. The default shall be nokeep. keepsave Keep the messages that have been saved from the system mailbox into other files in the file designated by the variable MBOX, instead of deleting them. The default shall be nokeepsave. metoo Suppress the deletion of the login name of the user from the recipient list when replying to a message or sending to a group. The default shall be nometoo. onehop When responding to a message that was originally sent to several recipients, the other recipient addresses are normally forced to be relative to the originating author's machine for the response. This flag disables alteration of the recipients' addresses, improving efficiency in a network where all machines can send directly to all other machines (that is, one hop away). The default shall be noonehop. outfolder Cause the files used to record outgoing messages to be located in the directory specified by the folder variable unless the pathname is absolute. The default shall be nooutfolder. See the record variable. page Insert a <form-feed> after each message sent through the pipe created by the pipe command. The default shall be nopage. prompt=string Set the command-mode prompt to string. If string is null or if noprompt is set, no prompting shall occur. The default shall be to prompt with the string "? ". quiet Refrain from writing the opening message and version when entering mailx. The default shall be noquiet. record=file Record all outgoing mail in the file with the pathname file. The default shall be norecord. See also outfolder above. save Enable saving of messages in the dead-letter file on interrupt or delivery error. See the variable DEAD for the location of the dead-letter file. The default shall be save. screen=number Set the number of lines in a screenful of headers for the headers and z commands. If screen is not specified, a value based on the terminal type identified by the TERM environment variable, the window size, the baud rate, or some combination of these shall be used. sendwait Wait for the background mailer to finish before returning. The default shall be nosendwait. showto When the sender of the message was the user who is invoking mailx, write the information from the To: line instead of the From: line in the header summary. The default shall be noshowto. sign=string Set the variable inserted into the text of a message when the ~a command escape is given. The default shall be nosign. The character sequences '\t' and '\n' shall be recognized in the variable as <tab> and <newline> characters, respectively. (See also ~i in Command Escapes in mailx.) Sign=string Set the variable inserted into the text of a message when the ~A command escape is given. The default shall be noSign. The character sequences '\t' and '\n' shall be recognized in the variable as <tab> and <newline> characters, respectively. toplines=number Set the number of lines of the message to write with the top command. The default shall be 5. Commands in mailx The following mailx commands shall be provided. In the following list, header refers to lines from the message header, as shown in the OUTPUT FILES section. Header-line refers to lines within the header that begin with one or more non-white-space characters, immediately followed by a <colon> and white space and continuing until the next line beginning with a non-white-space character or an empty line. Header-field refers to the portion of a header line prior to the first <colon> in that line. For each of the commands listed below, the command can be entered as the abbreviation (those characters in the Synopsis command word preceding the '['), the full command (all characters shown for the command word, omitting the '[' and ']'), or any truncation of the full command down to the abbreviation. For example, the exit command (shown as ex[it] in the Synopsis) can be entered as ex, exi, or exit. The arguments to commands can be quoted, using the following methods: * An argument can be enclosed between paired double-quotes ("") or single-quotes (''); any white space, shell word expansion, or <backslash> characters within the quotes shall be treated literally as part of the argument. A double-quote shall be treated literally within single-quotes and vice versa. These special properties of the <quotation-mark> characters shall occur only when they are paired at the beginning and end of the argument. * A <backslash> outside of the enclosing quotes shall be discarded and the following character treated literally as part of the argument. * An unquoted <backslash> at the end of a command line shall be discarded and the next line shall continue the command. Filenames, where expected, shall be subjected to the following transformations, in sequence: * If the filename begins with an unquoted <plus-sign>, and the folder variable is defined (see the folder variable), the <plus-sign> shall be replaced by the value of the folder variable followed by a <slash>. If the folder variable is unset or is set to null, the filename shall be unchanged. * Shell word expansions shall be applied to the filename (see Section 2.6, Word Expansions). If more than a single pathname results from this expansion and the command is expecting one file, the effects are unspecified. Declare Aliases Synopsis: a[lias] [alias [address...]] g[roup] [alias [address...]] Add the given addresses to the alias specified by alias. The names shall be substituted when alias is used as a recipient address specified by the user in an outgoing message (that is, other recipients addressed indirectly through the reply command shall not be substituted in this manner). Mail address alias substitution shall apply only when the alias string is used as a full address; for example, when hlj is an alias, [email protected] does not trigger the alias substitution. If no arguments are given, write a listing of the current aliases to standard output. If only an alias argument is given, write a listing of the specified alias to standard output. These listings need not reflect the same order of addresses that were entered. Declare Alternatives Synopsis: alt[ernates] name... (See also the metoo variable.) Declare a list of alternative names for the user's login. When responding to a message, these names shall be removed from the list of recipients for the response. The comparison of names shall be in a case-insensitive manner. With no arguments, alternates shall write the current list of alternative names. Change Current Directory Synopsis: cd [directory] ch[dir] [directory] Change directory. If directory is not specified, the contents of HOME shall be used. Copy Messages Synopsis: c[opy] [file] c[opy] [msglist] file C[opy] [msglist] Copy messages to the file named by the pathname file without marking the messages as saved. Otherwise, it shall be equivalent to the save command. In the capitalized form, save the specified messages in a file whose name is derived from the author of the message to be saved, without marking the messages as saved. Otherwise, it shall be equivalent to the Save command. Delete Messages Synopsis: d[elete] [msglist] Mark messages for deletion from the mailbox. The deletions shall not occur until mailx quits (see the quit command) or changes mailboxes (see the folder command). If autoprint is set and there are messages remaining after the delete command, the current message shall be written as described for the print command (see the print command); otherwise, the mailx prompt shall be written. Discard Header Fields Synopsis: di[scard] [header-field...] ig[nore] [header-field...] Suppress the specified header fields when writing messages. Specified header-fields shall be added to the list of suppressed header fields. Examples of header fields to ignore are status and cc. The fields shall be included when the message is saved. The Print and Type commands shall override this command. The comparison of header fields shall be in a case-insensitive manner. If no arguments are specified, write a list of the currently suppressed header fields to standard output; the listing need not reflect the same order of header fields that were entered. If both retain and discard commands are given, discard commands shall be ignored. Delete Messages and Display Synopsis: dp [msglist] dt [msglist] Delete the specified messages as described for the delete command, except that the autoprint variable shall have no effect, and the current message shall be written only if it was set to a message after the last message deleted by the command. Otherwise, an informational message to the effect that there are no further messages in the mailbox shall be written, followed by the mailx prompt. Echo a String Synopsis: ec[ho] string ... Echo the given strings, equivalent to the shell echo utility. Edit Messages Synopsis: e[dit] [msglist] Edit the given messages. The messages shall be placed in a temporary file and the utility named by the EDITOR variable is invoked to edit each file in sequence. The default EDITOR is unspecified. The edit command does not modify the contents of those messages in the mailbox. Exit Synopsis: ex[it] x[it] Exit from mailx without changing the mailbox. No messages shall be saved in the mbox (see also quit). Change Folder Synopsis: fi[le] [file] fold[er] [file] Quit (see the quit command) from the current file of messages and read in the file named by the pathname file. If no argument is given, the name and status of the current mailbox shall be written. Several unquoted special characters shall be recognized when used as file names, with the following substitutions: % The system mailbox for the invoking user. %user The system mailbox for user. # The previous file. & The current mbox. +file The named file in the folder directory. (See the folder variable.) The default file shall be the current mailbox. Display List of Folders Synopsis: folders Write the names of the files in the directory set by the folder variable. The command specified by the LISTER environment variable shall be used (see the ENVIRONMENT VARIABLES section). Follow Up Specified Messages Synopsis: fo[llowup] [message] F[ollowup] [msglist] In the lowercase form, respond to a message, recording the response in a file whose name is derived from the author of the message. See also the save and copy commands and outfolder. In the capitalized form, respond to the first message in the msglist, sending the message to the author of each message in the msglist. The subject line shall be taken from the first message and the response shall be recorded in a file whose name is derived from the author of the first message. See also the Save and Copy commands and outfolder. Both forms shall override the record variable, if set. Display Header Summary for Specified Messages Synopsis: f[rom] [msglist] Write the header summary for the specified messages. Display Header Summary Synopsis: h[eaders] [message] Write the page of headers that includes the message specified. If the message argument is not specified, the current message shall not change. However, if the message argument is specified, the current message shall become the message that appears at the top of the page of headers that includes the message specified. The screen variable sets the number of headers per page. See also the z command. Help Synopsis: hel[p] ? Write a summary of commands. Hold Messages Synopsis: ho[ld] [msglist] pre[serve] [msglist] Mark the messages in msglist to be retained in the mailbox when mailx terminates. This shall override any commands that might previously have marked the messages to be deleted. During the current invocation of mailx, only the delete, dp, or dt commands shall remove the preserve marking of a message. Execute Commands Conditionally Synopsis: i[f] s|r mail-commands el[se] mail-commands en[dif] Execute commands conditionally, where if s executes the following mail-commands, up to an else or endif, if the program is in Send Mode, and if r shall cause the mail-commands to be executed only in Receive Mode. List Available Commands Synopsis: l[ist] Write a list of all commands available. No explanation shall be given. Mail a Message Synopsis: m[ail] address... Mail a message to the specified addresses or aliases. Direct Messages to mbox Synopsis: mb[ox] [msglist] Arrange for the given messages to end up in the mbox save file when mailx terminates normally. See MBOX. See also the exit and quit commands. Process Next Specified Message Synopsis: n[ext] [message] If the current message has not been written (for example, by the print command) since mailx started or since any other message was the current message, behave as if the print command was entered. Otherwise, if there is an undeleted message after the current message, make it the current message and behave as if the print command was entered. Otherwise, an informational message to the effect that there are no further messages in the mailbox shall be written, followed by the mailx prompt. Should the current message location be the result of an immediately preceding hold, mbox, preserve, or touch command, next will act as if the current message has already been written. Pipe Message Synopsis: pi[pe] [[msglist] command] | [[msglist] command] Pipe the messages through the given command by invoking the command interpreter specified by SHELL with two arguments: -c and command. (See also sh -c.) The application shall ensure that the command is given as a single argument. Quoting, described previously, can be used to accomplish this. If no arguments are given, the current message shall be piped through the command specified by the value of the cmd variable. If the page variable is set, a <form-feed> shall be inserted after each message. Display Message with Headers Synopsis: P[rint] [msglist] T[ype] [msglist] Write the specified messages, including all header lines, to standard output. Override suppression of lines by the discard, ignore, and retain commands. If crt is set, the messages longer than the number of lines specified by the crt variable shall be paged through the command specified by the PAGER environment variable. Display Message Synopsis: p[rint] [msglist] t[ype] [msglist] Write the specified messages to standard output. If crt is set, the messages longer than the number of lines specified by the crt variable shall be paged through the command specified by the PAGER environment variable. Quit Synopsis: q[uit] end-of-file Terminate mailx, storing messages that were read in mbox (if the current mailbox is the system mailbox and unless hold is set), deleting messages that have been explicitly saved (unless keepsave is set), discarding messages that have been deleted, and saving all remaining messages in the mailbox. Reply to a Message List Synopsis: R[eply] [msglist] R[espond] [msglist] Mail a reply message to the sender of each message in the msglist. The subject line shall be formed by concatenating Re:<space> (unless it already begins with that string) and the subject from the first message. If record is set to a filename, the response shall be saved at the end of that file. See also the flipr variable. Reply to a Message Synopsis: r[eply] [message] r[espond] [message] Mail a reply message to all recipients included in the header of the message. The subject line shall be formed by concatenating Re:<space> (unless it already begins with that string) and the subject from the message. If record is set to a filename, the response shall be saved at the end of that file. See also the flipr variable. Retain Header Fields Synopsis: ret[ain] [header-field...] Retain the specified header fields when writing messages. This command shall override all discard and ignore commands. The comparison of header fields shall be in a case-insensitive manner. If no arguments are specified, write a list of the currently retained header fields to standard output; the listing need not reflect the same order of header fields that were entered. Save Messages Synopsis: s[ave] [file] s[ave] [msglist] file S[ave] [msglist] Save the specified messages in the file named by the pathname file, or the mbox if the file argument is omitted. The file shall be created if it does not exist; otherwise, the messages shall be appended to the file. The message shall be put in the state saved, and shall behave as specified in the description of the saved state when the current mailbox is exited by the quit or file command. In the capitalized form, save the specified messages in a file whose name is derived from the author of the first message. The name of the file shall be taken to be the author's name with all network addressing stripped off. See also the Copy, followup, and Followup commands and outfolder variable. Set Variables Synopsis: se[t] [name[=[string]] ...] [name=number ...] [noname ...] Define one or more variables called name. The variable can be given a null, string, or numeric value. Quoting and <backslash>-escapes can occur anywhere in string, as described previously, as if the string portion of the argument were the entire argument. The forms name and name= shall be equivalent to name="" for variables that take string values. The set command without arguments shall write a list of all defined variables and their values. The no name form shall be equivalent to unset name. Invoke a Shell Synopsis: sh[ell] Invoke an interactive command interpreter (see also SHELL). Display Message Size Synopsis: si[ze] [msglist] Write the size in bytes of each of the specified messages. Read mailx Commands From a File Synopsis: so[urce] file Read and execute commands from the file named by the pathname file and return to command mode. Display Beginning of Messages Synopsis: to[p] [msglist] Write the top few lines of each of the specified messages. If the toplines variable is set, it is taken as the number of lines to write. The default shall be 5. Touch Messages Synopsis: tou[ch] [msglist] Touch the specified messages. If any message in msglist is not specifically deleted nor saved in a file, it shall be placed in the mbox upon normal termination. See exit and quit. Delete Aliases Synopsis: una[lias] [alias]... Delete the specified alias names. If a specified alias does not exist, the results are unspecified. Undelete Messages Synopsis: u[ndelete] [msglist] Change the state of the specified messages from deleted to read. If autoprint is set, the last message of those restored shall be written. If msglist is not specified, the message shall be selected as follows: * If there are any deleted messages that follow the current message, the first of these shall be chosen. * Otherwise, the last deleted message that also precedes the current message shall be chosen. Unset Variables Synopsis: uns[et] name... Cause the specified variables to be erased. Edit Message with Full-Screen Editor Synopsis: v[isual] [msglist] Edit the given messages with a screen editor. Each message shall be placed in a temporary file, and the utility named by the VISUAL variable shall be invoked to edit each file in sequence. The default editor shall be vi. The visual command does not modify the contents of those messages in the mailbox. Write Messages to a File Synopsis: w[rite] [msglist] file Write the given messages to the file specified by the pathname file, minus the message header. Otherwise, it shall be equivalent to the save command. Scroll Header Display Synopsis: z[+|-] Scroll the header display forward (if '+' is specified or if no option is specified) or backward (if '-' is specified) one screenful. The number of headers written shall be set by the screen variable. Invoke Shell Command Synopsis: !command Invoke the command interpreter specified by SHELL with two arguments: -c and command. (See also sh -c.) If the bang variable is set, each unescaped occurrence of '!' in command shall be replaced with the command executed by the previous ! command or ~! command escape. Null Command Synopsis: # comment This null command (comment) shall be ignored by mailx. Display Current Message Number Synopsis: = Write the current message number. Command Escapes in mailx The following commands can be entered only from input mode, by beginning a line with the escape character (by default, <tilde> ('~')). See the escape variable description for changing this special character. The format for the commands shall be: <escape-character><command-char><separator>[<arguments>] where the <separator> can be zero or more <blank> characters. In the following descriptions, the application shall ensure that the argument command (but not mailx-command) is a shell command string. Any string acceptable to the command interpreter specified by the SHELL variable when it is invoked as SHELL -c command_string shall be valid. The command can be presented as multiple arguments (that is, quoting is not required). Command escapes that are listed with msglist or mailx-command arguments are invalid in Send Mode and produce unspecified results. ~! command Invoke the command interpreter specified by SHELL with two arguments: -c and command; and then return to input mode. If the bang variable is set, each unescaped occurrence of '!' in command shall be replaced with the command executed by the previous ! command or ~! command escape. ~. Simulate end-of-file (terminate message input). ~: mailx-command, ~_ mailx-command Perform the command-level request. ~? Write a summary of command escapes. ~A This shall be equivalent to ~i Sign. ~a This shall be equivalent to ~i sign. ~b name... Add the names to the blind carbon copy (Bcc) list. ~c name... Add the names to the carbon copy (Cc) list. ~d Read in the dead-letter file. See DEAD for a description of this file. ~e Invoke the editor, as specified by the EDITOR environment variable, on the partial message. ~f [msglist] Forward the specified messages. The specified messages shall be inserted into the current message without alteration. This command escape also shall insert message headers into the message with field selection affected by the discard, ignore, and retain commands. ~F [msglist] This shall be the equivalent of the ~f command escape, except that all headers shall be included in the message, regardless of previous discard, ignore, and retain commands. ~h If standard input is a terminal, prompt for a Subject line and the To, Cc, and Bcc lists. Other implementation-defined headers may also be presented for editing. If the field is written with an initial value, it can be edited as if it had just been typed. ~i string Insert the value of the named variable, followed by a <newline>, into the text of the message. If the string is unset or null, the message shall not be changed. ~m [msglist] Insert the specified messages into the message, prefixing non-empty lines with the string in the indentprefix variable. This command escape also shall insert message headers into the message, with field selection affected by the discard, ignore, and retain commands. ~M [msglist] This shall be the equivalent of the ~m command escape, except that all headers shall be included in the message, regardless of previous discard, ignore, and retain commands. ~p Write the message being entered. If the message is longer than crt lines (see Internal Variables in mailx), the output shall be paginated as described for the PAGER variable. ~q Quit (see the quit command) from input mode by simulating an interrupt. If the body of the message is not empty, the partial message shall be saved in the dead-letter file. See DEAD for a description of this file. ~r file, ~< file, ~r !command, ~< !command Read in the file specified by the pathname file. If the argument begins with an <exclamation-mark> ('!'), the rest of the string shall be taken as an arbitrary system command; the command interpreter specified by SHELL shall be invoked with two arguments: -c and command. The standard output of command shall be inserted into the message. ~s string Set the subject line to string. ~t name... Add the given names to the To list. ~v Invoke the full-screen editor, as specified by the VISUAL environment variable, on the partial message. ~w file Write the partial message, without the header, onto the file named by the pathname file. The file shall be created or the message shall be appended to it if the file exists. ~x Exit as with ~q, except the message shall not be saved in the dead-letter file. ~| command Pipe the body of the message through the given command by invoking the command interpreter specified by SHELL with two arguments: -c and command. If the command returns a successful exit status, the standard output of the command shall replace the message. Otherwise, the message shall remain unchanged. If the command fails, an error message giving the exit status shall be written. EXIT STATUS top When the -e option is specified, the following exit values are returned: 0 Mail was found. >0 Mail was not found or an error occurred. Otherwise, the following exit values are returned: 0 Successful completion; note that this status implies that all messages were sent, but it gives no assurances that any of them were actually delivered. >0 An error occurred. CONSEQUENCES OF ERRORS top When in input mode (Receive Mode) or Send Mode: * If an error is encountered processing an input line beginning with a <tilde> ('~') character, (see Command Escapes in mailx), a diagnostic message shall be written to standard error, and the message being composed may be modified, but this condition shall not prevent the message from being sent. * Other errors shall prevent the sending of the message. When in command mode: * Default. The following sections are informative. APPLICATION USAGE top Delivery of messages to remote systems requires the existence of communication paths to such systems. These need not exist. Input lines are limited to {LINE_MAX} bytes, but mailers between systems may impose more severe line-length restrictions. This volume of POSIX.12017 does not place any restrictions on the length of messages handled by mailx, and for delivery of local messages the only limitations should be the normal problems of available disk space for the target mail file. When sending messages to external machines, applications are advised to limit messages to less than 100000 bytes because some mail gateways impose message-length restrictions. The format of the system mailbox is intentionally unspecified. Not all systems implement system mailboxes as flat files, particularly with the advent of multimedia mail messages. Some system mailboxes may be multiple files, others records in a database. The internal format of the messages themselves is specified with the historical format from Version 7, but only after the messages have been saved in some file other than the system mailbox. This was done so that many historical applications expecting text-file mailboxes are not broken. Some new formats for messages can be expected in the future, probably including binary data, bit maps, and various multimedia objects. As described here, mailx is not prohibited from handling such messages, but it must store them as text files in secondary mailboxes (unless some extension, such as a variable or command line option, is used to change the stored format). Its method of doing so is implementation-defined and might include translating the data into text file-compatible or readable form or omitting certain portions of the message from the stored output. The discard and ignore commands are not inverses of the retain command. The retain command discards all header-fields except those explicitly retained. The discard command keeps all header- fields except those explicitly discarded. If headers exist on the retained header list, discard and ignore commands are ignored. EXAMPLES top None. RATIONALE top The standard developers felt strongly that a method for applications to send messages to specific users was necessary. The obvious example is a batch utility, running non- interactively, that wishes to communicate errors or results to a user. However, the actual format, delivery mechanism, and method of reading the message are clearly beyond the scope of this volume of POSIX.12017. The intent of this command is to provide a simple, portable interface for sending messages non-interactively. It merely defines a ``front-end'' to the historical mail system. It is suggested that implementations explicitly denote the sender and recipient in the body of the delivered message. Further specification of formats for either the message envelope or the message itself were deliberately not made, as the industry is in the midst of changing from the current standards to a more internationalized standard and it is probably incorrect, at this time, to require either one. Implementations are encouraged to conform to the various delivery mechanisms described in the CCITT X.400 standards or to the equivalent Internet standards, described in Internet Request for Comment (RFC) documents RFC 819, RFC 920, RFC 921, RFC 1123, and RFC 5322 (which succeeded RFC 822). Many historical systems modified each body line that started with From by prefixing the 'F' with '>'. It is unnecessary, but allowed, to do that when the string does not follow a blank line because it cannot be confused with the next header. The edit and visual commands merely edit the specified messages in a temporary file. They do not modify the contents of those messages in the mailbox; such a capability could be added as an extension, such as by using different command names. The restriction on a subject line being {LINE_MAX}-10 bytes is based on the historical format that consumes 10 bytes for Subject: and the trailing <newline>. Many historical mailers that a message may encounter on other systems are not able to handle lines that long, however. Like the utilities logger and lp, mailx admittedly is difficult to test. This was not deemed sufficient justification to exclude this utility from this volume of POSIX.12017. It is also arguable that it is, in fact, testable, but that the tests themselves are not portable. When mailx is being used by an application that wishes to receive the results as if none of the User Portability Utilities option features were supported, the DEAD environment variable must be set to /dev/null. Otherwise, it may be subject to the file creations described in mailx ASYNCHRONOUS EVENTS. Similarly, if the MAILRC environment variable is not set to /dev/null, historical versions of mailx and Mail read initialization commands from a file before processing begins. Since the initialization that a user specifies could alter the contents of messages an application is trying to send, such applications must set MAILRC to /dev/null. The description of LC_TIME uses ``may affect'' because many historical implementations do not or cannot manipulate the date and time strings in the incoming mail headers. Some headers found in incoming mail do not have enough information to determine the timezone in which the mail originated, and, therefore, mailx cannot convert the date and time strings into the internal form that then is parsed by routines like strftime() that can take LC_TIME settings into account. Changing all these times to a user-specified format is allowed, but not required. The paginator selected when PAGER is null or unset is partially unspecified to allow the System V historical practice of using pg as the default. Bypassing the pagination function, such as by declaring that cat is the paginator, would not meet with the intended meaning of this description. However, any ``portable user'' would have to set PAGER explicitly to get his or her preferred paginator on all systems. The paginator choice was made partially unspecified, unlike the VISUAL editor choice (mandated to be vi) because most historical pagers follow a common theme of user input, whereas editors differ dramatically. Options to specify addresses as cc (carbon copy) or bcc (blind carbon copy) were considered to be format details and were omitted. A zero exit status implies that all messages were sent, but it gives no assurances that any of them were actually delivered. The reliability of the delivery mechanism is unspecified and is an appropriate marketing distinction between systems. In order to conform to the Utility Syntax Guidelines, a solution was required to the optional file option-argument to -f. By making file an operand, the guidelines are satisfied and users remain portable. However, it does force implementations to support usage such as: mailx -fin mymail.box The no name method of unsetting variables is not present in all historical systems, but it is in System V and provides a logical set of commands corresponding to the format of the display of options from the mailx set command without arguments. The ask and asksub variables are the names selected by BSD and System V, respectively, for the same feature. They are synonyms in this volume of POSIX.12017. The mailx echo command was not documented in the BSD version and has been omitted here because it is not obviously useful for interactive users. The default prompt on the System V mailx is a <question-mark>, on BSD Mail an <ampersand>. Since this volume of POSIX.12017 chose the mailx name, it kept the System V default, assuming that BSD users would not have difficulty with this minor incompatibility (that they can override). The meanings of r and R are reversed between System V mailx and SunOS Mail. Once again, since this volume of POSIX.12017 chose the mailx name, it kept the System V default, but allows the SunOS user to achieve the desired results using flipr, an internal variable in System V mailx, although it has not been documented in the SVID. The indentprefix variable, the retain and unalias commands, and the ~F and ~M command escapes were adopted from 4.3 BSD Mail. The version command was not included because no sufficiently general specification of the version information could be devised that would still be useful to a portable user. This command name should be used by suppliers who wish to provide version information about the mailx command. The ``implementation-specific (unspecified) system start-up file'' historically has been named /etc/mailx.rc, but this specific name and location are not required. The intent of the wording for the next command is that if any command has already displayed the current message it should display a following message, but, otherwise, it should display the current message. Consider the command sequence: next 3 delete 3 next where the autoprint option was not set. The normative text specifies that the second next command should display a message following the third message, because even though the current message has not been displayed since it was set by the delete command, it has been displayed since the current message was anything other than message number 3. This does not always match historical practice in some implementations, where the command file address followed by next (or the default command) would skip the message for which the user had searched. FUTURE DIRECTIONS top None. SEE ALSO top Chapter 2, Shell Command Language, ed(1p), ls(1p), more(1p), vi(1p) The Base Definitions volume of POSIX.12017, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines COPYRIGHT top Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE/The Open Group 2017 MAILX(1P) Pages that refer to this page: logger(1p), lp(1p), uucp(1p), uuencode(1p) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mailx\n\n> Send and receive mail.\n> More information: <https://manned.org/mailx>.\n\n- Send mail (the content should be typed after the command, and ended with `Ctrl+D`):\n\n`mailx -s "{{subject}}" {{to_addr}}`\n\n- Send mail with content passed from another command:\n\n`echo "{{content}}" | mailx -s "{{subject}}" {{to_addr}}`\n\n- Send mail with content read from a file:\n\n`mailx -s "{{subject}}" {{to_addr}} < {{content.txt}}`\n\n- Send mail to a recipient and CC to another address:\n\n`mailx -s "{{subject}}" -c {{cc_addr}} {{to_addr}}`\n\n- Send mail specifying the sender address:\n\n`mailx -s "{{subject}}" -r {{from_addr}} {{to_addr}}`\n\n- Send mail with an attachment:\n\n`mailx -a {{path/to/file}} -s "{{subject}}" {{to_addr}}`\n
make
make(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training make(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | EXIT STATUS | SEE ALSO | BUGS | AUTHOR | COPYRIGHT | COLOPHON MAKE(1) User Commands MAKE(1) NAME top make - GNU make utility to maintain groups of programs SYNOPSIS top make [OPTION]... [TARGET]... DESCRIPTION top The make utility will determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them. The manual describes the GNU implementation of make, which was written by Richard Stallman and Roland McGrath, and is currently maintained by Paul Smith. Our examples show C programs, since they are very common, but you can use make with any programming language whose compiler can be run with a shell command. In fact, make is not limited to programs. You can use it to describe any task where some files must be updated automatically from others whenever the others change. To prepare to use make, you must write a file called the makefile that describes the relationships among files in your program, and provides commands for updating each file. In a program, typically the executable file is updated from object files, which are in turn made by compiling source files. Once a suitable makefile exists, each time you change some source files, this simple shell command: make suffices to perform all necessary recompilations. The make program uses the makefile description and the last-modification times of the files to decide which of the files need to be updated. For each of those files, it issues the commands recorded in the makefile. make executes commands in the makefile to update one or more targets, where target is typically a program. If no -f option is present, make will look for the makefiles GNUmakefile, makefile, and Makefile, in that order. Normally you should call your makefile either makefile or Makefile. (We recommend Makefile because it appears prominently near the beginning of a directory listing, right near other important files such as README.) The first name checked, GNUmakefile, is not recommended for most makefiles. You should use this name if you have a makefile that is specific to GNU make, and will not be understood by other versions of make. If makefile is '-', the standard input is read. make updates a target if it depends on prerequisite files that have been modified since the target was last modified, or if the target does not exist. OPTIONS top -b, -m These options are ignored for compatibility with other versions of make. -B, --always-make Unconditionally make all targets. -C dir, --directory=dir Change to directory dir before reading the makefiles or doing anything else. If multiple -C options are specified, each is interpreted relative to the previous one: -C / -C etc is equivalent to -C /etc. This is typically used with recursive invocations of make. -d Print debugging information in addition to normal processing. The debugging information says which files are being considered for remaking, which file-times are being compared and with what results, which files actually need to be remade, which implicit rules are considered and which are applied---everything interesting about how make decides what to do. --debug[=FLAGS] Print debugging information in addition to normal processing. If the FLAGS are omitted, then the behavior is the same as if -d was specified. FLAGS may be any or all of the following names, comma- or space-separated. Only the first character is significant: the rest may be omitted: all for all debugging output (same as using -d), basic for basic debugging, verbose for more verbose basic debugging, implicit for showing implicit rule search operations, jobs for details on invocation of commands, makefile for debugging while remaking makefiles, print shows all recipes that are run even if they are silent, and why shows the reason make decided to rebuild each target. Use none to disable all previous debugging flags. -e, --environment-overrides Give variables taken from the environment precedence over variables from makefiles. -E string, --eval string Interpret string using the eval function, before parsing any makefiles. -f file, --file=file, --makefile=FILE Use file as a makefile. -i, --ignore-errors Ignore all errors in commands executed to remake files. -I dir, --include-dir=dir Specifies a directory dir to search for included makefiles. If several -I options are used to specify several directories, the directories are searched in the order specified. Unlike the arguments to other flags of make, directories given with -I flags may come directly after the flag: -Idir is allowed, as well as -I dir. This syntax is allowed for compatibility with the C preprocessor's -I flag. -j [jobs], --jobs[=jobs] Specifies the number of jobs (commands) to run simultaneously. If there is more than one -j option, the last one is effective. If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously. --jobserver-style=style The style of jobserver to use. The style may be one of fifo, pipe, or sem (Windows only). -k, --keep-going Continue as much as possible after an error. While the target that failed, and those that depend on it, cannot be remade, the other dependencies of these targets can be processed all the same. -l [load], --load-average[=load] Specifies that no new jobs (commands) should be started if there are others jobs running and the load average is at least load (a floating-point number). With no argument, removes a previous load limit. -L, --check-symlink-times Use the latest mtime between symlinks and target. -n, --just-print, --dry-run, --recon Print the commands that would be executed, but do not execute them (except in certain circumstances). -o file, --old-file=file, --assume-old=file Do not remake the file file even if it is older than its dependencies, and do not remake anything on account of changes in file. Essentially the file is treated as very old and its rules are ignored. -O[type], --output-sync[=type] When running multiple jobs in parallel with -j, ensure the output of each job is collected together rather than interspersed with output from other jobs. If type is not specified or is target the output from the entire recipe for each target is grouped together. If type is line the output from each command line within a recipe is grouped together. If type is recurse output from an entire recursive make is grouped together. If type is none output synchronization is disabled. -p, --print-data-base Print the data base (rules and variable values) that results from reading the makefiles; then execute as usual or as otherwise specified. This also prints the version information given by the -v switch (see below). To print the data base without trying to remake any files, use make -p -f/dev/null. -q, --question ``Question mode''. Do not run any commands, or print anything; just return an exit status that is zero if the specified targets are already up to date, nonzero otherwise. -r, --no-builtin-rules Eliminate use of the built-in implicit rules. Also clear out the default list of suffixes for suffix rules. -R, --no-builtin-variables Don't define any built-in variables. -s, --silent, --quiet Silent operation; do not print the commands as they are executed. --no-silent Cancel the effect of the -s option. -S, --no-keep-going, --stop Cancel the effect of the -k option. -t, --touch Touch files (mark them up to date without really changing them) instead of running their commands. This is used to pretend that the commands were done, in order to fool future invocations of make. --trace Information about the disposition of each target is printed (why the target is being rebuilt and what commands are run to rebuild it). -v, --version Print the version of the make program plus a copyright, a list of authors and a notice that there is no warranty. -w, --print-directory Print a message containing the working directory before and after other processing. This may be useful for tracking down errors from complicated nests of recursive make commands. --no-print-directory Turn off -w, even if it was turned on implicitly. --shuffle[=MODE] Enable shuffling of goal and prerequisite ordering. MODE is one of none to disable shuffle mode, random to shuffle prerequisites in random order, reverse to consider prerequisites in reverse order, or an integer <seed> which enables random mode with a specific seed value. If MODE is omitted the default is random. -W file, --what-if=file, --new-file=file, --assume-new=file Pretend that the target file has just been modified. When used with the -n flag, this shows you what would happen if you were to modify that file. Without -n, it is almost the same as running a touch command on the given file before running make, except that the modification time is changed only in the imagination of make. --warn-undefined-variables Warn when an undefined variable is referenced. EXIT STATUS top GNU make exits with a status of zero if all makefiles were successfully parsed and no targets that were built failed. A status of one will be returned if the -q flag was used and make determines that a target needs to be rebuilt. A status of two will be returned if any errors were encountered. SEE ALSO top The full documentation for make is maintained as a Texinfo manual. If the info and make programs are properly installed at your site, the command info make should give you access to the complete manual. BUGS top See the chapter ``Problems and Bugs'' in The GNU Make Manual. AUTHOR top This manual page contributed by Dennis Morse of Stanford University. Further updates contributed by Mike Frysinger. It has been reworked by Roland McGrath. Maintained by Paul Smith. COPYRIGHT top Copyright 1992-1993, 1996-2022 Free Software Foundation, Inc. This file is part of GNU make. GNU Make is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/ . COLOPHON top This page is part of the make (GNU make) project. Information about the project can be found at http://www.gnu.org/software/make/. If you have a bug report for this manual page, see http://www.gnu.org/software/make/. This page was obtained from the tarball make-4.4.tar.gz fetched from http://ftp.gnu.org/gnu/make/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] GNU 31 May 2022 MAKE(1) Pages that refer to this page: dpkg-buildflags(1), dpkg-buildpackage(1), pkgdata(1), time(1), adjtime(3), pmdatrace(3), debhelper-compat-upgrade-checklist(7), sched(7), suffixes(7) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# make\n\n> Task runner for targets described in Makefile.\n> Mostly used to control the compilation of an executable from source code.\n> More information: <https://www.gnu.org/software/make/manual/make.html>.\n\n- Call the first target specified in the Makefile (usually named "all"):\n\n`make`\n\n- Call a specific target:\n\n`make {{target}}`\n\n- Call a specific target, executing 4 jobs at a time in parallel:\n\n`make -j{{4}} {{target}}`\n\n- Use a specific Makefile:\n\n`make --file {{path/to/file}}`\n\n- Execute make from another directory:\n\n`make --directory {{path/to/directory}}`\n\n- Force making of a target, even if source files are unchanged:\n\n`make --always-make {{target}}`\n\n- Override a variable defined in the Makefile:\n\n`make {{target}} {{variable}}={{new_value}}`\n\n- Override variables defined in the Makefile by the environment:\n\n`make --environment-overrides {{target}}`\n
man
man(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training man(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | EXAMPLES | OVERVIEW | DEFAULTS | OPTIONS | EXIT STATUS | ENVIRONMENT | FILES | STANDARDS | SEE ALSO | HISTORY | BUGS | COLOPHON MAN(1) Manual pager utils MAN(1) NAME top man - an interface to the system reference manuals SYNOPSIS top man [man options] [[section] page ...] ... man -k [apropos options] regexp ... man -K [man options] [section] term ... man -f [whatis options] page ... man -l [man options] file ... man -w|-W [man options] page ... DESCRIPTION top man is the system's manual pager. Each page argument given to man is normally the name of a program, utility or function. The manual page associated with each of these arguments is then found and displayed. A section, if provided, will direct man to look only in that section of the manual. The default action is to search in all of the available sections following a pre-defined order (see DEFAULTS), and to show only the first page found, even if page exists in several sections. The table below shows the section numbers of the manual followed by the types of pages they contain. 1 Executable programs or shell commands 2 System calls (functions provided by the kernel) 3 Library calls (functions within program libraries) 4 Special files (usually found in /dev) 5 File formats and conventions, e.g. /etc/passwd 6 Games 7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7), man-pages(7) 8 System administration commands (usually only for root) 9 Kernel routines [Non standard] A manual page consists of several sections. Conventional section names include NAME, SYNOPSIS, CONFIGURATION, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUE, ERRORS, ENVIRONMENT, FILES, VERSIONS, STANDARDS, NOTES, BUGS, EXAMPLE, AUTHORS, and SEE ALSO. The following conventions apply to the SYNOPSIS section and can be used as a guide in other sections. bold text type exactly as shown. italic text replace with appropriate argument. [-abc] any or all arguments within [ ] are optional. -a|-b options delimited by | cannot be used together. argument ... argument is repeatable. [expression] ... entire expression within [ ] is repeatable. Exact rendering may vary depending on the output device. For instance, man will usually not be able to render italics when running in a terminal, and will typically use underlined or coloured text instead. The command or function illustration is a pattern that should match all possible invocations. In some cases it is advisable to illustrate several exclusive invocations as is shown in the SYNOPSIS section of this manual page. EXAMPLES top man ls Display the manual page for the item (program) ls. man man.7 Display the manual page for macro package man from section 7. (This is an alternative spelling of "man 7 man".) man 'man(7)' Display the manual page for macro package man from section 7. (This is another alternative spelling of "man 7 man". It may be more convenient when copying and pasting cross-references to manual pages. Note that the parentheses must normally be quoted to protect them from the shell.) man -a intro Display, in succession, all of the available intro manual pages contained within the manual. It is possible to quit between successive displays or skip any of them. man -t bash | lpr -Pps Format the manual page for bash into the default troff or groff format and pipe it to the printer named ps. The default output for groff is usually PostScript. man --help should advise as to which processor is bound to the -t option. man -l -Tdvi ./foo.1x.gz > ./foo.1x.dvi This command will decompress and format the nroff source manual page ./foo.1x.gz into a device independent (dvi) file. The redirection is necessary as the -T flag causes output to be directed to stdout with no pager. The output could be viewed with a program such as xdvi or further processed into PostScript using a program such as dvips. man -k printf Search the short descriptions and manual page names for the keyword printf as regular expression. Print out any matches. Equivalent to apropos printf. man -f smail Lookup the manual pages referenced by smail and print out the short descriptions of any found. Equivalent to whatis smail. OVERVIEW top Many options are available to man in order to give as much flexibility as possible to the user. Changes can be made to the search path, section order, output processor, and other behaviours and operations detailed below. If set, various environment variables are interrogated to determine the operation of man. It is possible to set the "catch-all" variable $MANOPT to any string in command line format, with the exception that any spaces used as part of an option's argument must be escaped (preceded by a backslash). man will parse $MANOPT prior to parsing its own command line. Those options requiring an argument will be overridden by the same options found on the command line. To reset all of the options set in $MANOPT, -D can be specified as the initial command line option. This will allow man to "forget" about the options specified in $MANOPT, although they must still have been valid. Manual pages are normally stored in nroff(1) format under a directory such as /usr/share/man. In some installations, there may also be preformatted cat pages to improve performance. See manpath(5) for details of where these files are stored. This package supports manual pages in multiple languages, controlled by your locale. If your system did not set this up for you automatically, then you may need to set $LC_MESSAGES, $LANG, or another system-dependent environment variable to indicate your preferred locale, usually specified in the POSIX format: <language>[_<territory>[.<character-set>[,<version>]]] If the desired page is available in your locale, it will be displayed in lieu of the standard (usually American English) page. If you find that the translations supplied with this package are not available in your native language and you would like to supply them, please contact the maintainer who will be coordinating such activity. Individual manual pages are normally written and maintained by the maintainers of the program, function, or other topic that they document, and are not included with this package. If you find that a manual page is missing or inadequate, please report that to the maintainers of the package in question. For information regarding other features and extensions available with this manual pager, please read the documents supplied with the package. DEFAULTS top The order of sections to search may be overridden by the environment variable $MANSECT or by the SECTION directive in /usr/local/etc/man_db.conf. By default it is as follows: 1 n l 8 3 0 2 3type 5 4 9 6 7 The formatted manual page is displayed using a pager. This can be specified in a number of ways, or else will fall back to a default (see option -P for details). The filters are deciphered by a number of means. Firstly, the command line option -p or the environment variable $MANROFFSEQ is interrogated. If -p was not used and the environment variable was not set, the initial line of the nroff file is parsed for a preprocessor string. To contain a valid preprocessor string, the first line must resemble '\" <string> where string can be any combination of letters described by option -p below. If none of the above methods provide any filter information, a default set is used. A formatting pipeline is formed from the filters and the primary formatter (nroff or [tg]roff with -t) and executed. Alternatively, if an executable program mandb_nfmt (or mandb_tfmt with -t) exists in the man tree root, it is executed instead. It gets passed the manual source file, the preprocessor string, and optionally the device specified with -T or -E as arguments. OPTIONS top Non-argument options that are duplicated either on the command line, in $MANOPT, or both, are not harmful. For options that require an argument, each duplication will override the previous argument value. General options -C file, --config-file=file Use this user configuration file rather than the default of ~/.manpath. -d, --debug Print debugging information. -D, --default This option is normally issued as the very first option and resets man's behaviour to its default. Its use is to reset those options that may have been set in $MANOPT. Any options that follow -D will have their usual effect. --warnings[=warnings] Enable warnings from groff. This may be used to perform sanity checks on the source text of manual pages. warnings is a comma-separated list of warning names; if it is not supplied, the default is "mac". To disable a groff warning, prefix it with "!": for example, --warnings=mac,!break enables warnings in the "mac" category and disables warnings in the "break" category. See the Warnings node in info groff for a list of available warning names. Main modes of operation -f, --whatis Approximately equivalent to whatis. Display a short description from the manual page, if available. See whatis(1) for details. -k, --apropos Approximately equivalent to apropos. Search the short manual page descriptions for keywords and display any matches. See apropos(1) for details. -K, --global-apropos Search for text in all manual pages. This is a brute- force search, and is likely to take some time; if you can, you should specify a section to reduce the number of pages that need to be searched. Search terms may be simple strings (the default), or regular expressions if the --regex option is used. Note that this searches the sources of the manual pages, not the rendered text, and so may include false positives due to things like comments in source files, or false negatives due to things like hyphens being written as "\-" in source files. Searching the rendered text would be much slower. -l, --local-file Activate "local" mode. Format and display local manual files instead of searching through the system's manual collection. Each manual page argument will be interpreted as an nroff source file in the correct format. No cat file is produced. If '-' is listed as one of the arguments, input will be taken from stdin. If this option is not used, then man will also fall back to interpreting manual page arguments as local file names if the argument contains a "/" character, since that is a good indication that the argument refers to a path on the file system. -w, --where, --path, --location Don't actually display the manual page, but do print the location of the source nroff file that would be formatted. If the -a option is also used, then print the locations of all source files that match the search criteria. -W, --where-cat, --location-cat Don't actually display the manual page, but do print the location of the preformatted cat file that would be displayed. If the -a option is also used, then print the locations of all preformatted cat files that match the search criteria. If -w and -W are both used, then print both source file and cat file separated by a space. If all of -w, -W, and -a are used, then do this for each possible match. -c, --catman This option is not for general use and should only be used by the catman program. -R encoding, --recode=encoding Instead of formatting the manual page in the usual way, output its source converted to the specified encoding. If you already know the encoding of the source file, you can also use manconv(1) directly. However, this option allows you to convert several manual pages to a single encoding without having to explicitly state the encoding of each, provided that they were already installed in a structure similar to a manual page hierarchy. Consider using man-recode(1) instead for converting multiple manual pages, since it has an interface designed for bulk conversion and so can be much faster. Finding manual pages -L locale, --locale=locale man will normally determine your current locale by a call to the C function setlocale(3) which interrogates various environment variables, possibly including $LC_MESSAGES and $LANG. To temporarily override the determined value, use this option to supply a locale string directly to man. Note that it will not take effect until the search for pages actually begins. Output such as the help message will always be displayed in the initially determined locale. -m system[,...], --systems=system[,...] If this system has access to other operating systems' manual pages, they can be accessed using this option. To search for a manual page from NewOS's manual page collection, use the option -m NewOS. The system specified can be a combination of comma delimited operating system names. To include a search of the native operating system's manual pages, include the system name man in the argument string. This option will override the $SYSTEM environment variable. -M path, --manpath=path Specify an alternate manpath to use. By default, man uses manpath derived code to determine the path to search. This option overrides the $MANPATH environment variable and causes option -m to be ignored. A path specified as a manpath must be the root of a manual page hierarchy structured into sections as described in the man-db manual (under "The manual page system"). To view manual pages outside such hierarchies, see the -l option. -S list, -s list, --sections=list The given list is a colon- or comma-separated list of sections, used to determine which manual sections to search and in what order. This option overrides the $MANSECT environment variable. (The -s spelling is for compatibility with System V.) -e sub-extension, --extension=sub-extension Some systems incorporate large packages of manual pages, such as those that accompany the Tcl package, into the main manual page hierarchy. To get around the problem of having two manual pages with the same name such as exit(3), the Tcl pages were usually all assigned to section l. As this is unfortunate, it is now possible to put the pages in the correct section, and to assign a specific "extension" to them, in this case, exit(3tcl). Under normal operation, man will display exit(3) in preference to exit(3tcl). To negotiate this situation and to avoid having to know which section the page you require resides in, it is now possible to give man a sub-extension string indicating which package the page must belong to. Using the above example, supplying the option -e tcl to man will restrict the search to pages having an extension of *tcl. -i, --ignore-case Ignore case when searching for manual pages. This is the default. -I, --match-case Search for manual pages case-sensitively. --regex Show all pages with any part of either their names or their descriptions matching each page argument as a regular expression, as with apropos(1). Since there is usually no reasonable way to pick a "best" page when searching for a regular expression, this option implies -a. --wildcard Show all pages with any part of either their names or their descriptions matching each page argument using shell-style wildcards, as with apropos(1) --wildcard. The page argument must match the entire name or description, or match on word boundaries in the description. Since there is usually no reasonable way to pick a "best" page when searching for a wildcard, this option implies -a. --names-only If the --regex or --wildcard option is used, match only page names, not page descriptions, as with whatis(1). Otherwise, no effect. -a, --all By default, man will exit after displaying the most suitable manual page it finds. Using this option forces man to display all the manual pages with names that match the search criteria. -u, --update This option causes man to update its database caches of installed manual pages. This is only needed in rare situations, and it is normally better to run mandb(8) instead. --no-subpages By default, man will try to interpret pairs of manual page names given on the command line as equivalent to a single manual page name containing a hyphen or an underscore. This supports the common pattern of programs that implement a number of subcommands, allowing them to provide manual pages for each that can be accessed using similar syntax as would be used to invoke the subcommands themselves. For example: $ man -aw git diff /usr/share/man/man1/git-diff.1.gz To disable this behaviour, use the --no-subpages option. $ man -aw --no-subpages git diff /usr/share/man/man1/git.1.gz /usr/share/man/man3/Git.3pm.gz /usr/share/man/man1/diff.1.gz Controlling formatted output -P pager, --pager=pager Specify which output pager to use. By default, man uses less, falling back to cat if less is not found or is not executable. This option overrides the $MANPAGER environment variable, which in turn overrides the $PAGER environment variable. It is not used in conjunction with -f or -k. The value may be a simple command name or a command with arguments, and may use shell quoting (backslashes, single quotes, or double quotes). It may not use pipes to connect multiple commands; if you need that, use a wrapper script, which may take the file to display either as an argument or on standard input. -r prompt, --prompt=prompt If a recent version of less is used as the pager, man will attempt to set its prompt and some sensible options. The default prompt looks like Manual page name(sec) line x where name denotes the manual page name, sec denotes the section it was found under and x the current line number. This is achieved by using the $LESS environment variable. Supplying -r with a string will override this default. The string may contain the text $MAN_PN which will be expanded to the name of the current manual page and its section name surrounded by "(" and ")". The string used to produce the default could be expressed as \ Manual\ page\ \$MAN_PN\ ?ltline\ %lt?L/%L.: byte\ %bB?s/%s..?\ (END):?pB\ %pB\\%.. (press h for help or q to quit) It is broken into three lines here for the sake of readability only. For its meaning see the less(1) manual page. The prompt string is first evaluated by the shell. All double quotes, back-quotes and backslashes in the prompt must be escaped by a preceding backslash. The prompt string may end in an escaped $ which may be followed by further options for less. By default man sets the -ix8 options. The $MANLESS environment variable described below may be used to set a default prompt string if none is supplied on the command line. -7, --ascii When viewing a pure ascii(7) manual page on a 7 bit terminal or terminal emulator, some characters may not display correctly when using the latin1(7) device description with GNU nroff. This option allows pure ascii manual pages to be displayed in ascii with the latin1 device. It will not translate any latin1 text. The following table shows the translations performed: some parts of it may only be displayed properly when using GNU nroff's latin1(7) device. Description Octal latin1 ascii continuation 255 - hyphen bullet (middle 267 o dot) acute accent 264 ' multiplication 327 x sign If the latin1 column displays correctly, your terminal may be set up for latin1 characters and this option is not necessary. If the latin1 and ascii columns are identical, you are reading this page using this option or man did not format this page using the latin1 device description. If the latin1 column is missing or corrupt, you may need to view manual pages with this option. This option is ignored when using options -t, -H, -T, or -Z and may be useless for nroff other than GNU's. -E encoding, --encoding=encoding Generate output for a character encoding other than the default. For backward compatibility, encoding may be an nroff device such as ascii, latin1, or utf8 as well as a true character encoding such as UTF-8. --no-hyphenation, --nh Normally, nroff will automatically hyphenate text at line breaks even in words that do not contain hyphens, if it is necessary to do so to lay out words on a line without excessive spacing. This option disables automatic hyphenation, so words will only be hyphenated if they already contain hyphens. If you are writing a manual page and simply want to prevent nroff from hyphenating a word at an inappropriate point, do not use this option, but consult the nroff documentation instead; for instance, you can put "\%" inside a word to indicate that it may be hyphenated at that point, or put "\%" at the start of a word to prevent it from being hyphenated. --no-justification, --nj Normally, nroff will automatically justify text to both margins. This option disables full justification, leaving justified only to the left margin, sometimes called "ragged-right" text. If you are writing a manual page and simply want to prevent nroff from justifying certain paragraphs, do not use this option, but consult the nroff documentation instead; for instance, you can use the ".na", ".nf", ".fi", and ".ad" requests to temporarily disable adjusting and filling. -p string, --preprocessor=string Specify the sequence of preprocessors to run before nroff or troff/groff. Not all installations will have a full set of preprocessors. Some of the preprocessors and the letters used to designate them are: eqn (e), grap (g), pic (p), tbl (t), vgrind (v), refer (r). This option overrides the $MANROFFSEQ environment variable. zsoelim is always run as the very first preprocessor. -t, --troff Use groff -mandoc to format the manual page to stdout. This option is not required in conjunction with -H, -T, or -Z. -T[device], --troff-device[=device] This option is used to change groff (or possibly troff's) output to be suitable for a device other than the default. It implies -t. Examples (provided with Groff-1.17) include dvi, latin1, ps, utf8, X75 and X100. -H[browser], --html[=browser] This option will cause groff to produce HTML output, and will display that output in a web browser. The choice of browser is determined by the optional browser argument if one is provided, by the $BROWSER environment variable, or by a compile-time default if that is unset (usually lynx). This option implies -t, and will only work with GNU troff. -X[dpi], --gxditview[=dpi] This option displays the output of groff in a graphical window using the gxditview program. The dpi (dots per inch) may be 75, 75-12, 100, or 100-12, defaulting to 75; the -12 variants use a 12-point base font. This option implies -T with the X75, X75-12, X100, or X100-12 device respectively. -Z, --ditroff groff will run troff and then use an appropriate post- processor to produce output suitable for the chosen device. If groff -mandoc is groff, this option is passed to groff and will suppress the use of a post-processor. It implies -t. Getting help -?, --help Print a help message and exit. --usage Print a short usage message and exit. -V, --version Display version information. EXIT STATUS top 0 Successful program execution. 1 Usage, syntax or configuration file error. 2 Operational error. 3 A child process returned a non-zero exit status. 16 At least one of the pages/files/keywords didn't exist or wasn't matched. ENVIRONMENT top MANPATH If $MANPATH is set, its value is used as the path to search for manual pages. See the SEARCH PATH section of manpath(5) for the default behaviour and details of how this environment variable is handled. MANROFFOPT Every time man invokes the formatter (nroff, troff, or groff), it adds the contents of $MANROFFOPT to the formatter's command line. MANROFFSEQ If $MANROFFSEQ is set, its value is used to determine the set of preprocessors to pass each manual page through. The default preprocessor list is system dependent. MANSECT If $MANSECT is set, its value is a colon-delimited list of sections and it is used to determine which manual sections to search and in what order. The default is "1 n l 8 3 0 2 3type 5 4 9 6 7", unless overridden by the SECTION directive in /usr/local/etc/man_db.conf. MANPAGER, PAGER If $MANPAGER or $PAGER is set ($MANPAGER is used in preference), its value is used as the name of the program used to display the manual page. By default, less is used, falling back to cat if less is not found or is not executable. The value may be a simple command name or a command with arguments, and may use shell quoting (backslashes, single quotes, or double quotes). It may not use pipes to connect multiple commands; if you need that, use a wrapper script, which may take the file to display either as an argument or on standard input. MANLESS If $MANLESS is set, its value will be used as the default prompt string for the less pager, as if it had been passed using the -r option (so any occurrences of the text $MAN_PN will be expanded in the same way). For example, if you want to set the prompt string unconditionally to my prompt string, set $MANLESS to -Psmy prompt string. Using the -r option overrides this environment variable. BROWSER If $BROWSER is set, its value is a colon-delimited list of commands, each of which in turn is used to try to start a web browser for man --html. In each command, %s is replaced by a filename containing the HTML output from groff, %% is replaced by a single percent sign (%), and %c is replaced by a colon (:). SYSTEM If $SYSTEM is set, it will have the same effect as if it had been specified as the argument to the -m option. MANOPT If $MANOPT is set, it will be parsed prior to man's command line and is expected to be in a similar format. As all of the other man specific environment variables can be expressed as command line options, and are thus candidates for being included in $MANOPT it is expected that they will become obsolete. N.B. All spaces that should be interpreted as part of an option's argument must be escaped. MANWIDTH If $MANWIDTH is set, its value is used as the line length for which manual pages should be formatted. If it is not set, manual pages will be formatted with a line length appropriate to the current terminal (using the value of $COLUMNS, and ioctl(2) if available, or falling back to 80 characters if neither is available). Cat pages will only be saved when the default formatting can be used, that is when the terminal line length is between 66 and 80 characters. MAN_KEEP_FORMATTING Normally, when output is not being directed to a terminal (such as to a file or a pipe), formatting characters are discarded to make it easier to read the result without special tools. However, if $MAN_KEEP_FORMATTING is set to any non-empty value, these formatting characters are retained. This may be useful for wrappers around man that can interpret formatting characters. MAN_KEEP_STDERR Normally, when output is being directed to a terminal (usually to a pager), any error output from the command used to produce formatted versions of manual pages is discarded to avoid interfering with the pager's display. Programs such as groff often produce relatively minor error messages about typographical problems such as poor alignment, which are unsightly and generally confusing when displayed along with the manual page. However, some users want to see them anyway, so, if $MAN_KEEP_STDERR is set to any non-empty value, error output will be displayed as usual. MAN_DISABLE_SECCOMP On Linux, man normally confines subprocesses that handle untrusted data using a seccomp(2) sandbox. This makes it safer to run complex parsing code over arbitrary manual pages. If this goes wrong for some reason unrelated to the content of the page being displayed, you can set $MAN_DISABLE_SECCOMP to any non-empty value to disable the sandbox. PIPELINE_DEBUG If the $PIPELINE_DEBUG environment variable is set to "1", then man will print debugging messages to standard error describing each subprocess it runs. LANG, LC_MESSAGES Depending on system and implementation, either or both of $LANG and $LC_MESSAGES will be interrogated for the current message locale. man will display its messages in that locale (if available). See setlocale(3) for precise details. FILES top /usr/local/etc/man_db.conf man-db configuration file. /usr/share/man A global manual page hierarchy. STANDARDS top POSIX.1-2001, POSIX.1-2008, POSIX.1-2017. SEE ALSO top apropos(1), groff(1), less(1), manpath(1), nroff(1), troff(1), whatis(1), zsoelim(1), manpath(5), man(7), catman(8), mandb(8) Documentation for some packages may be available in other formats, such as info(1) or HTML. HISTORY top 1990, 1991 Originally written by John W. Eaton ([email protected]). Dec 23 1992: Rik Faith ([email protected]) applied bug fixes supplied by Willem Kasdorp ([email protected]). 30th April 1994 23rd February 2000: Wilf. ([email protected]) has been developing and maintaining this package with the help of a few dedicated people. 30th October 1996 30th March 2001: Fabrizio Polacco <[email protected]> maintained and enhanced this package for the Debian project, with the help of all the community. 31st March 2001 present day: Colin Watson <[email protected]> is now developing and maintaining man-db. BUGS top https://gitlab.com/man-db/man-db/-/issues https://savannah.nongnu.org/bugs/?group=man-db COLOPHON top This page is part of the man-db (manual pager suite) project. Information about the project can be found at http://www.nongnu.org/man-db/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository https://gitlab.com/cjwatson/man-db on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-18.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 2.12.0 2023-09-23 MAN(1) Pages that refer to this page: apropos(1), git(1), intro(1), lexgrog(1), manconv(1), manpath(1), man-recode(1), systemd-analyze(1), ul(1), whatis(1), zsoelim(1), manpath(5), environ(7), man(7), man-pages(7), catman(8), mandb(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# man\n\n> Format and display manual pages.\n> More information: <https://manned.org/man>.\n\n- Display the man page for a command:\n\n`man {{command}}`\n\n- Open the man page for a command in a browser:\n\n`man --html {{command}}`\n\n- Display the man page for a command from section 7:\n\n`man {{7}} {{command}}`\n\n- List all available sections for a command:\n\n`man --whatis {{command}}`\n\n- Display the path searched for manpages:\n\n`man --path`\n\n- Display the location of a manpage rather than the manpage itself:\n\n`man --where {{command}}`\n\n- Display the man page using a specific locale:\n\n`man --locale={{locale}} {{command}}`\n\n- Search for manpages containing a search string:\n\n`man --apropos "{{search_string}}"`\n
mandb
mandb(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mandb(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | DATABASE CACHES | OPTIONS | EXIT STATUS | DIAGNOSTICS | FILES | SEE ALSO | AUTHOR | BUGS | COLOPHON MANDB(8) Manual pager utils MANDB(8) NAME top mandb - create or update the manual page index caches SYNOPSIS top mandb [-dqsucpt?V] [-C file] [manpath] mandb [-dqsut] [-C file] -f filename ... DESCRIPTION top mandb is used to initialise or manually update index database caches. The caches contain information relevant to the current state of the manual page system and the information stored within them is used by the man-db utilities to enhance their speed and functionality. When creating or updating an index, mandb will warn of bad ROFF .so requests, bogus manual page filenames and manual pages from which the whatis cannot be parsed. Supplying mandb with an optional colon-delimited path will override the internal system manual page hierarchy search path, determined from information found within the man-db configuration file. DATABASE CACHES top mandb can be compiled with support for any one of the following database types. Name Async Filename Berkeley db Yes index.bt GNU gdbm Yes index.db UNIX ndbm No index.(dir|pag) Those database types that support asynchronous updates provide enhanced speed at the cost of possible corruption in the event of unusual termination. In an unusual case where this has occurred, it may be necessary to rerun mandb with the -c option to re- create the databases from scratch. OPTIONS top -d, --debug Print debugging information. -q, --quiet Produce no warnings. -s, --no-straycats Do not spend time looking for or adding information to the databases regarding stray cats. -p, --no-purge Do not spend time checking for deleted manual pages and purging them from the databases. -c, --create By default, mandb will try to update any previously created databases. If a database does not exist, it will create it. This option forces mandb to delete previous databases and re-create them from scratch, and implies --no-purge. This may be necessary if a database becomes corrupt or if a new database storage scheme is introduced in the future. -u, --user-db Create user databases only, even with write permissions necessary to create system databases. -t, --test Perform correctness checks on manual pages in the hierarchy search path. With this option, mandb will not alter existing databases. -f, --filename Update only the entries for the given filename. This option is not for general use; it is used internally by man when it has been compiled with the MAN_DB_UPDATES option and finds that a page is out of date. It implies -p and disables -c and -s. -C file, --config-file=file Use this user configuration file rather than the default of ~/.manpath. -?, --help Show the usage message, then exit. --usage Print a short usage message and exit. -V, --version Show the version, then exit. EXIT STATUS top 0 Successful program execution. 1 Usage, syntax, or configuration file error. 2 Operational error. 3 A child process failed. DIAGNOSTICS top The following warning messages can be emitted during database building. <filename>: whatis parse for page(sec) failed An attempt to extract whatis line(s) from the given <filename> failed. This is usually due to a poorly written manual page, but if many such messages are emitted it is likely that the system contains non-standard manual pages which are incompatible with the man-db whatis parser. See the WHATIS PARSING section in lexgrog(1) for more information. <filename>: is a dangling symlink <filename> does not exist but is referenced by a symbolic link. Further diagnostics are usually emitted to identify the <filename> of the offending link. <filename>: bad symlink or ROFF `.so' request <filename> is either a symbolic link to, or contains a ROFF include request to, a non existent file. <filename>: ignoring bogus filename The <filename> may or may not be a valid manual page but its name is invalid. This is usually due to a manual page with sectional extension <x> being put in manual page section <y>. <filename_mask>: competing extensions The wildcard <filename_mask> is not unique. This is usually caused by the existence of both a compressed and uncompressed version of the same manual page. All but the most recent are ignored. FILES top /usr/local/etc/man_db.conf man-db configuration file. /var/cache/man/index.(bt|db|dir|pag) An FHS compliant global index database cache. Older locations for the database cache included: /usr/man/index.(bt|db|dir|pag) A traditional global index database cache. /var/catman/index.(bt|db|dir|pag) An alternate or FSSTND compliant global index database cache. SEE ALSO top lexgrog(1), man(1), manpath(5), catman(8) The WHATIS PARSING section formerly in this manual page is now part of lexgrog(1). AUTHOR top Wilf. ([email protected]). Fabrizio Polacco ([email protected]). Colin Watson ([email protected]). BUGS top https://gitlab.com/man-db/man-db/-/issues https://savannah.nongnu.org/bugs/?group=man-db COLOPHON top This page is part of the man-db (manual pager suite) project. Information about the project can be found at http://www.nongnu.org/man-db/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository https://gitlab.com/cjwatson/man-db on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-18.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 2.12.0 2023-09-23 MANDB(8) Pages that refer to this page: apropos(1), lexgrog(1), man(1), whatis(1), man(7), catman(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mandb\n\n> Manage the pre-formatted manual page database.\n> More information: <https://man7.org/linux/man-pages/man8/mandb.8.html>.\n\n- Purge and process manual pages:\n\n`mandb`\n\n- Update a single entry:\n\n`mandb --filename {{path/to/file}}`\n\n- Create entries from scratch instead of updating:\n\n`mandb --create`\n\n- Only process user databases:\n\n`mandb --user-db`\n\n- Do not purge obsolete entries:\n\n`mandb --no-purge`\n\n- Check the validity of manual pages:\n\n`mandb --test`\n
manpath
manpath(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training manpath(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | ENVIRONMENT | FILES | SEE ALSO | AUTHOR | BUGS | COLOPHON MANPATH(1) Manual pager utils MANPATH(1) NAME top manpath - determine search path for manual pages SYNOPSIS top manpath [-qgdc?V] [-m system[,...]] [-C file] DESCRIPTION top If $MANPATH is set, manpath will simply display its contents and issue a warning. If not, manpath will determine a suitable manual page hierarchy search path and display the results. The colon-delimited path is determined using information gained from the man-db configuration file (/usr/local/etc/man_db.conf) and the user's environment. OPTIONS top -q, --quiet Do not issue warnings. -d, --debug Print debugging information. -c, --catpath Produce a catpath as opposed to a manpath. Once the manpath is determined, each path element is converted to its relative catpath. -g, --global Produce a manpath consisting of all paths named as "global" within the man-db configuration file. -m system[,...], --systems=system[,...] If this system has access to other operating systems' manual hierarchies, this option can be used to include them in the output of manpath. To include NewOS's manual page hierarchies use the option -m NewOS. The system specified can be a combination of comma delimited operating system names. To include the native operating system's manual page hierarchies, the system name man must be included in the argument string. This option will override the $SYSTEM environment variable. -C file, --config-file=file Use this user configuration file rather than the default of ~/.manpath. -?, --help Print a help message and exit. --usage Print a short usage message and exit. -V, --version Display version information. ENVIRONMENT top MANPATH If $MANPATH is set, manpath displays its value rather than determining it on the fly. See the SEARCH PATH section of manpath(5) for the default behaviour and details of how this environment variable is handled. SYSTEM If $SYSTEM is set, it will have the same effect as if it had been specified as the argument to the -m option. FILES top /usr/local/etc/man_db.conf man-db configuration file. SEE ALSO top apropos(1), man(1), whatis(1) AUTHOR top Wilf. ([email protected]). Fabrizio Polacco ([email protected]). Colin Watson ([email protected]). BUGS top https://gitlab.com/man-db/man-db/-/issues https://savannah.nongnu.org/bugs/?group=man-db COLOPHON top This page is part of the man-db (manual pager suite) project. Information about the project can be found at http://www.nongnu.org/man-db/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository https://gitlab.com/cjwatson/man-db on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-18.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] 2.12.0 2023-09-23 MANPATH(1) Pages that refer to this page: man(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# manpath\n\n> Determine the search path for manual pages.\n> More information: <https://manned.org/manpath>.\n\n- Display the search path used to find man pages:\n\n`manpath`\n\n- Show the entire global manpath:\n\n`manpath --global`\n
mcookie
mcookie(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mcookie(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | FILES | BUGS | SEE ALSO | REPORTING BUGS | AVAILABILITY MCOOKIE(1) User Commands MCOOKIE(1) NAME top mcookie - generate magic cookies for xauth SYNOPSIS top mcookie [options] DESCRIPTION top mcookie generates a 128-bit random hexadecimal number for use with the X authority system. Typical usage: xauth add :0 . mcookie The "random" number generated is actually the MD5 message digest of random information coming from one of the sources getrandom(2) system call, /dev/urandom, /dev/random, or the libc pseudo-random functions, in this preference order. See also the option --file. OPTIONS top -f, --file file Use this file as an additional source of randomness (for example /dev/urandom). When file is '-', characters are read from standard input. -m, --max-size number Read from file only this number of bytes. This option is meant to be used when reading additional randomness from a file or device. The number argument may be followed by the multiplicative suffixes KiB=1024, MiB=1024*1024, and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB") or the suffixes KB=1000, MB=1000*1000, and so on for GB, TB, PB, EB, ZB and YB. -v, --verbose Inform where randomness originated, with amount of entropy read from each source. -h, --help Display help text and exit. -V, --version Print version and exit. FILES top /dev/urandom /dev/random BUGS top It is assumed that none of the randomness sources will block. SEE ALSO top md5sum(1), X(7), xauth(1), rand(3) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The mcookie command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 MCOOKIE(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mcookie\n\n> Generates random 128-bit hexadecimal numbers.\n> More information: <https://manned.org/mcookie>.\n\n- Generate a random number:\n\n`mcookie`\n\n- Generate a random number, using the contents of a file as a seed for the randomness:\n\n`mcookie --file {{path/to/file}}`\n\n- Generate a random number, using a specific number of bytes from a file as a seed for the randomness:\n\n`mcookie --file {{path/to/file}} --max-size {{number_of_bytes}}`\n\n- Print the details of the randomness used, such as the origin and seed for each source:\n\n`mcookie --verbose`\n
mcs
mcs(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mcs(8) Linux manual page NAME | DESCRIPTION | SEE ALSO | FILES | COLOPHON mcs(8) mcs documentation mcs(8) NAME top mcs - Multi-Category System DESCRIPTION top MCS (Multiple Category System) allows users to label files on their system within administrator defined categories. It then uses SELinux Mandatory Access Control to protect those files. MCS is a discretionary model to allow users to mark their data with additional tags that further restrict access. The only mandatory aspect is authorizing users for categories by defining their clearance in policy. However, MCS is similar to MLS and exercises the same code paths and share the same support infrastructure. They just differ in their specific configuration. The /etc/selinux/{SELINUXTYPE}/setrans.conf configuration file translates the labels on disk to human readable form. Administrators can define any labels they want in this file. Certain applications like printing and auditing will use these labels to identify the files. By setting a category on a file you will prevent other applications/services from having access to the files. Examples of file labels would be PatientRecord, CompanyConfidential etc. SEE ALSO top selinux(8), chcon(1) FILES top /etc/selinux/{SELINUXTYPE}/setrans.conf COLOPHON top This page is part of the selinux (Security-Enhanced Linux user- space libraries and tools) project. Information about the project can be found at https://github.com/SELinuxProject/selinux/wiki. If you have a bug report for this manual page, see https://github.com/SELinuxProject/selinux/wiki/Contributing. This page was obtained from the project's upstream Git repository https://github.com/SELinuxProject/selinux on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-05-11.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] [email protected] 8 Sep 2005 mcs(8) Pages that refer to this page: setrans.conf(5), mcstransd(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mcs\n\n> Mono C# Compiler.\n> More information: <https://manned.org/mcs.1>.\n\n- Compile the specified files:\n\n`mcs {{path/to/input_file1.cs path/to/input_file2.cs ...}}`\n\n- Specify the output program name:\n\n`mcs -out:{{path/to/file.exe}} {{path/to/input_file1.cs path/to/input_file2.cs ...}}`\n\n- Specify the output program type:\n\n`mcs -target:{{exe|winexe|library|module}} {{path/to/input_file1.cs path/to/input_file2.cs ...}}`\n
md5sum
md5sum(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training md5sum(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | BUGS | AUTHOR | REPORTING BUGS | COPYRIGHT | SEE ALSO | COLOPHON MD5SUM(1) User Commands MD5SUM(1) NAME top md5sum - compute and check MD5 message digest SYNOPSIS top md5sum [OPTION]... [FILE]... DESCRIPTION top Print or check MD5 (128-bit) checksums. With no FILE, or when FILE is -, read standard input. -b, --binary read in binary mode -c, --check read checksums from the FILEs and check them --tag create a BSD-style checksum -t, --text read in text mode (default) -z, --zero end each output line with NUL, not newline, and disable file name escaping The following five options are useful only when verifying checksums: --ignore-missing don't fail or report status for missing files --quiet don't print OK for each successfully verified file --status don't output anything, status code shows success --strict exit non-zero for improperly formatted checksum lines -w, --warn warn about improperly formatted checksum lines --help display this help and exit --version output version information and exit The sums are computed as described in RFC 1321. When checking, the input should be a former output of this program. The default mode is to print a line with: checksum, a space, a character indicating input mode ('*' for binary, ' ' for text or where binary is insignificant), and name for each FILE. Note: There is no difference between binary mode and text mode on GNU systems. BUGS top Do not use the MD5 algorithm for security related purposes. Instead, use an SHA-2 algorithm, implemented in the programs sha224sum(1), sha256sum(1), sha384sum(1), sha512sum(1), or the BLAKE2 algorithm, implemented in b2sum(1) AUTHOR top Written by Ulrich Drepper, Scott Miller, and David Madore. REPORTING BUGS top GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT top Copyright 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO top cksum(1) Full documentation <https://www.gnu.org/software/coreutils/md5sum> or available locally via: info '(coreutils) md5sum invocation' COLOPHON top This page is part of the coreutils (basic file, shell and text manipulation utilities) project. Information about the project can be found at http://www.gnu.org/software/coreutils/. If you have a bug report for this manual page, see http://www.gnu.org/software/coreutils/. This page was obtained from the tarball coreutils-9.4.tar.xz fetched from http://ftp.gnu.org/gnu/coreutils/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] GNU coreutils 9.4 August 2023 MD5SUM(1) Pages that refer to this page: mcookie(1), pmlogmv(1), deb-md5sums(5), prelink(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# md5sum\n\n> Calculate MD5 cryptographic checksums.\n> More information: <https://www.gnu.org/software/coreutils/md5sum>.\n\n- Calculate the MD5 checksum for one or more files:\n\n`md5sum {{path/to/file1 path/to/file2 ...}}`\n\n- Calculate and save the list of MD5 checksums to a file:\n\n`md5sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.md5}}`\n\n- Calculate an MD5 checksum from `stdin`:\n\n`{{command}} | md5sum`\n\n- Read a file of MD5 sums and filenames and verify all files have matching checksums:\n\n`md5sum --check {{path/to/file.md5}}`\n\n- Only show a message for missing files or when verification fails:\n\n`md5sum --check --quiet {{path/to/file.md5}}`\n\n- Only show a message when verification fails, ignoring missing files:\n\n`md5sum --ignore-missing --check --quiet {{path/to/file.md5}}`\n
mdadm
mdadm(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mdadm(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | MODES | OPTIONS | Options for selecting a mode are: | Options that are not mode-specific are: | For create, build, or grow: | For assemble: | For Manage mode: | For Misc mode: | For Incremental Assembly mode: | For Monitor mode: | ASSEMBLE MODE | BUILD MODE | CREATE MODE | MANAGE MODE | MISC MODE | MONITOR MODE | GROW MODE | INCREMENTAL MODE | ENVIRONMENT | EXAMPLES | FILES | POSIX PORTABLE NAME | DEVICE NAMES | NOTE | SEE ALSO | COLOPHON MDADM(8) System Manager's Manual MDADM(8) NAME top mdadm - manage MD devices aka Linux Software RAID SYNOPSIS top mdadm [mode] <raiddevice> [options] <component-devices> DESCRIPTION top RAID devices are virtual devices created from two or more real block devices. This allows multiple devices (typically disk drives or partitions thereof) to be combined into a single device to hold (for example) a single filesystem. Some RAID levels include redundancy and so can survive some degree of device failure. Linux Software RAID devices are implemented through the md (Multiple Devices) device driver. Currently, Linux supports LINEAR md devices, RAID0 (striping), RAID1 (mirroring), RAID4, RAID5, RAID6, RAID10, MULTIPATH, FAULTY, and CONTAINER. MULTIPATH is not a Software RAID mechanism, but does involve multiple devices: each device is a path to one common physical storage device. New installations should not use md/multipath as it is not well supported and has no ongoing development. Use the Device Mapper based multipath-tools instead. FAULTY is also not true RAID, and it only involves one device. It provides a layer over a true device that can be used to inject faults. CONTAINER is different again. A CONTAINER is a collection of devices that are managed as a set. This is similar to the set of devices connected to a hardware RAID controller. The set of devices may contain a number of different RAID arrays each utilising some (or all) of the blocks from a number of the devices in the set. For example, two devices in a 5-device set might form a RAID1 using the whole devices. The remaining three might have a RAID5 over the first half of each device, and a RAID0 over the second half. With a CONTAINER, there is one set of metadata that describes all of the arrays in the container. So when mdadm creates a CONTAINER device, the device just represents the metadata. Other normal arrays (RAID1 etc) can be created inside the container. MODES top mdadm has several major modes of operation: Assemble Assemble the components of a previously created array into an active array. Components can be explicitly given or can be searched for. mdadm checks that the components do form a bona fide array, and can, on request, fiddle superblock information so as to assemble a faulty array. Build Build an array that doesn't have per-device metadata (superblocks). For these sorts of arrays, mdadm cannot differentiate between initial creation and subsequent assembly of an array. It also cannot perform any checks that appropriate components have been requested. Because of this, the Build mode should only be used together with a complete understanding of what you are doing. Create Create a new array with per-device metadata (superblocks). Appropriate metadata is written to each device, and then the array comprising those devices is activated. A 'resync' process is started to make sure that the array is consistent (e.g. both sides of a mirror contain the same data) but the content of the device is left otherwise untouched. The array can be used as soon as it has been created. There is no need to wait for the initial resync to finish. Follow or Monitor Monitor one or more md devices and act on any state changes. This is only meaningful for RAID1, 4, 5, 6, 10 or multipath arrays, as only these have interesting state. RAID0 or Linear never have missing, spare, or failed drives, so there is nothing to monitor. Grow Grow (or shrink) an array, or otherwise reshape it in some way. Currently supported growth options including changing the active size of component devices and changing the number of active devices in Linear and RAID levels 0/1/4/5/6, changing the RAID level between 0, 1, 5, and 6, and between 0 and 10, changing the chunk size and layout for RAID 0,4,5,6,10 as well as adding or removing a write- intent bitmap and changing the array's consistency policy. Incremental Assembly Add a single device to an appropriate array. If the addition of the device makes the array runnable, the array will be started. This provides a convenient interface to a hot-plug system. As each device is detected, mdadm has a chance to include it in some array as appropriate. Optionally, when the --fail flag is passed in we will remove the device from any active array instead of adding it. If a CONTAINER is passed to mdadm in this mode, then any arrays within that container will be assembled and started. Manage This is for doing things to specific components of an array such as adding new spares and removing faulty devices. Misc This is an 'everything else' mode that supports operations on active arrays, operations on component devices such as erasing old superblocks, and information-gathering operations. Auto-detect This mode does not act on a specific device or array, but rather it requests the Linux Kernel to activate any auto- detected arrays. OPTIONS top Options for selecting a mode are: top -A, --assemble Assemble a pre-existing array. -B, --build Build a legacy array without superblocks. -C, --create Create a new array. -F, --follow, --monitor Select Monitor mode. -G, --grow Change the size or shape of an active array. -I, --incremental Add/remove a single device to/from an appropriate array, and possibly start the array. --auto-detect Request that the kernel starts any auto-detected arrays. This can only work if md is compiled into the kernel not if it is a module. Arrays can be auto-detected by the kernel if all the components are in primary MS-DOS partitions with partition type FD, and all use v0.90 metadata. In-kernel autodetect is not recommended for new installations. Using mdadm to detect and assemble arrays possibly in an initrd is substantially more flexible and should be preferred. If a device is given before any options, or if the first option is one of --add, --re-add, --add-spare, --fail, --remove, or --replace, then the MANAGE mode is assumed. Anything other than these will cause the Misc mode to be assumed. Options that are not mode-specific are: top -h, --help Display a general help message or, after one of the above options, a mode-specific help message. --help-options Display more detailed help about command-line parsing and some commonly used options. -V, --version Print version information for mdadm. -v, --verbose Be more verbose about what is happening. This can be used twice to be extra-verbose. The extra verbosity currently only affects --detail --scan and --examine --scan. -q, --quiet Avoid printing purely informative messages. With this, mdadm will be silent unless there is something really important to report. -f, --force Be more forceful about certain operations. See the various modes for the exact meaning of this option in different contexts. -c, --config= Specify the config file or directory. If not specified, the default config file and default conf.d directory will be used. See mdadm.conf(5) for more details. If the config file given is partitions then nothing will be read, but mdadm will act as though the config file contained exactly DEVICE partitions containers and will read /proc/partitions to find a list of devices to scan, and /proc/mdstat to find a list of containers to examine. If the word none is given for the config file, then mdadm will act as though the config file were empty. If the name given is of a directory, then mdadm will collect all the files contained in the directory with a name ending in .conf, sort them lexically, and process all of those files as config files. -s, --scan Scan config file or /proc/mdstat for missing information. In general, this option gives mdadm permission to get any missing information (like component devices, array devices, array identities, and alert destination) from the configuration file (see previous option); one exception is MISC mode when using --detail or --stop, in which case --scan says to get a list of array devices from /proc/mdstat. -e, --metadata= Declare the style of RAID metadata (superblock) to be used. The default is 1.2 for --create, and to guess for other operations. The default can be overridden by setting the metadata value for the CREATE keyword in mdadm.conf. Options are: 0, 0.90 Use the original 0.90 format superblock. This format limits arrays to 28 component devices and limits component devices of levels 1 and greater to 2 terabytes. It is also possible for there to be confusion about whether the superblock applies to a whole device or just the last partition, if that partition starts on a 64K boundary. 1, 1.0, 1.1, 1.2 default Use the new version-1 format superblock. This has fewer restrictions. It can easily be moved between hosts with different endian-ness, and a recovery operation can be checkpointed and restarted. The different sub-versions store the superblock at different locations on the device, either at the end (for 1.0), at the start (for 1.1) or 4K from the start (for 1.2). "1" is equivalent to "1.2" (the commonly preferred 1.x format). "default" is equivalent to "1.2". ddf Use the "Industry Standard" DDF (Disk Data Format) format defined by SNIA. When creating a DDF array a CONTAINER will be created, and normal arrays can be created in that container. imsm Use the Intel(R) Matrix Storage Manager metadata format. This creates a CONTAINER which is managed in a similar manner to DDF, and is supported by an option-rom on some platforms: https://www.intel.com/content/www/us/en/support/products/122484 --homehost= This will override any HOMEHOST setting in the config file and provides the identity of the host which should be considered the home for any arrays. When creating an array, the homehost will be recorded in the metadata. For version-1 superblocks, it will be prefixed to the array name. For version-0.90 superblocks, part of the SHA1 hash of the hostname will be stored in the latter half of the UUID. When reporting information about an array, any array which is tagged for the given homehost will be reported as such. When using Auto-Assemble, only arrays tagged for the given homehost will be allowed to use 'local' names (i.e. not ending in '_' followed by a digit string). See below under Auto-Assembly. The special name "any" can be used as a wild card. If an array is created with --homehost=any then the name "any" will be stored in the array and it can be assembled in the same way on any host. If an array is assembled with this option, then the homehost recorded on the array will be ignored. --prefer= When mdadm needs to print the name for a device it normally finds the name in /dev which refers to the device and is the shortest. When a path component is given with --prefer mdadm will prefer a longer name if it contains that component. For example --prefer=by-uuid will prefer a name in a subdirectory of /dev called by-uuid. This functionality is currently only provided by --detail and --monitor. --home-cluster= specifies the cluster name for the md device. The md device can be assembled only on the cluster which matches the name specified. If this option is not provided, mdadm tries to detect the cluster name automatically. For create, build, or grow: top -n, --raid-devices= Specify the number of active devices in the array. This, plus the number of spare devices (see below) must equal the number of component-devices (including "missing" devices) that are listed on the command line for --create. Setting a value of 1 is probably a mistake and so requires that --force be specified first. A value of 1 will then be allowed for linear, multipath, RAID0 and RAID1. It is never allowed for RAID4, RAID5 or RAID6. This number can only be changed using --grow for RAID1, RAID4, RAID5 and RAID6 arrays, and only on kernels which provide the necessary support. -x, --spare-devices= Specify the number of spare (eXtra) devices in the initial array. Spares can also be added and removed later. The number of component devices listed on the command line must equal the number of RAID devices plus the number of spare devices. -z, --size= Amount (in Kilobytes) of space to use from each drive in RAID levels 1/4/5/6/10 and for RAID 0 on external metadata. This must be a multiple of the chunk size, and must leave about 128Kb of space at the end of the drive for the RAID superblock. If this is not specified (as it normally is not) the smallest drive (or partition) sets the size, though if there is a variance among the drives of greater than 1%, a warning is issued. A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, Megabytes, Gigabytes or Terabytes respectively. Sometimes a replacement drive can be a little smaller than the original drives though this should be minimised by IDEMA standards. Such a replacement drive will be rejected by md. To guard against this it can be useful to set the initial size slightly smaller than the smaller device with the aim that it will still be larger than any replacement. This option can be used with --create for determining the initial size of an array. For external metadata, it can be used on a volume, but not on a container itself. Setting the initial size of RAID 0 array is only valid for external metadata. This value can be set with --grow for RAID level 1/4/5/6/10 though DDF arrays may not be able to support this. RAID 0 array size cannot be changed. If the array was created with a size smaller than the currently active drives, the extra space can be accessed using --grow. The size can be given as max which means to choose the largest size that fits on all current drives. Before reducing the size of the array (with --grow --size=) you should make sure that space isn't needed. If the device holds a filesystem, you would need to resize the filesystem to use less space. After reducing the array size you should check that the data stored in the device is still available. If the device holds a filesystem, then an 'fsck' of the filesystem is a minimum requirement. If there are problems the array can be made bigger again with no loss with another --grow --size= command. -Z, --array-size= This is only meaningful with --grow and its effect is not persistent: when the array is stopped and restarted the default array size will be restored. Setting the array-size causes the array to appear smaller to programs that access the data. This is particularly needed before reshaping an array so that it will be smaller. As the reshape is not reversible, but setting the size with --array-size is, it is required that the array size is reduced as appropriate before the number of devices in the array is reduced. Before reducing the size of the array you should make sure that space isn't needed. If the device holds a filesystem, you would need to resize the filesystem to use less space. After reducing the array size you should check that the data stored in the device is still available. If the device holds a filesystem, then an 'fsck' of the filesystem is a minimum requirement. If there are problems the array can be made bigger again with no loss with another --grow --array-size= command. A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, Megabytes, Gigabytes or Terabytes respectively. A value of max restores the apparent size of the array to be whatever the real amount of available space is. Clustered arrays do not support this parameter yet. -c, --chunk= Specify chunk size in kilobytes. The default when creating an array is 512KB. To ensure compatibility with earlier versions, the default when building an array with no persistent metadata is 64KB. This is only meaningful for RAID0, RAID4, RAID5, RAID6, and RAID10. RAID4, RAID5, RAID6, and RAID10 require the chunk size to be a power of 2, with minimal chunk size being 4KB. A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, Megabytes, Gigabytes or Terabytes respectively. --rounding= Specify the rounding factor for a Linear array. The size of each component will be rounded down to a multiple of this size. This is a synonym for --chunk but highlights the different meaning for Linear as compared to other RAID levels. The default is 64K if a kernel earlier than 2.6.16 is in use, and is 0K (i.e. no rounding) in later kernels. -l, --level= Set RAID level. When used with --create, options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid4, 4, raid5, 5, raid6, 6, raid10, 10, multipath, mp, faulty, container. Obviously some of these are synonymous. When a CONTAINER metadata type is requested, only the container level is permitted, and it does not need to be explicitly given. When used with --build, only linear, stripe, raid0, 0, raid1, multipath, mp, and faulty are valid. Can be used with --grow to change the RAID level in some cases. See LEVEL CHANGES below. -p, --layout= This option configures the fine details of data layout for RAID5, RAID6, and RAID10 arrays, and controls the failure modes for faulty. It can also be used for working around a kernel bug with RAID0, but generally doesn't need to be used explicitly. The layout of the RAID5 parity block can be one of left-asymmetric, left-symmetric, right-asymmetric, right-symmetric, la, ra, ls, rs. The default is left-symmetric. It is also possible to cause RAID5 to use a RAID4-like layout by choosing parity-first, or parity-last. Finally for RAID5 there are DDF-compatible layouts, ddf-zero-restart, ddf-N-restart, and ddf-N-continue. These same layouts are available for RAID6. There are also 4 layouts that will provide an intermediate stage for converting between RAID5 and RAID6. These provide a layout which is identical to the corresponding RAID5 layout on the first N-1 devices, and has the 'Q' syndrome (the second 'parity' block used by RAID6) on the last device. These layouts are: left-symmetric-6, right-symmetric-6, left-asymmetric-6, right-asymmetric-6, and parity-first-6. When setting the failure mode for level faulty, the options are: write-transient, wt, read-transient, rt, write-persistent, wp, read-persistent, rp, write-all, read-fixable, rf, clear, flush, none. Each failure mode can be followed by a number, which is used as a period between fault generation. Without a number, the fault is generated once on the first relevant request. With a number, the fault will be generated after that many requests, and will continue to be generated every time the period elapses. Multiple failure modes can be current simultaneously by using the --grow option to set subsequent failure modes. "clear" or "none" will remove any pending or periodic failure modes, and "flush" will clear any persistent faults. The layout options for RAID10 are one of 'n', 'o' or 'f' followed by a small number signifying the number of copies of each datablock. The default is 'n2'. The supported options are: 'n' signals 'near' copies. Multiple copies of one data block are at similar offsets in different devices. 'o' signals 'offset' copies. Rather than the chunks being duplicated within a stripe, whole stripes are duplicated but are rotated by one device so duplicate blocks are on different devices. Thus subsequent copies of a block are in the next drive, and are one chunk further down. 'f' signals 'far' copies (multiple copies have very different offsets). See md(4) for more detail about 'near', 'offset', and 'far'. As for the number of copies of each data block, 2 is normal, 3 can be useful. This number can be at most equal to the number of devices in the array. It does not need to divide evenly into that number (e.g. it is perfectly legal to have an 'n2' layout for an array with an odd number of devices). A bug introduced in Linux 3.14 means that RAID0 arrays with devices of differing sizes started using a different layout. This could lead to data corruption. Since Linux 5.4 (and various stable releases that received backports), the kernel will not accept such an array unless a layout is explicitly set. It can be set to 'original' or 'alternate'. When creating a new array, mdadm will select 'original' by default, so the layout does not normally need to be set. An array created for either 'original' or 'alternate' will not be recognized by an (unpatched) kernel prior to 5.4. To create a RAID0 array with devices of differing sizes that can be used on an older kernel, you can set the layout to 'dangerous'. This will use whichever layout the running kernel supports, so the data on the array may become corrupt when changing kernel from pre-3.14 to a later kernel. When an array is converted between RAID5 and RAID6 an intermediate RAID6 layout is used in which the second parity block (Q) is always on the last device. To convert a RAID5 to RAID6 and leave it in this new layout (which does not require re-striping) use --layout=preserve. This will try to avoid any restriping. The converse of this is --layout=normalise which will change a non-standard RAID6 layout into a more standard arrangement. --parity= same as --layout (thus explaining the p of -p). -b, --bitmap= Specify a file to store a write-intent bitmap in. The file should not exist unless --force is also given. The same file should be provided when assembling the array. If the word internal is given, then the bitmap is stored with the metadata on the array, and so is replicated on all devices. If the word none is given with --grow mode, then any bitmap that is present is removed. If the word clustered is given, the array is created for a clustered environment. One bitmap is created for each node as defined by the --nodes parameter and are stored internally. To help catch typing errors, the filename must contain at least one slash ('/') if it is a real file (not 'internal' or 'none'). Note: external bitmaps are only known to work on ext2 and ext3. Storing bitmap files on other filesystems may result in serious problems. When creating an array on devices which are 100G or larger, mdadm automatically adds an internal bitmap as it will usually be beneficial. This can be suppressed with --bitmap=none or by selecting a different consistency policy with --consistency-policy. --bitmap-chunk= Set the chunk size of the bitmap. Each bit corresponds to that many Kilobytes of storage. When using a file-based bitmap, the default is to use the smallest size that is at least 4 and requires no more than 2^21 chunks. When using an internal bitmap, the chunk size defaults to 64Meg, or larger if necessary to fit the bitmap into the available space. A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, Megabytes, Gigabytes or Terabytes respectively. -W, --write-mostly subsequent devices listed in a --build, --create, or --add command will be flagged as 'write-mostly'. This is valid for RAID1 only and means that the 'md' driver will avoid reading from these devices if at all possible. This can be useful if mirroring over a slow link. --write-behind= Specify that write-behind mode should be enabled (valid for RAID1 only). If an argument is specified, it will set the maximum number of outstanding writes allowed. The default value is 256. A write-intent bitmap is required in order to use write-behind mode, and write-behind is only attempted on drives marked as write-mostly. --failfast subsequent devices listed in a --create or --add command will be flagged as 'failfast'. This is valid for RAID1 and RAID10 only. IO requests to these devices will be encouraged to fail quickly rather than cause long delays due to error handling. Also no attempt is made to repair a read error on these devices. If an array becomes degraded so that the 'failfast' device is the only usable device, the 'failfast' flag will then be ignored and extended delays will be preferred to complete failure. The 'failfast' flag is appropriate for storage arrays which have a low probability of true failure, but which may sometimes cause unacceptable delays due to internal maintenance functions. --assume-clean Tell mdadm that the array pre-existed and is known to be clean. It can be useful when trying to recover from a major failure as you can be sure that no data will be affected unless you actually write to the array. It can also be used when creating a RAID1 or RAID10 if you want to avoid the initial resync, however this practice while normally safe is not recommended. Use this only if you really know what you are doing. When the devices that will be part of a new array were filled with zeros before creation the operator knows the array is actually clean. If that is the case, such as after running badblocks, this argument can be used to tell mdadm the facts the operator knows. When an array is resized to a larger size with --grow --size= the new space is normally resynced in that same way that the whole array is resynced at creation. From Linux version 3.0, --assume-clean can be used with that command to avoid the automatic resync. --write-zeroes When creating an array, send write zeroes requests to all the block devices. This should zero the data area on all disks such that the initial sync is not necessary and, if successfull, will behave as if --assume-clean was specified. This is intended for use with devices that have hardware offload for zeroing, but despite this zeroing can still take several minutes for large disks. Thus a message is printed before and after zeroing and each disk is zeroed in parallel with the others. This is only meaningful with --create. --backup-file= This is needed when --grow is used to increase the number of raid devices in a RAID5 or RAID6 if there are no spare devices available, or to shrink, change RAID level or layout. See the GROW MODE section below on RAID-DEVICES CHANGES. The file must be stored on a separate device, not on the RAID array being reshaped. --data-offset= Arrays with 1.x metadata can leave a gap between the start of the device and the start of array data. This gap can be used for various metadata. The start of data is known as the data-offset. Normally an appropriate data offset is computed automatically. However it can be useful to set it explicitly such as when re-creating an array which was originally created using a different version of mdadm which computed a different offset. Setting the offset explicitly over-rides the default. The value given is in Kilobytes unless a suffix of 'K', 'M', 'G' or 'T' is used to explicitly indicate Kilobytes, Megabytes, Gigabytes or Terabytes respectively. Since Linux 3.4, --data-offset can also be used with --grow for some RAID levels (initially on RAID10). This allows the data-offset to be changed as part of the reshape process. When the data offset is changed, no backup file is required as the difference in offsets is used to provide the same functionality. When the new offset is earlier than the old offset, the number of devices in the array cannot shrink. When it is after the old offset, the number of devices in the array cannot increase. When creating an array, --data-offset can be specified as variable. In the case each member device is expected to have an offset appended to the name, separated by a colon. This makes it possible to recreate exactly an array which has varying data offsets (as can happen when different versions of mdadm are used to add different devices). --continue This option is complementary to the --freeze-reshape option for assembly. It is needed when --grow operation is interrupted and it is not restarted automatically due to --freeze-reshape usage during array assembly. This option is used together with -G , ( --grow ) command and device for a pending reshape to be continued. All parameters required for reshape continuation will be read from array metadata. If initial --grow command had required --backup-file= option to be set, continuation option will require to have exactly the same backup file given as well. Any other parameter passed together with --continue option will be ignored. -N, --name= Set a name for the array. It must be POSIX PORTABLE NAME compatible and cannot be longer than 32 chars. This is effective when creating an array with a v1 metadata, or an external array. If name is needed but not specified, it is taken from the basename of the device that is being created. See DEVICE NAMES -R, --run Insist that mdadm run the array, even if some of the components appear to be active in another array or filesystem. Normally mdadm will ask for confirmation before including such components in an array. This option causes that question to be suppressed. -f, --force Insist that mdadm accept the geometry and layout specified without question. Normally mdadm will not allow the creation of an array with only one device, and will try to create a RAID5 array with one missing drive (as this makes the initial resync work faster). With --force, mdadm will not try to be so clever. -o, --readonly Start the array read only rather than read-write as normal. No writes will be allowed to the array, and no resync, recovery, or reshape will be started. It works with Create, Assemble, Manage and Misc mode. -a, --auto{=yes,md,mdp,part,p}{NN} Instruct mdadm how to create the device file if needed, possibly allocating an unused minor number. "md" causes a non-partitionable array to be used (though since Linux 2.6.28, these array devices are in fact partitionable). "mdp", "part" or "p" causes a partitionable array (2.6 and later) to be used. "yes" requires the named md device to have a 'standard' format, and the type and minor number will be determined from this. With mdadm 3.0, device creation is normally left up to udev so this option is unlikely to be needed. See DEVICE NAMES below. The argument can also come immediately after "-a". e.g. "-ap". If --auto is not given on the command line or in the config file, then the default will be --auto=yes. If --scan is also given, then any auto= entries in the config file will override the --auto instruction given on the command line. For partitionable arrays, mdadm will create the device file for the whole array and for the first 4 partitions. A different number of partitions can be specified at the end of this option (e.g. --auto=p7). If the device name ends with a digit, the partition names add a 'p', and a number, e.g. /dev/md/home1p3. If there is no trailing digit, then the partition names just have a number added, e.g. /dev/md/scratch3. If the md device name is in a 'standard' format as described in DEVICE NAMES, then it will be created, if necessary, with the appropriate device number based on that name. If the device name is not in one of these formats, then an unused device number will be allocated. The device number will be considered unused if there is no active array for that number, and there is no entry in /dev for that number and with a non-standard name. Names that are not in 'standard' format are only allowed in "/dev/md/". This is meaningful with --create or --build. -a, --add This option can be used in Grow mode in two cases. If the target array is a Linear array, then --add can be used to add one or more devices to the array. They are simply catenated on to the end of the array. Once added, the devices cannot be removed. If the --raid-disks option is being used to increase the number of devices in an array, then --add can be used to add some extra devices to be included in the array. In most cases this is not needed as the extra devices can be added as spares first, and then the number of raid disks can be changed. However, for RAID0 it is not possible to add spares. So to increase the number of devices in a RAID0, it is necessary to set the new number of devices, and to add the new devices, in the same command. --nodes Only works when the array is created for a clustered environment. It specifies the maximum number of nodes in the cluster that will use this device simultaneously. If not specified, this defaults to 4. --write-journal Specify journal device for the RAID-4/5/6 array. The journal device should be an SSD with a reasonable lifetime. -k, --consistency-policy= Specify how the array maintains consistency in the case of an unexpected shutdown. Only relevant for RAID levels with redundancy. Currently supported options are: resync Full resync is performed and all redundancy is regenerated when the array is started after an unclean shutdown. bitmap Resync assisted by a write-intent bitmap. Implicitly selected when using --bitmap. journal For RAID levels 4/5/6, the journal device is used to log transactions and replay after an unclean shutdown. Implicitly selected when using --write-journal. ppl For RAID5 only, Partial Parity Log is used to close the write hole and eliminate resync. PPL is stored in the metadata region of RAID member drives, no additional journal drive is needed. Can be used with --grow to change the consistency policy of an active array in some cases. See CONSISTENCY POLICY CHANGES below. For assemble: top -u, --uuid= uuid of array to assemble. Devices which don't have this uuid are excluded -m, --super-minor= Minor number of device that array was created for. Devices which don't have this minor number are excluded. If you create an array as /dev/md1, then all superblocks will contain the minor number 1, even if the array is later assembled as /dev/md2. Giving the literal word "dev" for --super-minor will cause mdadm to use the minor number of the md device that is being assembled. e.g. when assembling /dev/md0, --super-minor=dev will look for super blocks with a minor number of 0. --super-minor is only relevant for v0.90 metadata, and should not normally be used. Using --uuid is much safer. -N, --name= Specify the name of the array to assemble. It must be POSIX PORTABLE NAME compatible and cannot be longer than 32 chars. This must be the name that was specified when creating the array. It must either match the name stored in the superblock exactly, or it must match with the current homehost prefixed to the start of the given name. -f, --force Assemble the array even if the metadata on some devices appears to be out-of-date. If mdadm cannot find enough working devices to start the array, but can find some devices that are recorded as having failed, then it will mark those devices as working so that the array can be started. This works only for native. For external metadata it allows to start dirty degraded RAID 4, 5, 6. An array which requires --force to be started may contain data corruption. Use it carefully. -R, --run Attempt to start the array even if fewer drives were given than were present last time the array was active. Normally if not all the expected drives are found and --scan is not used, then the array will be assembled but not started. With --run an attempt will be made to start it anyway. --no-degraded This is the reverse of --run in that it inhibits the startup of array unless all expected drives are present. This is only needed with --scan, and can be used if the physical connections to devices are not as reliable as you would like. -a, --auto{=no,yes,md,mdp,part} See this option under Create and Build options. -b, --bitmap= Specify the bitmap file that was given when the array was created. If an array has an internal bitmap, there is no need to specify this when assembling the array. --backup-file= If --backup-file was used while reshaping an array (e.g. changing number of devices or chunk size) and the system crashed during the critical section, then the same --backup-file must be presented to --assemble to allow possibly corrupted data to be restored, and the reshape to be completed. --invalid-backup If the file needed for the above option is not available for any reason an empty file can be given together with this option to indicate that the backup file is invalid. In this case the data that was being rearranged at the time of the crash could be irrecoverably lost, but the rest of the array may still be recoverable. This option should only be used as a last resort if there is no way to recover the backup file. -U, --update= Update the superblock on each device while assembling the array. The argument given to this flag can be one of sparc2.2, summaries, uuid, name, nodes, homehost, home- cluster, resync, byteorder, devicesize, no-bitmap, bbl, no-bbl, ppl, no-ppl, layout-original, layout-alternate, layout-unspecified, metadata, or super-minor. The sparc2.2 option will adjust the superblock of an array what was created on a Sparc machine running a patched 2.2 Linux kernel. This kernel got the alignment of part of the superblock wrong. You can use the --examine --sparc2.2 option to mdadm to see what effect this would have. The super-minor option will update the preferred minor field on each superblock to match the minor number of the array being assembled. This can be useful if --examine reports a different "Preferred Minor" to --detail. In some cases this update will be performed automatically by the kernel driver. In particular, the update happens automatically at the first write to an array with redundancy (RAID level 1 or greater) on a 2.6 (or later) kernel. The uuid option will change the uuid of the array. If a UUID is given with the --uuid option that UUID will be used as a new UUID and will NOT be used to help identify the devices in the array. If no --uuid is given, a random UUID is chosen. The name option will change the name of the array as stored in the superblock. This is only supported for version-1 superblocks. The nodes option will change the nodes of the array as stored in the bitmap superblock. This option only works for a clustered environment. The homehost option will change the homehost as recorded in the superblock. For version-0 superblocks, this is the same as updating the UUID. For version-1 superblocks, this involves updating the name. The home-cluster option will change the cluster name as recorded in the superblock and bitmap. This option only works for a clustered environment. The resync option will cause the array to be marked dirty meaning that any redundancy in the array (e.g. parity for RAID5, copies for RAID1) may be incorrect. This will cause the RAID system to perform a "resync" pass to make sure that all redundant information is correct. The byteorder option allows arrays to be moved between machines with different byte-order, such as from a big- endian machine like a Sparc or some MIPS machines, to a little-endian x86_64 machine. When assembling such an array for the first time after a move, giving --update=byteorder will cause mdadm to expect superblocks to have their byteorder reversed, and will correct that order before assembling the array. This is only valid with original (Version 0.90) superblocks. The summaries option will correct the summaries in the superblock. That is the counts of total, working, active, failed, and spare devices. The devicesize option will rarely be of use. It applies to version 1.1 and 1.2 metadata only (where the metadata is at the start of the device) and is only useful when the component device has changed size (typically become larger). The version 1 metadata records the amount of the device that can be used to store data, so if a device in a version 1.1 or 1.2 array becomes larger, the metadata will still be visible, but the extra space will not. In this case it might be useful to assemble the array with --update=devicesize. This will cause mdadm to determine the maximum usable amount of space on each device and update the relevant field in the metadata. The metadata option only works on v0.90 metadata arrays and will convert them to v1.0 metadata. The array must not be dirty (i.e. it must not need a sync) and it must not have a write-intent bitmap. The old metadata will remain on the devices, but will appear older than the new metadata and so will usually be ignored. The old metadata (or indeed the new metadata) can be removed by giving the appropriate --metadata= option to --zero-superblock. The no-bitmap option can be used when an array has an internal bitmap which is corrupt in some way so that assembling the array normally fails. It will cause any internal bitmap to be ignored. The bbl option will reserve space in each device for a bad block list. This will be 4K in size and positioned near the end of any free space between the superblock and the data. The no-bbl option will cause any reservation of space for a bad block list to be removed. If the bad block list contains entries, this will fail, as removing the list could cause data corruption. The ppl option will enable PPL for a RAID5 array and reserve space for PPL on each device. There must be enough free space between the data and superblock and a write- intent bitmap or journal must not be used. The no-ppl option will disable PPL in the superblock. The layout-original and layout-alternate options are for RAID0 arrays with non-uniform devices size that were in use before Linux 5.4. If the array was being used with Linux 3.13 or earlier, then to assemble the array on a new kernel, --update=layout-original must be given. If the array was created and used with a kernel from Linux 3.14 to Linux 5.3, then --update=layout-alternate must be given. This only needs to be given once. Subsequent assembly of the array will happen normally. For more information, see md(4). The layout-unspecified option reverts the effect of layout-orignal or layout-alternate and allows the array to be again used on a kernel prior to Linux 5.3. This option should be used with great caution. --freeze-reshape This option is intended to be used in start-up scripts during the initrd boot phase. When the array under reshape is assembled during the initrd phase, this option stops the reshape after the reshape-critical section has been restored. This happens before the file system pivot operation and avoids loss of filesystem context. Losing file system context would cause reshape to be broken. Reshape can be continued later using the --continue option for the grow command. For Manage mode: top -t, --test Unless a more serious error occurred, mdadm will exit with a status of 2 if no changes were made to the array and 0 if at least one change was made. This can be useful when an indirect specifier such as missing, detached or faulty is used in requesting an operation on the array. --test will report failure if these specifiers didn't find any match. -a, --add hot-add listed devices. If a device appears to have recently been part of the array (possibly it failed or was removed) the device is re-added as described in the next point. If that fails or the device was never part of the array, the device is added as a hot-spare. If the array is degraded, it will immediately start to rebuild data onto that spare. Note that this and the following options are only meaningful on array with redundancy. They don't apply to RAID0 or Linear. --re-add re-add a device that was previously removed from an array. If the metadata on the device reports that it is a member of the array, and the slot that it used is still vacant, then the device will be added back to the array in the same position. This will normally cause the data for that device to be recovered. However, based on the event count on the device, the recovery may only require sections that are flagged by a write-intent bitmap to be recovered or may not require any recovery at all. When used on an array that has no metadata (i.e. it was built with --build) it will be assumed that bitmap-based recovery is enough to make the device fully consistent with the array. --re-add can also be accompanied by --update=devicesize, --update=bbl, or --update=no-bbl. See descriptions of these options when used in Assemble mode for an explanation of their use. If the device name given is missing then mdadm will try to find any device that looks like it should be part of the array but isn't and will try to re-add all such devices. If the device name given is faulty then mdadm will find all devices in the array that are marked faulty, remove them and attempt to immediately re-add them. This can be useful if you are certain that the reason for failure has been resolved. --add-spare Add a device as a spare. This is similar to --add except that it does not attempt --re-add first. The device will be added as a spare even if it looks like it could be a recent member of the array. -r, --remove remove listed devices. They must not be active. i.e. they should be failed or spare devices. As well as the name of a device file (e.g. /dev/sda1) the words failed, detached and names like set-A can be given to --remove. The first causes all failed devices to be removed. The second causes any device which is no longer connected to the system (i.e an 'open' returns ENXIO) to be removed. The third will remove a set as described below under --fail. -f, --fail Mark listed devices as faulty. As well as the name of a device file, the word detached or a set name like set-A can be given. The former will cause any device that has been detached from the system to be marked as failed. It can then be removed. For RAID10 arrays where the number of copies evenly divides the number of devices, the devices can be conceptually divided into sets where each set contains a single complete copy of the data on the array. Sometimes a RAID10 array will be configured so that these sets are on separate controllers. In this case, all the devices in one set can be failed by giving a name like set-A or set-B to --fail. The appropriate set names are reported by --detail. --set-faulty same as --fail. --replace Mark listed devices as requiring replacement. As soon as a spare is available, it will be rebuilt and will replace the marked device. This is similar to marking a device as faulty, but the device remains in service during the recovery process to increase resilience against multiple failures. When the replacement process finishes, the replaced device will be marked as faulty. --with This can follow a list of --replace devices. The devices listed after --with will preferentially be used to replace the devices listed after --replace. These devices must already be spare devices in the array. --write-mostly Subsequent devices that are added or re-added will have the 'write-mostly' flag set. This is only valid for RAID1 and means that the 'md' driver will avoid reading from these devices if possible. --readwrite Subsequent devices that are added or re-added will have the 'write-mostly' flag cleared. --cluster-confirm Confirm the existence of the device. This is issued in response to an --add request by a node in a cluster. When a node adds a device it sends a message to all nodes in the cluster to look for a device with a UUID. This translates to a udev notification with the UUID of the device to be added and the slot number. The receiving node must acknowledge this message with --cluster-confirm. Valid arguments are <slot>:<devicename> in case the device is found or <slot>:missing in case the device is not found. --add-journal Add a journal to an existing array, or recreate journal for a RAID-4/5/6 array that lost a journal device. To avoid interrupting ongoing write operations, --add-journal only works for array in Read-Only state. --failfast Subsequent devices that are added or re-added will have the 'failfast' flag set. This is only valid for RAID1 and RAID10 and means that the 'md' driver will avoid long timeouts on error handling where possible. --nofailfast Subsequent devices that are re-added will be re-added without the 'failfast' flag set. Each of these options requires that the first device listed is the array to be acted upon, and the remainder are component devices to be added, removed, marked as faulty, etc. Several different operations can be specified for different devices, e.g. mdadm /dev/md0 --add /dev/sda1 --fail /dev/sdb1 --remove /dev/sdb1 Each operation applies to all devices listed until the next operation. If an array is using a write-intent bitmap, then devices which have been removed can be re-added in a way that avoids a full reconstruction but instead just updates the blocks that have changed since the device was removed. For arrays with persistent metadata (superblocks) this is done automatically. For arrays created with --build mdadm needs to be told that this device we removed recently with --re-add. Devices can only be removed from an array if they are not in active use, i.e. that must be spares or failed devices. To remove an active device, it must first be marked as faulty. For Misc mode: top -Q, --query Examine a device to see (1) if it is an md device and (2) if it is a component of an md array. Information about what is discovered is presented. -D, --detail Print details of one or more md devices. --detail-platform Print details of the platform's RAID capabilities (firmware / hardware topology) for a given metadata format. If used without an argument, mdadm will scan all controllers looking for their capabilities. Otherwise, mdadm will only look at the controller specified by the argument in the form of an absolute filepath or a link, e.g. /sys/devices/pci0000:00/0000:00:1f.2. -Y, --export When used with --detail, --detail-platform, --examine, or --incremental output will be formatted as key=value pairs for easy import into the environment. With --incremental The value MD_STARTED indicates whether an array was started (yes) or not, which may include a reason (unsafe, nothing, no). Also the value MD_FOREIGN indicates if the array is expected on this host (no), or seems to be from elsewhere (yes). -E, --examine Print contents of the metadata stored on the named device(s). Note the contrast between --examine and --detail. --examine applies to devices which are components of an array, while --detail applies to a whole array which is currently active. --sparc2.2 If an array was created on a SPARC machine with a 2.2 Linux kernel patched with RAID support, the superblock will have been created incorrectly, or at least incompatibly with 2.4 and later kernels. Using the --sparc2.2 flag with --examine will fix the superblock before displaying it. If this appears to do the right thing, then the array can be successfully assembled using --assemble --update=sparc2.2. -X, --examine-bitmap Report information about a bitmap file. The argument is either an external bitmap file or an array component in case of an internal bitmap. Note that running this on an array device (e.g. /dev/md0) does not report the bitmap for that array. --examine-badblocks List the bad-blocks recorded for the device, if a bad- blocks list has been configured. Currently only 1.x and IMSM metadata support bad-blocks lists. --dump=directory --restore=directory Save metadata from lists devices, or restore metadata to listed devices. -R, --run start a partially assembled array. If --assemble did not find enough devices to fully start the array, it might leaving it partially assembled. If you wish, you can then use --run to start the array in degraded mode. -S, --stop deactivate array, releasing all resources. -o, --readonly mark array as readonly. -w, --readwrite mark array as readwrite. --zero-superblock If the device contains a valid md superblock, the block is overwritten with zeros. With --force the block where the superblock would be is overwritten even if it doesn't appear to be valid. Note: Be careful when calling --zero-superblock with clustered raid. Make sure the array isn't used or assembled in another cluster node before executing it. --kill-subarray= If the device is a container and the argument to --kill-subarray specifies an inactive subarray in the container, then the subarray is deleted. Deleting all subarrays will leave an 'empty-container' or spare superblock on the drives. See --zero-superblock for completely removing a superblock. Note that some formats depend on the subarray index for generating a UUID, this command will fail if it would change the UUID of an active subarray. --update-subarray= If the device is a container and the argument to --update-subarray specifies a subarray in the container, then attempt to update the given superblock field in the subarray. See below in MISC MODE for details. -t, --test When used with --detail, the exit status of mdadm is set to reflect the status of the device. See below in MISC MODE for details. -W, --wait For each md device given, wait for any resync, recovery, or reshape activity to finish before returning. mdadm will return with success if it actually waited for every device listed, otherwise it will return failure. --wait-clean For each md device given, or each device in /proc/mdstat if --scan is given, arrange for the array to be marked clean as soon as possible. mdadm will return with success if the array uses external metadata and we successfully waited. For native arrays, this returns immediately as the kernel handles dirty-clean transitions at shutdown. No action is taken if safe-mode handling is disabled. --action= Set the "sync_action" for all md devices given to one of idle, frozen, check, repair. Setting to idle will abort any currently running action though some actions will automatically restart. Setting to frozen will abort any current action and ensure no other action starts automatically. Details of check and repair can be found it md(4) under SCRUBBING AND MISMATCHES. For Incremental Assembly mode: top --rebuild-map, -r Rebuild the map file (/run/mdadm/map) that mdadm uses to help track which arrays are currently being assembled. --run, -R Run any array assembled as soon as a minimal number of devices is available, rather than waiting until all expected devices are present. --scan, -s Only meaningful with -R this will scan the map file for arrays that are being incrementally assembled and will try to start any that are not already started. If any such array is listed in mdadm.conf as requiring an external bitmap, that bitmap will be attached first. --fail, -f This allows the hot-plug system to remove devices that have fully disappeared from the kernel. It will first fail and then remove the device from any array it belongs to. The device name given should be a kernel device name such as "sda", not a name in /dev. --path= Only used with --fail. The 'path' given will be recorded so that if a new device appears at the same location it can be automatically added to the same array. This allows the failed device to be automatically replaced by a new device without metadata if it appears at specified path. This option is normally only set by an udev script. For Monitor mode: top -m, --mail Give a mail address to send alerts to. -p, --program, --alert Give a program to be run whenever an event is detected. -y, --syslog Cause all events to be reported through 'syslog'. The messages have facility of 'daemon' and varying priorities. -d, --delay Give a delay in seconds. mdadm polls the md arrays and then waits this many seconds before polling again. The default is 60 seconds. Since 2.6.16, there is no need to reduce this as the kernel alerts mdadm immediately when there is any change. -r, --increment Give a percentage increment. mdadm will generate RebuildNN events with the given percentage increment. -f, --daemonise Tell mdadm to run as a background daemon if it decides to monitor anything. This causes it to fork and run in the child, and to disconnect from the terminal. The process id of the child is written to stdout. This is useful with --scan which will only continue monitoring if a mail address or alert program is found in the config file. -i, --pid-file When mdadm is running in daemon mode, write the pid of the daemon process to the specified file, instead of printing it on standard output. -1, --oneshot Check arrays only once. This will generate NewArray events and more significantly DegradedArray and SparesMissing events. Running mdadm --monitor --scan -1 from a cron script will ensure regular notification of any degraded arrays. -t, --test Generate a TestMessage alert for every array found at startup. This alert gets mailed and passed to the alert program. This can be used for testing that alert message do get through successfully. --no-sharing This inhibits the functionality for moving spares between arrays. Only one monitoring process started with --scan but without this flag is allowed, otherwise the two could interfere with each other. ASSEMBLE MODE top Usage: mdadm --assemble md-device options-and-component- devices... Usage: mdadm --assemble --scan md-devices-and-options... Usage: mdadm --assemble --scan options... This usage assembles one or more RAID arrays from pre-existing components. For each array, mdadm needs to know the md device, the identity of the array, and the number of component devices. These can be found in a number of ways. In the first usage example (without the --scan) the first device given is the md device. In the second usage example, all devices listed are treated as md devices and assembly is attempted. In the third (where no devices are listed) all md devices that are listed in the configuration file are assembled. If no arrays are described by the configuration file, then any arrays that can be found on unused devices will be assembled. If precisely one device is listed, but --scan is not given, then mdadm acts as though --scan was given and identity information is extracted from the configuration file. The identity can be given with the --uuid option, the --name option, or the --super-minor option, will be taken from the md- device record in the config file, or will be taken from the super block of the first component-device listed on the command line. Devices can be given on the --assemble command line or in the config file. Only devices which have an md superblock which contains the right identity will be considered for any array. The config file is only used if explicitly named with --config or requested with (a possibly implicit) --scan. In the latter case, the default config file is used. See mdadm.conf(5) for more details. If --scan is not given, then the config file will only be used to find the identity of md arrays. Normally the array will be started after it is assembled. However if --scan is not given and not all expected drives were listed, then the array is not started (to guard against usage errors). To insist that the array be started in this case (as may work for RAID1, 4, 5, 6, or 10), give the --run flag. If udev is active, mdadm does not create any entries in /dev but leaves that to udev. It does record information in /run/mdadm/map which will allow udev to choose the correct name. If mdadm detects that udev is not configured, it will create the devices in /dev itself. In Linux kernels prior to version 2.6.28 there were two distinct types of md devices that could be created: one that could be partitioned using standard partitioning tools and one that could not. Since 2.6.28 that distinction is no longer relevant as both types of devices can be partitioned. mdadm will normally create the type that originally could not be partitioned as it has a well-defined major number (9). Prior to 2.6.28, it is important that mdadm chooses the correct type of array device to use. This can be controlled with the --auto option. In particular, a value of "mdp" or "part" or "p" tells mdadm to use a partitionable device rather than the default. In the no-udev case, the value given to --auto can be suffixed by a number. This tells mdadm to create that number of partition devices rather than the default of 4. The value given to --auto can also be given in the configuration file as a word starting auto= on the ARRAY line for the relevant array. Auto-Assembly When --assemble is used with --scan and no devices are listed, mdadm will first attempt to assemble all the arrays listed in the config file. If no arrays are listed in the config (other than those marked <ignore>) it will look through the available devices for possible arrays and will try to assemble anything that it finds. Arrays which are tagged as belonging to the given homehost will be assembled and started normally. Arrays which do not obviously belong to this host are given names that are expected not to conflict with anything local, and are started "read-auto" so that nothing is written to any device until the array is written to. i.e. automatic resync etc is delayed. If mdadm finds a consistent set of devices that look like they should comprise an array, and if the superblock is tagged as belonging to the given home host, it will automatically choose a device name and try to assemble the array. If the array uses version-0.90 metadata, then the minor number as recorded in the superblock is used to create a name in /dev/md/ so for example /dev/md/3. If the array uses version-1 metadata, then the name from the superblock is used to similarly create a name in /dev/md/ (the name will have any 'host' prefix stripped first). This behaviour can be modified by the AUTO line in the mdadm.conf configuration file. This line can indicate that specific metadata type should, or should not, be automatically assembled. If an array is found which is not listed in mdadm.conf and has a metadata format that is denied by the AUTO line, then it will not be assembled. The AUTO line can also request that all arrays identified as being for this homehost should be assembled regardless of their metadata type. See mdadm.conf(5) for further details. Note: Auto-assembly cannot be used for assembling and activating some arrays which are undergoing reshape. In particular as the backup-file cannot be given, any reshape which requires a backup file to continue cannot be started by auto-assembly. An array which is growing to more devices and has passed the critical section can be assembled using auto-assembly. BUILD MODE top Usage: mdadm --build md-device --chunk=X --level=Y --raid-devices=Z devices This usage is similar to --create. The difference is that it creates an array without a superblock. With these arrays there is no difference between initially creating the array and subsequently assembling the array, except that hopefully there is useful data there in the second case. The level may raid0, linear, raid1, raid10, multipath, or faulty, or one of their synonyms. All devices must be listed and the array will be started once complete. It will often be appropriate to use --assume-clean with levels raid1 or raid10. CREATE MODE top Usage: mdadm --create md-device --chunk=X --level=Y --raid-devices=Z devices This usage will initialize a new md array, associate some devices with it, and activate the array. md-device is a new device. This could be standard name or chosen name. For details see: DEVICE NAMES The named device will normally not exist when mdadm --create is run, but will be created by udev once the array becomes active. The max length md-device name is limited to 32 characters. Different metadata types have more strict limitation (like IMSM where only 16 characters are allowed). For that reason, long name could be truncated or rejected, it depends on metadata policy. As devices are added, they are checked to see if they contain RAID superblocks or filesystems. They are also checked to see if the variance in device size exceeds 1%. If any discrepancy is found, the array will not automatically be run, though the presence of a --run can override this caution. To create a "degraded" array in which some devices are missing, simply give the word "missing" in place of a device name. This will cause mdadm to leave the corresponding slot in the array empty. For a RAID4 or RAID5 array at most one slot can be "missing"; for a RAID6 array at most two slots. For a RAID1 array, only one real device needs to be given. All of the others can be "missing". When creating a RAID5 array, mdadm will automatically create a degraded array with an extra spare drive. This is because building the spare into a degraded array is in general faster than resyncing the parity on a non-degraded, but not clean, array. This feature can be overridden with the --force option. When creating a partition based array, using mdadm with version-1.x metadata, the partition type should be set to 0xDA (non fs-data). This type of selection allows for greater precision since using any other [RAID auto-detect (0xFD) or a GNU/Linux partition (0x83)], might create problems in the event of array recovery through a live cdrom. A new array will normally get a randomly assigned 128bit UUID which is very likely to be unique. If you have a specific need, you can choose a UUID for the array by giving the --uuid= option. Be warned that creating two arrays with the same UUID is a recipe for disaster. Also, using --uuid= when creating a v0.90 array will silently override any --homehost= setting. If the array type supports a write-intent bitmap, and if the devices in the array exceed 100G is size, an internal write- intent bitmap will automatically be added unless some other option is explicitly requested with the --bitmap option or a different consistency policy is selected with the --consistency-policy option. In any case, space for a bitmap will be reserved so that one can be added later with --grow --bitmap=internal. If the metadata type supports it (currently only 1.x and IMSM metadata), space will be allocated to store a bad block list. This allows a modest number of bad blocks to be recorded, allowing the drive to remain in service while only partially functional. When creating an array within a CONTAINER mdadm can be given either the list of devices to use, or simply the name of the container. The former case gives control over which devices in the container will be used for the array. The latter case allows mdadm to automatically choose which devices to use based on how much spare space is available. The General Management options that are valid with --create are: --run insist on running the array even if some devices look like they might be in use. --readonly start the array in readonly mode. MANAGE MODE top Usage: mdadm device options... devices... This usage will allow individual devices in an array to be failed, removed or added. It is possible to perform multiple operations with on command. For example: mdadm /dev/md0 -f /dev/hda1 -r /dev/hda1 -a /dev/hda1 will firstly mark /dev/hda1 as faulty in /dev/md0 and will then remove it from the array and finally add it back in as a spare. However, only one md array can be affected by a single command. When a device is added to an active array, mdadm checks to see if it has metadata on it which suggests that it was recently a member of the array. If it does, it tries to "re-add" the device. If there have been no changes since the device was removed, or if the array has a write-intent bitmap which has recorded whatever changes there were, then the device will immediately become a full member of the array and those differences recorded in the bitmap will be resolved. MISC MODE top Usage: mdadm options ... devices ... MISC mode includes a number of distinct operations that operate on distinct devices. The operations are: --query The device is examined to see if it is (1) an active md array, or (2) a component of an md array. The information discovered is reported. --detail The device should be an active md device. mdadm will display a detailed description of the array. --brief or --scan will cause the output to be less detailed and the format to be suitable for inclusion in mdadm.conf. The exit status of mdadm will normally be 0 unless mdadm failed to get useful information about the device(s); however, if the --test option is given, then the exit status will be: 0 The array is functioning normally. 1 The array has at least one failed device. 2 The array has multiple failed devices such that it is unusable. 4 There was an error while trying to get information about the device. --detail-platform Print detail of the platform's RAID capabilities (firmware / hardware topology). If the metadata is specified with -e or --metadata= then the return status will be: 0 metadata successfully enumerated its platform components on this system 1 metadata is platform independent 2 metadata failed to find its platform components on this system --update-subarray= If the device is a container and the argument to --update-subarray specifies a subarray in the container, then attempt to update the given superblock field in the subarray. Similar to updating an array in "assemble" mode, the field to update is selected by -U or --update= option. The supported options are name, ppl, no-ppl, bitmap and no-bitmap. The name option updates the subarray name in the metadata. It must be POSIX PORTABLE NAME compatible and cannot be longer than 32 chars. If successes, new value will be respected after next assembly. The ppl and no-ppl options enable and disable PPL in the metadata. Currently supported only for IMSM subarrays. The bitmap and no-bitmap options enable and disable write- intent bitmap in the metadata. Currently supported only for IMSM subarrays. --examine The device should be a component of an md array. mdadm will read the md superblock of the device and display the contents. If --brief or --scan is given, then multiple devices that are components of the one array are grouped together and reported in a single entry suitable for inclusion in mdadm.conf. Having --scan without listing any devices will cause all devices listed in the config file to be examined. --dump=directory If the device contains RAID metadata, a file will be created in the directory and the metadata will be written to it. The file will be the same size as the device and will have the metadata written at the same location as it exists in the device. However, the file will be "sparse" so that only those blocks containing metadata will be allocated. The total space used will be small. The filename used in the directory will be the base name of the device. Further, if any links appear in /dev/disk/by-id which point to the device, then hard links to the file will be created in directory based on these by-id names. Multiple devices can be listed and their metadata will all be stored in the one directory. --restore=directory This is the reverse of --dump. mdadm will locate a file in the directory that has a name appropriate for the given device and will restore metadata from it. Names that match /dev/disk/by-id names are preferred, however if two of those refer to different files, mdadm will not choose between them but will abort the operation. If a file name is given instead of a directory then mdadm will restore from that file to a single device, always provided the size of the file matches that of the device, and the file contains valid metadata. --stop The devices should be active md arrays which will be deactivated, as long as they are not currently in use. --run This will fully activate a partially assembled md array. --readonly This will mark an active array as read-only, providing that it is not currently being used. --readwrite This will change a readonly array back to being read/write. --scan For all operations except --examine, --scan will cause the operation to be applied to all arrays listed in /proc/mdstat. For --examine, --scan causes all devices listed in the config file to be examined. -b, --brief Be less verbose. This is used with --detail and --examine. Using --brief with --verbose gives an intermediate level of verbosity. MONITOR MODE top Usage: mdadm --monitor options... devices... Monitor option can work in two modes: system wide mode, follow all md devices based on /proc/mdstat, follow only specified MD devices in command line. --scan - indicates system wide mode. Option causes the monitor to track all md devices that appear in /proc/mdstat. If it is not set, then at least one device must be specified. Monitor usage causes mdadm to periodically poll a number of md arrays and to report on any events noticed. In both modes, monitor will work as long as there is an active array with redundancy and it is defined to follow (for --scan every array is followed). As well as reporting events, mdadm may move a spare drive from one array to another if they are in the same spare-group or domain and if the destination array has a failed drive but no spares. The result of monitoring the arrays is the generation of events. These events are passed to a separate program (if specified) and may be mailed to a given E-mail address. When passing events to a program, the program is run once for each event, and is given 2 or 3 command-line arguments: the first is the name of the event (see below), the second is the name of the md device which is affected, and the third is the name of a related device if relevant (such as a component device that has failed). If --scan is given, then a program or an e-mail address must be specified on the command line or in the config file. If neither are available, then mdadm will not monitor anything. For devices given directly in command line, without program or email specified, each event is reported to stdout. Note: For systems where is configured via systemd, mdmonitor(mdmonitor.service) should be configured. The service is designed to be primary solution for array monitoring, it is configured to work in system wide mode. It is automatically started and stopped according to current state and types of MD arrays in system. The service may require additional configuration, like e-mail or delay. That should be done in mdadm.conf. The different events are: DeviceDisappeared An md array which previously was configured appears to no longer be configured. (syslog priority: Critical) If mdadm was told to monitor an array which is RAID0 or Linear, then it will report DeviceDisappeared with the extra information Wrong-Level. This is because RAID0 and Linear do not support the device-failed, hot-spare and resync operations which are monitored. RebuildStarted An md array started reconstruction (e.g. recovery, resync, reshape, check, repair). (syslog priority: Warning) RebuildNN Where NN is a two-digit number (eg. 05, 48). This indicates that the rebuild has reached that percentage of the total. The events are generated at a fixed increment from 0. The increment size may be specified with a command-line option (the default is 20). (syslog priority: Warning) RebuildFinished An md array that was rebuilding, isn't any more, either because it finished normally or was aborted. (syslog priority: Warning) Fail An active component device of an array has been marked as faulty. (syslog priority: Critical) FailSpare A spare component device which was being rebuilt to replace a faulty device has failed. (syslog priority: Critical) SpareActive A spare component device which was being rebuilt to replace a faulty device has been successfully rebuilt and has been made active. (syslog priority: Info) NewArray A new md array has been detected in the /proc/mdstat file. (syslog priority: Info) DegradedArray A newly noticed array appears to be degraded. This message is not generated when mdadm notices a drive failure which causes degradation, but only when mdadm notices that an array is degraded when it first sees the array. (syslog priority: Critical) MoveSpare A spare drive has been moved from one array in a spare-group or domain to another to allow a failed drive to be replaced. (syslog priority: Info) SparesMissing If mdadm has been told, via the config file, that an array should have a certain number of spare devices, and mdadm detects that it has fewer than this number when it first sees the array, it will report a SparesMissing message. (syslog priority: Warning) TestMessage An array was found at startup, and the --test flag was given. (syslog priority: Info) Only Fail, FailSpare, DegradedArray, SparesMissing and TestMessage cause Email to be sent. All events cause the program to be run. The program is run with two or three arguments: the event name, the array device and possibly a second device. Each event has an associated array device (e.g. /dev/md1) and possibly a second device. For Fail, FailSpare, and SpareActive the second device is the relevant component device. For MoveSpare the second device is the array that the spare was moved from. For mdadm to move spares from one array to another, the different arrays need to be labeled with the same spare-group or the spares must be allowed to migrate through matching POLICY domains in the configuration file. The spare-group name can be any string; it is only necessary that different spare groups use different names. When mdadm detects that an array in a spare group has fewer active devices than necessary for the complete array, and has no spare devices, it will look for another array in the same spare group that has a full complement of working drives and a spare. It will then attempt to remove the spare from the second array and add it to the first. If the removal succeeds but the adding fails, then it is added back to the original array. If the spare group for a degraded array is not defined, mdadm will look at the rules of spare migration specified by POLICY lines in mdadm.conf and then follow similar steps as above if a matching spare is found. GROW MODE top The GROW mode is used for changing the size or shape of an active array. During the kernel 2.6 era the following changes were added: change the "size" attribute for RAID1, RAID4, RAID5 and RAID6. increase or decrease the "raid-devices" attribute of RAID0, RAID1, RAID4, RAID5, and RAID6. change the chunk-size and layout of RAID0, RAID4, RAID5, RAID6 and RAID10. convert between RAID1 and RAID5, between RAID5 and RAID6, between RAID0, RAID4, and RAID5, and between RAID0 and RAID10 (in the near-2 mode). add a write-intent bitmap to any array which supports these bitmaps, or remove a write-intent bitmap from such an array. change the array's consistency policy. Using GROW on containers is currently supported only for Intel's IMSM container format. The number of devices in a container can be increased - which affects all arrays in the container - or an array in a container can be converted between levels where those levels are supported by the container, and the conversion is on of those listed above. Notes: Intel's native checkpointing doesn't use --backup-file option and it is transparent for assembly feature. Roaming between Windows(R) and Linux systems for IMSM metadata is not supported during grow process. When growing a raid0 device, the new component disk size (or external backup size) should be larger than LCM(old, new) * chunk-size * 2, where LCM() is the least common multiple of the old and new count of component disks, and "* 2" comes from the fact that mdadm refuses to use more than half of a spare device for backup space. SIZE CHANGES Normally when an array is built the "size" is taken from the smallest of the drives. If all the small drives in an arrays are, over time, removed and replaced with larger drives, then you could have an array of large drives with only a small amount used. In this situation, changing the "size" with "GROW" mode will allow the extra space to start being used. If the size is increased in this way, a "resync" process will start to make sure the new parts of the array are synchronised. Note that when an array changes size, any filesystem that may be stored in the array will not automatically grow or shrink to use or vacate the space. The filesystem will need to be explicitly told to use the extra space after growing, or to reduce its size prior to shrinking the array. Also, the size of an array cannot be changed while it has an active bitmap. If an array has a bitmap, it must be removed before the size can be changed. Once the change is complete a new bitmap can be created. Note: --grow --size is not yet supported for external file bitmap. RAID-DEVICES CHANGES A RAID1 array can work with any number of devices from 1 upwards (though 1 is not very useful). There may be times which you want to increase or decrease the number of active devices. Note that this is different to hot-add or hot-remove which changes the number of inactive devices. When reducing the number of devices in a RAID1 array, the slots which are to be removed from the array must already be vacant. That is, the devices which were in those slots must be failed and removed. When the number of devices is increased, any hot spares that are present will be activated immediately. Changing the number of active devices in a RAID5 or RAID6 is much more effort. Every block in the array will need to be read and written back to a new location. From 2.6.17, the Linux Kernel is able to increase the number of devices in a RAID5 safely, including restarting an interrupted "reshape". From 2.6.31, the Linux Kernel is able to increase or decrease the number of devices in a RAID5 or RAID6. From 2.6.35, the Linux Kernel is able to convert a RAID0 in to a RAID4 or RAID5. mdadm uses this functionality and the ability to add devices to a RAID4 to allow devices to be added to a RAID0. When requested to do this, mdadm will convert the RAID0 to a RAID4, add the necessary disks and make the reshape happen, and then convert the RAID4 back to RAID0. When decreasing the number of devices, the size of the array will also decrease. If there was data in the array, it could get destroyed and this is not reversible, so you should firstly shrink the filesystem on the array to fit within the new size. To help prevent accidents, mdadm requires that the size of the array be decreased first with mdadm --grow --array-size. This is a reversible change which simply makes the end of the array inaccessible. The integrity of any data can then be checked before the non-reversible reduction in the number of devices is request. When relocating the first few stripes on a RAID5 or RAID6, it is not possible to keep the data on disk completely consistent and crash-proof. To provide the required safety, mdadm disables writes to the array while this "critical section" is reshaped, and takes a backup of the data that is in that section. For grows, this backup may be stored in any spare devices that the array has, however it can also be stored in a separate file specified with the --backup-file option, and is required to be specified for shrinks, RAID level changes and layout changes. If this option is used, and the system does crash during the critical period, the same file must be passed to --assemble to restore the backup and reassemble the array. When shrinking rather than growing the array, the reshape is done from the end towards the beginning, so the "critical section" is at the end of the reshape. LEVEL CHANGES Changing the RAID level of any array happens instantaneously. However in the RAID5 to RAID6 case this requires a non-standard layout of the RAID6 data, and in the RAID6 to RAID5 case that non-standard layout is required before the change can be accomplished. So while the level change is instant, the accompanying layout change can take quite a long time. A --backup-file is required. If the array is not simultaneously being grown or shrunk, so that the array size will remain the same - for example, reshaping a 3-drive RAID5 into a 4-drive RAID6 - the backup file will be used not just for a "critical section" but throughout the reshape operation, as described below under LAYOUT CHANGES. CHUNK-SIZE AND LAYOUT CHANGES Changing the chunk-size or layout without also changing the number of devices as the same time will involve re-writing all blocks in-place. To ensure against data loss in the case of a crash, a --backup-file must be provided for these changes. Small sections of the array will be copied to the backup file while they are being rearranged. This means that all the data is copied twice, once to the backup and once to the new layout on the array, so this type of reshape will go very slowly. If the reshape is interrupted for any reason, this backup file must be made available to mdadm --assemble so the array can be reassembled. Consequently, the file cannot be stored on the device being reshaped. BITMAP CHANGES A write-intent bitmap can be added to, or removed from, an active array. Either internal bitmaps, or bitmaps stored in a separate file, can be added. Note that if you add a bitmap stored in a file which is in a filesystem that is on the RAID array being affected, the system will deadlock. The bitmap must be on a separate filesystem. CONSISTENCY POLICY CHANGES The consistency policy of an active array can be changed by using the --consistency-policy option in Grow mode. Currently this works only for the ppl and resync policies and allows to enable or disable the RAID5 Partial Parity Log (PPL). INCREMENTAL MODE top Usage: mdadm --incremental [--run] [--quiet] component-device [optional-aliases-for-device] Usage: mdadm --incremental --fail component-device Usage: mdadm --incremental --rebuild-map Usage: mdadm --incremental --run --scan This mode is designed to be used in conjunction with a device discovery system. As devices are found in a system, they can be passed to mdadm --incremental to be conditionally added to an appropriate array. Conversely, it can also be used with the --fail flag to do just the opposite and find whatever array a particular device is part of and remove the device from that array. If the device passed is a CONTAINER device created by a previous call to mdadm, then rather than trying to add that device to an array, all the arrays described by the metadata of the container will be started. mdadm performs a number of tests to determine if the device is part of an array, and which array it should be part of. If an appropriate array is found, or can be created, mdadm adds the device to the array and conditionally starts the array. Note that mdadm will normally only add devices to an array which were previously working (active or spare) parts of that array. The support for automatic inclusion of a new drive as a spare in some array requires a configuration through POLICY in config file. The tests that mdadm makes are as follow: + Is the device permitted by mdadm.conf? That is, is it listed in a DEVICES line in that file. If DEVICES is absent then the default it to allow any device. Similarly if DEVICES contains the special word partitions then any device is allowed. Otherwise the device name given to mdadm, or one of the aliases given, or an alias found in the filesystem, must match one of the names or patterns in a DEVICES line. This is the only context where the aliases are used. They are usually provided by a udev rules mentioning $env{DEVLINKS}. + Does the device have a valid md superblock? If a specific metadata version is requested with --metadata or -e then only that style of metadata is accepted, otherwise mdadm finds any known version of metadata. If no md metadata is found, the device may be still added to an array as a spare if POLICY allows. mdadm keeps a list of arrays that it has partially assembled in /run/mdadm/map. If no array exists which matches the metadata on the new device, mdadm must choose a device name and unit number. It does this based on any name given in mdadm.conf or any name information stored in the metadata. If this name suggests a unit number, that number will be used, otherwise a free unit number will be chosen. Normally mdadm will prefer to create a partitionable array, however if the CREATE line in mdadm.conf suggests that a non-partitionable array is preferred, that will be honoured. If the array is not found in the config file and its metadata does not identify it as belonging to the "homehost", then mdadm will choose a name for the array which is certain not to conflict with any array which does belong to this host. It does this be adding an underscore and a small number to the name preferred by the metadata. Once an appropriate array is found or created and the device is added, mdadm must decide if the array is ready to be started. It will normally compare the number of available (non-spare) devices to the number of devices that the metadata suggests need to be active. If there are at least that many, the array will be started. This means that if any devices are missing the array will not be restarted. As an alternative, --run may be passed to mdadm in which case the array will be run as soon as there are enough devices present for the data to be accessible. For a RAID1, that means one device will start the array. For a clean RAID5, the array will be started as soon as all but one drive is present. Note that neither of these approaches is really ideal. If it can be known that all device discovery has completed, then mdadm -IRs can be run which will try to start all arrays that are being incrementally assembled. They are started in "read-auto" mode in which they are read-only until the first write request. This means that no metadata updates are made and no attempt at resync or recovery happens. Further devices that are found before the first write can still be added safely. ENVIRONMENT top This section describes environment variables that affect how mdadm operates. MDADM_NO_MDMON Setting this value to 1 will prevent mdadm from automatically launching mdmon. This variable is intended primarily for debugging mdadm/mdmon. MDADM_NO_UDEV Normally, mdadm does not create any device nodes in /dev, but leaves that task to udev. If udev appears not to be configured, or if this environment variable is set to '1', the mdadm will create and devices that are needed. MDADM_NO_SYSTEMCTL If mdadm detects that systemd is in use it will normally request systemd to start various background tasks (particularly mdmon) rather than forking and running them in the background. This can be suppressed by setting MDADM_NO_SYSTEMCTL=1. IMSM_NO_PLATFORM A key value of IMSM metadata is that it allows interoperability with boot ROMs on Intel platforms, and with other major operating systems. Consequently, mdadm will only allow an IMSM array to be created or modified if detects that it is running on an Intel platform which supports IMSM, and supports the particular configuration of IMSM that is being requested (some functionality requires newer OROM support). These checks can be suppressed by setting IMSM_NO_PLATFORM=1 in the environment. This can be useful for testing or for disaster recovery. You should be aware that interoperability may be compromised by setting this value. These change can also be suppressed by adding mdadm.imsm.test=1 to the kernel command line. This makes it easy to test IMSM code in a virtual machine that doesn't have IMSM virtual hardware. MDADM_GROW_ALLOW_OLD If an array is stopped while it is performing a reshape and that reshape was making use of a backup file, then when the array is re-assembled mdadm will sometimes complain that the backup file is too old. If this happens and you are certain it is the right backup file, you can over-ride this check by setting MDADM_GROW_ALLOW_OLD=1 in the environment. MDADM_CONF_AUTO Any string given in this variable is added to the start of the AUTO line in the config file, or treated as the whole AUTO line if none is given. It can be used to disable certain metadata types when mdadm is called from a boot script. For example export MDADM_CONF_AUTO='-ddf -imsm' will make sure that mdadm does not automatically assemble any DDF or IMSM arrays that are found. This can be useful on systems configured to manage such arrays with dmraid. EXAMPLES top mdadm --query /dev/name-of-device This will find out if a given device is a RAID array, or is part of one, and will provide brief information about the device. mdadm --assemble --scan This will assemble and start all arrays listed in the standard config file. This command will typically go in a system startup file. mdadm --stop --scan This will shut down all arrays that can be shut down (i.e. are not currently in use). This will typically go in a system shutdown script. mdadm --follow --scan --delay=120 If (and only if) there is an Email address or program given in the standard config file, then monitor the status of all arrays listed in that file by polling them ever 2 minutes. mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd[ac]1 Create /dev/md0 as a RAID1 array consisting of /dev/hda1 and /dev/hdc1. echo 'DEVICE /dev/hd*[0-9] /dev/sd*[0-9]' > mdadm.conf mdadm --detail --scan >> mdadm.conf This will create a prototype config file that describes currently active arrays that are known to be made from partitions of IDE or SCSI drives. This file should be reviewed before being used as it may contain unwanted detail. echo 'DEVICE /dev/hd[a-z] /dev/sd*[a-z]' > mdadm.conf mdadm --examine --scan --config=mdadm.conf >> mdadm.conf This will find arrays which could be assembled from existing IDE and SCSI whole drives (not partitions), and store the information in the format of a config file. This file is very likely to contain unwanted detail, particularly the devices= entries. It should be reviewed and edited before being used as an actual config file. mdadm --examine --brief --scan --config=partitions mdadm -Ebsc partitions Create a list of devices by reading /proc/partitions, scan these for RAID superblocks, and printout a brief listing of all that were found. mdadm -Ac partitions -m 0 /dev/md0 Scan all partitions and devices listed in /proc/partitions and assemble /dev/md0 out of all such devices with a RAID superblock with a minor number of 0. mdadm --monitor --scan --daemonise > /run/mdadm/mon.pid If config file contains a mail address or alert program, run mdadm in the background in monitor mode monitoring all md devices. Also write pid of mdadm daemon to /run/mdadm/mon.pid. mdadm -Iq /dev/somedevice Try to incorporate newly discovered device into some array as appropriate. mdadm --incremental --rebuild-map --run --scan Rebuild the array map from any current arrays, and then start any that can be started. mdadm /dev/md4 --fail detached --remove detached Any devices which are components of /dev/md4 will be marked as faulty and then remove from the array. mdadm --grow /dev/md4 --level=6 --backup-file=/root/backup-md4 The array /dev/md4 which is currently a RAID5 array will be converted to RAID6. There should normally already be a spare drive attached to the array as a RAID6 needs one more drive than a matching RAID5. mdadm --create /dev/md/ddf --metadata=ddf --raid-disks 6 /dev/sd[a-f] Create a DDF array over 6 devices. mdadm --create /dev/md/home -n3 -l5 -z 30000000 /dev/md/ddf Create a RAID5 array over any 3 devices in the given DDF set. Use only 30 gigabytes of each device. mdadm -A /dev/md/ddf1 /dev/sd[a-f] Assemble a pre-exist ddf array. mdadm -I /dev/md/ddf1 Assemble all arrays contained in the ddf array, assigning names as appropriate. mdadm --create --help Provide help about the Create mode. mdadm --config --help Provide help about the format of the config file. mdadm --help Provide general help. FILES top /proc/mdstat If you're using the /proc filesystem, /proc/mdstat lists all active md devices with information about them. mdadm uses this to find arrays when --scan is given in Misc mode, and to monitor array reconstruction on Monitor mode. /etc/mdadm.conf (or /etc/mdadm/mdadm.conf) Default config file. See mdadm.conf(5) for more details. /etc/mdadm.conf.d (or /etc/mdadm/mdadm.conf.d) Default directory containing configuration files. See mdadm.conf(5) for more details. /run/mdadm/map When --incremental mode is used, this file gets a list of arrays currently being created. POSIX PORTABLE NAME top A valid name can only consist of characters "A-Za-z0-9.-_". The name cannot start with a leading "-" and cannot exceed 255 chars. DEVICE NAMES top mdadm understand two sorts of names for array devices. The first is the so-called 'standard' format name, which matches the names used by the kernel and which appear in /proc/mdstat. The second sort can be freely chosen, but must reside in /dev/md/. When giving a device name to mdadm to create or assemble an array, either full path name such as /dev/md0 or /dev/md/home can be given, or just the suffix of the second sort of name, such as home can be given. In every style, raw name must be compatible with POSIX PORTABLE NAME and has to be no longer than 32 chars. When mdadm chooses device names during auto-assembly or incremental assembly, it will sometimes add a small sequence number to the end of the name to avoid conflicted between multiple arrays that have the same name. If mdadm can reasonably determine that the array really is meant for this host, either by a hostname in the metadata, or by the presence of the array in mdadm.conf, then it will leave off the suffix if possible. Also if the homehost is specified as <ignore> mdadm will only use a suffix if a different array of the same name already exists or is listed in the config file. The standard names for non-partitioned arrays (the only sort of md array available in 2.4 and earlier) are of the form /dev/mdNN where NN is a number. The standard names for partitionable arrays (as available from 2.6 onwards) are of the form: /dev/md_dNN Partition numbers should be indicated by adding "pMM" to these, thus "/dev/md/d1p2". From kernel version 2.6.28 the "non-partitioned array" can actually be partitioned. So the "md_dNN" names are no longer needed, and partitions such as "/dev/mdNNpXX" are possible. From kernel version 2.6.29 standard names can be non-numeric following the form: /dev/md_XXX where XXX is any string. These names are supported by mdadm since version 3.3 provided they are enabled in mdadm.conf. NOTE top mdadm was previously known as mdctl. SEE ALSO top For further information on mdadm usage, MD and the various levels of RAID, see: https://raid.wiki.kernel.org/ (based upon Jakob stergaard's Software-RAID.HOWTO) The latest version of mdadm should always be available from https://www.kernel.org/pub/linux/utils/raid/mdadm/ Related man pages: mdmon(8), mdadm.conf(5), md(4). COLOPHON top This page is part of the mdadm (Tool for managing md arrays in Linux) project. Information about the project can be found at http://neil.brown.name/blog/mdadm. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/ on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-19.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] v4.2 MDADM(8) Pages that refer to this page: md(4), mdadm.conf(5), blkdeactivate(8), mdmon(8), raid6check(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mdadm\n\n> RAID management utility.\n> More information: <https://manned.org/mdadm>.\n\n- Create array:\n\n`sudo mdadm --create {{/dev/md/MyRAID}} --level {{raid_level}} --raid-devices {{number_of_disks}} {{/dev/sdXN}}`\n\n- Stop array:\n\n`sudo mdadm --stop {{/dev/md0}}`\n\n- Mark disk as failed:\n\n`sudo mdadm --fail {{/dev/md0}} {{/dev/sdXN}}`\n\n- Remove disk:\n\n`sudo mdadm --remove {{/dev/md0}} {{/dev/sdXN}}`\n\n- Add disk to array:\n\n`sudo mdadm --assemble {{/dev/md0}} {{/dev/sdXN}}`\n\n- Show RAID info:\n\n`sudo mdadm --detail {{/dev/md0}}`\n\n- Reset disk by deleting RAID metadata:\n\n`sudo mdadm --zero-superblock {{/dev/sdXN}}`\n
mesg
mesg(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mesg(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | ARGUMENTS | OPTIONS | EXIT STATUS | FILES | HISTORY | SEE ALSO | REPORTING BUGS | AVAILABILITY MESG(1) User Commands MESG(1) NAME top mesg - display (or do not display) messages from other users SYNOPSIS top mesg [option] [n|y] DESCRIPTION top The mesg utility is invoked by a user to control write access others have to the terminal device associated with standard error output. If write access is allowed, then programs such as talk(1) and write(1) may display messages on the terminal. Traditionally, write access is allowed by default. However, as users become more conscious of various security risks, there is a trend to remove write access by default, at least for the primary login shell. To make sure your ttys are set the way you want them to be set, mesg should be executed in your login scripts. The mesg utility silently exits with error status 2 if not executed on a terminal. In this case executing mesg is pointless. The command line option --verbose forces mesg to print a warning in this situation. This behaviour has been introduced in version 2.33. ARGUMENTS top n Disallow messages. y Allow messages to be displayed. If no arguments are given, mesg shows the current message status on standard error output. OPTIONS top -v, --verbose Explain what is being done. -h, --help Display help text and exit. -V, --version Print version and exit. EXIT STATUS top The mesg utility exits with one of the following values: 0 Messages are allowed. 1 Messages are not allowed. >1 An error has occurred. FILES top /dev/[pt]ty*, /dev/pts/[0-9]* HISTORY top mesg (I) appears in the UNIX Programmers Manual. It used to invert the current state with no argument before Version 7 AT&T UNIX. SEE ALSO top login(1), talk(1), write(1), wall(1), xterm(1) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The mesg command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 MESG(1) Pages that refer to this page: wall(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mesg\n\n> Check or set a terminal's ability to receive messages from other users, usually from the `write` command.\n> See also `write`, `talk`.\n> More information: <https://manned.org/mesg.1>.\n\n- Check terminal's openness to write messages:\n\n`mesg`\n\n- Disallow receiving messages from other users:\n\n`mesg n`\n\n- Allow receiving messages from other users:\n\n`mesg y`\n\n- Enable [v]erbose mode, printing a warning if the command is not executed from a terminal:\n\n`mesg --verbose`\n
minicom
minicom(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training minicom(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | COMMAND-LINE | USE | DIALING DIRECTORY | CONFIGURATION | STATUS LINE | LOCALES | MISC | FILES | SEE ALSO | BUGS | AUTHORS | COLOPHON MINICOM(1) Version 2.7 MINICOM(1) NAME top minicom - friendly serial communication program SYNOPSIS top minicom [options] [configuration] DESCRIPTION top minicom is a communication program which somewhat resembles the shareware program TELIX but is free with source code and runs under most Unices. Features include dialing directory with auto- redial, support for UUCP-style lock files on serial devices, a separate script language interpreter, capture to file, multiple users with individual configurations, and more. COMMAND-LINE top -s, --setup Setup. Root edits the system-wide defaults in /etc/minirc.dfl with this option. When it is used, minicom does not initialize, but puts you directly into the configuration menu. This is very handy if minicom refuses to start up because your system has changed, or for the first time you run minicom. For most systems, reasonable defaults are already compiled in. -o, --noinit Do not initialize. Minicom will skip the initialization code. This option is handy if you quit from minicom without resetting, and then want to restart a session. It is potentially dangerous though: no check for lock files etc. is made, so a normal user could interfere with things like UUCP... maybe this will be taken out later. For now it is assumed, that users who are given access to a modem are responsible enough for their actions. -m, --metakey Override command-key with the Meta or ALT key. This is the default in 1.80 and it can also be configured in one of minicom's menus, but if you use different terminals all the time, of which some don't have a Meta or ALT key, it's handy to set the default command key to Ctrl-A and use this option when you have a keyboard supporting Meta or ALT keys. Minicom assumes that your Meta key sends the ESC prefix, not the other variant that sets the highest bit of the character. -M, --metakey8 Same as -m, but assumes that your Meta key sets the 8th bit of the character high (sends 128 + character code). -z, --statline Use terminal status line. This only works on terminals that support it and that have the relevant information in their termcap or terminfo database entry. -l, --ansi Literal translation of characters with the high bit set. With this flag on, minicom will try to translate the IBM line characters to ASCII. Many PC-unix clones will display character correctly without translation (Linux in a special mode, Coherent and SCO). -L, --iso Ditto but assume screen uses an ISO8859 character set. -w, --wrap Turns line-wrap on at startup by default. -H, --displayhex Turn on output in hex mode. -a, --attrib=on/off Attribute usage. Some terminals, notably Televideo's, have rotten attribute handling (serial instead of parallel). By default, minicom uses '-a on', but if you are using such a terminal you can (must!) supply the option '-a off'. The trailing 'on' or 'off' is needed. -t, --term=TERM Terminal type. With this flag, you can override the environment TERM variable. This is handy for use in the MINICOM environment variable; one can create a special termcap entry for use with minicom on the console, that initializes the screen to raw mode so that in conjunction with the -l flag, the IBM line characters are displayed untranslated. -c, --color=on/off Color usage. Some terminals (such as the Linux console) support color with the standard ANSI escape sequences. Because there is apparently no termcap support for color, these escape sequences are hard-coded into minicom. Therefore this option is off by default. You can turn it on with '-c on'. This, and the '-m' option, are good candidates to put into the MINICOM environment variable. -S, --script=SCRIPT script. Run the named script at startup. So far, passing username and password to a startup script is not supported. If you also use the -d option to start dialing at startup, the -S script will be run BEFORE dialing the entries specified with -d. -d, --dial=ENTRY Dial an entry from the dialing directory on startup. You can specify an index number, but also a substring of the name of the entry. If you specify a name that has multiple entries in the directory, they are all tagged for dialing. You can also specify multiple names or index numbers by separating them with commas. The dialing will start from the first entry specified after all other program initialization procedures are completed. -p, --ptty=TTYP Pseudo terminal to use. This overrides the terminal port defined in the configuration files, but only if it is a pseudo TTY. The filename supplied must be of the form (/dev/)tty[p-z/][0-f], (/dev/)pts[p-z/][0-f] or (/dev/)pty[p-z/][0-f]. For example, /dev/ttyp1, pts/0 or /dev/ptyp2. -C, --capturefile=FILE filename. Open capture file at startup. --capturefile-buffer-mode=MODE Buffering mode of capture file. MODE can be one of: N Unbuffered (the default). L Line buffered. F Fully buffered. -F, --statlinefmt Format for the status line. The following format specifier are available: %H Escape key for help screen. %V Version string of minicom. %b Information on connection, such as baud rate. %T Terminal type. %C Cursor mode. %D Device path, possibly shorted to remaining available space. %t Online time. %% % character. Example: "%H for help | %b | Minicom %V | %T | %C | %t" -b, --baudrate Specify the baud rate, overriding the value given in the configuration file. -D, --device Specify the device, overriding the value given in the configuration file. -O, --option Set an option. The argument can be a single word, or a key=value pair. Recognized options: timestamp with values simple, delta, persecond, and extended. If no value is given, 'simple' is selected. -R, --remotecharset Specify the character set of the remote system is using and convert it to the character set of the local side. Example might be 'latin1'. -7, --7bit 7bit mode for terminals which aren't 8bit capable. 8bit is default if the environment is configured for this via LANG or LC_ALL, 7bit otherwise. -8, --8bit 8bit characters pass through without any modification. 'Continuous' means no locate/attribute control sequences are inserted without real change of locate/attribute. This mode is to display 8bit multi-byte characters such as Japanese. Not needed in every language with 8bit characters. (For example displaying Finnish text doesn't need this.) -h, --help Display help and exit. -v, --version Print the minicom version. When minicom starts, it first searches the MINICOM environment variable for command-line arguments, which can be over-ridden on the command line. Thus, if you have done MINICOM='-m -c on' export MINICOM or the equivalent, and start minicom, minicom will assume that your terminal has a Meta or <ALT> key and that color is supported. If you then log in from a terminal without color support, and you have set MINICOM in your startup (.profile or equivalent) file, and don't want to re-set your environment variable, you can type 'minicom -c off' and run without color support for that session. configuration The configuration argument is more interesting. Normally, minicom gets its defaults from a file called "minirc.dfl". If you however give an argument to minicom, it will try to get its defaults from a file called "minirc.configuration". So it is possible to create multiple configuration files, for different ports, different users etc. Most sensible is to use device names, such as tty1, tty64, sio2 etc. If a user creates their own configuration file, it will show up in their home directory as ".minirc.dfl" or ".minirc.configuration". USE top Minicom is window based. To pop-up a window with the function you want, press Control-A (from now on, we will use C-A to mean Control-A), and then the function key (a-z or A-Z). By pressing C-A first and then 'z', a help screen comes up with a short summary of all commands. This escape key can be altered when minicom is configured (-s option or C-A O), but we'll stick to Control-A for now. For every menu the next keys can be used: UP arrow-up or 'k' DOWN arrow-down or 'j' LEFT arrow-left or 'h' RIGHT arrow-right or 'l' CHOOSE Enter CANCEL ESCape. The screen is divided into two portions: the upper 24 lines are the terminal-emulator screen. In this window, ANSI or VT100 escape sequences are interpreted. If there is a line left at the bottom, a status line is placed there. If this is not possible the status line will be showed every time you press C-A. On terminals that have a special status line that will be used if the termcap information is complete and the -k flag has been given. Possible commands are listed next, in alphabetical order. C-A Pressing C-A a second time will just send a C-A to the remote system. If you have changed your "escape character" to something other than C-A, this works analogously for that character. A Toggle 'Add Linefeed' on/off. If it is on, a linefeed is added before every carriage return displayed on the screen. B Gives you a scroll back buffer. You can scroll up with u, down with d, a page up with b, a page down with f, and if you have them the arrow and page up/page down keys can also be used. You can search for text in the buffer with s (case- sensitive) or S (case-insensitive). N will find the next occurrence of the string. c will enter citation mode. A text cursor appears and you specify the start line by hitting Enter key. Then scroll back mode will finish and the contents with prefix '>' will be sent. C Clears the screen. D Dial a number, or go to the dialing directory. E Toggle local echo on and off (if your version of minicom supports it). F A break signal is sent to the modem. G Run script (Go). Runs a login script. H Hangup. I Toggle the type of escape sequence that the cursor keys send between normal and applications mode. (See also the comment about the status line below). J Jump to a shell. On return, the whole screen will be redrawn. K Clears the screen, runs kermit and redraws the screen upon return. L Turn Capture file on off. If turned on, all output sent to the screen will be captured in the file too. M Sends the modem initialization string. If you are online and the DCD line setting is on, you are asked for confirmation before the modem is initialized. N Toggle between timestamp modes to be added to the output. Available are simple and extended time formats for each line, a delta to the previous line, a time display each second and no timestamps (the default). O Configure minicom. Puts you in the configuration menu. P Communication Parameters. Allows you to change the bps rate, parity and number of bits. Q Exit minicom without resetting the modem. If macros changed and were not saved, you will have a chance to do so. R Receive files. Choose from various protocols (external). If you have the filename selection window and the prompt for download directory enabled, you'll get a selection window for choosing the directory for downloading. Otherwise the download directory defined in the Filenames and paths menu will be used. S Send files. Choose the protocol like you do with the receive command. If you don't have the filename selection window enabled (in the File transfer protocols menu), you'll just have to write the filename(s) in a dialog window. If you have the selection window enabled, a window will pop up showing the filenames in your upload directory. You can tag and untag filenames by pressing spacebar, and move the cursor up and down with the cursor keys or j/k. The selected filenames are shown highlighted. Directory names are shown [within brackets] and you can move up or down in the directory tree by pressing the spacebar twice. Finally, send the files by pressing ENTER or quit by pressing ESC. T Choose Terminal emulation: Ansi(color) or vt100. You can also change the backspace key here, turn the status line on or off, and define delay (in milliseconds) after each newline if you need that. U Add carriage return to each received line. W Toggle line-wrap on/off. X Exit minicom, reset modem. If macros changed and were not saved, you will have a chance to do so. Y Paste a file. Reads a file and sends its contests just as if it would be typed in. Z Pop up the help screen. DIALING DIRECTORY top By pressing C-A D the program puts you in the dialing directory. Select a command by pressing the capitalized letter or moving cursor right/left with the arrow keys or the h/l keys and pressing Enter. You can add, delete or edit entries and move them up and down in the directory list. By choosing "dial" the phone numbers of the tagged entries, or if nothing is tagged, the number of the highlighted entry will be dialed. While the modem is dialing, you can press escape to cancel dialing. Any other key will close the dial window, but won't cancel the dialing itself. Your dialing directory will be saved into the file ".dialdir" in your home directory. You can scroll up and down with the arrow keys, but you can also scroll complete pages by pressing the PageUp or PageDown key. If you don't have those, use Control-B (Backward) and Control-F (Forward). You can use the space bar to tag a number of entries and minicom will rotate trough this list if a connection can't be made. A '>' symbol is drawn in the directory before the names of the tagged entries. The "edit" menu speaks for itself, but I will discuss it briefly here. A - Name The name for this entry B - Number and its telephone number. C - Dial string # Which specific dial string you want to use to connect. There are three different dial strings (prefixes and suffixes) that can be configured in the Modem and dialing menu. D - Local echo can be on or off for this system (if your version of minicom supports it). E - Script The script that must be executed after a successful connection is made (see the manual for runscript) F - Username The username that is passed to the runscript program. It is passed in the environment string "$LOGIN". G - Password The password is passed as "$PASS". H - Terminal Emulation Use ANSI or VT100 emulation. I - Backspace key sends What code (Backspace or Delete) the backspace key sends. J - Linewrap Can be on or off. K - Line settings Bps rate, bits, parity and number of stop bits to use for this connection. You can choose current for the speed, so that it will use whatever speed is being used at that moment (useful if you have multiple modems). L - Conversion table You may specify a character conversion table to be loaded whenever this entry answers, before running the login script. If this field is blank, the conversion table stays unchanged. The edit menu also shows the latest date and time when you called this entry and the total number of calls there, but doesn't let you change them. They are updated automatically when you connect. The moVe command lets you move the highlighted entry up or down in the dialing directory with the up/down arrow keys or the k and j keys. Press Enter or ESC to end moving the entry. CONFIGURATION top By pressing C-A O you will be thrown into the setup menu. Filenames and paths This menu defines your default directories. A - Download directory where the downloaded files go to. B - Upload directory where the uploaded files are read from. C - Script directory Where you keep your login scripts. D - Script program Which program to use as the script interpreter. Defaults to the program "runscript", but if you want to use something else (eg, /bin/sh or "expect") it is possible. Stdin and stdout are connected to the modem, stderr to the screen. If the path is relative (ie, does not start with a slash) then it's relative to your home directory, except for the script interpreter. E - Kermit program Where to find the executable for kermit, and it's options. Some simple macro's can be used on the command line: '%l' is expanded to the complete filename of the dial out- device, '%f' is expanded to the serial port file descriptor and '%b' is expanded to the current serial port speed. F - Logging options Options to configure the logfile writing. A - File name Here you can enter the name of the logfile. The file will be written in your home directory, and the default value is "minicom.log". If you blank the name, all logging is turned off. B - Log connects and hangups This option defines whether or not the logfile is written when the remote end answers the call or hangs up. Or when you give the hangup command yourself or leave minicom without hangup while online. C - Log file transfers Do you want log entries of receiving and sending files. The 'log' command in the scripts is not affected by logging options B and C. It is always executed, if you just have the name of the log file defined. File Transfer Protocols Protocols defined here will show up when C-A s/r is pressed. "Name" in the beginning of the line is the name that will show up in the menu. "Program" is the path to the protocol. "Name" after that defines if the program needs an argument, e.g. a file to be transmitted. U/D defines if this entry should show up in the upload or the download menu. Fullscr defines if the program should run full screen, or that minicom will only show it's stderr in a window. IO-Red defines if minicom should attach the program's standard in and output to the modem port or not. "Multi" tells the filename selection window whether or not the protocol can send multiple files with one command. It has no effect on download protocols, and it is also ignored with upload protocols if you don't use the filename selection window. The old sz and rz are not full screen, and have IO-Red set. However, there are curses based versions of at least rz that do not want their stdin and stdout redirected, and run full screen. All file transfer protocols are run with the UID of the user, and not with UID=root. '%l', '%f' and '%b' can be used on the command line as with kermit. Within this menu you can also define if you want to use the filename selection window when prompted for files to upload, and if you like to be prompted for the download directory every time the automatic download is started. If you leave the download directory prompt disabled, the download directory defined in the file and directory menu is used. Serial port setup A - Serial device /dev/tty1 or /dev/ttyS1 for most people. /dev/cua<n> is still possible under GNU/Linux, but no longer recommended as these devices are obsolete and many systems with kernel 2.2.x or newer don't have them. Use /dev/ttyS<n> instead. You may also have /dev/modem as a symlink to the real device. If you have modems connected to two or more serial ports, you may specify all of them here in a list separated by space, comma or semicolon. When Minicom starts, it checks the list until it finds an available modem and uses that one. (However, you can't specify different init strings to them... at least not yet.) To use a UNIX socket for communication the device name must be prefixed with "unix#" following by the full path and the filename of the socket. Minicom will then try to connect to this socket as a client. As long as it cannot connect to the socket it stays 'offline'. As soon as the connection establishes, minicom goes 'online'. If the server closes the socket, minicom switches to 'offline' again. B - Lock file location On most systems This should be /usr/spool/uucp. GNU/Linux systems use /var/lock. If this directory does not exist, minicom will not attempt to use lockfiles. C - Callin program If you have a uugetty or something on your serial port, it could be that you want a program to be run to switch the modem cq. port into dialin/dialout mode. This is the program to get into dialin mode. D - Callout program And this to get into dialout mode. E - Bps/Par/Bits Default parameters at startup. If one of the entries is left blank, it will not be used. So if you don't care about locking, and don't have a getty running on your modemline, entries B - D should be left blank. Modem and Dialing Here, the parameters for your modem are defined. I will not explain this further because the defaults are for generic Hayes modems, and should work always. This file is not a Hayes tutorial :-) The only things worth noticing are that control characters can be sent by prefixing them with a '^', in which '^^' means '^' itself, and the '\' character must also be doubled as '\\', because backslash is used specially in the macro definitions. Some options however, don't have much to do with the modem but more with the behaviour of minicom itself: M - Dial time The number of seconds before minicom times out if no connection is established. N - Delay before redial Minicom will redial if no connection was made, but it first waits some time. O - Number of tries Maximum number of times that minicom attempts to dial. P - Drop DTR time If you set this to 0, minicom hangs up by sending a Hayes- type hangup sequence. If you specify a non-zero value, the hangup will be done by dropping the DTR line. The value tells in seconds how long DTR will be kept down. Q - Auto bps detect If this is on, minicom tries to match the dialed party's speed. With most modern modems this is NOT desirable, since the modem buffers the data and converts the speed. R - Modem has DCD line If your modem, and your O/S both support the DCD line (that goes 'high' when a connection is made) minicom will use it. When you have this option on, minicom will also NOT start dialing while you are already online. S - Status line shows DTE speed / line speed You can toggle the status line to show either the DTE speed (the speed which minicom uses to communicate with your modem) or the line speed (the speed that your modem uses on the line to communicate with the other modem). Notice that the line speed may change during the connection, but you will still only see the initial speed that the modems started the connection with. This is because the modem doesn't tell the program if the speed is changed. Also, to see the line speed, you need to have the modem set to show it in the connect string. Otherwise you will only see 0 as the line speed. T - Multi-line untag You can toggle the feature to untag entries from the dialing directory when a connection is established to a multi-line BBS. All the tagged entries that have the same name are untagged. Note that a special exception is made for this menu: every user can change all parameters here, but some of them will not be saved. Screen and keyboard A - Command key is the 'Hot Key' that brings you into command mode. If this is set to 'ALT' or 'meta key', you can directly call commands by alt-key instead of HotKey-key. B - Backspace key sends There still are some systems that want a VT100 to send DEL instead of BS. With this option you can enable that stupidity. (Eh, it's even on by default...) C - Status line is Enabled or disabled. Some slow terminals (for example, X- terminals) cause the status line to jump "up and down" when scrolling, so you can turn it off if desired. It will still be shown in command-mode. D - Alarm sound If turned on, minicom will sound an alarm (on the console only) after a successful connection and when up/downloading is complete. E - Foreground Color (menu) indicates the foreground color to use for all the configuration windows in minicom. F - Background Color (menu) indicates the background color to use for all the configuration windows in minicom. Note that minicom will not allow you to set foreground and background colors to the same value. G - Foreground Color (term) indicates the foreground color to use in the terminal window. H - Background Color (term) indicates the background color to use in the terminal window. Note that minicom will not allow you to set foreground and background colors to the same value. I - Foreground Color (stat) indicates the foreground color to use in for the status bar. J - Background Color (stat) indicates the color to use in for the status bar. Note that minicom will allow you to set the status bar's foreground and background colors to the same value. This will effectively make the status bar invisible but if these are your intentions, please see the option K - History buffer size The number of lines to keep in the history buffer (for backscrolling). L - Macros file is the full path to the file that holds macros. Macros allow you to define a string to be sent when you press a certain key. In minicom, you may define F1 through F12 to send up to 256 characters [this is set at compile time]. The filename you specify is verified as soon as you hit ENTER. If you do not have permissions to create the specified file, an error message will so indicate and you will be forced to re-edit the filename. If you are permitted to create the file, minicom checks to see if it already exists. If so, it assumes it's a macro file and reads it in. If it isn't, well, it's your problem :-) If the file does not exist, the filename is accepted. M - Edit Macros opens up a new window which allows you to edit the F1 through F12 macros. N - Macros enabled - Yes or No. If macros are disabled, the F1-F12 keys will just send the VT100/VT220 function key escape sequences. O - Character conversion The active conversion table filename is shown here. If you can see no name, no conversion is active. Pressing O, you will see the conversion table edit menu. Edit Macros Here, the macros for F1 through F12 are defined. The bottom of the window shows a legend of character combinations that have special meaning. They allow you to enter special control characters with plain text by prefixing them with a '^', in which '^^' means '^' itself. You can send a 1 second delay with the '^~' code. This is useful when you are trying to login after ftp'ing or telnet'ing somewhere. You can also include your current username and password from the phone directory in the macros with '\u' and '\p', respectively. If you need the backslash character in the macro, write it doubled as '\\'. To edit a macro, press the shown number or letter and you will be moved to the end of the macro. When editing the line, you may use the left & right arrows, Home & End keys, Delete & BackSpace, and ESC and RETURN. ESC cancels any changes made while ENTER accepts the changes. Character conversion Here you can edit the character conversion table. If you are not an American, you know that in many languages there are characters that are not included in the ASCII character set, and in the old times they may have replaced some less important characters in ASCII and now they are often represented with character codes above 127. AND there are various different ways to represent them. This is where you may edit conversion tables for systems that use a character set different from the one on your computer. A - Load table You probably guessed it. This command loads a table from the disk. You are asked a file name for the table. Predefined tables .mciso, .mcpc8 and .mcsf7 should be included with the program. Table .mciso does no conversion, .mcpc8 is to be used for connections with systems that use the 8-bit pc character set, and .mcsf7 is for compatibility with the systems that uses the good old 7-bit coding to replace the characters {|}[]\ with the diacritical characters used in Finnish and Swedish. B - Save table This one saves the active table on the filename you specify. C - edit char This is where you can make your own modifications to the existing table. First you are asked the character value (in decimal) whose conversion you want to change. Next you'll say which character you want to see on your screen when that character comes from the outside world. And then you'll be asked what you want to be sent out when you enter that character from your keyboard. D - next screen E - prev screen Yeah, you probably noticed that this screen shows you what kind of conversions are active. The screen just is (usually) too small to show the whole table at once in an easy-to-understand format. This is how you can scroll the table left and right. F - convert capture Toggles whether or not the character conversion table is used when writing the capture file. Save setup as dfl Save the parameters as the default for the next time the program is started. Instead of dfl, any other parameter name may appear, depending on which one was used when the program was started. Save setup as.. Save the parameters under a special name. Whenever Minicom is started with this name as an argument, it will use these parameters. This option is of course privileged to root. Exit Escape from this menu without saving. This can also be done with ESC. Exit from minicom Only root will see this menu entry, if he/she started minicom with the '-s' option. This way, it is possible to change the configuration without actually running minicom. STATUS LINE top The status line has several indicators, that speak for themselves. The mysterious APP or NOR indicator probably needs explanation. The VT100 cursor keys can be in two modes: applications mode and cursor mode. This is controlled by an escape sequence. If you find that the cursor keys do not work in, say, vi when you're logged in using minicom then you can see with this indicator whether the cursor keys are in applications or cursor mode. You can toggle the two with the C-A I key. If the cursor keys then work, it's probably an error in the remote system's termcap initialization strings (is). LOCALES top Minicom has support for local languages. This means you can change most of the English messages and other strings to another language by setting the environment variable LANG. MISC top If minicom is hung, kill it with SIGTERM . (This means kill -15, or since sigterm is default, just plain "kill <minicompid>". This will cause a graceful exit of minicom, doing resets and everything. You may kill minicom from a script with the command "! killall -9 minicom" without hanging up the line. Without the -9 parameter, minicom first hangs up before exiting. Since a lot of escape sequences begin with ESC (Arrow up is ESC [ A), Minicom does not know if the escape character it gets is you pressing the escape key, or part of a sequence. An old version of Minicom, V1.2, solved this in a rather crude way: to get the escape key, you had to press it twice. As of release 1.3 this has bettered a little: now a 1-second timeout is builtin, like in vi. For systems that have the select() system call the timeout is 0.5 seconds. And... surprise: a special Linux-dependent hack :-) was added. Now, minicom can separate the escape key and escape-sequences. To see how dirty this was done, look into wkeys.c. But it works like a charm! FILES top Minicom keeps it's configuration files in one directory, usually /var/lib/minicom, /usr/local/etc or /etc. To find out what default directory minicom has compiled in, issue the command minicom -h. You'll probably also find the demo files for runscript(1), and the examples of character conversion tables either there or in the subdirectories of /usr/doc/minicom*. The conversion tables are named something like mc.* in that directory, but you probably want to copy the ones you need in your home directory as something beginning with a dot. minirc.* $HOME/.minirc.* $HOME/.dialdir $HOME/minicom.log /usr/share/locale/*/LC_MESSAGES/minicom.mo SEE ALSO top runscript(1) BUGS top Please report any bugs to [email protected]. Thank you! AUTHORS top The original author of minicom is Miquel van Smoorenburg ([email protected]). He wrote versions up to 1.75. Jukka Lahtinen ([email protected], [email protected]) has been responsible for new versions since 1.78, helped by some other people, including: [email protected] wrote the History buffer searching to 1.79. Arnaldo Carvalho de Melo ([email protected]) did the internationalization and the Brazilian Portuguese translations. Jim Seymour ([email protected]) wrote the multiple modem support and the filename selection window used since 1.80. Tomohiro Kubota ([email protected]) wrote the Japanese translations and the citation facility, and did some fixes. Gael Queri ([email protected]) wrote the French translations. Arkadiusz Miskiewicz ([email protected]) wrote the Polish translations. Kim Soyoung ([email protected]) wrote the Korean translations. Jork Loeser ([email protected]) provided the socket extension. Most of this man page is copied, with corrections, from the original minicom README, but some pieces and the corrections are by Michael K. Johnson. Jukka Lahtinen ([email protected]) has added some information of the changes made after version 1.75. Adam Lackorzynski ([email protected]) is the current maintainer of minicom. COLOPHON top This page is part of the minicom (a serial communication program) project. Information about the project can be found at https://salsa.debian.org/minicom-team/minicom. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository https://salsa.debian.org/minicom-team/minicom on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-09-22.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] User's Manual Dec 2013 MINICOM(1) Pages that refer to this page: ascii-xfr(1), runscript(1), xminicom(1) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# minicom\n\n> Communicate with the serial interface of a device.\n> More information: <https://manned.org/minicom>.\n\n- Open a given serial port:\n\n`sudo minicom --device {{/dev/ttyUSB0}}`\n\n- Open a given serial port with a given baud rate:\n\n`sudo minicom --device {{/dev/ttyUSB0}} --baudrate {{115200}}`\n\n- Enter the configuration menu before communicating with a given serial port:\n\n`sudo minicom --device {{/dev/ttyUSB0}} --setup`\n
mkdir
mkdir(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mkdir(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | AUTHOR | REPORTING BUGS | COPYRIGHT | SEE ALSO | COLOPHON MKDIR(1) User Commands MKDIR(1) NAME top mkdir - make directories SYNOPSIS top mkdir [OPTION]... DIRECTORY... DESCRIPTION top Create the DIRECTORY(ies), if they do not already exist. Mandatory arguments to long options are mandatory for short options too. -m, --mode=MODE set file mode (as in chmod), not a=rwx - umask -p, --parents no error if existing, make parent directories as needed, with their file modes unaffected by any -m option. -v, --verbose print a message for each created directory -Z set SELinux security context of each created directory to the default type --context[=CTX] like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX --help display this help and exit --version output version information and exit AUTHOR top Written by David MacKenzie. REPORTING BUGS top GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT top Copyright 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO top mkdir(2) Full documentation <https://www.gnu.org/software/coreutils/mkdir> or available locally via: info '(coreutils) mkdir invocation' COLOPHON top This page is part of the coreutils (basic file, shell and text manipulation utilities) project. Information about the project can be found at http://www.gnu.org/software/coreutils/. If you have a bug report for this manual page, see http://www.gnu.org/software/coreutils/. This page was obtained from the tarball coreutils-9.4.tar.xz fetched from http://ftp.gnu.org/gnu/coreutils/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] GNU coreutils 9.4 August 2023 MKDIR(1) Pages that refer to this page: systemd-mount(1), mkdir(2), cpuset(7) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mkdir\n\n> Create directories and set their permissions.\n> More information: <https://www.gnu.org/software/coreutils/mkdir>.\n\n- Create specific directories:\n\n`mkdir {{path/to/directory1 path/to/directory2 ...}}`\n\n- Create specific directories and their [p]arents if needed:\n\n`mkdir -p {{path/to/directory1 path/to/directory2 ...}}`\n\n- Create directories with specific permissions:\n\n`mkdir -m {{rwxrw-r--}} {{path/to/directory1 path/to/directory2 ...}}`\n
mke2fs
mke2fs(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mke2fs(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | ENVIRONMENT | AUTHOR | AVAILABILITY | SEE ALSO | COLOPHON MKE2FS(8) System Manager's Manual MKE2FS(8) NAME top mke2fs - create an ext2/ext3/ext4 file system SYNOPSIS top mke2fs [ -c | -l filename ] [ -b block-size ] [ -C cluster-size ] [ -d root-directory ] [ -D ] [ -g blocks-per-group ] [ -G number- of-groups ] [ -i bytes-per-inode ] [ -I inode-size ] [ -j ] [ -J journal-options ] [ -N number-of-inodes ] [ -n ] [ -m reserved- blocks-percentage ] [ -o creator-os ] [ -O [^]feature[,...] ] [ -q ] [ -r fs-revision-level ] [ -E extended-options ] [ -v ] [ -F ] [ -L volume-label ] [ -M last-mounted-directory ] [ -S ] [ -t fs-type ] [ -T usage-type ] [ -U UUID ] [ -V ] [ -e errors- behavior ] [ -z undo_file ] device [ fs-size ] mke2fs -O journal_dev [ -b block-size ] [ -L volume-label ] [ -n ] [ -q ] [ -v ] external-journal [ fs-size ] DESCRIPTION top mke2fs is used to create an ext2, ext3, or ext4 file system, usually in a disk partition (or file) named by device. The file system size is specified by fs-size. If fs-size does not have a suffix, it is interpreted as power-of-two kilobytes, unless the -b blocksize option is specified, in which case fs- size is interpreted as the number of blocksize blocks. If the fs-size is suffixed by 'k', 'm', 'g', 't' (either upper-case or lower-case), then it is interpreted in power-of-two kilobytes, megabytes, gigabytes, terabytes, etc. If fs-size is omitted, mke2fs will create the file system based on the device size. If mke2fs is run as mkfs.XXX (i.e., mkfs.ext2, mkfs.ext3, or mkfs.ext4) the option -t XXX is implied; so mkfs.ext3 will create a file system for use with ext3, mkfs.ext4 will create a file system for use with ext4, and so on. The defaults of the parameters for the newly created file system, if not overridden by the options listed below, are controlled by the /etc/mke2fs.conf configuration file. See the mke2fs.conf(5) manual page for more details. OPTIONS top -b block-size Specify the size of blocks in bytes. Valid block-size values are powers of two from 1024 up to 65536 (however note that the kernel is able to mount only file systems with block-size smaller or equal to the system page size - 4k on x86 systems, up to 64k on ppc64 or aarch64 depending on kernel configuration). If omitted, block-size is heuristically determined by the file system size and the expected usage of the file system (see the -T option). In most common cases, the default block size is 4k. If block- size is preceded by a negative sign ('-'), then mke2fs will use heuristics to determine the appropriate block size, with the constraint that the block size will be at least block-size bytes. This is useful for certain hardware devices which require that the blocksize be a multiple of 2k. -c Check the device for bad blocks before creating the file system. If this option is specified twice, then a slower read-write test is used instead of a fast read-only test. -C cluster-size Specify the size of cluster in bytes for file systems using the bigalloc feature. Valid cluster-size values are from 2048 to 256M bytes per cluster. This can only be specified if the bigalloc feature is enabled. (See the ext4(5) man page for more details about bigalloc.) The default cluster size if bigalloc is enabled is 16 times the block size. -d root-directory Copy the contents of the given directory into the root directory of the file system. -D Use direct I/O when writing to the disk. This avoids mke2fs dirtying a lot of buffer cache memory, which may impact other applications running on a busy server. This option will cause mke2fs to run much more slowly, however, so there is a tradeoff to using direct I/O. -e error-behavior Change the behavior of the kernel code when errors are detected. In all cases, a file system error will cause e2fsck(8) to check the file system on the next boot. error-behavior can be one of the following: continue Continue normal execution. remount-ro Remount file system read-only. panic Cause a kernel panic. -E extended-options Set extended options for the file system. Extended options are comma separated, and may take an argument using the equals ('=') sign. The -E option used to be -R in earlier versions of mke2fs. The -R option is still accepted for backwards compatibility, but is deprecated. The following extended options are supported: encoding=encoding-name Enable the casefold feature in the super block and set encoding-name as the encoding to be used. If encoding-name is not specified, the encoding defined in mke2fs.conf(5) is used. encoding_flags=encoding-flags Define parameters for file name character encoding operations. If a flag is not changed using this parameter, its default value is used. encoding-flags should be a comma- separated lists of flags to be enabled. To disable a flag, add it to the list with the prefix "no". The only flag that can be set right now is strict which means that invalid strings should be rejected by the file system. In the default configuration, the strict flag is disabled. mmp_update_interval=interval Adjust the initial MMP update interval to interval seconds. Specifying an interval of 0 means to use the default interval. The specified interval must be less than 300 seconds. Requires that the mmp feature be enabled. stride=stride-size Configure the file system for a RAID array with stride-size file system blocks. This is the number of blocks read or written to disk before moving to the next disk, which is sometimes referred to as the chunk size. This mostly affects placement of file system metadata like bitmaps at mke2fs time to avoid placing them on a single disk, which can hurt performance. It may also be used by the block allocator. stripe_width=stripe-width Configure the file system for a RAID array with stripe-width file system blocks per stripe. This is typically stride-size * N, where N is the number of data-bearing disks in the RAID (e.g. for RAID 5 there is one parity disk, so N will be the number of disks in the array minus 1). This allows the block allocator to prevent read-modify-write of the parity in a RAID stripe if possible when the data is written. offset=offset Create the file system at an offset from the beginning of the device or file. This can be useful when creating disk images for virtual machines. resize=max-online-resize Reserve enough space so that the block group descriptor table can grow to support a file system that has max-online-resize blocks. lazy_itable_init[= <0 to disable, 1 to enable>] If enabled and the uninit_bg feature is enabled, the inode table will not be fully initialized by mke2fs. This speeds up file system initialization noticeably, but it requires the kernel to finish initializing the file system in the background when the file system is first mounted. If the option value is omitted, it defaults to 1 to enable lazy inode table zeroing. lazy_journal_init[= <0 to disable, 1 to enable>] If enabled, the journal inode will not be fully zeroed out by mke2fs. This speeds up file system initialization noticeably, but carries some small risk if the system crashes before the journal has been overwritten entirely one time. If the option value is omitted, it defaults to 1 to enable lazy journal inode zeroing. assume_storage_prezeroed[= <0 to disable, 1 to enable>] If enabled, mke2fs assumes that the storage device has been prezeroed, skips zeroing the journal and inode tables, and annotates the block group flags to signal that the inode table has been zeroed. no_copy_xattrs Normally mke2fs will copy the extended attributes of the files in the directory hierarchy specified via the (optional) -d option. This will disable the copy and leaves the files in the newly created file system without any extended attributes. num_backup_sb=<0|1|2> If the sparse_super2 file system feature is enabled this option controls whether there will be 0, 1, or 2 backup superblocks created in the file system. packed_meta_blocks[= <0 to disable, 1 to enable>] Place the allocation bitmaps and the inode table at the beginning of the disk. This option requires that the flex_bg file system feature to be enabled in order for it to have effect, and will also create the journal at the beginning of the file system. This option is useful for flash devices that use SLC flash at the beginning of the disk. It also maximizes the range of contiguous data blocks, which can be useful for certain specialized use cases, such as supported Shingled Drives. root_owner[=uid:gid] Specify the numeric user and group ID of the root directory. If no UID:GID is specified, use the user and group ID of the user running mke2fs. In mke2fs 1.42 and earlier the UID and GID of the root directory were set by default to the UID and GID of the user running the mke2fs command. The root_owner= option allows explicitly specifying these values, and avoid side-effects for users that do not expect the contents of the file system to change based on the user running mke2fs. test_fs Set a flag in the file system superblock indicating that it may be mounted using experimental kernel code, such as the ext4dev file system. orphan_file_size=size Set size of the file for tracking unlinked but still open inodes and inodes with truncate in progress. Larger file allows for better scalability, reserving a few blocks per cpu is ideal. discard Attempt to discard blocks at mkfs time (discarding blocks initially is useful on solid state devices and sparse / thin- provisioned storage). When the device advertises that discard also zeroes data (any subsequent read after the discard and before write returns zero), then mark all not-yet- zeroed inode tables as zeroed. This significantly speeds up file system initialization. This is set as default. nodiscard Do not attempt to discard blocks at mkfs time. quotatype Specify the which quota types (usrquota, grpquota, prjquota) which should be enabled in the created file system. The argument of this extended option should be a colon separated list. This option has effect only if the quota feature is set. The default quota types to be initialized if this option is not specified is both user and group quotas. If the project feature is enabled that project quotas will be initialized as well. -F Force mke2fs to create a file system, even if the specified device is not a partition on a block special device, or if other parameters do not make sense. In order to force mke2fs to create a file system even if the file system appears to be in use or is mounted (a truly dangerous thing to do), this option must be specified twice. -g blocks-per-group Specify the number of blocks in a block group. There is generally no reason for the user to ever set this parameter, as the default is optimal for the file system. (For administrators who are creating file systems on RAID arrays, it is preferable to use the stride RAID parameter as part of the -E option rather than manipulating the number of blocks per group.) This option is generally used by developers who are developing test cases. If the bigalloc feature is enabled, the -g option will specify the number of clusters in a block group. -G number-of-groups Specify the number of block groups that will be packed together to create a larger virtual block group (or "flex_bg group") in an ext4 file system. This improves meta-data locality and performance on meta-data heavy workloads. The number of groups must be a power of 2 and may only be specified if the flex_bg file system feature is enabled. -i bytes-per-inode Specify the bytes/inode ratio. mke2fs creates an inode for every bytes-per-inode bytes of space on the disk. The larger the bytes-per-inode ratio, the fewer inodes will be created. This value generally shouldn't be smaller than the blocksize of the file system, since in that case more inodes would be made than can ever be used. Be warned that it is not possible to change this ratio on a file system after it is created, so be careful deciding the correct value for this parameter. Note that resizing a file system changes the number of inodes to maintain this ratio. -I inode-size Specify the size of each inode in bytes. The inode-size value must be a power of 2 larger or equal to 128. The larger the inode-size the more space the inode table will consume, and this reduces the usable space in the file system and can also negatively impact performance. It is not possible to change this value after the file system is created. File systems with an inode size of 128 bytes do not support timestamps beyond January 19, 2038. Inodes which are 256 bytes or larger will support extended timestamps, project id's, and the ability to store some extended attributes in the inode table for improved performance. The default inode size is controlled by the mke2fs.conf(5) file. In the mke2fs.conf file shipped with e2fsprogs, the default inode size is 256 bytes for most file systems, except for small file systems where the inode size will be 128 bytes. -j Create the file system with an ext3 journal. If the -J option is not specified, the default journal parameters will be used to create an appropriately sized journal (given the size of the file system) stored within the file system. Note that you must be using a kernel which has ext3 support in order to actually make use of the journal. -J journal-options Create the ext3 journal using options specified on the command-line. Journal options are comma separated, and may take an argument using the equals ('=') sign. The following journal options are supported: size=journal-size Create an internal journal (i.e., stored inside the file system) of size journal-size megabytes. The size of the journal must be at least 1024 file system blocks (i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.) and may be no more than 10,240,000 file system blocks or half the total file system size (whichever is smaller) fast_commit_size=fast-commit-size Create an additional fast commit journal area of size fast-commit-size kilobytes. This option is only valid if fast_commit feature is enabled on the file system. If this option is not specified and if fast_commit feature is turned on, fast commit area size defaults to journal-size / 64 megabytes. The total size of the journal with fast_commit feature set is journal-size + ( fast-commit-size * 1024) megabytes. The total journal size may be no more than 10,240,000 file system blocks or half the total file system size (whichever is smaller). location=journal-location Specify the location of the journal. The argument journal-location can either be specified as a block number, or if the number has a units suffix (e.g., 'M', 'G', etc.) interpret it as the offset from the beginning of the file system. device=external-journal Attach the file system to the journal block device located on external-journal. The external journal must already have been created using the command mke2fs -O journal_dev external-journal Note that external-journal must have been created with the same block size as the new file system. In addition, while there is support for attaching multiple file systems to a single external journal, the Linux kernel and e2fsck(8) do not currently support shared external journals yet. Instead of specifying a device name directly, external-journal can also be specified by either LABEL=label or UUID=UUID to locate the external journal by either the volume label or UUID stored in the ext2 superblock at the start of the journal. Use dumpe2fs(8) to display a journal device's volume label and UUID. See also the -L option of tune2fs(8). Only one of the size or device options can be given for a file system. -l filename Read the bad blocks list from filename. Note that the block numbers in the bad block list must be generated using the same block size as used by mke2fs. As a result, the -c option to mke2fs is a much simpler and less error- prone method of checking a disk for bad blocks before formatting it, as mke2fs will automatically pass the correct parameters to the badblocks program. -L new-volume-label Set the volume label for the file system to new-volume- label. The maximum length of the volume label is 16 bytes. -m reserved-blocks-percentage Specify the percentage of the file system blocks reserved for the super-user. This avoids fragmentation, and allows root-owned daemons, such as syslogd(8), to continue to function correctly after non-privileged processes are prevented from writing to the file system. The default percentage is 5%. -M last-mounted-directory Set the last mounted directory for the file system. This might be useful for the sake of utilities that key off of the last mounted directory to determine where the file system should be mounted. -n Causes mke2fs to not actually create a file system, but display what it would do if it were to create a file system. This can be used to determine the location of the backup superblocks for a particular file system, so long as the mke2fs parameters that were passed when the file system was originally created are used again. (With the -n option added, of course!) -N number-of-inodes Overrides the default calculation of the number of inodes that should be reserved for the file system (which is based on the number of blocks and the bytes-per-inode ratio). This allows the user to specify the number of desired inodes directly. -o creator-os Overrides the default value of the "creator operating system" field of the file system. The creator field is set by default to the name of the OS the mke2fs executable was compiled for. -O [^]feature[,...] Create a file system with the given features (file system options), overriding the default file system options. The features that are enabled by default are specified by the base_features relation, either in the [defaults] section in the /etc/mke2fs.conf configuration file, or in the [fs_types] subsections for the usage types as specified by the -T option, further modified by the features relation found in the [fs_types] subsections for the file system and usage types. See the mke2fs.conf(5) manual page for more details. The file system type-specific configuration setting found in the [fs_types] section will override the global default found in [defaults]. The file system feature set will be further edited using either the feature set specified by this option, or if this option is not given, by the default_features relation for the file system type being created, or in the [defaults] section of the configuration file. The file system feature set is comprised of a list of features, separated by commas, that are to be enabled. To disable a feature, simply prefix the feature name with a caret ('^') character. Features with dependencies will not be removed successfully. The pseudo-file system feature "none" will clear all file system features. For more information about the features which can be set, please see the manual page ext4(5). -q Quiet execution. Useful if mke2fs is run in a script. -r revision Set the file system revision for the new file system. Note that 1.2 kernels only support revision 0 file systems. The default is to create revision 1 file systems. -S Write superblock and group descriptors only. This is an extreme measure to be taken only in the very unlikely case that all of the superblock and backup superblocks are corrupted, and a last-ditch recovery method is desired by experienced users. It causes mke2fs to reinitialize the superblock and group descriptors, while not touching the inode table and the block and inode bitmaps. The e2fsck program should be run immediately after this option is used, and there is no guarantee that any data will be salvageable. Due to the wide variety of possible options to mke2fs that affect the on-disk layout, it is critical to specify exactly the same format options, such as blocksize, fs-type, feature flags, and other tunables when using this option, or the file system will be further corrupted. In some cases, such as file systems that have been resized, or have had features enabled after format time, it is impossible to overwrite all of the superblocks correctly, and at least some file system corruption will occur. It is best to run this on a full copy of the file system so other options can be tried if this doesn't work. -t fs-type Specify the file system type (i.e., ext2, ext3, ext4, etc.) that is to be created. If this option is not specified, mke2fs will pick a default either via how the command was run (for example, using a name of the form mkfs.ext2, mkfs.ext3, etc.) or via a default as defined by the /etc/mke2fs.conf file. This option controls which file system options are used by default, based on the fstypes configuration stanza in /etc/mke2fs.conf. If the -O option is used to explicitly add or remove file system options that should be set in the newly created file system, the resulting file system may not be supported by the requested fs-type. (e.g., "mke2fs -t ext3 -O extent /dev/sdXX" will create a file system that is not supported by the ext3 implementation as found in the Linux kernel; and "mke2fs -t ext3 -O ^has_journal /dev/hdXX" will create a file system that does not have a journal and hence will not be supported by the ext3 file system code in the Linux kernel.) -T usage-type[,...] Specify how the file system is going to be used, so that mke2fs can choose optimal file system parameters for that use. The usage types that are supported are defined in the configuration file /etc/mke2fs.conf. The user may specify one or more usage types using a comma separated list. If this option is is not specified, mke2fs will pick a single default usage type based on the size of the file system to be created. If the file system size is less than 3 megabytes, mke2fs will use the file system type floppy. If the file system size is greater than or equal to 3 but less than 512 megabytes, mke2fs(8) will use the file system type small. If the file system size is greater than or equal to 4 terabytes but less than 16 terabytes, mke2fs(8) will use the file system type big. If the file system size is greater than or equal to 16 terabytes, mke2fs(8) will use the file system type huge. Otherwise, mke2fs(8) will use the default file system type default. -U UUID Set the universally unique identifier (UUID) of the file system to UUID. The format of the UUID is a series of hex digits separated by hyphens, like this: "c1b9d5a2-f162-11cf-9ece-0020afc76f16". The UUID parameter may also be one of the following: clear clear the file system UUID random generate a new randomly-generated UUID time generate a new time-based UUID -v Verbose execution. -V Print the version number of mke2fs and exit. -z undo_file Before overwriting a file system block, write the old contents of the block to an undo file. This undo file can be used with e2undo(8) to restore the old contents of the file system should something go wrong. If the empty string is passed as the undo_file argument, the undo file will be written to a file named mke2fs-device.e2undo in the directory specified via the E2FSPROGS_UNDO_DIR environment variable or the undo_dir directive in the configuration file. WARNING: The undo file cannot be used to recover from a power or system crash. ENVIRONMENT top MKE2FS_SYNC If set to non-zero integer value, its value is used to determine how often sync(2) is called during inode table initialization. MKE2FS_CONFIG Determines the location of the configuration file (see mke2fs.conf(5)). MKE2FS_FIRST_META_BG If set to non-zero integer value, its value is used to determine first meta block group. This is mostly for debugging purposes. MKE2FS_DEVICE_SECTSIZE If set to non-zero integer value, its value is used to determine logical sector size of the device. MKE2FS_DEVICE_PHYS_SECTSIZE If set to non-zero integer value, its value is used to determine physical sector size of the device. MKE2FS_SKIP_CHECK_MSG If set, do not show the message of file system automatic check caused by mount count or check interval. AUTHOR top This version of mke2fs has been written by Theodore Ts'o <[email protected]>. AVAILABILITY top mke2fs is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net. SEE ALSO top mke2fs.conf(5), badblocks(8), dumpe2fs(8), e2fsck(8), tune2fs(8), ext4(5) COLOPHON top This page is part of the e2fsprogs (utilities for ext2/3/4 filesystems) project. Information about the project can be found at http://e2fsprogs.sourceforge.net/. It is not known how to report bugs for this man page; if you know, please send a mail to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-07.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] E2fsprogs version 1.47.0 February 2023 MKE2FS(8) Pages that refer to this page: crypttab(5), ext4(5), mke2fs.conf(5), badblocks(8), debugfs(8), dumpe2fs(8), e2fsck(8), e2label(8), e2undo(8), e4crypt(8), e4defrag(8), mke2fs(8), mkfs(8), mklost+found(8), mount(8), resize2fs(8), tune2fs(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mke2fs\n\n> Creates a Linux filesystem inside a partition.\n> More information: <https://manned.org/mke2fs>.\n\n- Create an ext2 filesystem in partition 1 of device b (`sdb1`):\n\n`mkfs.ext2 {{/dev/sdb1}}`\n\n- Create an ext3 filesystem in partition 1 of device b (`sdb1`):\n\n`mkfs.ext3 {{/dev/sdb1}}`\n\n- Create an ext4 filesystem in partition 1 of device b (`sdb1`):\n\n`mkfs.ext4 {{/dev/sdb1}}`\n
mkfifo
mkfifo(1) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mkfifo(1) Linux manual page NAME | SYNOPSIS | DESCRIPTION | AUTHOR | REPORTING BUGS | COPYRIGHT | SEE ALSO | COLOPHON MKFIFO(1) User Commands MKFIFO(1) NAME top mkfifo - make FIFOs (named pipes) SYNOPSIS top mkfifo [OPTION]... NAME... DESCRIPTION top Create named pipes (FIFOs) with the given NAMEs. Mandatory arguments to long options are mandatory for short options too. -m, --mode=MODE set file permission bits to MODE, not a=rw - umask -Z set the SELinux security context to default type --context[=CTX] like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX --help display this help and exit --version output version information and exit AUTHOR top Written by David MacKenzie. REPORTING BUGS top GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT top Copyright 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO top mkfifo(3) Full documentation <https://www.gnu.org/software/coreutils/mkfifo> or available locally via: info '(coreutils) mkfifo invocation' COLOPHON top This page is part of the coreutils (basic file, shell and text manipulation utilities) project. Information about the project can be found at http://www.gnu.org/software/coreutils/. If you have a bug report for this manual page, see http://www.gnu.org/software/coreutils/. This page was obtained from the tarball coreutils-9.4.tar.xz fetched from http://ftp.gnu.org/gnu/coreutils/ on 2023-12-22. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] GNU coreutils 9.4 August 2023 MKFIFO(1) Pages that refer to this page: mkfifo(3), fifo(7), pipe(7) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mkfifo\n\n> Makes FIFOs (named pipes).\n> More information: <https://www.gnu.org/software/coreutils/mkfifo>.\n\n- Create a named pipe at a given path:\n\n`mkfifo {{path/to/pipe}}`\n
mkfs
mkfs(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mkfs(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | BUGS | AUTHORS | SEE ALSO | REPORTING BUGS | AVAILABILITY MKFS(8) System Administration MKFS(8) NAME top mkfs - build a Linux filesystem SYNOPSIS top mkfs [options] [-t type] [fs-options] device [size] DESCRIPTION top This mkfs frontend is deprecated in favour of filesystem specific mkfs.<type> utils. mkfs is used to build a Linux filesystem on a device, usually a hard disk partition. The device argument is either the device name (e.g., /dev/hda1, /dev/sdb2), or a regular file that shall contain the filesystem. The size argument is the number of blocks to be used for the filesystem. The exit status returned by mkfs is 0 on success and 1 on failure. In actuality, mkfs is simply a front-end for the various filesystem builders (mkfs.fstype) available under Linux. The filesystem-specific builder is searched for via your PATH environment setting only. Please see the filesystem-specific builder manual pages for further details. OPTIONS top -t, --type type Specify the type of filesystem to be built. If not specified, the default filesystem type (currently ext2) is used. fs-options Filesystem-specific options to be passed to the real filesystem builder. -V, --verbose Produce verbose output, including all filesystem-specific commands that are executed. Specifying this option more than once inhibits execution of any filesystem-specific commands. This is really only useful for testing. -h, --help Display help text and exit. -V, --version Print version and exit. (Option -V will display version information only when it is the only parameter, otherwise it will work as --verbose.) BUGS top All generic options must precede and not be combined with filesystem-specific options. Some filesystem-specific programs do not automatically detect the device size and require the size parameter to be specified. AUTHORS top David Engel <[email protected]>, Fred N. van Kempen <[email protected]>, Ron Sommeling <[email protected]>. The manual page was shamelessly adapted from Remy Cards version for the ext2 filesystem. SEE ALSO top fs(5), badblocks(8), fsck(8), mkdosfs(8), mke2fs(8), mkfs.bfs(8), mkfs.ext2(8), mkfs.ext3(8), mkfs.ext4(8), mkfs.minix(8), mkfs.msdos(8), mkfs.vfat(8), mkfs.xfs(8) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The mkfs command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 MKFS(8) Pages that refer to this page: crypttab(5), filesystems(5), lvmvdo(7), fdisk(8), fsck(8@@e2fsprogs), fsck(8), fsck.minix(8), mkfs.bfs(8), mkfs.minix(8), parted(8), xfs_growfs(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mkfs\n\n> Build a Linux filesystem on a hard disk partition.\n> This command is deprecated in favor of filesystem specific mkfs.<type> utils.\n> More information: <https://manned.org/mkfs>.\n\n- Build a Linux ext2 filesystem on a partition:\n\n`mkfs {{path/to/partition}}`\n\n- Build a filesystem of a specified type:\n\n`mkfs -t {{ext4}} {{path/to/partition}}`\n\n- Build a filesystem of a specified type and check for bad blocks:\n\n`mkfs -c -t {{ntfs}} {{path/to/partition}}`\n
mkfs.btrfs
mkfs.btrfs(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mkfs.btrfs(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | SIZE UNITS | MULTIPLE DEVICES | FILESYSTEM FEATURES | RUNTIME FEATURES | BLOCK GROUPS, CHUNKS, RAID | PROFILES | DUP PROFILES ON A SINGLE DEVICE | KNOWN ISSUES | AVAILABILITY | SEE ALSO | COLOPHON MKFS.BTRFS(8) Btrfs Manual MKFS.BTRFS(8) NAME top mkfs.btrfs - create a btrfs filesystem SYNOPSIS top mkfs.btrfs [options] <device> [<device>...] DESCRIPTION top mkfs.btrfs is used to create the btrfs filesystem on a single or multiple devices. <device> is typically a block device but can be a file-backed image as well. Multiple devices are grouped by UUID of the filesystem. Before mounting such filesystem, the kernel module must know all the devices either via preceding execution of btrfs device scan or using the device mount option. See section MULTIPLE DEVICES for more details. The default block group profiles for data and metadata depend on number of devices and possibly other factors. Its recommended to use specific profiles but the defaults should be OK and allowing future conversions to other profiles. Please see options -d and -m for further detals and btrfs-balance(8) for the profile conversion post mkfs. OPTIONS top -b|--byte-count <size> Specify the size of the filesystem. If this option is not used, then mkfs.btrfs uses the entire device space for the filesystem. --csum <type>, --checksum <type> Specify the checksum algorithm. Default is crc32c. Valid values are crc32c, xxhash, sha256 or blake2. To mount such filesystem kernel must support the checksums as well. See CHECKSUM ALGORITHMS in btrfs(5). -d|--data <profile> Specify the profile for the data block groups. Valid values are raid0, raid1, raid1c3, raid1c4, raid5, raid6, raid10 or single or dup (case does not matter). See DUP PROFILES ON A SINGLE DEVICE for more details. On multiple devices, the default was raid0 until version 5.7, while it is single since version 5.8. You can still select raid0 manually, but it was not suitable as default. -m|--metadata <profile> Specify the profile for the metadata block groups. Valid values are raid0, raid1, raid1c3, raid1c4, raid5, raid6, raid10, single or dup (case does not matter). Default on a single device filesystem is DUP and is recommended for metadata in general. The duplication might not be necessary in some use cases and its up to the user to changed that at mkfs time or later. This depends on hardware that could potentially deduplicate the blocks again but this cannot be detected at mkfs time. NOTE Up to version 5.14 there was a detection of a SSD device (more precisely if its a rotational device, determined by the contents of file /sys/block/DEV/queue/rotational) that used to select single. This has changed in version 5.15 to be always dup. Note that the rotational status can be arbitrarily set by the underlying block device driver and may not reflect the true status (network block device, memory-backed SCSI devices, real block device behind some additional device mapper layer, etc). Its recommended to always set the options --data/--metadata to avoid confusion and unexpected results. See DUP PROFILES ON A SINGLE DEVICE for more details. On multiple devices the default is raid1. -M|--mixed Normally the data and metadata block groups are isolated. The mixed mode will remove the isolation and store both types in the same block group type. This helps to utilize the free space regardless of the purpose and is suitable for small devices. The separate allocation of block groups leads to a situation where the space is reserved for the other block group type, is not available for allocation and can lead to ENOSPC state. The recommended size for the mixed mode is for filesystems less than 1GiB. The soft recommendation is to use it for filesystems smaller than 5GiB. The mixed mode may lead to degraded performance on larger filesystems, but is otherwise usable, even on multiple devices. The nodesize and sectorsize must be equal, and the block group types must match. Note versions up to 4.2.x forced the mixed mode for devices smaller than 1GiB. This has been removed in 4.3+ as it caused some usability issues. -l|--leafsize <size> Alias for --nodesize. Deprecated. -n|--nodesize <size> Specify the nodesize, the tree block size in which btrfs stores metadata. The default value is 16KiB (16384) or the page size, whichever is bigger. Must be a multiple of the sectorsize and a power of 2, but not larger than 64KiB (65536). Leafsize always equals nodesize and the options are aliases. Smaller node size increases fragmentation but leads to taller b-trees which in turn leads to lower locking contention. Higher node sizes give better packing and less fragmentation at the cost of more expensive memory operations while updating the metadata blocks. Note versions up to 3.11 set the nodesize to 4k. -s|--sectorsize <size> Specify the sectorsize, the minimum data block allocation unit. The default value is the page size and is autodetected. If the sectorsize differs from the page size, the created filesystem may not be mountable by the running kernel. Therefore it is not recommended to use this option unless you are going to mount it on a system with the appropriate page size. -L|--label <string> Specify a label for the filesystem. The string should be less than 256 bytes and must not contain newline characters. -K|--nodiscard Do not perform whole device TRIM operation on devices that are capable of that. This does not affect discard/trim operation when the filesystem is mounted. Please see the mount option discard for that in btrfs(5). -r|--rootdir <rootdir> Populate the toplevel subvolume with files from rootdir. This does not require root permissions to write the new files or to mount the filesystem. Note This option may enlarge the image or file to ensure its big enough to contain the files from rootdir. Since version 4.14.1 the filesystem size is not minimized. Please see option --shrink if you need that functionality. --shrink Shrink the filesystem to its minimal size, only works with --rootdir option. If the destination block device is a regular file, this option will also truncate the file to the minimal size. Otherwise it will reduce the filesystem available space. Extra space will not be usable unless the filesystem is mounted and resized using btrfs filesystem resize. Note prior to version 4.14.1, the shrinking was done automatically. -O|--features <feature1>[,<feature2>...] A list of filesystem features turned on at mkfs time. Not all features are supported by old kernels. To disable a feature, prefix it with ^. See section FILESYSTEM FEATURES for more details. To see all available features that mkfs.btrfs supports run: mkfs.btrfs -O list-all -R|--runtime-features <feature1>[,<feature2>...] A list of features that be can enabled at mkfs time, otherwise would have to be turned on a mounted filesystem. Although no runtime feature is enabled by default, to disable a feature, prefix it with ^. See section RUNTIME FEATURES for more details. To see all available runtime features that mkfs.btrfs supports run: mkfs.btrfs -R list-all -f|--force Forcibly overwrite the block devices when an existing filesystem is detected. By default, mkfs.btrfs will utilize libblkid to check for any known filesystem on the devices. Alternatively you can use the wipefs utility to clear the devices. -q|--quiet Print only error or warning messages. Options --features or --help are unaffected. Resets any previous effects of --verbose. -U|--uuid <UUID> Create the filesystem with the given UUID. The UUID must not exist on any filesystem currently present. -v|--verbose Increase verbosity level, default is 1. -V|--version Print the mkfs.btrfs version and exit. --help Print help. SIZE UNITS top The default unit is byte. All size parameters accept suffixes in the 1024 base. The recognized suffixes are: k, m, g, t, p, e, both uppercase and lowercase. MULTIPLE DEVICES top Before mounting a multiple device filesystem, the kernel module must know the association of the block devices that are attached to the filesystem UUID. There is typically no action needed from the user. On a system that utilizes a udev-like daemon, any new block device is automatically registered. The rules call btrfs device scan. The same command can be used to trigger the device scanning if the btrfs kernel module is reloaded (naturally all previous information about the device registration is lost). Another possibility is to use the mount options device to specify the list of devices to scan at the time of mount. # mount -o device=/dev/sdb,device=/dev/sdc /dev/sda /mnt Note that this means only scanning, if the devices do not exist in the system, mount will fail anyway. This can happen on systems without initramfs/initrd and root partition created with RAID1/10/5/6 profiles. The mount action can happen before all block devices are discovered. The waiting is usually done on the initramfs/initrd systems. RAID5/6 has known problems and should not be used in production. FILESYSTEM FEATURES top Features that can be enabled during creation time. See also btrfs(5) section FILESYSTEM FEATURES. mixed-bg (kernel support since 2.6.37) mixed data and metadata block groups, also set by option --mixed extref (default since btrfs-progs 3.12, kernel support since 3.7) increased hardlink limit per file in a directory to 65536, older kernels supported a varying number of hardlinks depending on the sum of all file name sizes that can be stored into one metadata block raid56 (kernel support since 3.9) extended format for RAID5/6, also enabled if raid5 or raid6 block groups are selected skinny-metadata (default since btrfs-progs 3.18, kernel support since 3.10) reduced-size metadata for extent references, saves a few percent of metadata no-holes (default since btrfs-progs 5.15, kernel support since 3.14) improved representation of file extents where holes are not explicitly stored as an extent, saves a few percent of metadata if sparse files are used zoned (kernel support since 5.12) zoned mode, data allocation and write friendly to zoned/SMR/ZBC/ZNS devices, see ZONED MODE in btrfs(5), the mode is automatically selected when a zoned device is detected RUNTIME FEATURES top Features that are typically enabled on a mounted filesystem, eg. by a mount option or by an ioctl. Some of them can be enabled early, at mkfs time. This applies to features that need to be enabled once and then the status is permanent, this does not replace mount options. quota (kernel support since 3.4) Enable quota support (qgroups). The qgroup accounting will be consistent, can be used together with --rootdir. See also btrfs-quota(8). free-space-tree (default since btrfs-progs 5.15, kernel support since 4.5) Enable the free space tree (mount option space_cache=v2) for persisting the free space cache. BLOCK GROUPS, CHUNKS, RAID top The highlevel organizational units of a filesystem are block groups of three types: data, metadata and system. DATA store data blocks and nothing else METADATA store internal metadata in b-trees, can store file data if they fit into the inline limit SYSTEM store structures that describe the mapping between the physical devices and the linear logical space representing the filesystem Other terms commonly used: block group, chunk a logical range of space of a given profile, stores data, metadata or both; sometimes the terms are used interchangeably A typical size of metadata block group is 256MiB (filesystem smaller than 50GiB) and 1GiB (larger than 50GiB), for data its 1GiB. The system block group size is a few megabytes. RAID a block group profile type that utilizes RAID-like features on multiple devices: striping, mirroring, parity profile when used in connection with block groups refers to the allocation strategy and constraints, see the section PROFILES for more details PROFILES top There are the following block group types available: Profile Redundancy Space Min/max utilization devices Copies Parity Striping single 1 100% 1/any DUP 2 / 1 50% 1/any device ^(see note 1) RAID0 1 to N 100% 1/any ^(see note 5) RAID1 2 50% 2/any RAID1C3 3 33% 3/any RAID1C4 4 25% 4/any RAID10 2 1 to N 50% 2/any ^(see note 5) RAID5 1 1 2 to N-1 (N-1)/N 2/any ^(see note 2) RAID6 1 2 3 to N-2 (N-2)/N 3/any ^(see note 3) Warning Its not recommended to create filesystems with RAID0/1/10/5/6 profiles on partitions from the same device. Neither redundancy nor performance will be improved. Note 1: DUP may exist on more than 1 device if it starts on a single device and another one is added. Since version 4.5.1, mkfs.btrfs will let you create DUP on multiple devices without restrictions. Note 2: Its not recommended to use 2 devices with RAID5. In that case, parity stripe will contain the same data as the data stripe, making RAID5 degraded to RAID1 with more overhead. Note 3: Its also not recommended to use 3 devices with RAID6, unless you want to get effectively 3 copies in a RAID1-like manner (but not exactly that). Note 4: Since kernel 5.5 its possible to use RAID1C3 as replacement for RAID6, higher space cost but reliable. Note 5: Since kernel 5.15 its possible to use (mount, convert profiles) RAID0 on one device and RAID10 on two devices. PROFILE LAYOUT For the following examples, assume devices numbered by 1, 2, 3 and 4, data or metadata blocks A, B, C, D, with possible stripes eg. A1, A2 that would be logically A, etc. For parity profiles PA and QA are parity and syndrom, associated with the given stripe. The simple layouts single or DUP are left out. Actual physical block placement on devices depends on current state of the free/allocated space and may appear random. All devices are assumed to be present at the time of the blocks would have been written. RAID1 device 1 device 2 device 3 device 4 A D B C C D A B RAID1C3 device 1 device 2 device 3 device 4 A A D B B C A C D D C B RAID0 device 1 device 2 device 3 device 4 A2 C3 A3 C2 B1 A1 D2 B3 C1 D3 B4 D1 D4 B2 C4 A4 RAID5 device 1 device 2 device 3 device 4 A2 C3 A3 C2 B1 A1 D2 B3 C1 D3 PB D1 PD B2 PC PA RAID6 device 1 device 2 device 3 device 4 A2 QC QA C2 B1 A1 D2 QB C1 QD PB D1 PD B2 PC PA DUP PROFILES ON A SINGLE DEVICE top The mkfs utility will let the user create a filesystem with profiles that write the logical blocks to 2 physical locations. Whether there are really 2 physical copies highly depends on the underlying device type. For example, a SSD drive can remap the blocks internally to a single copythus deduplicating them. This negates the purpose of increased redundancy and just wastes filesystem space without providing the expected level of redundancy. The duplicated data/metadata may still be useful to statistically improve the chances on a device that might perform some internal optimizations. The actual details are not usually disclosed by vendors. For example we could expect that not all blocks get deduplicated. This will provide a non-zero probability of recovery compared to a zero chance if the single profile is used. The user should make the tradeoff decision. The deduplication in SSDs is thought to be widely available so the reason behind the mkfs default is to not give a false sense of redundancy. As another example, the widely used USB flash or SD cards use a translation layer between the logical and physical view of the device. The data lifetime may be affected by frequent plugging. The memory cells could get damaged, hopefully not destroying both copies of particular data in case of DUP. The wear levelling techniques can also lead to reduced redundancy, even if the device does not do any deduplication. The controllers may put data written in a short timespan into the same physical storage unit (cell, block etc). In case this unit dies, both copies are lost. BTRFS does not add any artificial delay between metadata writes. The traditional rotational hard drives usually fail at the sector level. In any case, a device that starts to misbehave and repairs from the DUP copy should be replaced! DUP is not backup. KNOWN ISSUES top SMALL FILESYSTEMS AND LARGE NODESIZE The combination of small filesystem size and large nodesize is not recommended in general and can lead to various ENOSPC-related issues during mount time or runtime. Since mixed block group creation is optional, we allow small filesystem instances with differing values for sectorsize and nodesize to be created and could end up in the following situation: # mkfs.btrfs -f -n 65536 /dev/loop0 btrfs-progs v3.19-rc2-405-g976307c See http://btrfs.wiki.kernel.org for more information. Performing full device TRIM (512.00MiB) ... Label: (null) UUID: 49fab72e-0c8b-466b-a3ca-d1bfe56475f0 Node size: 65536 Sector size: 4096 Filesystem size: 512.00MiB Block group profiles: Data: single 8.00MiB Metadata: DUP 40.00MiB System: DUP 12.00MiB SSD detected: no Incompat features: extref, skinny-metadata Number of devices: 1 Devices: ID SIZE PATH 1 512.00MiB /dev/loop0 # mount /dev/loop0 /mnt/ mount: mount /dev/loop0 on /mnt failed: No space left on device The ENOSPC occurs during the creation of the UUID tree. This is caused by large metadata blocks and space reservation strategy that allocates more than can fit into the filesystem. AVAILABILITY top mkfs.btrfs is part of btrfs-progs. Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for further details. SEE ALSO top btrfs(5), btrfs(8), btrfs-balance(8), wipefs(8) COLOPHON top This page is part of the btrfs-progs (btrfs filesystem tools) project. Information about the project can be found at https://btrfs.wiki.kernel.org/index.php/Btrfs_source_repositories. If you have a bug report for this manual page, see https://btrfs.wiki.kernel.org/index.php/Problem_FAQ#How_do_I_report_bugs_and_issues.3F. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Btrfs v5.16.1 02/06/2022 MKFS.BTRFS(8) Pages that refer to this page: btrfs(8), btrfs-balance(8), btrfs-check(8), btrfs-convert(8), btrfs-device(8), btrfs-filesystem(8), btrfs-find-root(8), btrfs-image(8), btrfs-inspect-internal(8), btrfs-map-logical(8), btrfs-property(8), btrfs-qgroup(8), btrfs-quota(8), btrfs-receive(8), btrfs-replace(8), btrfs-rescue(8), btrfs-restore(8), btrfs-scrub(8), btrfs-send(8), btrfs-subvolume(8), btrfstune(8), [email protected](8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mkfs.btrfs\n\n> Create a BTRFS filesystem.\n> Defaults to `raid1`, which specifies 2 copies of a data block spread across 2 different devices.\n> More information: <https://btrfs.readthedocs.io/en/latest/mkfs.btrfs.html>.\n\n- Create a btrfs filesystem on a single device:\n\n`sudo mkfs.btrfs --metadata single --data single {{/dev/sda}}`\n\n- Create a btrfs filesystem on multiple devices with raid1:\n\n`sudo mkfs.btrfs --metadata raid1 --data raid1 {{/dev/sda}} {{/dev/sdb}} {{/dev/sdN}}`\n\n- Set a label for the filesystem:\n\n`sudo mkfs.btrfs --label "{{label}}" {{/dev/sda}} [{{/dev/sdN}}]`\n
mkfs.cramfs
mkfs.cramfs(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mkfs.cramfs(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | ARGUMENTS | OPTIONS | EXIT STATUS | SEE ALSO | REPORTING BUGS | AVAILABILITY MKFS.CRAMFS(8) System Administration MKFS.CRAMFS(8) NAME top mkfs.cramfs - make compressed ROM file system SYNOPSIS top mkfs.cramfs [options] directory file DESCRIPTION top Files on cramfs file systems are zlib-compressed one page at a time to allow random read access. The metadata is not compressed, but is expressed in a terse representation that is more space-efficient than conventional file systems. The file system is intentionally read-only to simplify its design; random write access for compressed files is difficult to implement. cramfs ships with a utility (mkcramfs(8)) to pack files into new cramfs images. File sizes are limited to less than 16 MB. Maximum file system size is a little under 272 MB. (The last file on the file system must begin before the 256 MB block, but can extend past it.) ARGUMENTS top The directory is simply the root of the directory tree that we want to generate a compressed filesystem out of. The file will contain the cram file system, which later can be mounted. OPTIONS top -v Enable verbose messaging. -E Treat all warnings as errors, which are reflected as command exit status. -b blocksize Use defined block size, which has to be divisible by page size. -e edition Use defined file system edition number in superblock. -N big, little, host Use defined endianness. Value defaults to host. -i file Insert a file to cramfs file system. -n name Set name of the cramfs file system. -p Pad by 512 bytes for boot code. -s This option is ignored. Originally the -s turned on directory entry sorting. -z Make explicit holes. -l[=mode] Use exclusive BSD lock for device or file it operates. The optional argument mode can be yes, no (or 1 and 0) or nonblock. If the mode argument is omitted, it defaults to "yes". This option overwrites environment variable $LOCK_BLOCK_DEVICE. The default is not to use any lock at all, but its recommended to avoid collisions with udevd or other tools. -h, --help Display help text and exit. -V, --version Print version and exit. EXIT STATUS top 0 success 8 operation error, such as unable to allocate memory SEE ALSO top fsck.cramfs(8), mount(8) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The mkfs.cramfs command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 MKFS.CRAMFS(8) Pages that refer to this page: fsck.cramfs(8), [email protected](8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mkfs.cramfs\n\n> Creates a ROM filesystem inside a partition.\n> More information: <https://manned.org/mkfs.cramfs>.\n\n- Create a ROM filesystem inside partition 1 on device b (`sdb1`):\n\n`mkfs.cramfs {{/dev/sdb1}}`\n\n- Create a ROM filesystem with a volume-name:\n\n`mkfs.cramfs -n {{volume_name}} {{/dev/sdb1}}`\n
mkfs.fat
mkfs.fat(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mkfs.fat(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | BUGS | SEE ALSO | HOMEPAGE | AUTHORS | COLOPHON MKFS.FAT(8) System Manager's Manual MKFS.FAT(8) NAME top mkfs.fat - create an MS-DOS FAT filesystem SYNOPSIS top mkfs.fat [OPTIONS] DEVICE [BLOCK-COUNT] DESCRIPTION top mkfs.fat is used to create a FAT filesystem on a device or in an image file. DEVICE is the special file corresponding to the device (e.g. /dev/sdXX) or the image file (which does not need to exist when the option -C is given). BLOCK-COUNT is the number of blocks on the device and size of one block is always 1024 bytes, independently of the sector size or the cluster size. Therefore BLOCK-COUNT specifies size of filesystem in KiB unit and not in the number of sectors (like for all other mkfs.fat options). If omitted, mkfs.fat automatically chooses a filesystem size to fill the available space. Two different variants of the FAT filesystem are supported. Standard is the FAT12, FAT16 and FAT32 filesystems as defined by Microsoft and widely used on hard disks and removable media like USB sticks and SD cards. The other is the legacy Atari variant used on Atari ST. In Atari mode, if not directed otherwise by the user, mkfs.fat will always use 2 sectors per cluster, since GEMDOS doesn't like other values very much. It will also obey the maximum number of sectors GEMDOS can handle. Larger filesystems are managed by raising the logical sector size. An Atari-compatible serial number for the filesystem is generated, and a 12 bit FAT is used only for filesystems that have one of the usual floppy sizes (720k, 1.2M, 1.44M, 2.88M), a 16 bit FAT otherwise. This can be overridden with the -F option. Some PC-specific boot sector fields aren't written, and a boot message (option -m) is ignored. OPTIONS top -a Normally, for any filesystem except very small ones, mkfs.fat will align all the data structures to cluster size, to make sure that as long as the partition is properly aligned, so will all the data structures in the filesystem. This option disables alignment; this may provide a handful of additional clusters of storage at the expense of a significant performance degradation on RAIDs, flash media or large-sector hard disks. -A Select using the Atari variation of the FAT filesystem if that isn't active already, otherwise select standard FAT filesystem. This is selected by default if mkfs.fat is run on 68k Atari Linux. -b SECTOR-OF-BACKUP Selects the location of the backup boot sector for FAT32. Default depends on number of reserved sectors, but usually is sector 6. If there is a free space available after the backup boot sector then backup of the FAT32 info sector is put after the backup boot sector, usually at sector 7. The backup must be within the range of reserved sectors. Value 0 completely disables creating of backup boot and info FAT32 sectors. -c Check the device for bad blocks before creating the filesystem. -C Create the file given as DEVICE on the command line, and write the to-be-created filesystem to it. This can be used to create the new filesystem in a file instead of on a real device, and to avoid using dd in advance to create a file of appropriate size. With this option, the BLOCK-COUNT must be given, because otherwise the intended size of the filesystem wouldn't be known. The file created is a sparse file, which actually only contains the meta-data areas (boot sector, FATs, and root directory). The data portions won't be stored on the disk, but the file nevertheless will have the correct size. The resulting file can be copied later to a floppy disk or other device, or mounted through a loop device. -D DRIVE-NUMBER Specify the BIOS drive number to be stored in the FAT boot sector. For hard disks and removable media it is usually 0x800xFF (0x80 is first hard disk C:, 0x81 is second hard disk D:, ...), for floppy devices or partitions to be used for floppy emulation it is 0x000x7F (0x00 is first floppy A:, 0x01 is second floppy B:). -f NUMBER-OF-FATS Specify the number of file allocation tables in the filesystem. The default is 2. -F FAT-SIZE Specifies the type of file allocation tables used (12, 16 or 32 bit). If nothing is specified, mkfs.fat will automatically select between 12, 16 and 32 bit, whatever fits better for the filesystem size. -g HEADS/SECTORS-PER-TRACK Specify HEADS and SECTORS-PER-TRACK numbers which represents disk geometry of DEVICE. Both numbers are stored into the FAT boot sector. Number SECTORS-PER-TRACK is used also for aligning the total count of FAT sectors. By default disk geometry is read from DEVICE itself. If it is not available then LBA-Assist Translation and translation table from the SD Card Part 2 File System Specification based on total number of disk sectors is used. -h NUMBER-OF-HIDDEN-SECTORS Specify the number of so-called hidden sectors, as stored in the FAT boot sector: this number represents the beginning sector of the partition containing the file system. Normally this is an offset (in sectors) relative to the start of the disk, although for MBR logical volumes contained in an extended partition of type 0x05 (a non-LBA extended partition), a quirk in the MS-DOS implementation of FAT requires it to be relative to the partition's immediate containing Extended Boot Record. Boot code and other software handling FAT volumes may also rely on this field being set up correctly; most modern FAT implementations will ignore it. By default, if the DEVICE is a partition block device, mkfs.fat uses the partition offset relative to disk start. Otherwise, mkfs.fat assumes zero. Use this option to override this behaviour. -i VOLUME-ID Sets the volume ID of the newly created filesystem; VOLUME-ID is a 32-bit hexadecimal number (for example, 2e24ec82). The default is a number which depends on the filesystem creation time. -I Ignore and disable safety checks. By default mkfs.fat refuses to create a filesystem on a device with partitions or virtual mapping. mkfs.fat will complain and tell you that it refuses to work. This is different when using MO disks. One doesn't always need partitions on MO disks. The filesystem can go directly to the whole disk. Under other OSes this is known as the superfloppy format. This switch will force mkfs.fat to work properly. -l FILENAME Read the bad blocks list from FILENAME. -m MESSAGE-FILE Sets the message the user receives on attempts to boot this filesystem without having properly installed an operating system. The message file must not exceed 418 bytes once line feeds have been converted to carriage return-line feed combinations, and tabs have been expanded. If the filename is a hyphen (-), the text is taken from standard input. -M FAT-MEDIA-TYPE Specify the media type to be stored in the FAT boot sector. This value is usually 0xF8 for hard disks and is 0xF0 or a value from 0xF9 to 0xFF for floppies or partitions to be used for floppy emulation. --mbr[=y|yes|n|no|a|auto] Fill (fake) MBR table with disk signature one partition which starts at sector 0 (includes MBR itself) and spans whole disk device. It is needed only for non-removable disks used on Microsoft Windows systems and only when formatting whole unpartitioned disk. Location of the disk signature and partition table overlaps with the end of the first FAT sector (boot code location), therefore there is no additional space usage. Default is auto mode in which mkfs.fat put MBR table only for non-removable disks when formatting whole unpartitioned disk. -n VOLUME-NAME Sets the volume name (label) of the filesystem. The volume name can be up to 11 characters long. Supplying an empty string, a string consisting only of white space or the string "NO NAME" as VOLUME-NAME has the same effect as not giving the -n option. The default is no label. --codepage=PAGE Use DOS codepage PAGE to encode label. By default codepage 850 is used. -r ROOT-DIR-ENTRIES Select the minimal number of entries available in the root directory. The default is 112 or 224 for floppies and 512 for hard disks. Note that this is minimal number and it may be increased by mkfs.fat due to alignment of structures. See also mkfs.fat option -a. -R NUMBER-OF-RESERVED-SECTORS Select the minimal number of reserved sectors. With FAT32 format at least 2 reserved sectors are needed, the default is 32. Otherwise the default is 1 (only the boot sector). Note that this is minimal number and it may be increased by mkfs.fat due to alignment of structures. See also mkfs.fat option -a. -s SECTORS-PER-CLUSTER Specify the number of disk sectors per cluster. Must be a power of 2, i.e. 1, 2, 4, 8, ... 128. -S SECTOR-SIZE Specify the number of bytes per filesystem sector. Must be a power of 2 and greater than or equal to 512, i.e. 512, 1024, 2048, 4096, 8192, 16384, or 32768. Values larger than 4096 are not conforming to the FAT filesystem specification and may not work everywhere. Some operating systems have requirement that filesystem sector size must match logical disk device sector size. So default value is logical disk sector size. -v Verbose execution. --offset SECTOR Write the filesystem at a specific sector into the device file. This is useful for creating a filesystem in a partitioned disk image without having to set up a loop device. --variant TYPE Create a filesystem of variant TYPE. Acceptable values are standard and atari (in any combination of upper/lower case). See above under DESCRIPTION for the differences. --help Display option summary and exit. --invariant Use constants for normally randomly generated or time based data such as volume ID and creation time. Multiple runs of mkfs.fat on the same device create identical results with this option. Its main purpose is testing mkfs.fat. BUGS top mkfs.fat can not create boot-able filesystems. This isn't as easy as you might think at first glance for various reasons and has been discussed a lot already. mkfs.fat simply will not support it ;) SEE ALSO top fatlabel(8), fsck.fat(8) HOMEPAGE top The home for the dosfstools project is its GitHub project page https://github.com/dosfstools/dosfstools. AUTHORS top dosfstools were written by Werner Almesberger [email protected], Roman Hodek Roman.Hodek@ informatik.uni-erlangen.de, and others. Current maintainers are Andreas Bombe [email protected] and Pali Rohr pali.rohar@ gmail.com. COLOPHON top This page is part of the dosfstools (Tools for making and checking MS-DOS FAT filesystems) project. Information about the project can be found at https://github.com/dosfstools/dosfstools. If you have a bug report for this manual page, see https://github.com/dosfstools/dosfstools/issues. This page was obtained from the project's upstream Git repository https://github.com/dosfstools/dosfstools.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-10.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] dosfstools 4.2+git 2021-01-31 MKFS.FAT(8) Pages that refer to this page: dosfsck(8), dosfslabel(8), fatlabel(8), fsck.fat(8), fsck.msdos(8), fsck.vfat(8), [email protected](8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mkfs.fat\n\n> Creates an MS-DOS filesystem inside a partition.\n> More information: <https://manned.org/mkfs.fat>.\n\n- Create a fat filesystem inside partition 1 on device b (`sdb1`):\n\n`mkfs.fat {{/dev/sdb1}}`\n\n- Create filesystem with a volume-name:\n\n`mkfs.fat -n {{volume_name}} {{/dev/sdb1}}`\n\n- Create filesystem with a volume-id:\n\n`mkfs.fat -i {{volume_id}} {{/dev/sdb1}}`\n\n- Use 5 instead of 2 file allocation tables:\n\n`mkfs.fat -f 5 {{/dev/sdb1}}`\n
mkfs.minix
mkfs.minix(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mkfs.minix(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | ENVIRONMENT | EXIT STATUS | SEE ALSO | REPORTING BUGS | AVAILABILITY MKFS.MINIX(8) System Administration MKFS.MINIX(8) NAME top mkfs.minix - make a Minix filesystem SYNOPSIS top mkfs.minix [options] device [size-in-blocks] DESCRIPTION top mkfs.minix creates a Linux MINIX filesystem on a device (usually a disk partition). The device is usually of the following form: /dev/hda[1-8] (IDE disk 1) /dev/hdb[1-8] (IDE disk 2) /dev/sda[1-8] (SCSI disk 1) /dev/sdb[1-8] (SCSI disk 2) The device may be a block device or an image file of one, but this is not enforced. Expect not much fun on a character device :-). The size-in-blocks parameter is the desired size of the file system, in blocks. It is present only for backwards compatibility. If omitted the size will be determined automatically. Only block counts strictly greater than 10 and strictly less than 65536 are allowed. OPTIONS top -c, --check Check the device for bad blocks before creating the filesystem. If any are found, the count is printed. -n, --namelength length Specify the maximum length of filenames. Currently, the only allowable values are 14 and 30 for file system versions 1 and 2. Version 3 allows only value 60. The default is 30. --lock[=mode] Use exclusive BSD lock for device or file it operates. The optional argument mode can be yes, no (or 1 and 0) or nonblock. If the mode argument is omitted, it defaults to yes. This option overwrites environment variable $LOCK_BLOCK_DEVICE. The default is not to use any lock at all, but its recommended to avoid collisions with systemd-udevd(8) or other tools. -i, --inodes number Specify the number of inodes for the filesystem. -l, --badblocks filename Read the list of bad blocks from filename. The file has one bad-block number per line. The count of bad blocks read is printed. -1 Make a Minix version 1 filesystem. This is the default. -2, -v Make a Minix version 2 filesystem. -3 Make a Minix version 3 filesystem. -h, --help Display help text and exit. -V, --version Print version and exit. The long option cannot be combined with other options. ENVIRONMENT top LOCK_BLOCK_DEVICE=<mode> use exclusive BSD lock. The mode is "1" or "0". See --lock for more details. EXIT STATUS top The exit status returned by mkfs.minix is one of the following: 0 No errors 8 Operational error 16 Usage or syntax error SEE ALSO top fsck(8), mkfs(8), reboot(8) REPORTING BUGS top For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY top The mkfs.minix command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. This page is part of the util-linux (a random collection of Linux utilities) project. Information about the project can be found at https://www.kernel.org/pub/linux/utils/util-linux/. If you have a bug report for this manual page, send it to [email protected]. This page was obtained from the project's upstream Git repository git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-14.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] util-linux 2.39.594-1e0ad 2023-07-19 MKFS.MINIX(8) Pages that refer to this page: fsck.minix(8), mkfs(8), [email protected](8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mkfs.minix\n\n> Creates a Minix filesystem inside a partition.\n> More information: <https://manned.org/mkfs.minix>.\n\n- Create a Minix filesystem inside partition 1 on device b (`sdb1`):\n\n`mkfs.minix {{/dev/sdb1}}`\n
mkfs.vfat
mkfs.vfat(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mkfs.vfat(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | OPTIONS | BUGS | SEE ALSO | HOMEPAGE | AUTHORS | COLOPHON MKFS.FAT(8) System Manager's Manual MKFS.FAT(8) NAME top mkfs.fat - create an MS-DOS FAT filesystem SYNOPSIS top mkfs.fat [OPTIONS] DEVICE [BLOCK-COUNT] DESCRIPTION top mkfs.fat is used to create a FAT filesystem on a device or in an image file. DEVICE is the special file corresponding to the device (e.g. /dev/sdXX) or the image file (which does not need to exist when the option -C is given). BLOCK-COUNT is the number of blocks on the device and size of one block is always 1024 bytes, independently of the sector size or the cluster size. Therefore BLOCK-COUNT specifies size of filesystem in KiB unit and not in the number of sectors (like for all other mkfs.fat options). If omitted, mkfs.fat automatically chooses a filesystem size to fill the available space. Two different variants of the FAT filesystem are supported. Standard is the FAT12, FAT16 and FAT32 filesystems as defined by Microsoft and widely used on hard disks and removable media like USB sticks and SD cards. The other is the legacy Atari variant used on Atari ST. In Atari mode, if not directed otherwise by the user, mkfs.fat will always use 2 sectors per cluster, since GEMDOS doesn't like other values very much. It will also obey the maximum number of sectors GEMDOS can handle. Larger filesystems are managed by raising the logical sector size. An Atari-compatible serial number for the filesystem is generated, and a 12 bit FAT is used only for filesystems that have one of the usual floppy sizes (720k, 1.2M, 1.44M, 2.88M), a 16 bit FAT otherwise. This can be overridden with the -F option. Some PC-specific boot sector fields aren't written, and a boot message (option -m) is ignored. OPTIONS top -a Normally, for any filesystem except very small ones, mkfs.fat will align all the data structures to cluster size, to make sure that as long as the partition is properly aligned, so will all the data structures in the filesystem. This option disables alignment; this may provide a handful of additional clusters of storage at the expense of a significant performance degradation on RAIDs, flash media or large-sector hard disks. -A Select using the Atari variation of the FAT filesystem if that isn't active already, otherwise select standard FAT filesystem. This is selected by default if mkfs.fat is run on 68k Atari Linux. -b SECTOR-OF-BACKUP Selects the location of the backup boot sector for FAT32. Default depends on number of reserved sectors, but usually is sector 6. If there is a free space available after the backup boot sector then backup of the FAT32 info sector is put after the backup boot sector, usually at sector 7. The backup must be within the range of reserved sectors. Value 0 completely disables creating of backup boot and info FAT32 sectors. -c Check the device for bad blocks before creating the filesystem. -C Create the file given as DEVICE on the command line, and write the to-be-created filesystem to it. This can be used to create the new filesystem in a file instead of on a real device, and to avoid using dd in advance to create a file of appropriate size. With this option, the BLOCK-COUNT must be given, because otherwise the intended size of the filesystem wouldn't be known. The file created is a sparse file, which actually only contains the meta-data areas (boot sector, FATs, and root directory). The data portions won't be stored on the disk, but the file nevertheless will have the correct size. The resulting file can be copied later to a floppy disk or other device, or mounted through a loop device. -D DRIVE-NUMBER Specify the BIOS drive number to be stored in the FAT boot sector. For hard disks and removable media it is usually 0x800xFF (0x80 is first hard disk C:, 0x81 is second hard disk D:, ...), for floppy devices or partitions to be used for floppy emulation it is 0x000x7F (0x00 is first floppy A:, 0x01 is second floppy B:). -f NUMBER-OF-FATS Specify the number of file allocation tables in the filesystem. The default is 2. -F FAT-SIZE Specifies the type of file allocation tables used (12, 16 or 32 bit). If nothing is specified, mkfs.fat will automatically select between 12, 16 and 32 bit, whatever fits better for the filesystem size. -g HEADS/SECTORS-PER-TRACK Specify HEADS and SECTORS-PER-TRACK numbers which represents disk geometry of DEVICE. Both numbers are stored into the FAT boot sector. Number SECTORS-PER-TRACK is used also for aligning the total count of FAT sectors. By default disk geometry is read from DEVICE itself. If it is not available then LBA-Assist Translation and translation table from the SD Card Part 2 File System Specification based on total number of disk sectors is used. -h NUMBER-OF-HIDDEN-SECTORS Specify the number of so-called hidden sectors, as stored in the FAT boot sector: this number represents the beginning sector of the partition containing the file system. Normally this is an offset (in sectors) relative to the start of the disk, although for MBR logical volumes contained in an extended partition of type 0x05 (a non-LBA extended partition), a quirk in the MS-DOS implementation of FAT requires it to be relative to the partition's immediate containing Extended Boot Record. Boot code and other software handling FAT volumes may also rely on this field being set up correctly; most modern FAT implementations will ignore it. By default, if the DEVICE is a partition block device, mkfs.fat uses the partition offset relative to disk start. Otherwise, mkfs.fat assumes zero. Use this option to override this behaviour. -i VOLUME-ID Sets the volume ID of the newly created filesystem; VOLUME-ID is a 32-bit hexadecimal number (for example, 2e24ec82). The default is a number which depends on the filesystem creation time. -I Ignore and disable safety checks. By default mkfs.fat refuses to create a filesystem on a device with partitions or virtual mapping. mkfs.fat will complain and tell you that it refuses to work. This is different when using MO disks. One doesn't always need partitions on MO disks. The filesystem can go directly to the whole disk. Under other OSes this is known as the superfloppy format. This switch will force mkfs.fat to work properly. -l FILENAME Read the bad blocks list from FILENAME. -m MESSAGE-FILE Sets the message the user receives on attempts to boot this filesystem without having properly installed an operating system. The message file must not exceed 418 bytes once line feeds have been converted to carriage return-line feed combinations, and tabs have been expanded. If the filename is a hyphen (-), the text is taken from standard input. -M FAT-MEDIA-TYPE Specify the media type to be stored in the FAT boot sector. This value is usually 0xF8 for hard disks and is 0xF0 or a value from 0xF9 to 0xFF for floppies or partitions to be used for floppy emulation. --mbr[=y|yes|n|no|a|auto] Fill (fake) MBR table with disk signature one partition which starts at sector 0 (includes MBR itself) and spans whole disk device. It is needed only for non-removable disks used on Microsoft Windows systems and only when formatting whole unpartitioned disk. Location of the disk signature and partition table overlaps with the end of the first FAT sector (boot code location), therefore there is no additional space usage. Default is auto mode in which mkfs.fat put MBR table only for non-removable disks when formatting whole unpartitioned disk. -n VOLUME-NAME Sets the volume name (label) of the filesystem. The volume name can be up to 11 characters long. Supplying an empty string, a string consisting only of white space or the string "NO NAME" as VOLUME-NAME has the same effect as not giving the -n option. The default is no label. --codepage=PAGE Use DOS codepage PAGE to encode label. By default codepage 850 is used. -r ROOT-DIR-ENTRIES Select the minimal number of entries available in the root directory. The default is 112 or 224 for floppies and 512 for hard disks. Note that this is minimal number and it may be increased by mkfs.fat due to alignment of structures. See also mkfs.fat option -a. -R NUMBER-OF-RESERVED-SECTORS Select the minimal number of reserved sectors. With FAT32 format at least 2 reserved sectors are needed, the default is 32. Otherwise the default is 1 (only the boot sector). Note that this is minimal number and it may be increased by mkfs.fat due to alignment of structures. See also mkfs.fat option -a. -s SECTORS-PER-CLUSTER Specify the number of disk sectors per cluster. Must be a power of 2, i.e. 1, 2, 4, 8, ... 128. -S SECTOR-SIZE Specify the number of bytes per filesystem sector. Must be a power of 2 and greater than or equal to 512, i.e. 512, 1024, 2048, 4096, 8192, 16384, or 32768. Values larger than 4096 are not conforming to the FAT filesystem specification and may not work everywhere. Some operating systems have requirement that filesystem sector size must match logical disk device sector size. So default value is logical disk sector size. -v Verbose execution. --offset SECTOR Write the filesystem at a specific sector into the device file. This is useful for creating a filesystem in a partitioned disk image without having to set up a loop device. --variant TYPE Create a filesystem of variant TYPE. Acceptable values are standard and atari (in any combination of upper/lower case). See above under DESCRIPTION for the differences. --help Display option summary and exit. --invariant Use constants for normally randomly generated or time based data such as volume ID and creation time. Multiple runs of mkfs.fat on the same device create identical results with this option. Its main purpose is testing mkfs.fat. BUGS top mkfs.fat can not create boot-able filesystems. This isn't as easy as you might think at first glance for various reasons and has been discussed a lot already. mkfs.fat simply will not support it ;) SEE ALSO top fatlabel(8), fsck.fat(8) HOMEPAGE top The home for the dosfstools project is its GitHub project page https://github.com/dosfstools/dosfstools. AUTHORS top dosfstools were written by Werner Almesberger [email protected], Roman Hodek Roman.Hodek@ informatik.uni-erlangen.de, and others. Current maintainers are Andreas Bombe [email protected] and Pali Rohr pali.rohar@ gmail.com. COLOPHON top This page is part of the dosfstools (Tools for making and checking MS-DOS FAT filesystems) project. Information about the project can be found at https://github.com/dosfstools/dosfstools. If you have a bug report for this manual page, see https://github.com/dosfstools/dosfstools/issues. This page was obtained from the project's upstream Git repository https://github.com/dosfstools/dosfstools.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-10-10.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] dosfstools 4.2+git 2021-01-31 MKFS.FAT(8) Pages that refer to this page: mkfs(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mkfs.vfat\n\n> Creates an MS-DOS filesystem inside a partition.\n> More information: <https://manned.org/mkfs.vfat>.\n\n- Create a vfat filesystem inside partition 1 on device b (`sdb1`):\n\n`mkfs.vfat {{/dev/sdb1}}`\n\n- Create filesystem with a volume-name:\n\n`mkfs.vfat -n {{volume_name}} {{/dev/sdb1}}`\n\n- Create filesystem with a volume-id:\n\n`mkfs.vfat -i {{volume_id}} {{/dev/sdb1}}`\n\n- Use 5 instead of 2 file allocation tables:\n\n`mkfs.vfat -f 5 {{/dev/sdb1}}`\n
mkhomedir_helper
mkhomedir_helper(8) - Linux manual page man7.org > Linux > man-pages Linux/UNIX system programming training mkhomedir_helper(8) Linux manual page NAME | SYNOPSIS | DESCRIPTION | SEE ALSO | AUTHOR | COLOPHON MKHOMEDIR_HELPER(8) Linux-PAM Manual MKHOMEDIR_HELPER(8) NAME top mkhomedir_helper - Helper binary that creates home directories SYNOPSIS top mkhomedir_helper {user} [umask [ path-to-skel [ home_mode ] ]] DESCRIPTION top mkhomedir_helper is a helper program for the pam_mkhomedir module that creates home directories and populates them with contents of the specified skel directory. The default value of umask is 0022 and the default value of path-to-skel is /etc/skel. The default value of home_mode is computed from the value of umask. The helper is separated from the module to not require direct access from login SELinux domains to the contents of user home directories. The SELinux domain transition happens when the module is executing the mkhomedir_helper. The helper never touches home directories if they already exist. SEE ALSO top pam_mkhomedir(8) AUTHOR top Written by Tomas Mraz based on the code originally in pam_mkhomedir module. COLOPHON top This page is part of the linux-pam (Pluggable Authentication Modules for Linux) project. Information about the project can be found at http://www.linux-pam.org/. If you have a bug report for this manual page, see //www.linux-pam.org/. This page was obtained from the project's upstream Git repository https://github.com/linux-pam/linux-pam.git on 2023-12-22. (At that time, the date of the most recent commit that was found in the repository was 2023-12-18.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to [email protected] Linux-PAM Manual 12/22/2023 MKHOMEDIR_HELPER(8) HTML rendering created 2023-12-22 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.
# mkhomedir_helper\n\n> Create the user's home directory after creating the user.\n> More information: <https://manned.org/mkhomedir_helper>.\n\n- Create a home directory for a user based on `/etc/skel` with umask 022:\n\n`sudo mkhomedir_helper {{username}}`\n\n- Create a home directory for a user based on `/etc/skel` with all permissions for owner (0) and read permission for group (3):\n\n`sudo mkhomedir_helper {{username}} {{037}}`\n\n- Create a home directory for a user based on a custom skeleton:\n\n`sudo mkhomedir_helper {{username}} {{umask}} {{path/to/skeleton_directory}}`\n