how can I override priority between paths of /bin and /usr/local/bin?

9,031

Solution 1

You can give /bin/ss priority by creating a symbolic link to it.

sudo mkdir /opt/ss
sudo ln -s /bin/ss /opt/ss/

and add /opt/ss to your path before /usr/local/bin

export PATH=/opt/ss:$PATH
$ echo $PATH
/opt/ss:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

to make this permanent, add to the end of ~/.profile

PATH=/opt/ss:$PATH

Solution 2

Your PATH does.

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
/bin:/usr/games:/usr/local/games

and please do not just change the path (it will likely change more than just "ss"). Use

/bin/ss  -tpla
Share:
9,031

Related videos on Youtube

kenn
Author by

kenn

𐱅𐰇𐰼𐰰

Updated on September 18, 2022

Comments

  • kenn
    kenn over 1 year

    Today I wanted to run ss -tpla command to see network connections, to my surprize I got error: unknown option -t. Then I checked location of ss command:

     ~$ whereis ss
     ss: /bin/ss /usr/local/bin/ss /usr/share/man/man8/ss.8.gz
    

    As you see I have two ss commands, one in /bin/ss and the other in /usr/local/bin/ss.

    I might have installed another application with the same name from source code into /usr/local/bin/ss. I don't remember when and usage of it but it's not the command I want to run. Strange thing is that when I run

     ss -tpla  
    

    it redirects the command to /usr/local/bin/ss I can run actual ss command with

     /bin/ss  -tpla
    

    I thought /bin has the priority over other paths.

    My question is what determines priorities of system paths and how I can override them.

  • kenn
    kenn about 8 years
    so the priority is the same as in PATH env variable?