I was trying to add a new path to my bashrc file but I have seemed to messed something up. after I $ source ~/.bashrc I no longer can use the commands ls, mv, cp, cat, vi, and probably others that I haven't tried yet. Is there anyway I can reset the path so it all comes back?

[rn1041@cluster ~]$ ls
-bash: ls: No such file or directory
[rn1041@cluster ~]$ rm
-bash: rm: No such file or directory
[rn1041@cluster ~]$ cp
-bash: cp: No such file or directory
[rn1041@cluster ~]$ mv
-bash: mv: No such file or directory
[rn1041@cluster ~]$ echo path

2 Answers 2


Most commonly used commands (including the ones you tried) are in /bin, so you can run them by typing /bin/ls, etc.

P.S. What you meant to do is echo "$PATH".

  • ... and it will report "no command_you_are_searching_for in ()", because it also searches in PATH. Commented Mar 18, 2016 at 19:52

Here is an original, untouched ~/.bashrc from CentOS 6.

# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc

You probably meant to do something like this:

export PATH=$PATH:your/path/here
  • And what he probably did instead was, export PATH=/your/path/here. By the way, it's advisable to quote variable assignments when using export.
    – Wildcard
    Commented Mar 18, 2016 at 6:26
  • It's advisable to quote all references to shell variables (unless you have a good reason not to, and you’re sure you know what you’re doing).  P.S. As a special case, it's unnecessary for simple assignments, like FOO=$BAR, but it doesn't hurt, and it's better for a beginner to get into the habit of always doing it. Commented Mar 18, 2016 at 19:57
  • P.S. Another common mistake is export PATH=PATH:/your/path/here. Commented Feb 16, 2017 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .