Last active
March 8, 2023 12:47
-
-
Save justinhartman/7347de7127f8d0b00a444ae46e82a1d7 to your computer and use it in GitHub Desktop.
Bash Aliases and Colours
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
# Bash | |
alias ls='ls --color=always' | |
alias ll='ls -lh --color=always' | |
alias la='ls -lha --color=always' | |
alias ..='cd ..' | |
alias ...='cd ...' | |
alias ....='cd ....' | |
# Apt | |
alias apt-update='sudo apt update' | |
alias apt-upgrade='sudo apt update && sudo apt upgrade' | |
alias apt-install='sudo apt install' | |
alias apt-remove='sudo apt remove' | |
alias apt-search='sudo apt search' | |
# Search | |
alias grep='grep -n --color=always' | |
export GREP_COLOR='1;35;40' | |
# Sudo | |
alias sudo-www='sudo -u www-data' | |
# Laravel | |
alias artisan="php artisan" | |
# Git commands | |
## General | |
alias gcf='git config --list' | |
alias gd='git diff' | |
## Clone/Checkout | |
alias gcr='git clone $1' | |
alias gcl='git clone --recurse-submodules' | |
alias gcm='git checkout master' | |
alias gcb='git checkout -b' | |
## Commit | |
alias gcam='git commit -a -m' | |
alias gcmsg='git commit -m' | |
## Push & Pull | |
alias gp='git push' | |
alias gpa='git push origin --all && git push origin --tags' | |
alias gl='git pull' | |
alias glo='git pull origin master' | |
## Tagging | |
alias gts='git tag -s' | |
## Stats/Status | |
alias gsb='git status -sb' | |
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'" | |
# Folder sizes. | |
# Returns a recurring list of folders with the total folder size, sorted from | |
# smallest to biggest in human readable format. | |
dufs() { | |
du -chd 1 "$1" | sort -h | |
} | |
## To enable the two commands below read: | |
## https://justhart.com/extremely-fast-compression-with-lz4/ | |
## This will install what you need for super fast archive creation/extraction. | |
# Make an LZ4 archive | |
#lz4make () { | |
# tar -c - "${1}" | lz4 - "${1}.tar.lz4" | |
#} | |
# Extract an LZ4 archive | |
#lz4extract () { | |
# pv "${1}" | lz4 -dc - | tar -x | |
#} |
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
# Fixes locale issues. | |
export LANGUAGE=en_GB.UTF-8 | |
export LANG=en_GB.UTF-8 | |
export LC_ALL=en_GB.UTF-8 | |
export LC_TERMINAL=en_GB.UTF-8 | |
# Load bash which also gives us colours :-) | |
exec bash |
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
## Append this function to your ~/.bashrc file. | |
# Folder sizes. | |
# Returns a recurring list of folders with the total folder size, sorted from | |
# smallest to biggest in human readable format. | |
dufs() { | |
du -chd 1 "$1" | sort -h | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment