common command line
#make alias for easy access to commands
~/.bash_profile
#apache log
nano /var/log/apache2/error.log
#apache config
/etc/apache2/apache2.conf #stage
/etc/apache2/mods-available/mpm_prefork.conf #prod
# dayly-use command-line tools
find . -name "dir.php" -type f
touch # make file (name.extension)
mkdir # make dir
rmdir # remove dir
rm -rf # remove all files
cd # move to folder
ls // # list all files
ls -1 # list in 1 row∏
ls -lt #list with more info
du -hs folderpath # calculate folder size
tar --strip-components=1 -zxvf filename # decompress tar file
mv -v folder/* folder/ # move stuff */
wget -r --no-parent # Download open folders from url
# Launch Sublime Text 3 from the command line
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
# ssh tunnel for local mysql
ssh -L 3306:e195abe983e2704aafbb75c12380928352af2038.rackspaceclouddb.com:3306 hllanquin@162.242.163.130
# file permissions
chmod -R 755 *foldername
# change permissions on terminal
sudo chown -R llanquin:staff /usr/local/share
sudo chown -R hllanquin:www-data confirmation.php
# reset apache memcache
service memcached restart
# server user list
cut -d: -f1 /etc/passwd
# restart apache
sudo service apache2 restart
# mysql delete spam comments
DELETE FROM wp_comments WHERE comment_approved = 0
# Find the latest file by modified date
find . -type f -exec ls -lt \{\} \+ | head
# change osx default screenshot route
defaults write com.apple.screencapture location ~/Desktop/Screenshots/;killall SystemUIServer
# modify my hosts file
c:\Windows\System32\Drivers\etc\hosts # windows
sudo nano /private/etc/hosts # osx 10.8
dscacheutil -flushcache # dns flush
# find all installed apps
system_profiler -detailLevel full SPApplicationsDataType
# Copy specific file extensions and delete originals
rsync -avz --include '*.png' --exclude '*' --remove-source-files ~/public_html/hectorllanquin/ ~/public_html/hectorllanquin/img/