Linked Questions

106
votes
4answers
61k views

What is the difference between “&&” and “;” when chaining commands [duplicate]

What is the difference between the following methods of chaining commands? cmd1; cmd2 cmd1 && cmd2
141
votes
3answers
60k views

What's the difference between semicolon and double ampersand && [duplicate]

What is the difference between echo "Hello " ; echo "world" and echo "Hello " && echo "world" Both seems to run the two commands after each other.
20
votes
5answers
11k views

Is there a difference between `;` and `&&` and `|`? [duplicate]

When you want to run multiple commands you can use ;, && and | Like this: killall Finder; killall SystemUIServer, cd ~/Desktop/ && rm Caches Or: man grep | man cat for example. But, ...
32
votes
2answers
19k views

Difference between executing multiple commands with && and ; [duplicate]

What's the difference between executing multiple commands with && and ;? Examples: echo "Hi\!" && echo "How are you?" and echo "Hi\!"; echo "How are you?"
11
votes
2answers
6k views

How to redirect the output of a command to an already existing file without deleting its contents? [duplicate]

I am making a backup of some files and am creating a checksum file, checksums.txt, to later check the integrity of my data. However pasting each checksum manually into the file is inconvenient since ...
13
votes
3answers
24k views

What does “>” do vs “>>”? [duplicate]

I am currently doing preparation for my GCSE computing controlled assessment on Linux. I type ls > list and ls >> list into the command line, but it does not do anything. I have googled it ...
18
votes
2answers
12k views

What does the < (left chevron / triangle bracket) do? [duplicate]

I understand that the > (right chevron) is for redirecting the STDOUT of a program to a file, as in echo 'polo' > marco.txt will create a text file called marco.txt with polo as the contents ...
14
votes
2answers
16k views

What is &>> in a shell script [duplicate]

In a script I have inherited the output of one of our programs is put in to a file with: program &>> result.txt I have been reading in my book "Learning the bash shell" at home over the ...
9
votes
2answers
16k views

How do i run a command only after previous command is unsuccessful in bash? [duplicate]

We use && operator to run a command after previous one finishes. update-system-configuration && restart-service but how do I run a command only if previous command is unsuccessful ? ...
5
votes
3answers
9k views

What does || mean in bash? [duplicate]

Apologies if this is a duplicate post. I did try searching to see if someone already asked/answered this but didn't find anything. What does || mean in bash? For example, in researching steps to ...
4
votes
2answers
5k views

What is the difference between > and >> (especially as it relates to use with the cat program)? [duplicate]

Suppose that I have a file called temp.txt. Using the cat program, I would like to add the contents of this file to the end of myfile.txt -- creating myfile.txt if it does not exist and appending to ...
0
votes
1answer
36k views

How do I use: cat << EOF [duplicate]

I am little confused and not sure, how to add the cat << EOF style to my script. Would really appreciate a little feedback and help. Here is my script !/bin/sh #This is a disk mailer script ...
7
votes
1answer
3k views

Difference between parentheses and braces in terminal? [duplicate]

( du /etc; du /var; ) > tmp.txt { du /etc; du /var; } > tmp.txt Is there a difference between the () and {}? The output of tmp.txt seems exactly the same, and I was wondering whether i'm ...
4
votes
1answer
8k views

< and << in UNIX /Linux [duplicate]

What are the operators <<and < used for in Linux? For example cat << abc.txt
3
votes
2answers
2k views

Convert file contents to lowercase and store result in same file [duplicate]

I use the following command to convert my input file contents to lowercase tr A-Z a-z < input > output This command works fine. But when I try to store the output in input file itself, it is ...

15 30 50 per page