LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-09-2008, 08:50 AM   #1
hashbangbinbash
Member
 
Registered: Mar 2008
Posts: 108

Rep: Reputation: 16
Can I switch the terminal screen to a process id?


I sometimes run rtorrent at work and go away. When I get home I want to be able to log in to my server and check on how rtorrent's doing, I can us "ps aux" to see what processes are running, but how do I then "enter" the process so I can in this case look at rtorrent's output screen?

Thanks for any help.
 
Old 12-09-2008, 09:09 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
I think you are looking for the screen command. Personally I've never used it, but you can take a look at this article on the LQ wiki and check the external links section for a tutorial.
 
Old 12-09-2008, 10:02 AM   #3
hashbangbinbash
Member
 
Registered: Mar 2008
Posts: 108

Original Poster
Rep: Reputation: 16
Thanks, I've actually used this command before, I guess if you don't use screen in the first place there's no way to switch through the screens of processes.
 
Old 12-09-2008, 10:13 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Yes, I think so! If you can not detach a process from a terminal, you cannot see the output anywhere else, except in that terminal.
 
Old 12-09-2008, 10:21 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,074

Rep: Reputation: 387Reputation: 387Reputation: 387Reputation: 387
You can't magically detach one process that depends on a tty-like thing (like a terminal emulator) and reattach it in any other way. Once you close the tty linked to the process the process dies. Just like X based apps die when you exit X. That is, unless the application can run without a tty, on the background (daemonized) or it's running under some kind of tty emulator or multiplexer, like GNU Screen. You can also look into dtach, which is a simpler tool and has only a subset of the functionality that Screen can do.

Another option is to use a program that can work daemonized. That way, you can run it as a daemon in the background (hence, it's not tied to the tty). If you run it as a daemon then the important output should be on the logs, and you can always use a client program to connect to the daemon at any time to see how's the thing going.

As an example, you could use mldonkey. Once it's daemonized you can connect to the daemon to see what it's doing by using lots of frontends (kmldonkey, localhost:4080 on any web browser, telnet localhost 4000, and probably many other ways). So, as you see, it depends on what do you exactly want to do, and what pieces are involved. I never used rtorrent, and I don't know if it can work as a daemon.

Last edited by i92guboj; 12-09-2008 at 10:25 AM.
 
Old 12-09-2008, 10:31 AM   #6
hashbangbinbash
Member
 
Registered: Mar 2008
Posts: 108

Original Poster
Rep: Reputation: 16
out of interest, where can I find out how to demonize stuff? this term demonize gives google entirely the wrong idea.
 
Old 12-09-2008, 11:07 AM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,074

Rep: Reputation: 387Reputation: 387Reputation: 387Reputation: 387
Quote:
Originally Posted by hashbangbinbash View Post
out of interest, where can I find out how to demonize stuff? this term demonize gives google entirely the wrong idea.
Try "daemonize", instead of "demonize".

Most times this is done via a command line option. It depends on the concrete tool. Some tools simply run as daemons by default. Some others will have a --background, -d, --daemon or a similar switch to do this.

This is by design, not all programs can run as daemons and it wouldn't make sense either. If a program is intended to be run on a tty (or a terminal or any other similar thing) then you are not going to be able to run it without that.

In general, if you just want to preserve your command line sessions (as long as you don't turn off your box, that is) learn to use screen. You don't need anything else.

If it's just for rtorrent, investigate if it has daemon capabilities. If it doesn't, you can either use it under screen or use another torrent client that can run as daemon (again, mldonkey can).
 
Old 12-09-2008, 11:31 AM   #8
hashbangbinbash
Member
 
Registered: Mar 2008
Posts: 108

Original Poster
Rep: Reputation: 16
Thanks for that.
 
  


Reply


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
not screen-blanking in terminal - what sets the idle timeout on monitor for terminal stardotstar Linux - Hardware 2 08-14-2011 06:46 AM
avoiding TLB flush on process switch kailas Linux - Kernel 7 07-27-2008 10:40 AM
could not switch to terminal session alpha_lin Ubuntu 2 10-06-2006 08:00 AM
Blank screen when I log off or switch to a terminal liegerm Ubuntu 9 09-25-2006 02:00 PM
Switch to pseudo terminal you didn't log out of? xnomad Linux - General 2 07-19-2005 01:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:16 PM.

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