1

While using virtual box, I'm unable to use ls command, it shows

ls: unrecognized option '--color=auto'
ls: use the --help option for usage information

can anybody give me suggestion. I search google and came through alias command it shows,

alias cp='cp -i'
alias dmesgg='dmesg | grep'
alias l='ls $LS_OPTIONS -lA'
alias lh='ls $LS_OPTIONS -lh'
alias ll='ls $LS_OPTIONS -l'
alias ls='ls $LS_OPTIONS'
alias lt='ls $LS_OPTIONS -lht'
alias mv='mv -i'
alias pss='ps -ef | grep'
alias rm='rm -i'

please provide any suggestion for it??

  • I'd say look in your .bashrc or .profile file for lines containing --color=auto, and look for signs of bad formatting, but that trailing <br/> has me wondering where you could possibly be getting that value. what do you get when you run echo $LS_OPTIONS? – Frank Thomas Nov 14 '16 at 8:55
  • Sorry that was copy paste error. I use echo $LS_OPTIONS it shows this message : [1] 2318 bash:LS_OPTIONS: command not found [1]+ Done echo – bp04 Nov 14 '16 at 9:15
2

First run unalias ls. Then run ls as normal.

You will have to do that every time you start a new shell unless you find where the bad alias is being created, e.g. in /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile as described by @dirkt above, or perhaps in ~/.bashrc. Alternatively you can add unalias ls to the end of your ~/.profile, though that is a pretty nasty hack.

| improve this answer | |
1

You probably have a misconfigured .profile or similar file. (see the man command for your shell, there's a bunch of them. If you don't know which shell you have, use ps.) which either sets the option wrongly as '--color=auto'<br/> (if this is not a cut and paste error) using an alias similar to the ones you googled, or you have an ls command that does not unterstand this option.

To make ls work, try calling it directly as /bin/ls. If it's not in /bin, try which ls to find out where it is.

With the working ls command, look at the various shell-profile files, and fix the problem.

| improve this answer | |
  • I search for ls by bin, the path /bin/ls is there but when i typed which ls it showed /usr/bin/ls – bp04 Nov 14 '16 at 9:30
  • ps commands showed me this output **PID TTY TIME CMD 1996 tty1 00:00:00 login 2020 tty1 00:00:00 bash 2269 tty1 00:00:00 bash 2332 tty1 00:00:00 ps ** – bp04 Nov 14 '16 at 9:33
  • You have a bash, so the files are /etc/profile, ~/.bash_profile, ~/.bash_login, and ~/.profile (at least on my system). The tilde ~ means your home directory. Read man bash for details (long, use the search function). If on your system it's /usr/bin/ls, then use that. – dirkt Nov 14 '16 at 10:06
  • i used !/bin/ls command it showed me ls (GNU coreutils) 5.97 Copyright (C) 2006 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License <gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law. Written by Richard Stallman and David MacKenzie. – bp04 Nov 14 '16 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.