Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Putty and the command line

Hybrid View

  1. #1

    Default Putty and the command line

    Hey, I'm new to openSUSE (Ubuntu user) and I have a few questions about it.

    I installed openSUSE 11.3 without xwindows so that it boots directly into the command line on my server. I can login fine with putty (ssh) to change settings and manage files but I'd like to know a way to keep a program running after the putty session closes.

    Also, are there commands to "minimize" a program and then come back to it later? For instance, I'm running a craftbukkit minecraft server; I want to "minimize" it and download a plugin while keeping minecraft running and come back to it.

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,893
    Blog Entries
    3

    Default Re: Putty and the command line

    From a login with putty, you need to run the command so that it is disconnected from the terminal.

    Try: command-name < /dev/null > /dev/null 2>&1 &

    This assumes you are using bash as shell.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  3. #3

    Default Re: Putty and the command line

    I just tried running "top" like this and, I got the output:
    "[1] 3052"
    And the program did not appear to run. Just for the fun of it though, I tried the "jobs" command and I got this line:
    "[1]+ Exit 1 top < /dev/null > /dev/null 2>&1"

    So I assume that this means the program is running? How do I call it back to the screen?

  4. #4
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Putty and the command line

    On 2011-03-06 20:36, Viench wrote:

    > So I assume that this means the program is running? How do I call it
    > back to the screen?


    fg

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

  5. #5

    Default Re: Putty and the command line

    New issue, when I try the "command-name < /dev/null > /dev/null 2>&1 &" now I get no output and nothing when I type "jobs".

    Any ideas?

    Also, I'd like to know more about the "< /dev/null > /dev/null 2>&1 &" commands. Would anyone care to tell me more about them or point me in the direction of some documentation?

  6. #6
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Putty and the command line

    On 2011-03-06 22:06, Viench wrote:

    > Also, I'd like to know more about the "< /dev/null > /dev/null 2>&1 &"
    > commands. Would anyone care to tell me more about them or point me in
    > the direction of some documentation?


    Pipes.
    Dustbin.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Putty and the command line

    On 2011-03-06 18:06, Viench wrote:
    >
    > Hey, I'm new to openSUSE (Ubuntu user) and I have a few questions about
    > it.
    >
    > I installed openSUSE 11.3 without xwindows so that it boots directly
    > into the command line on my server. I can login fine with putty (ssh) to
    > change settings and manage files but I'd like to know a way to keep a
    > program running after the putty session closes.


    There is a command I can't remember that does that, detach a program from
    the terminal and access it again from another terminal, even after you log out.

    Ah, screen! From an old post in the mail list:

    [SLE] background process and controlling terminal / 2003 07 15 / Jason

    Have a look at screen. At a terminal, type 'screen' and press return after
    the copyright and pizza notice. Start your lengthy processes as normal.
    Ctrl-A-D detaches the screen, or you can just close the terminal. Open up
    another xterm and type "screen -r", and it attaches itself to the terminal.

    I use it for monitoring KDE CVS compiles from work. Start the compile
    script from within screen in Konsole at home, and use Putty to ssh into my
    box and use 'screen -r' to see if the compile is continuing OK.


    > Also, are there commands to "minimize" a program and then come back to


    No way. Minimize is an 'X' concept, and you have no 'X' running.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

  8. #8

    Default Re: Putty and the command line

    Sorry to double post, but I couldn't edit my post for some reason.

    Quote Originally Posted by robin_listas View Post
    There is a command I can't remember that does that, detach a program from
    the terminal and access it again from another terminal, even after you log out.

    Ah, screen! From an old post in the mail list:

    [SLE] background process and controlling terminal / 2003 07 15 / Jason

    Have a look at screen. At a terminal, type 'screen' and press return after
    the copyright and pizza notice. Start your lengthy processes as normal.
    Ctrl-A-D detaches the screen, or you can just close the terminal. Open up
    another xterm and type "screen -r", and it attaches itself to the terminal.

    I use it for monitoring KDE CVS compiles from work. Start the compile
    script from within screen in Konsole at home, and use Putty to ssh into my
    box and use 'screen -r' to see if the compile is continuing OK.


    > Also, are there commands to "minimize" a program and then come back to

    No way. Minimize is an 'X' concept, and you have no 'X' running.
    "Screen" seems to work well for my putty needs. However is there a way to have more than one at a time, and see a list of the screens I have running?

    Also, I didn't mean minimize in the traditional X sense. I was referring to letting me manage files and such while programs I started are running. It is not necessarily in reference to this server, but it is general command line knowledge that I would like to know anyway.

  9. #9
    Join Date
    Aug 2008
    Location
    Behind the 8 ball
    Posts
    116

    Default Re: Putty and the command line

    I can login fine with putty (ssh) to change settings and manage files but I'd like to know a way to keep a program running after the putty session closes.
    Use nohup
    Code:
    nohup command-name &
    Hiatt

  10. #10

    Default Re: Putty and the command line

    Quote Originally Posted by jthiatt08 View Post
    Use nohup
    Code:
    nohup command-name &
    Hiatt
    I like this command much more than < /dev/null > /dev/null 2>&1 &. (Easier to remember) How do I call back the program with fg though?

Page 1 of 2 12 LastLast

Posting Permissions

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