Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am not able to find 'ifconfig' command, So I need to modify $PATH variable. Can you provide the best way to modify $PATH varible, whenever I logged-in.

[aaa@cyclrtp10 ~]$ ifconfig
ifconfig: Command not found.
[aaa@cyclrtp10 ~]$ echo $PATH
[aaa@cyclrtp10 ~]$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:56:82:1E:2C
          inet addr:  Bcast:  Mask:
          inet6 addr: fd20:8b1e:b255:800b:250:56ff:fe82:1e2c/64 Scope:Global
          inet6 addr: fe80::250:56ff:fe82:1e2c/64 Scope:Link
          RX packets:10597755438 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10754394830 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7987750842424 (7.2 TiB)  TX bytes:6618160592811 (6.0 TiB)

lo        Link encap:Local Loopback
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:5156561681 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5156561681 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:16690172948881 (15.1 TiB)  TX bytes:16690172948881 (15.1 TiB)

[aaa@cyclrtp10 ~]$
share|improve this question

migrated from Jul 23 '12 at 9:14

This question came from our site for professional and enthusiast programmers.

this is offtopic, certainly better fitted to Superuser – Ivan c00kiemon5ter V Kanak Jul 23 '12 at 8:11
You have transferred HOW much data over that poor eth0??? – Michael Kjörling Jul 23 '12 at 11:39

In some Linux distros I have seen /sbin/ restricted to root's profile. You have a few options.

Executing ifconfig as root:

$sudo ifconfig

Supplying the direct path on the cli:


Creating an alias in your ~/.bashrc OR ~/.bash_profile OR ~/.bash_login OR ~/.profile:

alias ifconfig="/sbin/ifconfig";

Lastly you could add /sbin /usr/sbin and /usr/local/sbin to your existing path variable in whichever config "~/.bashrc OR ~/.bash_profile OR ~/.bash_login OR ~/.profile" that is most convenient for your system.

Simply add:


If you want to add a local bin in your profile as well:

if [ -d "$HOME/bin" ] ; then
share|improve this answer
thanks Gareth for the edit job. I get moments here. kid is 3, need i say more. lol – tao Jul 26 '12 at 23:00

If you're using bash as your shell, modify $HOME/.bash_profile and add:

export PATH="/sbin/:$PATH"

with a new loggin, the new PATH will be loaded.

If you're using sh or dash, you should modify $HOME/.profile

You may also want to read this

share|improve this answer

Independently of your login shell you can create a .profile file in your home directory and add (or update an existing .profile file and append) the following line:

export PATH=/my/new/path:$PATH
share|improve this answer
not really, if bash finds .bash_profile it will stop looking further (ie look for and read .profile). – Ivan c00kiemon5ter V Kanak Jul 23 '12 at 8:16
Correct. For global setting try using /etc/profile file instead (requires root access) – pankar Jul 23 '12 at 8:32
@c00kiemon5ter: I've rarely seen .bash_profile used in practice. Usually it's plain ~/.profile that includes ~/.bashrc if it exists and if the current shell is Bash. That way Bash-specific features (like command completion) are kept seperate in .bashrc and general things (like PATH) are in the general .profile that is used for all shells. – rsp Jul 23 '12 at 9:04
I would go the other way around. Use .bash_profile, since it will be found first, but source .profile from it. That way, you don't need an explicit check in .profile to see what the current shell is. (In practice, I only use .bash_profile and .bashrc, and just don't worry about sh-compatibility.) – chepner Jul 23 '12 at 13:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.