13

I can' t use the command route:

route
bash: route: command not found

Why is it not found? (I'm using debian 9).

I tried to run it as root but it still does not work. However it is supposed to work also without root.

Additional diagnostics:

whereis route
route:

which route (empty output).

export PATH=$PATH:/sbin (no output) and nothing changes.

I already have iproute2 installed, to be sure I ran:
apt --reinstall install iproute2

Scorpion
  • 757
  • Do you see it if you do sudo -i instead? – Rui F Ribeiro Nov 02 '18 at 11:34
  • 3
    The fact that you have two very different answers already is indicating that this question is far too broad. This amounts to an "It doesn't work!" question, and such questions are poor. Really, people cannot tell why things are happening as they are without pertinent information about what your account is, what your PATH is, and why you think that you even have a route command in the first place on a package-based operating system. None of that is in the question as it stands. – JdeBP Nov 02 '18 at 11:38
  • I ran it as root – Scorpion Nov 02 '18 at 11:38
  • If you want more info ask me i don't know what add. The second answer is good and tell me to check a required package of that command. And this command is supposed to works with normal user. – Scorpion Nov 02 '18 at 11:40
  • It seems you already have already a couple of poor quality questions due to (ab)use root use. Have people not advised you it is poor practice to run a system as root by default? – Rui F Ribeiro Nov 02 '18 at 11:49
  • @RuiFRibeiro Which questions are due to root? – Scorpion Nov 02 '18 at 11:52
  • @GAD3R was that update the answer, thanks. – Scorpion Nov 02 '18 at 11:57
  • @RuiFRibeiro tell me why this question is poor, why the the other questions are poor (and which) and WHY root use is related!!! – Scorpion Nov 02 '18 at 12:00
  • I am not your maid or employee, beware the imperative. thanks. – Rui F Ribeiro Nov 02 '18 at 12:03
  • 1
    /sbin/ is not always in path for normal user, but is for root. If you'd shown the value of your $PATH variable, that would have avoided the irrelevant answers. – JigglyNaga Nov 02 '18 at 12:04
  • @JdeBP only 1 answer, and if i knew about that i would add it in the question. I 'm not familiar with /sbin/. – Scorpion Nov 02 '18 at 12:56
  • @RuiFRibeiro why is root related? – Scorpion Nov 02 '18 at 12:59
  • @JdeBP here there is a similar question https://unix.stackexchange.com/questions/145447/ifconfig-command-not-found 118 + and 41 stars... – Scorpion Nov 02 '18 at 13:10
  • 1
    Notice that the differences from that to yours are the very ones that I mentioned. That question gave people the value of PATH and what user account was being used right from the start, in the question. – JdeBP Nov 02 '18 at 14:14
  • run it as /sbin/route – ctrl-alt-delor Nov 03 '18 at 11:15
  • -1 as this question is very hard to understand. Please proof-read and edit, to make it easy to read, and to remove ambiguity. – ctrl-alt-delor Nov 03 '18 at 18:29
  • @ctrl-alt-delor after I posted the question people ask me more info, now the question is as the original. – Scorpion Nov 04 '18 at 14:24
  • @Scorpion removing stuff did not help. I have re-written as best I can. I have improved the grammar and clarity (Hope it is correct). I appreciate that English may not be your first language, so in future avoid using abbreviation. Also proof-read your text, then edit, to ensure that it makes sense. – ctrl-alt-delor Nov 04 '18 at 20:12
  • @ctrl-alt-delor all the stuffs is pointless the problem was the missing package . Which abbreviation? – Scorpion Nov 04 '18 at 20:19
  • “I can' t to use the” and “Why it isn't found?” – ctrl-alt-delor Nov 04 '18 at 20:26
  • The extra info that i added to the original question. – Scorpion Nov 04 '18 at 20:28

3 Answers3

25

The "command not found" error means you don't have the command installed.

Using Debian's "search the contents of packages" page brings up:

...
/sbin/route     net-tools [not powerpc]
....

So (providing your CPU isn't PowerPC) you should install the net-tools package.

JigglyNaga
  • 7,886
  • 2
    How can this answer be correct, when root can run the command? – ctrl-alt-delor Nov 03 '18 at 11:18
  • @ctrl-alt-delor The OP wasn't very clear -- by "I ran it as root", I believe they meant "I entered route as root, and still got the same error", not "it runs when I try it as root". – JigglyNaga Nov 03 '18 at 11:41
  • @JigglyNaga "I ran it as as root" means I ran route as a root user, pretty simple. Because one told me to run it as root (sudo -i). – Scorpion Nov 04 '18 at 14:25
14

You need install package net-tools.

metallic
  • 346
  • 1
  • 4
7

The /sbin isn't in your PATH, use:

$ /sbin/route

or :

$ export PATH=$PATH:/sbin
$ route

You can add the above command to your .bashrc:

echo "export PATH=$PATH:/sbin" >> .bashrc
source .bashrc

The net-tools provide the route command. Reading the output of route command doesn't require a special right.

GAD3R
  • 66,769