I tried installing Metasploit on Ubuntu 16, using this webpage. Following the instructions, I got the following error

sudo: exec: command not found

While downloading Ruby rbenv, I forgot to do the Framework install, so I went back to it, but then every time I open the terminal, I get this error:

enter image description here


The error means you have some incorrectly formatted lines in your ~/.bashrc file.

It looks like you might have copied + pasted incorrectly under the section on installing ruby using rbenv.

The easiest way to solve this is to edit your .bashrc file and either correct or remove the lines the tutorial inserted.

What your .bashrc should contain (according to the tutorial):

export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"

Once you have that you make use of it by issuing the command $ source .bashrc.

I have no idea if the tutorial is correct so even if you match the content you might not get things working. In that case remove these lines and again issue $ source .bashrc.

Just in case you have to recreate your .bashrc file you can do the following :

/bin/cp /etc/skel/.bashrc ~/

Again you need to source the replacement:

source ~/.bashrc

| improve this answer | |
  • I don't seem to have a .bashrc file in my home directory or root folder, i think i must have deleted it incorrectly. Is there anyway i can possibly recreate it? – Hermit Jun 22 '16 at 7:02
  • Are you sure? Are you viewing hidden files? – Jack Jun 22 '16 at 7:04
  • Edited answer to recreate bashrc – Jack Jun 22 '16 at 7:47
  • Ok, thank you. Problem was solved, all my errors disappeared from the terminal. – Hermit Jun 22 '16 at 10:24
  • that's great. If my answer was correct can you accept it? If the solution was something else it's helpful to add it as an answer yourself -> it's useful for people searching for similar problems in the future. – Jack Jun 22 '16 at 10:27

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.