Linux nohup, Jobs, FG, tail command and forward switch

Source: Internet
Author: User

# Import Time  for  in range (0, +):    print  i    time.sleep (3)

NOHUP directive >log.log 2>&1 &:

Linux under Execution nohup python-u test.py >log.log 2>&1 &

Jobs-l view the commands executed in the background:

[1]-18071 running nohup python-u test.py >log.log 2>&1 &

Output the Log.log file in real time:

  Tail-f Log.log

Convert background commands to foreground:

  FG%n Here n is the number that jobs looked at [1] FG%1

After converting to foreground, you can use CTRL + C to end the directive:

CTRL + C

The jobs command only takes effect on the current terminal after exiting the current terminal, you can use the following method (PS) to view the process:

Ps-aux |grep mlgrp (login user name)

  You can end the process with a process ID

Linux nohup, Jobs, FG, tail command and forward switch

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.