Last active
October 19, 2015 22:57
-
-
Save stefbowerman/109f473b361139dcd6b6 to your computer and use it in GitHub Desktop.
Assorted bash commands to get me through life
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copy a file from local host to remote host | |
| ################################################## | |
| scp -i ~/.ssh/{key}.pem {local_file} {username}@{host}:{directory_path} | |
| # i.e. scp -i ~/.ssh/elder-aws.pem ./my_file.php ubuntu@ec2-52-27-158-192.us-west-2.compute.amazonaws.com:/var/www/html/directory | |
| # Copy a file from a remote host to local host | |
| ################################################## | |
| scp -i ~/.ssh/{key}.pem {username}@{host}:{file_path} {local_directory} | |
| # i.e. scp -i ~/.ssh/elder-aws.pem ubuntu@ec2-52-27-158-192.us-west-2.compute.amazonaws.com:/var/www/html/directory/file.php ./my_documents | |
| # Connect to mysql (RDS instance once logged into ec2) | |
| ###################################################### | |
| mysql -h {host} -P {port} -u {username} -p | |
| # i.e. > mysql -h elderstatesman-db.ck0tqiakowb4.us-west-2.rds.amazonaws.com -P 3306 -u elderstatesman -p | |
| # Tarball file | |
| ################################################## | |
| tar -cvzf {file_name}.tar.gz directory_to_compress/ | |
| # Untarball a file | |
| ################################################## | |
| tar -xvf {file_name}.tar | |
| # Search for files modified in the last number of days | |
| ################################################## | |
| find {directory} -iname {extension} -mtime -{num_days} -print | |
| # i.e. find /var/www/html -iname "*.php" -mtime -10 -print | |
| # Restart apache on ubuntu | |
| ################################################## | |
| sudo service apache2 restart | |
| # Change permissions for all files within a specific directory | |
| ############################################################### | |
| find {dir} -type f -exec chmod {permissions_num} {} \; | |
| # i.e. find /opt/lampp/htdocs -type f -exec chmod 644 {} \; | |
| # Change permissions for all directories within a directory | |
| ############################################################### | |
| find {dir} -type d -exec chmod {permissions_num} {} \; | |
| # i.e. find /opt/lampp/htdocs -type d -exec chmod 755 {} \; | |
| # _____ _____ _______ | |
| # / ____|_ _|__ __| | |
| # | | __ | | | | | |
| # | | |_ | | | | | | |
| # | |__| |_| |_ | | | |
| # \_____|_____| |_| | |
| ################################################## | |
| # Update feature branch with stuff from master | |
| ################################################## | |
| git checkout feature-branch | |
| git rebase master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment