Sorted, recursive long file listing

lsr() { find "${@:-.}" -print0 |sort -z |xargs -0 ls $LS_OPTIONS -dla; }
Tells you everything you could ever want to know about all files and subdirectories. Great for package creators. Totally secure too. On my Slackware box, this gets set upon login: LS_OPTIONS='-F -b -T 0 --color=auto' and alias ls='/bin/ls $LS_OPTIONS' which works great.
Sample Output
=[9 h3xx@necronomicon ~ ]= $ lsr ~/.cron
drwx------ 10 h3xx users  304 Aug 13 01:45 /home/h3xx/.cron/
drwx------  2 h3xx users  264 Aug 14 03:09 /home/h3xx/.cron/cron.01d/
-rwxr-xr-x  1 h3xx users  466 Jun 10 13:10 /home/h3xx/.cron/cron.01d/clean-chrome-tmp.sh*
-rwxr-xr-x  1 h3xx users 4973 Aug 13 22:59 /home/h3xx/.cron/cron.01d/clean-maildirs.sh*
-rwxr-xr-x  1 h3xx users  117 Aug  9 18:32 /home/h3xx/.cron/cron.01d/clean-thumbscache.sh*
-rwxr-xr-x  1 h3xx users   50 Aug 10  2010 /home/h3xx/.cron/cron.01d/linuxcounter.sh*
-rw-r--r--  1 h3xx users 1264 Oct 12  2007 /home/h3xx/.cron/cron.01d/mkbackups.sh
-rw-------  1 h3xx users  375 Oct  7  2005 /home/h3xx/.cron/cron.01d/rcsync.sh
drwx------  2 h3xx users  224 Aug 13 09:14 /home/h3xx/.cron/cron.01h/
-rw-r--r--  1 h3xx users  937 Dec 31  2010 /home/h3xx/.cron/cron.01h/.bash-history.sh-notworking
-rwxr-xr-x  1 h3xx users  433 Aug 13 09:14 /home/h3xx/.cron/cron.01h/getmail-3.sh*
-rwxr-xr-x  1 h3xx users 4427 Jul  6  2010 /home/h3xx/.cron/cron.01h/randsig.pl*
-rw-r--r--  1 h3xx users 1358 Aug 17  2010 /home/h3xx/.cron/cron.01h/stupid-curl
-rwxr-xr-x  1 h3xx users  172 Aug 13 00:09 /home/h3xx/.cron/cron.01h/waffles-log.sh*
drwxr-xr-x  2 h3xx users   80 Dec 31  2010 /home/h3xx/.cron/cron.01m/
-rw-------  1 h3xx users  218 Mar 27  2006 /home/h3xx/.cron/cron.01m/vidcap.sh
drwx--x--x  2 h3xx users   48 Mar 21  2008 /home/h3xx/.cron/cron.05m/
drwx------  2 h3xx users  160 Aug  2 03:31 /home/h3xx/.cron/cron.07d/
-rwxr-xr-x  1 h3xx users  140 Apr 20  2009 /home/h3xx/.cron/cron.07d/clean-vim-views.sh*
-rwxr-xr-x  1 h3xx users  165 Apr 17  2008 /home/h3xx/.cron/cron.07d/insert_bash_history.sh*
-rwx--x--x  1 h3xx users   92 Sep 28  2010 /home/h3xx/.cron/cron.07d/logrotate.sh*
drwxr-xr-x  2 h3xx users   80 Aug 14 03:09 /home/h3xx/.cron/cron.15m/
-rwxr-xr-x  1 h3xx users  433 Aug 13 09:14 /home/h3xx/.cron/cron.15m/getmail-1.sh*
drwxr-xr-x  2 h3xx users   96 Aug 14 03:09 /home/h3xx/.cron/cron.30d/
-rwxr-xr-x  1 h3xx users  752 Aug 13 23:50 /home/h3xx/.cron/cron.30d/bogofilter-db-maintenance.sh*
drwx------  2 h3xx users  144 Aug 13 09:14 /home/h3xx/.cron/cron.30m/
-rwxr-xr-x  1 h3xx users  367 Jan 23  2010 /home/h3xx/.cron/cron.30m/dyndns-update*
-rw-r--r--  1 h3xx users  433 Aug 13 09:14 /home/h3xx/.cron/cron.30m/getmail-2.sh
lrwxrwxrwx  1 h3xx users   26 Aug 18  2008 /home/h3xx/.cron/cron.30m/process-spam.sh -> ../../libs/process-spam.sh
-rwx--x--x  1 h3xx users 4125 Aug 13 01:41 /home/h3xx/.cron/install-crontab*
-rwx--x--x  1 h3xx users 4122 Aug 13 01:34 /home/h3xx/.cron/install-crontab~*
=[9 h3xx@necronomicon ~ ]= $

2
By: h3xx
2011-08-15 03:10:58

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: