LINUX terminal command combination

Source: Internet
Author: User
LINUX terminal command combination method-general Linux technology-Linux programming and kernel information. The following is a detailed description. To complete a complex task in shell, you usually need to enter multiple commands. When executing a command, you need to depend on whether the previous command is successfully executed. For example, copy all the files in one directory to another directory and delete all the files in the original directory. Before deleting a file, make sure that the copy is successful. Otherwise, all or part of the files may be lost.

Combination Method 1:

Command1; command2 (a semicolon in the middle)

In this arrangement, command1 is executed first, regardless of whether command1 is successful or not.

Combination Method 2:

Command1 & command2

In this way, command2 is executed only after the command command1 is correctly executed.

Combination Method 3:

Command1 | command2

In this way, command2 is executed if command1 is not successfully executed.

Combination Method 4:

(Command1; command2 ;...)

In this way, these commands are executed together.

After reading this article, we recommend that you operate it on Linux. More profound experience!

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.