Author Topic: How to clean duplicate $PATH entries  (Read 383 times)

hakerdefo

  • Posts: 484
    • View Profile
    • Looking at Linux through the Windows of Life
How to clean duplicate $PATH entries
« on: January 09, 2016, 09:02:31 PM »
Open terminal and type,
Code: [Select]
echo $PATH

Do you see any duplicate path entries? If no, Great! If yes, Worry not! Fix is simple!
Open  '.bashrc' file in your favorite text-editor and just add following lines at the bottom,

Code: [Select]
PATH="$(echo $PATH | perl -e 'print join(":", grep { not $seen{$_}++ } split(/:/, scalar <>))')"
export PATH

Save the file. Do Logout-Login and voila! No more duplicate path entries!
Cheers!!!
You Can't Always Git What You Want

Snap

  • Posts: 462
    • View Profile
Re: How to clean duplicate $PATH entries
« Reply #1 on: January 11, 2016, 07:10:00 AM »
Nice trick. Thanks, buddie.