As I watch someone else using a shell on Linux or OSX, I’m amazed that they haven’t customized the most important command, ls, in any way. ls seems like a pretty easy command, but there are subtle things that you can ask it to do which will provide much more useful information for zero extra work.
root@mail:/etc# ls default localtime resolv.conf defoma logcheck rmt deluser.conf login.defs rpc depmod.d logrotate.d sasldb2 dhcp3 logwatch securetty dpkg lsb-base security e2fsck.conf lsb-base-logging.sh services environment lsb-release shadow esound lynx.cfg shadow- event.d lynx.lss shells fonts magic skel
Ok, fine. That’s useful, but hardly informative.
root@mail:/etc# ls -F
default/ localtime resolv.conf
defoma/ logcheck/ rmt*
deluser.conf login.defs rpc
depmod.d/ logrotate.d/ sasldb2
dhcp3/ logwatch/ securetty
dpkg/ lsb-base/ security/
e2fsck.conf lsb-base-logging.sh services
environment lsb-release shadow
esound/ lynx.cfg shadow
event.d/ lynx.lss shells
fonts/ magic skel/
See how that provides more information? We can easily see directories, executable programs, soft-linked files, named pipes and other special files. That’s really handy.
I prefer ls -F to be my default and I have a few other ls aliases to make information easier to access. Here they are:
alias ls=‘ls -F’
alias ll=‘ls -l’
alias lm=‘ll |more ’
alias ltm=’ls -alt| more’
Order is important, so the first ls is used for the next ll and the next lm and the last ltm .
A few other aliases that I like are:
alias df=‘df -k’
alias du=‘du -k’
alias psg=‘ps -eaf | grep $*’
alias lp2pg=‘lp -d laser -o number-up=2’
Simple and effective. Yes, I mistype more a lot. I know what I meant, so I let the computer do what I meant. If you ever want to use the non-aliased command, just put use
That is handy when you’re shoving a list of files into a script, for example.