Quote:
Originally Posted by
bbilheimer
What about the differences between du and ls?
man du, man ls
The former tells you about "disk usage", that is: how much space is used by a file or a part of a directory tree. The following method will tell you how much space is used by which part of the file hierarchy:
cd to a directory
issue "du -ks * | sort -rn"
You will get a list of files/directories with their respective space used sorted reversely by size. If you find a directory in this list with an abnormal size, then change into it and repeat the command there to see which files/directory is responsible for that, and so forth.
The latter command (ls) is to list directory information: my system (AIX) lacks the -h option you seem to find so useful, but it has ~20 other options to tailor the output to exactly your needs. Most of the times i use "ls -l" or "ls -lai", "ls -lrt" to get the files sorted by time and for everything else i look into the manpage for reference. Nobody knows all the options of "ls" by heart, it is for most of us a mixture of having a general grasp of what to use and a knowledge of where to find additional information when it is needed.
Quote:
Do most people use the latter even though it's not a very simple output?
Most common is "ls -l", but only because there is all the information you "normally" need. Use whatever is suited to your needs, there is no "One True Way" as with churches: UNIX is an ecumenical system, so to say. ;-))
Quote:
Are there better ways of doing it? I ask because I'm always surprised by little neat tricks and tips people have here and there.
What is "better" is defined by what you want to accomplish: there is no "better" way to get the information "ls -l" provides than issuing "ls -l", etc. The "neat little tricks" are just to strip some abundance of information down to the very minimum you need for a specific task.
If you think you need that set of info on a regular basis use "alias" and "function" to make it easier accessible, as ghostdog74 has already told you.
bakunin