Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 12-26-2005, 10:58 AM   #1
Registered: Dec 2005
Posts: 2

Rep: Reputation: 0
Howto get the output of a running process using ssh?

Hello, i would like to know if i can log or view the output of a running process, using ssh?
Old 12-26-2005, 11:34 AM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
can you explain in some useful detail what you actually want to achieve?? i would assume that ssh and the contents of a process on a remote system are utterly irrelevant to one another. 1) get to remote system 2) look at whateveter it is you want... so probably ignore the first part and tell us what you actually mean for the second.
Old 12-26-2005, 12:04 PM   #3
Senior Member
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian
Posts: 2,192

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339
Originally Posted by agouz
Hello, i would like to know if i can log or view the output of a running process, using ssh?
If you just want to log an ssh session that you invoke:

$ ssh -l login_name machine_name 2>&1 | tee ssh_logfile.txt

Graphical ssh clients (like Putty) may have session logging built in, but I've never looked for that so I don't know for sure.

Do you mean you want to invoke ssh, and then attach to an already running process on the remote machine and see what it's writing to stdout and/or stderr? You can use "truss" to see what's going on with a running process, but that shows the low level calls, not just stdout/stderr. You have to own the process (or be root) to do this. You could also try snooping around in /proc. I don't think you can grab only stdout/stderr from there, but I could very well be wrong on that. Again, you will either need to own the process or be root to see details under /proc.

If you mean the simpler "start a process and send it's output to a logfile":

$ program_name 2>&1 >logfile.txt view and log at the same time:

$ program_name 2>&1 | tee logfile.txt
Old 12-26-2005, 12:11 PM   #4
Registered: Dec 2005
Posts: 2

Original Poster
Rep: Reputation: 0
I would like to view the output of a running process. The process is running in a tty and the output of the process is in the stdout. How can i view the output (without restarting the process) from an another tty (i can't use myproc > /dev/pts/x because i don't want to restart the process).
thanks in advance.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regaining output from a background process the_holysmoke Linux - Newbie 4 03-11-2011 06:48 PM
SSH connection termination during a running process... jayemef Linux - General 1 08-16-2005 11:41 AM
Problem in output to a process in perl saneax Linux - Software 2 08-31-2004 06:18 AM
Please help easy questions, how do I stop a process from running in SSH? lexington Linux - Newbie 3 05-01-2004 12:03 PM
Redirecting process output to shell mhelles Linux - Newbie 1 04-30-2003 09:30 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration