Linked Questions

3 votes
1 answer
11k views

Semicolon or double ampersand for chaining commands? [duplicate]

When writing a bash script, which is better to chain commands, a semicolon ; or double ampersand &&?
Micheal Saunders's user avatar
2 votes
1 answer
3k views

How to chain make command with git clone? [duplicate]

I want to automate pulling git repo and building that repo unattended. Is there any way I can clone repository and run make immediately after running git clone? Something like: git clone << ...
Humble's user avatar
  • 153
0 votes
1 answer
1k views

Script with commands split & cat [duplicate]

I want to split an image.jpg into parts and merge it again. I used the following commands: split -b 1440 image.jpg # It divides it into 6 parts. cat xaa.jpg xab.jpg xac.jpg xad.jpg xae.jpg xaf.jpg &...
thmk's user avatar
  • 1
0 votes
0 answers
44 views

choice of command-line operator and running a bunch of command line commands one after another [duplicate]

I wrote a simple python script that outputs a bunch of linux commands for a custom image manipulation command-line tool. As an example, here is what the python script creates: img_dae_create /d /t /19 ...
SkyeBoniwell's user avatar
40 votes
8 answers
25k views

Why combine commands on a single line in a Bash script?

I am new to Linux and Bash scripting. At work, I've seen Bash scripts with constructions similar to this: mkdir build && cd build && touch blank.txt Or: mkdir build; cd build; touch ...
AlainD's user avatar
  • 849
31 votes
3 answers
83k views

How to execute several commands after each other with one request to the terminal (without using a file)?

I could (1) prepare a file with typed commands separated by end-line, (2) make it executable, (3) run it from a file-system manager or the terminal. But this is ridiculous for not repeatable and ...
Esamo's user avatar
  • 1,522
36 votes
2 answers
85k views

How to combine multiple commands in terminal?

I have the following commands. cd import zcat urls1.sql.gz | mysql -u root -p urls cd /var/www/project1/ nano 1.php As of now I'm executing it one by one. Is there a way to combine those commands ...
PrivateUser's user avatar
19 votes
1 answer
14k views

Run two commands in case of || or &&

I have read about && and || and I'd like to run two commands in the false case. I have tried ; but that is running always. I have tried putting it in curly braces { command1; command2 } but ...
Thomas Weller's user avatar
8 votes
4 answers
6k views

How to start two Ubuntu applications in one go?

Lets suppose that there are two binary files, e.g. XXX and YYY, at destination /usr/bin/. I want to start them at once, always! In other words, when I type the name of either of those in unity, I want ...
user88349's user avatar
  • 309
4 votes
1 answer
4k views

How do I recursively zip all subfolders in a directory?

Currently, I have this directory structure: /Downloads /Download 1/ /Download 2/ /Download 3/ ... I would like to have this directory structure: /Downloads Download 1.zip ...
sameetandpotatoes's user avatar
2 votes
1 answer
753 views

What are the steps of this command using ; || and &&

Note: A B C are commands..... Please tell what the step process would be of these commands A || B && C = A && B ; C = What I am really after is something like this (but would like ...
R0tten's user avatar
  • 21
1 vote
1 answer
821 views

How to restore my Firebird database and modify owner settings in a single command line?

I am using Ubuntu 18.04.4 LTS and I've recently upgraded from Firebird 2.5 to Firebird 3.0. Prior to upgrading, I was restoring my local database with the following unzip&replace command: zcat /...
mickmackusa's user avatar
0 votes
1 answer
155 views

Two commands at once in Bash

I want to add a bash command that does the following: Currently, I need to run this: $ pdflatex <filename>.tex | open <filename>.pdf Is there any way to convert that into something like ...
Landmaster's user avatar
0 votes
0 answers
176 views

need a single repository as argument

Help need to fix this problem, Error: need a single repository as argument I wrote this sudo add-apt-repository ppa:ondrej/php sudo apt-get update I am about to add php7 ppa:
Janice Hadap's user avatar