Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What do you mean for a script which is not in a file? In which way do you run this code? Redirecting output of a command/script does not mean modify the command/script. It is simply add some words to the command line itself!
The line of code which I posted IS what I execute in the shell, so that line is actualy my script.
So in in this context, adding redirection is actualy modifying the code.
Let me re-phrase the question ... is there a way to see the output (stdout) of a process which is run under my username under another session or is there a way to "fg" a process into my session from another session?
With session i refer to a master shell process ie. bash or sh or csh or whateversh.
Last edited by freakolowsky; 01-30-2007 at 08:16 AM.
Got it! So you want to see what happen on the console remotely, don't you? I remember this can be done on Solaris machines, as explained here, but I don't know in Linux.
it outputs right in front of me. What exactly are you trying to do? A simple ">> somefile" at the end of the command will output what you want to another file for easy acess, but i assume you already thought of that, which again raises the question of what exactly you want to do if its so hard to modify a command, or append something to it?
It seems to me i just can't get this question out correctly ...
Can i hijack into my session or at least see the output of a command/script/whatever which is already started.
So ... i canNOT:
- change anything in the command/script/whatever
- add redirection of output to file
- run it in a screen session
- walk on watter
- say "you're a moron" to my boss ... oh wait ... that i can ...
so as i said without modifying a command/script/whatever i MEANT without modifying anything ... adding stuff ie. redirection is also modifying
No, I don't you can actually hijack the output of a running process and make it appear on your terminal window.
At least, not without modifying the code (ie redirection, FIFO pipes, IPC, ...).
You can still communicate with the running process ie via signals, so making it stop/suspend should work.
You can also detach the process from the terminal window it started in, but you can't make it re-attach to another terminal window afterwards. At least, not as far as I know.
See also the links to similar threads at the bottom. The first thread for instance mentions a command called "truss" (run as root) which may help you.
Have a look at the Text-Terminal-HOWTO, section 17.16. Probably ttysnoop is what you are looking for! Here is a link for setting it up. I wonder if it works... please post your results here!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.