Click to See Complete Forum and Search --> : customizing ls


kkmc
12-06-2000, 01:03 PM
I'd like to customize ls to show a header row before it's output. Like when I type ls -l I get columns of information and I want a header row before that info so I know what each category of info is. Like what ps -ef does. Anyway, I know I can alias ls to a customized ls, but how do I actually customize ls? I'm assuming I'll need to attach a program or script of some kind. Or just echo a line with the header information to be displayed before the ls -l output. I just don't know how.
Thanks,
Karen

Strike
12-06-2000, 02:40 PM
Put this in your profile -
alias ls='echo -e "Attributes ??\towner\tgroup\tsize\tdate\ttime\tfilename"; ls'
(I don't know what the ?? field is)
This doesn't format it correctly, but it's a start.

kkmc
12-06-2000, 03:25 PM
Cool, THANKS, so the \t acts as a tab. It works nicely. I just added a few spaces here and there to tweak it to conform to the columns more or less.

I found out that the second column is the number of hard links.

How do I add it to my profile so it runs each time I log in?

Strike
12-06-2000, 05:32 PM
You can put it in ~/.bash_profile (~ is your home directory, like /home/ddipaolo is mine since my username is ddipaolo).

Where did you gind that reference on the second column? I checked the info and man pages and I didn't see that ... maybe I just missed it.

kkmc
12-07-2000, 03:29 PM
Thanks, it works great.

I got the info on the hard links from info ls. The info version we're using is 4.0 -- what's yours?

It was under the heading "what information is listed", specifically then under -l.

Thanks, again!

Strike
12-07-2000, 04:30 PM
Ah, okay, I found it .. I'm dumb http://www.linuxnewbie.org/ubb/smile.gif
glad it worked