How to get list of all cron jobs ( crontab ) in a server

Run below as root :


for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done


If you want to see who owns that cron job run below :

for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done


getent passwd cut -d: -f1 perl -e'while(<>){chomp;$l = `crontab -u $_ -l 2>/dev/null`;print "$_\n$l\n" if $l}'

Bash Script to get public ip

#!/bin/bash




pubip=$( curl http://ip4.me 2>/dev/null | sed -e 's#<[^>]*>##g' | grep '^[0-9]' )



echo $pubip



you can replace curl command with



curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//' 

Apache hardening tips - Subhash C

# Server banner


ServerSignature Off // will not show apache version etc
ServerTokens Prod // Will hide OS version etc

# Disable TRACE requests

TraceEnable off

### Security Fixes

RewriteEngine on

RewriteCond %{REQUEST_METHOD} ^(TRACE
TRACK)

RewriteRule .* - [F]

Some Find commands regularly used for finding disk usage


find . -size +500000 -print

du -ch | grep total ( total size of directory)

du -sk * | sort -nr | head -3

find /home -type f | xargs ls -s | sort -rn | awk '{size=$1/1024; printf("%dMb %s\n", size,$2);}' | head

find / -type f -size +300000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

du -hs /home/* | grep G

du -hs /home/* | grep M

Command to import SSL certificate need for java applications

keytool -import -alias anotherdomainname -file /tmp/certificatename.cer -keystore $JAVA_HOME/jre/lib/security/cacerts

How to reset winsock entries and reset TCP/IP stack in windows7


goto command prompt then enter below two commands

netsh winsock reset catlog

netsh int ip reset reset.log hit


then reboot your pc