TIP - happy with the 'ls' command output?
Ive always had a problem with the output of the 'ls' command when wanting to quickly view the sizes of files and sub-folders in a top-level folder, it never seemed quite right.
it seems to be better (for me at least) to use the 'du' (disk usage) command like this 'du --human-readable --all --max-depth=1' you also get a nice total at the bottom. ive got this aliased to 'duh' ;) |
Thanks for the tip. It does format nicely.:-)
|
I'll have to add that one to my alias list. I also have ll='ls -l' and la='ls -a'
|
I didn't alias it to duh, I ppicked lu so from above I have la, ll, la and lu in my alias list
Thanks to both of you. :-) |
ls -l covers pretty much 90% of my directory listing needs when I am not using display criteria and wild cards, like listing hidden files and directories (ls -l .*). I find this will give you the contents of hidden directories too. ls -dl will give you the just contents of the top directory listing of your criteria with no immediate subdirectory content listing.
|
Thanks and raise you one
Thanks for the tip. I took your duh and also made a duhs =
'du --human-readable --all --max-depth=1 | sort -k 2,2 ' Now the output is in order by filename (ascii or alphabetically). However, the total is first instead of last. |
nice 1 john, good idea to pipe the output to sort :)
|
nice and helpful. TKS. JP
|
i guess, the best one for the sorted human readable out of a directory contents in a clean way is
$ ls -rShl (its more simple, right? try this) then if you want to go for a total size, then do $ du -sh again for the users who want to stick with du (who dont like ls), let me make the first commands little more simple; $ du -h --max-depth=1 thats all.. |
Quote:
|
Quote:
Added to my list of ls aliases: Code:
alias ls='ls -F --color=auto' # color the output, classify files If you'd like to use a regular ls, without using any of the aliases, just use: Code:
\ls |
All times are GMT -5. The time now is 02:03 PM. |