Terminal tips


Puny Member
Couple of terminal tips for you all.

First change the background to black and the foreground to white. Then add these two lines to your .tcshrc file:

set color
alias ls ls-F

Now when you re-login and press tab, everything has a color according to what kind of file/dir it is (directory, library, device, executable, etc.). The ls command also uses the same colors.

You can change the colors by setting the LS_COLORS environment variable (see man tcsh)
thanks for the advice. But doesn't that alias mess up any other use of ls, such as ls -al and the like?

Unless I have no use for any of the flags for a command, I prefer to asign such an alias to a string that does not already exist as a command name.

For example I used:
alias ll ls-F
ll is already aliased to ls to provide a quick way of listing one screen at time w/ al the details. Try it. its nice.
Creating an alias for ls as described above is a fine thing to do.

When you run ls by itself, ls will be passed the flag described in the alias (-F). If you later run ls with other flags, both sets of flags will be passed to ls.

Think of aliases as just substituting the word ls with something a little different. For example, ls is replaced with ls -F, and ls -l becomes ls -F -l.

In the Unix world, it is perfectly okay to pass many different options to a command. For example, you could write:

ls -FC


ls -F -C


Actually I think ls-F is a tcsh macro. ls -F doesn't work unless you have the GNU ls AFAIK.
If you are in sh you have to type:
alias ls="ls -F"
the -F option is an ls option and has nothing to do with the shell in which you are in. BTW is there a way to have color even when not hitting tab - I have seen this in Linux but I am not sure how it was done there either?
That is WHY I said ls-F not ls -F

There is a difference

One is ls-F

the other is ls -F

(hint: one has a space in between)
Strobe, this seems to work fine when used by itself, but when I try a command like "ls -la" I get the response...

ls: -la: No such file or directory

Is there any way around this without making a bunch of alias's?
Yep I just noticed that. I have seen some other implementations of ls include --color switch which allows this functionality to be accessed from any shell. Maybe ls needs to be updated to included this functionality under Darwin/MacOS X.
I think it comes down to using the GNU's ls.

Anybody know if FreeBSD's ls knows color, and if so what license it's under?