Linux command background Run tricks (3)

Source: Internet
Author: User

All the content is collected in the network, part of the simple translation

First, use screen to execute commands

nohup & The command executes after the command is executed in the background, even if you exit the login. However, you cannot reconnect to this session, and to reconnect to this session, you can use the screen command as described in the previous article.

The Linux Screen command provides the ability to detach and reconnect a session. When you reconnect to this session, your terminal is exactly the same as when you were separated.

For more information, please refer to this article screen Command examples:get Control of Linux/unix Terminal

Ii. using at to execute a command as a batch

With at commands, you can have a command run at a specified date and time, for example, to execute the backup script in the background at 10 o'clock in the morning tomorrow, and execute the following command:

$ at -f backup.sh 10 am tomorrow

Please refer to this article for details understand at, ATQ, ATRM, batch Commands using 9 Examples

Some of the tasks that you perform in batch mode require some options to be enabled. The following article will give a detailed explanation:

    • How-to-Capture Unix Top Command Output to a File in readable Format
    • Unix BC Command Line Calculator in Batch Mode
    • How-to-Execute SSH and SCP in Batch Mode (if passwordless login is enabled)
Third, use watch to execute a command continuously

To execute a command continuously at a fixed interval, you can use the watch command as follows:

$ watch df -h

Please refer to this article for more information watch:repeat Unix Commands or shell-scripts every N seconds

Iv. killing process

Killing a program that has already started is the same as the normal way:

    • Pkill-9 Name
    • Killall Name
    • Kill PID
Finish

Linux command background Run tricks (3)

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.