3

I try to edit .bashrc to view the C-compilers that I installed before. But after opening the new terminal I am stuck with strange error.

I am unable to ls the files/directories and nothing works. It hangs with the following error message on command line:

vi .bashrc
Command `vi` is available in /usr/bin/vi
The command could not be located because /usr/bin is not included in the PATH environment variable.
vi: command not found

Can anyone please assist me ?

david6
  • 14,528
  • 5
  • 38
  • 46
HASSAN
  • 33

3 Answers3

3

If you are still logged in, or can login to the graphical session without problems, then you can copy the file /etc/skel/.bashrc to your home directory (be aware that hidden files are not shown by default in the file manager.

As an alternative, press F2 then launch the command

cp /etc/skel/.bashrc /home/your-username

If these methods do not work, then you have to follow the method shown by @gertvdijk.

enzotib
  • 96,093
2

You've probably messed up your .bashrc file and now you can't open a terminal anymore, because this file is used to set up your shell.

  1. Boot into recovery mode. How do I boot into recovery mode?

  2. Remount your system with write access:

    sudo mount -o remount,rw /
    
  3. Copy the pristine .bashrc file from /etc/skel into your homedir to fix this. See Where are the pristine, untouched contents of a ~/.profile file? (also answers .bashrc), e.g.:

    cp /etc/skel/.bashrc ~username/
    chown username: ~username/.bashrc
    
gertvdijk
  • 69,427
0

Could be the same problem: Try resetting your path with this command:

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

(Source)

David Foerster
  • 36,890
  • 56
  • 97
  • 151