Program: lst

Have you ever wondered what the newest or biggest files within a directory are? The standard ls program has options for listing out directories sorted in time order (the -t flag) and for recursing into subdirectories (the -R flag). However, it pauses at each directory to display the sorted contents of just that directory. It doesn’t descend through all the subdirectories first and then sort everything it finds.

The following lst program does that. Here’s an example using its -l flag to get a long listing:

% lst -l /etc

               12695 0600      1     root    wheel      512 Fri May 29 10:42:41 1998 
            
                   /etc/ssh_random_seed
            
               12640 0644      1     root    wheel    10104 Mon May 25  7:39:19 1998 
            
                   /etc/ld.so.cache
            
               12626 0664      1     root    wheel    12288 Sun May 24 19:23:08 1998 
            
                   /etc/psdevtab
            
               12304 0644      1     root     root      237 Sun May 24 13:59:33 1998 
            
                   /etc/exports
            
               12309 0644      1     root     root     3386 Sun May 24 13:24:33 1998 
            
                   /etc/inetd.conf
            
               12399 0644      1     root     root    30205 Sun May 24 10:08:37 1998 
            
                   /etc/sendmail.cf
            
               18774 0644      1     gnat  perldoc     2199 Sun May 24  9:35:57 1998 
            
                   /etc/X11/XMetroconfig
            
               12636 0644      1     root    wheel      290 Sun May 24  9:05:40 1998 
            
                   /etc/mtab
            
               12627 0640      1     root     root        0 Sun May 24  8:24:31 1998 
            
                   /etc/wtmplock
            
               12310 0644      1     root  tchrist       65 Sun May 24  8:23:04 1998 
            
                   /etc/issue
....

/etc/X11/XMetroconfig showed up in the middle of the listing for /etc because it wasn’t just for /etc, but for everything within that directory, recursively.

Other supported options include sorting on read time instead of write time using -u and sorting ...

Get Perl Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.