Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
Linux .bashrc aliases
# Edit the hosts file
alias edit-hosts='sudo gedit /etc/hosts'
# Edit this file
alias edit-bash='sudo gedit ~/.bashrc'
# Apply changes in this file to current terminal session
alias refresh-bash='source ~/.bashrc'
# Switch to local web root
alias www-root='cd /var/www/html'
# Flush DNS cache
# First install nscd: sudo aptitude install nscd
alias flush-dns='sudo /etc/init.d/nscd restart'
# Edit virtual hosts file
alias edit-vhosts='sudo gedit /etc/apache2/sites-available/myconfig.conf'
# Edit Apache config
alias edit-apache-config='sudo gedit /etc/apache2/apache2.conf'
# Edit PHP ini file
alias edit-phpini='sudo gedit /etc/php5/apache2/php.ini'
# Restart Apache
alias apache-restart='sudo /etc/init.d/apache2 restart'
# Open Apache errors log
alias apache-errors='gedit /var/log/apache2/error.log'
# Check Apache configuration
alias apache-check-config='apache2ctl -S'
# Check Apache virtual hosts
alias apache-check-vhosts='apache2ctl -t -D DUMP_VHOSTS'
# Set localhost default permissions for all files in cwd and below
# Replace [user] with your username
alias perms-localhost='sudo chown -R [user]:www-data *;
sudo chown -R [user]:www-data .[^.]*;
sudo chmod 775 $(find . -type d);
sudo chmod 664 $(find . -type f);'
# Copy WordPress local config file from Gist, with prompts for settings
alias copy-wp-config-local='curl -o wp-config-local.php;
echo "DB name: "; read dbname;
echo "DB user: "; read dbuser;
echo "DB password: "; read -s dbpassword;
echo "Table prefix: "; read dbprefix;
sed -i "s/\[\[local-db-name\]\]/${dbname}/g" wp-config-local.php;
sed -i "s/\[\[local-db-user\]\]/${dbuser}/g" wp-config-local.php;
sed -i "s/\[\[local-db-password\]\]/${dbpassword}/g" wp-config-local.php;
sed -i "s/\[\[db-prefix\]\]/${dbprefix}/g" wp-config-local.php;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.