last 100k requests by networks /32:
tail -n100000 /var/log/apache2/access.log| grep " 200 "|awk '{print $1}' | awk '{sub(/\.[0-9][0-9]?[0-9]?$/,".x",$1)} 1' | sort -n | uniq -c | sort -nr | head -20

last 100k requests by IP:
tail -n 100000 /var/log/apache2/access.log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -20

total requests by IP:
cat /var/log/apache2/access.log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -20

apache's top requests:
cut -d' ' -f7 /var/log/apache2/access_log | sort | uniq -c | sort -rn | head -20

requests from IP:
cut -d' ' -f1 /var/log/apache2/access.log | sort | uniq -c | sort -rn | head -25 | column -t


filesystem creation date:
rpm -qi basesystem | grep "Install Date"
fs=$(df / | tail -1 | cut -f1 -d' ') && tune2fs -l $fs | grep 'Filesystem created'


veliki fajlove (npr za dev.smartweb.rs)
find /var/www -type f -size +502400k -exec ls -lh {} \;


find external IP from CLI:
dig +short myip.opendns.com @resolver1.opendns.com
curl 'https://api.ipify.org?format=json'

top ten memory utilization process:
ps axo rss,comm,pid | awk '{ proc_list[$2]++; proc_list[$2 "," 1] += $1; } END { for (proc in proc_list) { printf("%d\t%s\n", proc_list[proc "," 1],proc); }}' | sort -n | tail -n 10


mysql workload:
mysqladmin processlist


swap space
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less


sort files by size:
du -h --max-depth=1 | sort -h



cpanel find files outside of user directory for user 'cpanel_username'
cpaneluser=cpanel_username && find / -path /home/virtfs -prune -o -path /home/${cpaneluser} -prune -o -user "${cpaneluser}" -type f -ls > files_outside_homedir.txt 2>/dev/null

find /tmp -type f -user cpanel_username -name '.spamassassin*' -exec mv {} /root/user_homedir/tmp_spamassassin/ \;


clear pagecache (for dentries and inodes 2, for pagecache, dentries and inodes 3):
sync; echo 1 > /proc/sys/vm/drop_caches

clear cache for cpanel
echo 1 > /proc/sys/vm/drop_caches


roundcube redesign: https://www.awsmonster.com/cwp-customize-roundcube-webclient-for


bash show full hostname: in ~/.bashrc
export PS1="$(hostname -f):~$ "


dovecot quota recalculation:
doveadm quota recalc -A



check ssl certificate
openssl x509 -in certificate.crt -text -noout


check which process uses swap
for file in /proc/*/status; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less


successful login to cpanel
grep "login=1&post_login=" /usr/local/cpanel/logs/access_log | awk '{print $1" : "$3" : "$4}'


load average (also to read: https://www.brendangregg.com/blog/2017-08-08/linux-load-averages.html)
/proc/loadavg
vmstat 5 60


clear mailqueue from noreply@ius.bg.ac.rs:
postqueue -p | egrep -v '^ *\(|-Queue ID-' | awk 'BEGIN { RS = "" } { if ($7 == "noreply@ius.bg.ac.rs") print $1} '| tr -d '*!'| postsuper -d -

postqueue -p | egrep -v '^ *\(|-Queue ID-' | awk 'BEGIN { RS = "" } { if ($7 == "rpavlovic@aob.rs" && $5 == 8) print $1} '| tr -d '*!'| postsuper -d -


whatis

rsa key generate and install
ssh-keygen -t rsa -b 2048
ssh-copy-id id@server



truenas show active connections
netstat -n -f inet -p tcp
same for ubuntu
netstat -n -p tcp


find domain on cpanel
grep domain.com /etc/userdomains

SSL check:
openssl x509 -in /root/.acme.sh/birn.rs_ecc/fullchain.cer -text -noout | grep -e efore -e fter