Find the answer to your Linux question:
Results 1 to 3 of 3
I'd like to tail a file that's sitting on another server, but simply typing: tail address.of.server:/file/to/tail >> output doesn't seem to be doing the trick: tail: cannot open "address.of.server:/file/to/tail" for ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    2

    tailing a file on another server


    I'd like to tail a file that's sitting on another server, but simply typing:

    tail address.of.server:/file/to/tail >> output

    doesn't seem to be doing the trick:

    tail: cannot open "address.of.server:/file/to/tail" for reading: No such file or directory

    I'm fairly new to bash and linux in general, so how should I form this? I know how to access this file normally, and I CAN do this by just logging onto the server and then typing:

    tail /file/to/tail >> output

    but I, for whatever reason, want to consolidate everything to one statement, if possible.

  2. #2
    Linux Engineer khafa's Avatar
    Join Date
    Apr 2008
    Location
    Tokyo, Japan
    Posts
    858
    hi,

    you can use ssh to do this,

    Code:
    ssh yourlogin@remote_server "tail file_name" >> output_file
    Edit- do you wanna create the output_file on the local machine(from where you are running ssh) or on the remote machine? the above command saves the output on the local machine
    Last edited by khafa; 06-18-2008 at 03:10 PM. Reason: clarification
    Linux and me it's a love story

  3. #3
    Just Joined!
    Join Date
    Jun 2008
    Posts
    2
    The local machine is where I want to place this file.

    Thanks a lot, what I'm planning on doing is tailing an SMTP log file, then accessing the output via a Java program, searching to ensure a specific email was sent. I plan on executing the ssh line you gave to make the data more easily accessible to my program.

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •