Tech Tips from Another Lifetime

The following is mostly for my own personal reference. About 5 years ago, I worked as a technical support agent for a fairly large webhosting company that used to be located in Utah, and at the time I kept a small Wordpress site with some tips or code snippets that often came in handy. I was cleaning out soem old files, and came across the SQL dump of that site when I left that job. I’m turning them all into a post here for future reference.

MTR - Combo of ping and traceroute

1
2
3
4
5
6
7
8
9
$ mtr --report google.com
Start: 2018-07-07T17:31:19-0600
HOST: sean                        Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- _gateway                   0.0%    10    0.7   0.8   0.7   0.9   0.1
...
 14.|-- 108.170.234.125            0.0%    10   30.5  30.5  30.4  30.6   0.1
 15.|-- 108.170.247.129            0.0%    10   32.0  32.2  31.9  32.7   0.3
 16.|-- 209.85.242.103             0.0%    10   31.3  31.2  31.2  31.3   0.1
 17.|-- lax02s23-in-f206.1e100.ne  0.0%    10   29.9  29.9  29.8  30.1   0.1

Curl Debug

1
$ curl --trace-ascii debugdump.txt

Apache: Redirect HTTP to HTTPS

1
2
RewriteEngine On\r\nRewriteCond %{HTTPS} !on
RewriteRule (.*) <a href="https://%%7BHTTP_HOST%7D%%7BREQUEST_URI%7D" target="_BLANK">https://%{HTTP_HOST}%{REQUEST_URI}</a>

Use exigrep to search EXIM logs

1
$ sudo exigrep "[email protected]" /var/log/exim_mainlog.{14..17}.gz

Change File/Folder Permissions recursively to 644755

Source: http://rainsoftletters.wordpress.com/2008/07/22/recursively-chmodi-only-directories-or-files/

1
2
$ find . -type d -exec chmod 755 {}
$ find . -type f -exec chmod 644 {}

Recursive Terminal File Count

1
$ ls -R | wc -l

Debuggin WP Hacks

  • Use mtime to see if anything was modified recently
  • Use something like Sucuri, wepawet, unmasked parasites, etc for surface level hacks that are part of the discoverable file structure

Flush the DNS Cache in Windows or Mac

  • Mac: $ dscacheutil -flushcache
  • Windows: $ ipconfig /flushdns

Count IP Addresses within an Access Log

1
$ file/path/to/log.txt | cut -f1 -d '' '' | sort | uniq -c | sort -g -r | head

Find files older than DAY

1
$ find ./cur/* -type f -ctime +[DAY]

Use -ctime for created date and -mtime for last modified date. Probably be careful with this one.

Show Disk Usage, Sorted by Size

1
$ du -hs * | sort -hr

Comments

To leave a comment, visit this post's issue page on GitHub. A GitHub account is required, since I host this site's comments on GitHub.