DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 5th May 2009
bsdnewbie999 bsdnewbie999 is offline
Package Pilot
 
Join Date: May 2008
Posts: 145
Default How to modify the ls command?

ls program in bsd display all the contents in the current directory but some file are directories. I know with the option ls -F can differentiate between them. Then I come out the question, can i modify the ls program to display the directory in color and others remain the same just like Linux.

Last edited by bsdnewbie999; 5th May 2009 at 02:11 PM. Reason: should be program not command.
Reply With Quote
  #2   (View Single Post)  
Old 5th May 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

OpenBSD's ls(1) does not support colours, but if really require such a ridiculous feature.. someone has created a modified version, you can find it in the ports tree.

Here is shortcut: sysutils/colorls
Reply With Quote
  #3   (View Single Post)  
Old 6th May 2009
wraith0x2b's Avatar
wraith0x2b wraith0x2b is offline
Port Guard
 
Join Date: May 2009
Posts: 12
Default

To add to what BSDfan666 said, after (or if) you install colorls, you should alias ls to point to colorls
for bash this would mean adding `alias ls="colorls"` to ~/.bashrc
Reply With Quote
  #4   (View Single Post)  
Old 6th May 2009
marcolino's Avatar
marcolino marcolino is offline
Real Name: Mark
Custom Title Maker
 
Join Date: May 2008
Location: At the Mountains of Madness
Posts: 128
Default

To add even more, use:
Code:
alias ls='colorls -G'
__________________
That's nothing a couple o' pints wouldn't fix.
Reply With Quote
  #5   (View Single Post)  
Old 8th May 2009
Zmyrgel Zmyrgel is offline
Port Guard
 
Join Date: May 2008
Posts: 30
Default

Quote:
Originally Posted by BSDfan666 View Post
OpenBSD's ls(1) does not support colours, but if really require such a ridiculous feature.. someone has created a modified version, you can find it in the ports tree.
Why do you say that color support in ls is ridiculous? I'd say colors quickly indicate which kind of files directory has. It's much easier to read ls output with colors.
Reply With Quote
  #6   (View Single Post)  
Old 9th May 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

I beg to differer, that's what file(1) is for.. there is no point arguing though, this is just my personal opinion.
Reply With Quote
  #7   (View Single Post)  
Old 9th May 2009
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

Quote:
Originally Posted by BSDfan666 View Post
I beg to differer, that's what file(1) is for.. there is no point arguing though, this is just my personal opinion.
It is hard to argue with Ubuntu users who think that the other systems
should behave the same.
Reply With Quote
  #8   (View Single Post)  
Old 9th May 2009
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

Quote:
Originally Posted by Zmyrgel View Post
Why do you say that color support in ls is ridiculous? I'd say colors quickly indicate which kind of files directory has. It's much easier to read ls output with colors.
Actually 'ls -F' is much better IMHO, and much more reliable if you want the information retained when piping data into another program. I've found the '/', '*', '@', '=', '%', and '|' to be excellent visual indicators of things, while file and vi are more useful for inspecting a files contents. The colours are better for ascetics then anything else.


If anyone requires syntax highlighting to write code, they probably do not know how to write code in the first place. If anyone requires colour output to tell directories from files, they are probably a dipstick.

Simple.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #9   (View Single Post)  
Old 16th May 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Quote:
If anyone requires syntax highlighting to write code, they probably do not know how to write code in the first place. If anyone requires colour output to tell directories from files, they are probably a dipstick.
This is interesting. As you might all know from my previous posts I'm not a programmer, but after starting to use OpenBSD I also switched to Latex (which, if I understand right, is to some extent a programming language) to get my papers done. Well, I used it in black and white for a long time, then discovered that Vim supports color syntax highlighting, tried it, and found it useful, especially because, for example, you can spot out a \emph{blabla} inside e paragraph quickly.
Now the question: why is using syntax highlighting to be considered a bad habit? And what are the strategies to make do without?
tks
Reply With Quote
Old 16th May 2009
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,319
Default

Quote:
Originally Posted by gosha View Post
why is using syntax highlighting to be considered a bad habit?
You may be taking the comments made in this thread a bit too literally.

There is nothing inherently evil about color syntax highlighting, however if it becomes a crutch such that you have to have it available, then this may become a problem when you have to migrate to systems which don't have your specific customizations configured.

I use color syntax highlighting on occasions for similar reasons: it can help bring to focus certain aspects of structure, but I can also live without it. Emacs colors differently (by default) than vim, so because I have spent a lot of time in Emacs lately, suddenly moving to vim initially seems odd. Most editors make the colors configurable, but I don't find the default choices so distasteful in these environments to do anything about it. Besides, on OpenBSD systems, I tend to use mg(1) which doesn't provide color syntax highlighting at all. Also, it's better because it is faster.

I suspect the consternation you may be reading in this thread result from the fact Linux distributions tend to have the output of ls(1) color-coded. Personally, I find this distracting, but that is my opinion, & preference. If others find it helpful, fine. This debate can quickly decay into a religious war which doesn't possess significant value.

Now if you start treading on my ANSI color-fied shell prompt, then those are fighting words.

So it's a question of what has been your experience, & what your choices are based upon that experience. Nothing more. If you like color-syntax highlighting great. If you don't, that's fine too. It's merely a feature.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delayed command? wubrgamer Other BSD and UNIX/UNIX-like 9 22nd April 2009 03:15 AM
read & modify files out side chroot jail Dr_Death_UAE FreeBSD Security 5 6th November 2008 09:20 PM
Modify host-level firewall rules (without getting locked out) anomie Guides 13 16th June 2008 04:26 AM
Which light Gui from modify images files? aleunix OpenBSD General 7 15th June 2008 04:32 PM
How to modify the boot loader? Sunsawe FreeBSD General 5 29th May 2008 05:13 AM


All times are GMT. The time now is 12:11 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick