silly question

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?

Simply,

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.

Cheers,

SZ