Skip to content

Instantly share code, notes, and snippets.

@davidsword
Last active April 25, 2018 17:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidsword/8f9473242c53824c9481e17ac427069a to your computer and use it in GitHub Desktop.
Save davidsword/8f9473242c53824c9481e17ac427069a to your computer and use it in GitHub Desktop.
πŸ”₯🍺 Terminal Cheat Sheet

πŸ“˜ LAMP πŸ“˜ MySQL πŸ“• Terminal πŸ“˜ htaccess


COPY CONTENTS AND PRESERVE PERMISSIONS

sudo cp -rp source/. destination/

HOSTS FILE

sudo vi /etc/hosts
dscacheutil -flushcache
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;

BASH EDIT

vi ~/.bash_profile
source .bash_profile

TRUNICATE A FILE

> filename.log

SECURE COPY

scp -r ~/Desktop/folder/* user@host:/var/www/dest_folder
scp -r root@host:/var/dir/* ~/destination/
scp -r user@host:"file1.log file2.log" ~/Desktop

ZIP

zip -r newzipname.zip /html/dir/to/zip

FIND VARIOUS

find / -type f -perm
find / -type f -perm 0777 -exec chmod 775 {} \; -exec chgrp -R www {} \;
find / -type d -exec chmod 777 {} \;
find . -type f -size +100M
find ./ -regex ".*\(php\|html\|tpl\)$"
grep -r "filemtime" /var/www/wp-content/themes/
find /dir/to/search -type f | xargs grep 'og:locale'
find /var/www/ -type d -exec chmod 755 {} \;
find /var/www/ -type f -exec chmod 644 {} \;

TERMINAL HIDE

> chflags nohidden ~/Library/

COOL

npm install -g learnyounode

SYMBOLIC LINKING

ln -s {DESTINATION} {ALIAS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment