Permission Cheat Sheet
chown -R www-data:www-data ./
// set the proper owner
find . -type f -exec chmod 644 {} \+
// Recursively set FILE permissions.
find . -type d -exec chmod 755 {} \+
// Recursively set DIRECTORY permission
Devops Cheat Sheet
Change the $VAR sign with the appropriate variables
ps auxww -H
// to check running process and show hierarchies (child-parent)
pgrep -fl php
// PHP related processes
strace -f -p $PID
// What is the process doing
lsof -p $PID
// What files the process open?
kill xxxx
kill xxxx yyyy zzzz
pkill <name of process>
pkill -f <word in process name>
// many ways to Kill
watch 'ps aux | grep ruby'
// Keep an eye of a process
free -m
cat /proc/meminfo
// Check for Free memory
vmstat 1
// Are we swapping?
ps aux --sort=-resident|head -11
// Check for memory hoggers (one who leak?)
lsof | grep delete
// Files marked of deletion, but not deleted yet
df -h
// Overview of disks
du -hs
// Usage of this dir and sub-dirs
find . -size +100M
// Files over 100megs
ls -al /tmp
// Some file that can be removed?
find . -mtime -7
// Files created within last 7 days
find . -mtime +14 -type f -name '*.gz'
// Files *.gz older than 14 days
tail -f file.log | grep 192.168.1.1
// Monitor a log file
lsof -nPi tcp
// TCP in use
ip addr
ifconfig
// IP
host 192.1.1.1
host myrouter
// Host -> IP resolution
curl -LI http://google.com
// Curl header (and follow redirect)
tcptraceroute google.com
// Traceroute using TCP
iptables -L
// List all blocking rules
netstat -tlnp
// Show all listeners (servers)
wget cachefly.cachefly.net/100mb.test -O /dev/null
// Speedtest (Do not run in production!)
lastlog
// Get list of users, and when they are last logging-in
cat /etc/group
groups
// Get all groups