NAME lstat -- show the results of lstat(2) SYNOPSIS lstat [ options ] file [ ... ] BRIEF DESCRIPTION lstat calls lstat(2) on each file specified and prints the contents of the stat struct. By default, all values are shown in base 10; this can be changed, to either a different base or a symbolic representation (where appropriate), by using a modifier as described below. OPTIONS -F str quote the filename using "str"; implies -f -f quote the filename -h show the default list of members (plus type and perm) with mode, type, perm, uid, gid, atime, mtime, and ctime shown in either an alternate base or symbolically; overrides -o but may be used with -O -L str quote the symbolic link target using "str"; implies -l -l quote the symbolic link target -m show the default list of member names then exit -M show the list of members produced by "-h" then exit -N str if "link" is specified in the list of members but the file is not a symbolic link, show "str" for the link target (default is "//") -O str a comma-separated list of members to be appended to the default list of members; can be used with -o or -h -o str a comma-separated list of members to be displayed -s str see "Separators" (below) -v show the version number then exit FULL DESCRIPTION lstat allows the user to specify the files to be reported on, the members of the stat struct to be shown, the format of the output, and the format of the input list of members. Member names are the same as in the stat struct but without the leading "st_". Not all members of the stat struct are supported on every architecture; the following members should always be available: dev, ino, mode, nlink, uid, gid, size, atime, mtime, and ctime. The default output shows the preceeding list of members, in the order specified, with values separated by semicolons (";"); the name of the file is then shown, separated by a space. The -O flag appends user-specified members to the preceeding list. Several "synthetic" member names are also available: perm the file permissions (the low-order portion of "mode") type the file type (the high-order portion of "mode") link if the file is a symbolic link, the target; if the file is not a symlink, the string "//"; the -? flag can be used to specify an alternate string By default, all members are shown in base 10; this can be changed by specifying the member name, followed by a colon and a base (2 - 16) or one of the following letters: b binary o octal x hexadecimal (lower case letters) X hexadecimal (upper case letters) For atime, ctime, and mtime, the following letters are also recognized: d YYYY-MM-DD D YYYYMMDD t YYYY-MM-DD-hh-mm-ss T YYYYMMDDhhmmss z YYYY-MM-DD.hh:mm:ss Z YYYYMMDD.hhmmss For gid, perm, type, and uid the modifier "s" may be used to show the member in "symbolic" form. For gid and uid, this will be the name of the group or user; for perm, the output will be a comma- separated string in the form understood by chmod(1); for type, the output will be the same letter as the first character of the output from "ls -l" except that "f" will be used for plain files (ls would show "-"). For mode, the modifier "L" may also be used; this will show the same output as ls(1). (It would have been more mnemonic to have used lower case ell, but that's too easily confused with the digit one.) If the -h flag is given, the default member list will be as follows (split for readability): "dev,ino,mode:o,type:s,perm:s,nlink," "uid,gid,size,atime:z,mtime:z,ctime:z" In the output, the file name and symbolic link target can be shown surrounded by quotes. By default, the double-quote character is used; this can be changed with the -F switch (for the file name) or the -L switch (for the target). Both switches accept a string as an argument; the first half of the string will be displayed before the member, the second half after the member. If the string is an odd number of characters, the behavior is unspecified; each string may be up to 64 characters long. Separators lstat uses four separators (2 for input, 2 for output) as follows: output member separator in the output, the separator between members; default is semicolon (";") because "perm:s" contains commas (",") output filename separator in the output, the separator between the last member and the file name; default is space (" ") input member separator in conjunction with -o, the separator between members; default is semicolon (";") input format separator also in conjunction with -o, the separator between a member and the output format specifier (a numeric base, a letter indicating a base, or a letter indicating a 'symbolic" format); default is colon (":") Any or all of these separators can be changed with the -s flag. This flag takes one to four characters, corresponding to the list of separators above, in the order shown above. For example: lstat -s "." -o uid,gid somefile gives: 101.101 somefile Another example: lstat -s "|:.=" -o "uid=s.mtime=T" somefile gives: adamm|20090911094249:somefile Changing the output separators is always safe. Changing the input separators should be used only in conjunction with the -o flag; changing the input separators with -O, -h, or the default member list will almost certainly break things. EXIT STATUS lstat will exit with one of the following values: 0 no errors 1 you did something wrong 2 lstat() failed 3 something else failed There are lots of causes of each type of error; details will be printed on standard error. BUGS Several. :-) EXAMPLE lstat somefile 2049;1734;33188;1;101;101;459;1252677159;1252676569;1252676569 somefile lstat -o dev,ino,mode,nlink,uid,gid,size,atime,mtime,ctime somefile 2049;1734;33188;1;101;101;459;1252677159;1252676569;1252676569 somefile lstat -o "type:s,perm:o,perm:s,uid,uid:s" somefile f;644;u=rw,g=r,o=r;101;adamm somefile lstat -o 'mtime:z' somefile 2009-09-11.09:42:49 somefile SEE ALSO lstat(2), chmod(1), ls(1) AUTHOR Adam Moskowitz