Pipeline commands in the shell and parallel execution

Source: Internet
Author: User
Tags execution linux

Found that three symbols are useful when writing scripts. One is the pipe command "|", one is executing the command "&" in parallel, and the other is "&&"

The so-called pipe, acting as a function of the connection between the front and back two parts of the pipeline. Specifically, the result of executing the command before the pipe is used as the input after the pipeline. For example, when viewing DNS-related properties in Android, you can use the command getprop |grep DNS because getprop returns more results, but not all of our current concerns, using the grep command to filter the output of Getprop, Only contains the keyword DNS, which displays the properties of the Android system associated with DNS.

Execute the command "&" in parallel, which I recently learned from the Internet by searching for multithreading under Linux. Because the way to perform multiple operations on Linux at the same time is to open multiple terminal, you will find it inconvenient when the terminal is open more than once, and if there is any way to execute concurrently with multiple commands. & is the way to do this, as long as you add an ampersand between commands that need to be executed in parallel, multiple commands can be executed in parallel.

Serial execution Command "&&". If you want to see how much time a program is executing, you can view it using the command date&&./the program you need to execute &&date.

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

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.