Bash tips
Aus WikiStar
# bash history without numbers history | cut -c 8- history | cut -d' ' -f4- | sed 's/^ \(.*$\)/\1/g'
SED
# Insert string to configuration file # To append after the pattern: (-i is for inplace replace). line1 and line2 are the lines you want to append(or prepend): sed -i '/pattern/a \ line1 \ line2' inputfile # To prepend the lines before: sed -i '/pattern/i \ line1 \ line2' inputfile # Find all SSL CA activators and change string from apache to apache2 find /home/broot/ -name "*SSL_CA_activator.sh" -type f -exec sed -i 's/\/apache\//\/apache2\//g' {} ";" -exec sed -i 's/\\\/apache\\\//\\\/apache2\\\//g' {} ";" -exec sed -i 's/\/etc\/rc.d\/apache restart/\/etc\/rc.d\/apache2 restart/g' {} ";" # Finding with DSSH dssh "find /home/broot/ -name \"*SSL_CA_activator.sh\" -type f -exec ls -la {} \";\"" | less # Path correction in httpd.conf file dssh "sed -i \"s/\/usr\/local\/apache2\/icons/\/usr\/local\/apache2\/share\/icons/g\" /usr/local/apache2/conf/httpd.conf" # Find and replace find -type f -exec sed -i 's/OLD-STRING/NEW-STRING/g' {} \;
access-log auswerten
kudos @ tch
15.12.2014 - 19.12.2014
postmedien.ch
durschnitt 1200 unique sites aufrufe
~50'000 unique sites aufrufe
499 server itself unique
wirtschaft.com
durschnitt 3300 unique ip adressen pro tag
~130'000 unique sites aufrufe
28485 server itself unique
count ip
cat access_log | awk '{print $1}' | sort -n | uniq -c | sort -n
uniq ip
cat access_log | awk '{print $1}' | sort -n | uniq | wc -l
~uniqe sites
cat access_log | awk '{print $7}' | grep -v jpg | grep -v png | grep -v css |sort -n | uniq -c |sort -n | wc -l
server itself
grep 85.10.207.17 access_log |awk '{print $7}' | sort -n | uniq -c |sort -n | grep -v jpg | grep -v png
count requests per IP
zgrep moodle access_log-20150307.bz2 | grep learntools | cut -d' ' -f1 |sort | uniq -c | sort -n