LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I display colours with ls, without using -G (using bash) (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-display-colours-with-ls-without-using-g-using-bash-175355/)

r4nd0mz 04-27-2004 10:22 PM

How do I display colours with ls, without using -G (using bash)
 
Hello, I recently installed FreeBSD (v. 4.10) on a semi-old computer of mine, to use mostly as a programming workstation. However, when I went to 'ls' a directory to view the files there, it was all listed in black and white, and I was unable to tell which files were programs, files, directories, etc. I read the 'man' on ls, and it talked about 3 environment variables: CLICOLOR, CLICOLOR_FORCE, and LSCOLORS. However, I couldn't really do anything with those, I played around them for a while, and didn't get anywhere. It also told me that I could use 'ls -G' to see colours, and I used that, but it was annoying, and I'd rather not type ' -G' everytime I wish to view the contents of a directory with colours.

After searching all the forums here, and finding only one topic that seemed semi-similar, it turning out not to be very close; I decided to post! Where would I go, and what would I do so that it would permanently display appropriate colours of files. (I'm not really concerned about which colours they are, as long as they're different, and distinguishable).

Thanks for any help at all, or even just your time!

:Pengy: :newbie: :Pengy:

ToniT 04-27-2004 10:25 PM

in bash:
alias ls='ls -G'

For permanent setting, put that into your ~/.bashrc or ~/.bash_profile or whatever (see invocation section in man bash).

r4nd0mz 04-27-2004 10:34 PM

Yeee-Haw!! It worked!! (I also did: PS1=">> " - my preferred cmd thingy..)
Thanks ever so much!

Gotta love this site :p

r4nd0mz 04-27-2004 10:50 PM

One more question... How can I set my user to be able to make directories, and files in: /home/?? Would I have to make that the user's 'home' folder? Or what?

ToniT 04-27-2004 11:34 PM

You shouldn't do it. Other users shouln't be able to modify other users data.

Why would you want to do such thing? Where are you aiming at in a long run?

If you still want to do it, see chmod.

r4nd0mz 04-28-2004 04:59 PM

I'm using that computer mainly for programming, and I'm storing all my files in /home/. I don't want to have to be logged in as root all the time to create files, and make directories, etc. (There is only one user - me. [root too, of course]) And I want full permissions to be able to create files and do w/e without having to be logged in with root. Anyways, I'll look at chmod to see the proper settings. Thx!

Matt Collier 04-28-2004 05:53 PM

regardless, it's still good practice to do as little as possible as root. most programmers that do require a full file system to test with use a chroot'd environment so as to not possibly corrupt the system with buggy code. even if you were creating a farily ambitious program that did require access to the majority of the file system, standard practice is to create a new user for the system and to chmod the required dirs to this user, and have the code executed as this user, so if it potentially runs away, the worst it can do is destroy it's own run environment, leaving the system itself safe.
i would recommend looking into suid.


All times are GMT -5. The time now is 03:39 PM.