Is there a way to get ls to print in colour in busybox?

6,916

Solution 1

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.

Solution 2

ls --color doesn't work?

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

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

Solution 3

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 :)

Share:
6,916

Related videos on Youtube

Dennis Plucinik
Author by

Dennis Plucinik

Updated on September 17, 2022

Comments

  • Dennis Plucinik
    Dennis Plucinik almost 2 years

    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?

  • Dennis Plucinik
    Dennis Plucinik about 15 years
    You're right, but the nokia n810 just has an older version, I guess.
  • Dave Klotz
    Dave Klotz about 15 years
    Countries that originally make the language shouldn't have to apologies for spelling words correctly. Just my 2 cents =)
  • x3ja
    x3ja about 15 years
    Thanks for your tuppence worth :). "Sorry" wasn't the correct word perhaps. Maybe I should substitute in "Note".
  • Dennis Plucinik
    Dennis Plucinik about 15 years
    I wonder why this isn't default.
  • Andy
    Andy about 15 years
    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.
  • sleske
    sleske over 14 years
    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.
  • SamB
    SamB over 13 years
    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
    SamB over 13 years
    @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...