Edit a PATH in Linux

How can I quickly remove a portion of PATH variable in Linux ?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Do you want to edit the PATH variable for root or for all users on the system?

If you want to remove /home/user/bin you can do:

PATH=$(echo $PATH | sed -e 's;:\?/home/user/bin;;' -e 's;/home/user/bin:\?;;')
You can redefined PATH.
export PATH=new list

To make an adjustment you need to be more specific
Are you trying to alter a path that is set applicable to system wide.
Has config files that set during user creation.

If the files there reference a central  /etc/, making changes there will be seen.
Or each individual users

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AXISHKAuthor Commented:
do you mean /etc/profil e will apply the path to everyone, correct ?
/etc/profile applies an initial path to everyone, but they also have a .loging,  .profile, or .bash_profile and .bash_rc that can change settings too.  There's also /etc/bashrc
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.