Results 1 to 3 of 3

Thread: differnce between "ps ax" and "ps ax &"

  1. #1
    Join Date
    Jul 2010
    Beans
    98

    differnce between "ps ax" and "ps ax &"

    What is the difference when I run
    Code:
      ps ax
    and

    Code:
     ps ax &

  2. #2
    Join Date
    Aug 2009
    Beans
    75
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: differnce between "ps ax" and "ps ax &"

    The "&" tells the shell to run a command in the background, i.e. you don't have to wait for the command to complete before getting back to a prompt. If you run
    Code:
    sleep 10 &
    you should get a prompt back almost immediately (along with a process ID). If you then do a ps, you will see the sleep command is still running.
    Last edited by BitJunkie; August 12th, 2011 at 07:16 PM. Reason: added code tag

  3. #3
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    6,590
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: differnce between "ps ax" and "ps ax &"

    Quote Originally Posted by BitJunkie View Post
    The "&" tells the shell to run a command in the background, i.e. you don't have to wait for the command to complete before getting back to a prompt.
    +1

    It is very easy to understand with a command that takes more time. Try this:
    Code:
    $ sleep 5
    And then:
    Code:
    $ sleep 5 &
    Hope it helps,
    Regards.

Bookmarks

Posting Permissions

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