[CLUE-Tech] Changing view of ls command
Michael J. Hammel
mjhammel at graphics-muse.org
Wed Dec 6 12:53:04 MST 2000
Thus spoke Kevin Cullis
> However, I'd like to limit my search to just my home directory and not
> the .files to show up, don't need them. Based on Grants comment, I
> would guess that I'm going to have to use sort to limit it to that. I
> was wondering if I could modify something to display the kilobytes in
> the ls command, but alas, I can't.
You can write a bash (or ksh) function that does what you want, then alias
"ls" to that function. This is what I do with vi and cd in order to get the
name of the file being edited or the directory to which I've changed into
the title bar of my xterms. Here is how it's set up:
if [ "$TERM" = "xterm" ] && [ "$0" = "bash" -o "$0" = "-bash" -o "$0" = "/bin/bash" ]
then
ilabel () { echo -n "]1;$*"; }
label () { echo -n "]2;$*"; }
alias stripe='label $HOSTNAME - ${PWD#$HOME/}'
alias stripe2='label $HOSTNAME - vi $*'
cds () { "cd" $*; eval stripe; }
vis () { eval stripe2; "vi" $*; eval stripe;}
alias cd=cds
alias vi=vis
eval stripe
# eval ilabel "$USER@$HOSTNAME"
eval ilabel "$HOSTNAME"
fi
This is placed in my .bashrc file. You can do something similar in order
to get ls to do what you're asking (even using command line args, which I
do with another alias for cscope).
--
Michael J. Hammel |
The Graphics Muse | A hard-on doesn't count as personal growth.
mjhammel at graphics-muse.org |
http://www.graphics-muse.com
More information about the clue-tech
mailing list