Difference between revisions of "Bash oneliners"

From UVOO Tech Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
```
 +
bash <(curl https://raw.githubusercontent.com/example/scripts/foo.sh)
 +
```
 +
 
```
 
```
 
grep -rl oldtext . | xargs sed -i 's/oldtext/newtext/g'
 
grep -rl oldtext . | xargs sed -i 's/oldtext/newtext/g'
Line 8: Line 12:
  
 
```
 
```
for ip in $(cat ips.txt | awk '{print $
+
for ip in $(cat ips.txt | awk '{print $1}'); do if ping
2}'); do if ping -c 1 -w 2 "$ip" &>/dev/null ; then echo "$ip up"; fi; done
+
-c 1 -w 2 "$ip" &>/dev/null ; then echo "$ip up"; fi; done
 
```
 
```

Latest revision as of 22:45, 6 December 2023

bash <(curl https://raw.githubusercontent.com/example/scripts/foo.sh)
grep -rl oldtext . | xargs sed -i 's/oldtext/newtext/g'
find /home/www \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g'
for ip in $(cat ips.txt | awk '{print $1}'); do if ping
 -c 1 -w 2 "$ip" &>/dev/null ; then echo "$ip up"; fi; done