Skip to content

Instantly share code, notes, and snippets.

@susanBuck
Last active February 10, 2024 14:34
Show Gist options
  • Save susanBuck/e93caea662cf53f361abc2071603a0d6 to your computer and use it in GitHub Desktop.
Save susanBuck/e93caea662cf53f361abc2071603a0d6 to your computer and use it in GitHub Desktop.
Bash Aliases
# Edit the bashrc file
alias configedit='code ~/.bashrc'
# Edit the alias config file
alias configalias='code ~/.bash_aliases'
# Recognize changes to bashrc config
# (which will also recognize changes to the alias config file)
alias configrefresh='source ~/.bashrc'
# Restart server and PHP
alias restart='systemctl restart nginx; systemctl reload php8.2-fpm'
# Edit php.ini file
alias phpini='code /etc/php/8.2/fpm/php.ini'
# View server error log file
alias errorlog='code /var/log/nginx/error.log'
# Enable swap
alias swap="sudo fallocate -l 4G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile && sudo echo '/swapfile none swap sw 0 0' >> /etc/fstab"
# Laravel permissions
alias lp='sudo chown -R www-data storage; sudo chown -R www-data bootstrap/cache'
# apt update
alias aptupdate='sudo add-apt-repository ppa:ondrej/php && sudo apt update'
# Upgrade PHP
alias upgradephp='sudo apt -y install php8.2 php-common php8.2-apcu php8.2-cli php8.2-common php8.2-curl php8.2-fpm php8.2-mysql php8.2-opcache php8.2-readline'
# Install extensions needed for Laravel
alias laravelextensions='sudo apt install php8.2-curl php8.2-dom php8.2-mbstring php8.2-xml php8.2-mysql zip unzip'
# Github key
alias sshkey='cd ~/.ssh && ssh-keygen -t rsa -C "Demo" && cat id_rsa.pub'
# Suppress Composer as root warning
alias composerroot='export COMPOSER_ALLOW_SUPERUSER=1; composer show;'
# Install composer
alias composerinstall='cd /usr/bin && curl -sS https://getcomposer.org/installer | sudo php && sudo mv composer.phar composer'
# Uninstall MySQL
alias uninstallmysql='sudo systemctl stop mysql && sudo apt remove -y --purge mysql-* && sudo rm -rf /usr/bin/mysql /var/lib/mysql /etc/mysql /var/log/mysql && sudo apt-get -y autoremove'
# Install MySQL
alias installmysql='sudo apt update && sudo apt install -y mysql-server'
# Uninstall MariaDB
alias uninstallmariadb='sudo systemctl stop mysql && sudo apt remove -y --purge mariadb-* && sudo rm -rf /usr/bin/mysql /var/lib/mysql /etc/mysql /var/log/mysql && sudo apt-get -y autoremove'
# Install MariaDB
alias installmariadb='sudo apt update && sudo apt install -y mariadb-server'
# Function to remove previous lines
cl () {
local j
for ((j = 0; j <= ${1:-1}; j++ )); do
tput cuu1 # moves the cursor up one line in the terminal
done
tput ed # erase from the current cursor position to the end of the screen
}
#
# Make it so anything that is pasted is not automatically highlighted
#
bind 'set enable-bracketed-paste off'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment