• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / How To / Run Multiple Commands In Linux Shell Script

Run Multiple Commands In Linux Shell Script

By Sourabh / May 24, 2023 Category: How To, Ubuntu

How to run multiple Linux commands at once or run multiple Linux commands in one line. Running multiple commands in a single line Linux is easy, learn how:

How to Run Multiple Linux Commands in One Line

There are 3 ways to run multiple commands in one line in Linux:

  • ; Command 1 ; Command 2 – This will run command 1 first and then command 2
  • && Command 1 && Command 2 – This will command 2 only if command 1 ends successfully
  • || Command 1 || Command 2 – This will command 2 only if command 1 fails

See below to learn the use in full details:

  1. Using ;

When you use ; no matter the first command (command 1) run successfully or not, always run the second command (command 2).

  1. Using &&

When you use && the second command (command 2) will run only when the first command (command 1) run successfully.

  1. Using ||

When you use || the only when the second command (command 2) will be executed only when the first command (command 1) fails to run.

Running more than 2 commands at once in one line

You can use ; to run multiple Linux commands in one line. Simply use semicolon (;) to add/combine multiple commands in single line. The following format can be used:

command 1; command 2; command 3

NOTE: The command 1 will run first, then command 2 will run and then the command 3 will run. The commands will run irrespective of whether the previous command has beene xecuted successfully or not.

Similarly you can use command 1 && command 2 && command 3.

Primary Sidebar

Latest Posts

Downlaod Ubuntu 26.10 Stonking Stingray

How To Shutdown Linux With A 15 Minute Delay And Message

Using Linux Terminal How To Get Total Disk Size In GB

Count And Find Number Of Files In A Linux Directory Using Command

Check How Many Users Are Created In Linux Ubuntu

How To Check User Permissions In Linux Using Command

Check Which Folder Is Taking More Space In Ubuntu Linux

How to Install Claude Desktop App in Ubuntu Linux

Job Scheduling Using At Command In Linux With Examples

How To Check Permissions Of A Directory In Linux Command

© 2026 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap