-2

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.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
Aloysius
  • 1
  • 1
  • 1
  • Welcome to U&L , please add the output of `echo $PATH`. [You can edit here](https://unix.stackexchange.com/posts/435341/edit) – GAD3R Apr 03 '18 at 17:59
  • Possible duplicate of [How to correctly add a path to PATH?](https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path) – GAD3R Apr 03 '18 at 18:02
  • 3
    And if you did a truly minimal install, many/most of those commands (like `sudo`) 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
  • I tried running the sudo command but I kept getting the "command not found ". This is what is in my path after running echo $PATH /usr/local/bin:/usr/bin:/usr/local/games:/usr/games – Aloysius Apr 04 '18 at 06:19

1 Answers1

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
  • 2
  • 11