How to remove a directory’s path from the $PATH variable in Linux [Ubuntu]

Hello everyone,

Though its a silly question to ask for many linux experts out there. It is obviously a question which has to be answered for the linux newbies. Lets say:

You have a path /usr/lib/jvm/java-6-openjdk-amd64/jre:/usr/java/jdk1.7.0_51:/usr/local/apache-maven/apache-maven- 3.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin: /bin:/usr/games:/usr/local/games 

and you want to remove one of the directory from this path variable. How do you do it?


do the following:

export PATH=/usr/lib/jvm/java-6-openjdk-amd64/jre:/usr/local/apache-maven/apache-maven-3.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games 

and to check whether it worked.. execute echo $PATH to view the result.





Leave a Reply

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

You are commenting using your 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