16.29 sls: Super ls with Format You Can ChooseThe ls -l command, and related commands like stat (21.13 ) , give lots of information about a file (more exactly, about a file's inode (1.22 ) ). The information is printed in a way that's (sort of) nice to look at. But the format might not be exactly what you want. That format can be tough for shell programmers to use: parsing the output with sed , awk , and others is tricky and a pain (article 16.25 has an example). Finally, the ls -l output is different on BSD and System V systems.
And there's much more. The manual page on the disc explains sls formatting in detail. Here are a few examples. Let's start with the style of ls -l output that has fixed-width columns and doesn't show group ownership. (The default sls -l is similar, but its date format doesn't change after six months and it doesn't have the total line.) % Here's a more user-friendly format for people who aren't UNIX hackers
(it might be best to put this into an
alias or shell function (10.1
)
).
The date and time are shown, followed by the owner's name, the size in
kbytes, and the filename without the symbolic link information like
% How about a simple ls output that shows all three file dates (16.5 ) : modification, access, and inode change? We'll use echo (8.6 ) to print a title first: % Finally, let's ask sls to make a set of UNIX commands that could be used at the end of a shell archive (19.2 ) file. These commands would recreate the modes, date and owner (with a numeric UID) as the files are extracted from the archive:
I didn't show the sorting options or many of the other output format characters. But I hope I've given you an idea (or ten). - |
|