Just another reference to linux useful commands
cat file.logs | grep "Desired word to be located" -C 50
# - -A (after)
# - -B (before)
# - -C (context [before + after])
find . -type f -print0 | xargs -0 dos2unix
cat /dev/null > file.sh && vi file.sh
# If you have more than one process running in the background, do this:
jobs
# use the fg to get the job by the index
fg %3
sudo find . -type f -name "*.crt"
sudo find . -type f -name "FileName"
sysctl -a | grep overco
sysctl -w vm.overcommit_memory=1
sysctl -w vm.swappiness=1
* - nofile 16384
/etc/security/limit.conf
# Edit the /etc/security/limit.conf file.
# Change the statement that specifies the value of nofiles to 8000.
# If you want the change to take effect in the current session, type ulimit -n 8000.
yum install jq
cat example.json | jq '.[] | .HostsPath'
ps aux | awk '{print $6/1024 " MB\t\t" $11}' | sort -n
ps aux | sort -n
ps aux --sort -rss
ps aux | sort -rn -k 5,6
ps --sort -rss -eo rss,pid,command | head
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr
pstree -hgcp
df -h
free -m
vmstat -SM 1 100
alias ducks='du -cks * | sort -rn | head'
ducks
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: localhost:80" \
--header "Origin: http://localhost:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://localhost:80/
ssh-copy-id -i ~/.ssh/mykey user@host
sudo ip addr flush interface-name
sudo systemctl restart networking
declare -a array=($(tail -n +2 /proc/net/tcp | cut -d":" -f"3"|cut -d" " -f"1")) && for port in ${array[@]}; do echo $((0x$port)); done
mount -t cifs -o username=<change it> //network-folder /local-folder
systemctl status firewalld.service
sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0
sudo firewall-cmd --reload
sudo iptables -L
sudo iptables -L --line-numbers
sudo iptables -A FORWARD -i docker0 -o eth0 -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o docker0 -j ACCEPT
sudo iptables -I INPUT -j ACCEPT
sudo journalctl -fu NetworkManager
## Does not set any bits (TCP flag header is 0) ##
nmap -sN 192.168.0.1
## Sets just the TCP FIN bit ##
nmap -sF 192.168.0.1
## Sets the FIN, PSH, and URG flags, lighting the packet up like a Christmas tree ##
nmap -sX 192.168.0.1
nmap -v -sS -A -T4 192.168.0.1
watch -n1 -d "iptables -vnxL | grep -v -e pkts -e Chain | sort -nk1 | tac | column -t"