[TUHS] Command line options and complexity
John P. Linderman
jpl.jpl at gmail.com
Sun Mar 15 05:52:08 AEST 2020
Here's a command I wrote long ago using a different way to deal with
Usage: isee format file ...
Display specified inode information for files passed as arguments.
Items of the form ``%X'' in format will be replaced for these X:
dev inode ino mode nlink uid gid rdev size atime
mtime ctime now filename
Parenthesized printf-style format specifications can follow a %
to override the default format for the various items.
%filename is the name of the current file argument.
%now is the time (in seconds) when the command started running.
The other items are from the stat structure.
Example: isee "%(40s)filename: %mtime %mode" /dev/null
Show file modification time and mode of /dev/null
inode is just a synonym for ino.
Instead of a kazillion options, the %-stat-field items identify *what* you
want to see and the printf-style formats identify *how* you want them
shown. Someone in the Murray Hill library added strftime formats for date
fields, a fine addition, in my view. Adding readable user and group names
rather than numerical ids would be worth considering. *Maybe* having a
"rwx"-style form for mode. Sorting can be done by piping the output through
sort. Don't get hung up on shortcomings of the command, just consider how a
few familiar concepts and pipes can be combined to provide a large number
On Sat, Mar 14, 2020 at 12:35 AM Greg 'groggy' Lehey <grog at lemis.com> wrote:
> On Friday, 13 March 2020 at 21:45:21 +1100, Dave Horsfall wrote:
> > On Fri, 13 Mar 2020, Greg 'groggy' Lehey wrote:
> >>> -h is a gnuism, isn't it?
> >> It might have originated there, but then I would expect it to be spelt
> >> '--produce-human-readable-output'. I haven't been able to establish
> from the
> >> FreeBSD sources or commit logs when it was introduced. It would
> clearly have
> >> been a reimplementation.
> > It's in "df" as well, praise Cthulu:
> > aneurin# df -h
> > Filesystem Size Used Avail Capacity Mounted on
> > /dev/ad0s1a 496M 302M 154M 66% /
> > /dev/ad0s1d 2.9G 1.4G 1.2G 54% /usr
> > /dev/ad0s1e 989M 581M 329M 64% /var
> It also has the , option:
> === grog at eureka (/dev/pts/72) ~ 8 -> df -,
> Filesystem 1048576-blocks Used Avail Capacity Mounted on
> /dev/ada0p4 39,662 21,918 14,571 60% /
> /dev/ada0p2 39,662 13,447 23,042 37% /destdir
> /dev/ada0p5 3,705,520 1,831,345 1,577,733 54% /home
> /dev/ada1p1 7,629,565 6,358,607 1,194,661 84% /Photos
> I find it much easier to see the relative size like that.
> Sent from my desktop computer.
> Finger grog at lemis.com for PGP public key.
> See complete headers for address and phone numbers.
> This message is digitally signed. If your Microsoft mail program
> reports problems, please read http://lemis.com/broken-MUA
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the TUHS