I need to add commands found in /usr/bin to my root/home directory search path because I recently formatted my dell inspiron amd64 bit with Debian 9 stretch. I only installed the core os without any additional software. So now, each time I tried running sudo on my home directory or if I try running any commands on my root account, I keep getting an error message that such commands cannot be found. From my little research online , I have come to know that I need to add those commands to either my home or root search path.
Asked
Active
Viewed 5,500 times
-2
1 Answers
3
To see your path type:
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin
To append /usr/bin to your path immediately, type:
$ PATH="$PATH:/usr/bin"
To make sure /usr/bin remains in your path after next login, add(or edit) the PATH variable to your rc file (in my case .bashrc):
Check shell:
$ echo $SHELL
/bin/bash
My shell is bash, so I edit my .bashrc file:
vi ~/.bashrc
Add the following line (or edit the PATH line if it already exists):
PATH="$PATH:/usr/bin"

L.Ray
- 469
-
Thanks, but where in the bashrc file should I add the new path to? Should it be before the last FI or after it. – Aloysius Apr 04 '18 at 06:14
-
echo $PATH
. You can edit here – GAD3R Apr 03 '18 at 17:59sudo
) may not even be installed. Please post your$PATH
variable contents (echo $PATH
) and exactly what command you are trying to run. – ivanivan Apr 03 '18 at 18:14