Linux: set path using export command and profile.d

Show current path :-

echo $PATH

borne shell (bash) style to export in current terminal :-

export PATH=$PATH:/new/path:/second/newpath

Cshell (tcsh) style :-

setenv PATH $PATH:/new/path:/second/newpath

auto load new path for current/spesific user, add bash style export to .bashrc OR tcsh to .cshrc

auto load new path for all user, create new file in /etc/profile.d/
Example:

Filename: /etc/profile.d/mynewpath.sh
Line to add : export PATH=$PATH:/new/path:/second/newpath

reference : cyberciti.biz
tested on : centos 6, fedora 20

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s