Skip to content

Shell

Delete line with specific string:

sed -i '/sha/d' ./*.log

Delete line that not contain specific string:

sed -i '/sha\|cas/!d' ./*.log

The most netstat command can be used on ss as well

# Listening(-l) TCP(-t)/UDP(-u) Ports
netstat -tlnp | less
netstat -ulnp | less
# All Ports
netstat -nap | less
ss -nap | less
iostat -m /dev/xvdb 1 | while read a; do echo "$a" | awk '/xvdb/ {print strftime("%Y-%m-%d %T")",", $2 }' >> $(date +'%Y-%m-%d')-iops.csv; done
# Or save it to a .csv files
iostat -m /dev/xvdb 1 | while read a; do echo "$a" | awk '/xvdb/ {sum += $2; n++; print strftime("%Y-%m-%d %T")",", sum / n",", $2 }' >> $(date +%Y-%m-%d)-iops-with-average.csv; done

Kernal panic: dmesg tail: tail -n 5 ls: ls -lhS (-S: ordering by size; -t: ordering by time) grep: grep -c (-c: count only)

Terminal Shotcut and Software’s Commands

Section titled “Terminal Shotcut and Software’s Commands”

Attach and deattach the remote session (-t to attach specific session)

tmux a -d -t Wordspace
rsync --archive --one-file-system --hard-links \
--acls --xattrs --sparse \
--human-readable --numeric-ids --delete --delete-excluded \
--itemize-changes --verbose --progress \
--exclude='*~' \
--exclude-from=root.exclude \
src dest

Reference: