1
  1. CTRL+ALT+F1
  2. Login to shell
  3. Type any command: sudo, ls, cat
  4. Output:

     -bash sudo: No such file or directory
    

Also when I login, environment variable is printed:

-bash: export: '/home/some/path:/home/some/other/path: _not a  valid identifier_

It's thenot a valid identifier part which I believe is causing the problem. I am new to Ubuntu. What I would like to know is

  1. How to get sudo working here?
  2. Anyway I can edit my .profile?
  • Your profile shouldn't need sudo to edit by you: just edit it using for example /usr/bin/nano ~/.profile – steeldriver Apr 12 '16 at 14:58
  • @steeldriver potential answer?? Anyway, you probably still have a issue becuase sudo should be available - what is the output of echo $PATH, and have you edited any rc files lately (e.g. ~/.bashrc, ~/.bash_profile)? – Wilf Apr 12 '16 at 15:24
4

You have trashed the definition of PATH, the list of directories the shell searches for commands you type. Thus, when you type ls the shell looks at the directories in $PATH and doesn't find /bin/ls. There is a two-step fix:

# First, manually set PATH to something survivable
export PATH=/usr/local/bin:/usr/bin:/bin

# then edit your `~/.bashrc`, find the line that begins with
# "/home/some/path:/home/some/other/path" and see why Bash wants to
# see an identifier at this point. Bad continuation on the previous line?
nano ~/.bashrc

When you've fixed the problem, either log out/in or source ~/.bashrc in every shell process you have open.

| improve this answer | |

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.