6

I'm on a nokia n810 device, which uses busybox instead of the usual gnu coreutils. Is there a way to get busybox's ls to print in colour?

Andy
  • 1,493
  • 14
  • 14
Neil
  • 2,345
  • 8
  • 35
  • 44

3 Answers3

4

ls --color doesn't work?

I thought it was supposed to on the more recent versions.

http://www.busybox.net/downloads/BusyBox.html

sclarson
  • 3,624
  • 21
  • 20
4

The current busybox version for the latest release of Diablo (43-7) is 1.6.1, which as you've seen doesn't include options for colour.

A fully coloured version of ls can be installed on the n810 from Andrey's repository.
If you don't wish to install and use this repository you can install ls-color manually by downloading and using dpkg -i.

Then as x3ja says you can create an alias for it, although since Maemo uses Busybox your default shell is sh, so you'll have to put the alias in your .profile

alias ls='ls.color'

Installing bash is also easy if you so wish - bash2 can be installed from the Maemo extras repository, and bash3 is available through the gronmayer link below.

A great resource for finding apps in certain repositories is gronmayer's site, and of course the latest developments from Maemo Talk.

Andy
  • 1,493
  • 14
  • 14
  • I wonder why this isn't default. – Neil May 23 '09 at 06:23
  • 1
    Probably the same reason that they strip the man command and any documentation that gets attached to packagess - free space concern. The n800 and n810 use an almost identical image, but the n800 has much less memory (hence I boot from a 16gb SD card instead of the internal flash). Plus having your ls in colour is a nice feature, but you could get by without it. – Andy May 23 '09 at 06:36
  • Wouldn't you actually want to put that in a file pointed to by `$ENV` (which you would set in `.profile`)? That seems to be the closest thing to `.bashrc` or `.zshrc` in plain `sh(1)`. (POSIX doesn't even have `/etc/profile` or `.profile`, but it seems most shells do -- `dash(1)` for example.) – SamB Nov 12 '10 at 15:06
1

You could of course put something like this in your login scripts (.bashrc or similar):

alias ls='ls --color=auto'

Then when you type ls, it will actually run the command ls --color=auto and so it will display in colour*.

* Sorry for the British spelling, but I am British after all :)

x3ja
  • 313
  • 2
  • 8
  • 4
    Countries that originally make the language shouldn't have to apologies for spelling words correctly. Just my 2 cents =) – sclarson May 21 '09 at 16:58
  • Thanks for your tuppence worth :). "Sorry" wasn't the correct word perhaps. Maybe I should substitute in "Note". – x3ja May 22 '09 at 08:28
  • 1
    The poster's `ls` *cannot* do color, because it's not compiled in. This would be the right solution for a regular `ls`, but not on busybox. – sleske Jan 25 '10 at 11:27
  • @sparks: Heck, I'm american and *I* use British spelling fairly often. I'm consequently always annoyed that spellcheckers are unable to cope with a mixture of US and UK spellings. (It's especially annoying when you want to spell check the documentation in an international software project!) Say, maybe that's why Wikipedia has that "be consistant within an article" guideline... – SamB Nov 12 '10 at 15:11