linux redirect output multiple commands file

i queried for linux redirect output multiple commands file and wasn’t satisfied.  I figured out the solution and am sharing it here for folks

Issue?
Need to run multiple commands in a row and append output to the same file (linux)

Solution?
use a semicolon in between each command

Example:

rm -f 2000000.txt;ping+ 192.168.2.10 1450 5 15 > 2000000.txt;ping+ 192.168.2.10 1450 10 15 >> 2000000.txt;ping+ 192.168.2.10 1450 15 15  >> 2000000.txt;ping+ 192.168.2.10 1450 20 15  >> 2000000.txt;cat 2000000.txt

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.