-1

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

closed as too broad by JdeBP, Rui F Ribeiro, RalfFriedl, Isaac, jimmij Nov 3 '18 at 17:52

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Do you see it if you do sudo -i instead? – Rui F Ribeiro Nov 2 '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 2 '18 at 11:38
  • I ran it as root – Scorpion Nov 2 '18 at 11:38
  • 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 2 '18 at 12:04
  • 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 2 '18 at 14:14
4

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.

  • How can this answer be correct, when root can run the command? – ctrl-alt-delor Nov 3 '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 3 '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 4 '18 at 14:25
6

You need install package net-tools.

  • 3
    packages.debian.org/buster/amd64/iproute2/filelist This answer is wrong. – JdeBP Nov 2 '18 at 11:46
  • How? How is it possible that this answer is wrong (“Is already installed”), yet an identical answer gets a ✓? – ctrl-alt-delor Nov 3 '18 at 11:18
  • Red the edit history of the answer carefully, ctrl-alt-delor. – JdeBP Nov 3 '18 at 12:40
  • 1
    @ctrl-alt-delor He edited the answer before was another package. – Scorpion Nov 4 '18 at 14:28
2

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.

  • How can i check? If i use /sbin/route i get: bash: /sbin/route: No such file or directory. – Scorpion Nov 2 '18 at 11:37
  • And also export PATH=$PATH:/sbin didn't work. – Scorpion Nov 2 '18 at 11:37
  • First nothing, second route: – Scorpion Nov 2 '18 at 11:42
  • Are you using the same machine, for all your your tests?: First it is installed, then it is not, then it is already installed, then not. – ctrl-alt-delor Nov 3 '18 at 11:20
  • @ctrl-alt-delor yes same machine, the package already installed is another. – Scorpion Nov 4 '18 at 14:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.