diff --git a/misc/bash.md b/misc/bash.md index 964f52d..369214c 100644 --- a/misc/bash.md +++ b/misc/bash.md @@ -7,6 +7,7 @@ Remove duplicate lines inside a text file | `awk '!seen[$0]++' filename` Find lines ONLY in file2 (sorted) | `comm -13 file1 file2` Find lines ONLY in file2 (unsorted) | `comm -13 <(sort file1.txt) <(sort file2.txt)` Ping each host once and only show replies (10.0.0.1/24)| `for i in {1..254}; do ping -c 1 -W 1 10.0.0.$i \| grep 'from'; done` +Perform DNS lookup on each hostname in file | `while read hostname; do host "$hostname"; done < hosts.txt` ### IP addresses Function | Command @@ -23,4 +24,4 @@ Function | Command ------------ | ------------- World-writable folders | `find / -writable -type d 2>/dev/null` World-writable files | `find / -writable -type f 2>/dev/null` -Exclude /proc/ and /sys/ | `egrep -v "/proc/\|/sys/"` \ No newline at end of file +Exclude /proc/ and /sys/ | `egrep -v "/proc/\|/sys/"`