Last active
August 29, 2015 14:23
-
-
Save wesruv/cd2b8d87a5f5cdb6d46c to your computer and use it in GitHub Desktop.
Bash helpers
This file contains 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
# Awesome aliases I have ------------------------ | |
## https://bitbucket.org/wesruv/dotfiles/src/297dc482c49ff31e2dd810fc769a2231f0bcb480/.bashrc?at=master | |
## Adds ~/.ssh/id_rsa to your session so you don't have to enter your SSH keys pass all the time | |
sshadd | |
## Changes the owner of the webroot to apache (default user is in the apache group) | |
ownwww | |
## Changes the home folder user and group to the default user | |
ownhome | |
## cd1, cd2, cd3, cd4, cd5, and cd6. Will go up the number of levels the number is | |
cd1 | |
## Reloads the .bashrc file in case you add new stuff to it and don't feel like rebooting | |
sb | |
# Linuxy stuffs ---------------- | |
## List files | |
ll # Ubuntu alias for ls -l | |
ls | |
# -a to show all including hidden | |
# -l is long listing | |
# -t sorts by modification date descending | |
## Shutdown | |
sudo shutdown -h now #-r is reboot | |
## BECOME GOD | |
sudo -s | |
## Copy -Rp means recursive and preserve perms | |
cp -Rp source target | |
## Symlink | |
ln -s target newlink | |
## Change owner | |
chown owner[:group] folder | |
## Change perms on settings.php to 400 | |
chmod 400 settings.php | |
## Change perms for all folders to 775 (be careful where you do this) | |
find <path to scan> -type d -exec chmod 775 {} \; | |
## Change perms for all files to 664 (be careful where you do this) | |
find <path to scan> -type f -exec chmod 664 {} \; | |
## Make directory | |
mkdir name | |
## Delete a directory that's empty (makes sure its' empty) | |
rmdir directory | |
## Delete the mutha (and don't axe me no questions) | |
rm -rf | |
## Restart Apache | |
sudo service apache2 restart | |
### The service name (apache2) is tab-completable | |
## Unzip a gzip file | |
gzip -d FILENAME.GZ | |
## Zip tar.gz | |
tar czf FILENAME.tar.gz LOCATION | |
## Zip up webroot with date in filename | |
tar czf webroot`date +%Y%m%d_%H%M`.tar.gz webroot | |
## Unzip tar.gz | |
tar xzf FILENAME.tar.gz {location} | |
## Will stage new/untracked files, modified files, as well as deleted files. | |
### Find files | |
sudo find / -print | grep -i "FILENAME.EXT" | |
### Find Directory | |
sudo find / -type d -name DIRNAME -print |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment