16.12 Useful ls AliasesBecause ls is one of the most commonly used UNIX commands and provides numerous options, it's a good idea to create aliases for the display formats that best suit your needs. For example, many users always want to know about their "hidden" files. That's reasonable - they're just as important as any other files you have. In some cases, they can grow to take up lots of room (for example, some editors hide backup files), so it's worth being aware of them. Rather than typing alias la "ls -aF" or: alias la "ls -AF" Two things to note here. First, I recommend using la as the name of the alias, rather than just renaming ls . I personally think it's dangerous to hide the pure, unadulterated command underneath an alias; it's better to pick a new name, and get used to using that name. If you ever need the original ls for some reason, you'll be able to get at it without problems. Second, what's with the -F option? I just threw it in to see if you were paying attention. It's actually quite useful; many users add it to their ls aliases. The -F option shows you the type of file in each directory by printing an extra character after each filename. Table 16.1 lists what the extra character can be.
For example: % This says that Mail and performance are directories. powertools is a symbolic link (ls -l will show you what it's linked to). There are no executables or "sockets" in this directory. You may want this version instead: alias la ls -aFC
The -C
option lists the files in multiple columns. This option isn't needed
on systems where multi-column output is the normal behavior
(for example, in SVR4). Note, however, that when piped to another
command, ls
output is single-column unless -C
is used.
For example, use Finally, if you often need the full listing, use the alias: alias ll ls -l This alias may not seem like much of a shortcut until after you've typed it a dozen times. In addition, it's easy to remember as "long listing." Some UNIX systems even include ll as a regular command. - , |
|