ls
" command, it is always color-coded.Adding this functionality is super simple, and is almost identical to the process I explained in the "show entire path of current directory" post. I was screwing around, trying to get this working at work on our Tiger machine and Dale gave me a few tips on using Vi. He actually suggested that I use Vim (Vi IMproved). Thankfully this is part of Tiger as well as Leopard so I gave it a shot.
In order to add the colors to
ls
we have to add another line to our .bash_profile
file.1.) Open Terminal
2.) It should start you off in your Home directory, just to make sure type "
cd
"3.) Type the following line:
vim .bash_profile
4.) If this file has not been created yet, it will then display a blank screen, however if you've created this file before (maybe you did my post about showing the entire directory path!) then it will show you the previous lines that you have entered
5.) Press "
i
" to enter "Input mode"6.) Now enter the following line:
alias ls="ls -G"
7.) Press the escape button. This will take you out of "Input mode"
8.) Type ":wq" and then press Enter (The colon prompts you to enter commands and the w and q commands stand for "Write," and "Quit")
9.) Finally, quit out of Terminal and re-open it. Now when you invoke the "
ls
" command, it should return the list of files and folders, but this time color-coded!I got most of my information about this tip from this blog, however Leopard differs and does not seem to look at the "
.profile
" file. After a little bit of experimenting, I found out that instead Leopard seems to be looking at ".bash_profile
". However if you are still running Tiger, the blog that I just posted works perfectly! Also see that blog for additional information on what all the color codes mean. Thanks again Dale for a lot of the hints!
2 comments:
another command to create a file like .profile is to use touch. So you can do a
touch .profile
then
vim .profile
Just a way that I do it instead of doing vim .profile...which is basically th esame thing, just in fewer commands. ...So, why am I telling you this, you ask? I'm not really sure, but now you know another command, right?!?!?!
Yep, same as here:
http://duivesteyn.net/2008/fix-colours-in-mac-os-x-terminal/
Post a Comment