How to Run Multiple Linux Commands at Once in Linux Terminal [Essential Beginners Tip]

Running two or more commands in one line can save you a good deal of time and help you become more efficient and productive in Linux.

There are three ways you can run multiple commands in one line in Linux.

Let me show you in detail how you can chain commands in Linux.

The simplest of them all is the semicolon . You just combine several commands that you want to run using in the following fashion.

Here cmd1 will run first. Irrespective of whether cmd1 runs successfully or with error cmd2 will run after it. And when cmd2 command finishes cmd3 will run.

Lets take an example you can practice easily if you want to. .

In the above command you first create a new directory named newdir with mkdir command. Then you switch to this newly created directory using cd command. Lastly you print your current location with pwd command.


Read Full Post

News Link:
RSS Link:

Linux Chatter is a news aggregator service that curates some of the best Linux, Cloud, Technical Guides, Hardware and Security news. We display just enough content from the original post to spark your interest. If you like the topic, then click on the 'read full post' button to visit the author's website. Use Linux Chatter to find content from amazing authors!

Note: The content provided has been modified and is not displayed as intended by the author. Any trademarks, copyrights and rights remain with the source.

Disclaimer: Linux Chatter sources content from RSS feeds and personal content submissions. The views and opinions expressed in these articles are those of the authors and do not necessarily reflect those of Linux Chatter.