I've made a batch file on a Windows machine, with the following command:

rsh hdvg-1 -l root lspci

The hdvg-1 is the name of the Linux machine on the network.

But what I get in result is: command not found. Can someone tell me what i am doing wrong?

Perhaps also help me to use the following command in order to filter the lspci result:

lspci | grep 'certain string
  • Is there some specific problem with the grep? That pipe seems to look like it should work... – ilkkachu Aug 27 '16 at 15:46
  • i dont know, i first want to get the "lspci" command running... – R T Aug 27 '16 at 16:37

rsh expects the hostname after the options, e.g.,

rsh  -l root hdvg-1 lspci

Otherwise, it is trying to execute "-l".

The grep command has an unbalanced quote, and should be something like

lspci | grep 'certain string'

If you want to verify that the lspci command is available on your machine, you could do just

rsh  -l root hdvg-1

to get a shell, and then type lspci in that shell. By the way, since rsh is likely an alias for ssh, you should use ssh to avoid confusion.

Another source of confusion is that when using remote shells, your $PATH environment variable may not be set the same as if you logged in normally. According to a discussion in rsh server "script..." which $PATH is used ?,

rsh requires fully qualified names of executables, scripts to be safe. It uses /usr/bin/sh (whatever that evaluates to on the remote server), and the PATH is usually limited: /usr/bin:/usr/sbin

On your remote machine, lspci may not be in the $PATH used for the remote call.

Further reading:

  • dear thomas, i tried your command, but still i get "command not found"... – R T Aug 27 '16 at 16:37
  • the exact message is: lspci: command not found – R T Aug 27 '16 at 16:38
  • when i try only "rsh -l root hdvg-1" on the batch file, i get a window opened and than immidietly closed... – R T Aug 27 '16 at 17:00
  • It might help to explain which rsh/ssh client you are using (which would clarify why you "get a window"). If you were having problems with logging in, then it's odd that you get as far as the "command not found" message. – Thomas Dickey Aug 27 '16 at 22:33
  • as i explained, i do the the following: open a notepad, write the code in it, rename the notepad file as .bat, and then double cliick it. – R T Aug 28 '16 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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