configs/.bash_aliases
2023-03-19 01:13:20 -05:00

128 lines
4.5 KiB
Bash
Executable File

# Application management
# Install something bypassing the prompts
alias inst='sudo apt-get install -y'
# Do a basic update. Ubuntu only
alias update='sudo apt-get update -y && sudo apt-get upgrade -y'
# Upgrade the fuck out of just fucking everything
alias upgrade_all='sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y && sudo apt-get autoclean -y && sudo apt-get --with-new-pkgs upgrade -y'
# Search packages. Ubuntu Only
alias pacs='apt-cache search'
# Uninstall. Ubuntu only.
alias burn='sudo apt-get autoremove'
# General
# Get $HOME quick
alias ~='cd ~/'
# A Nice display of all files in a directory
alias ll='ls -hog'
# Above but...different I'm sure
alias lsa='ls -lah'
# List stuff sorted by size
alias lt='ls --human-readable --size -1 -S --classify'
# Grep command history fast-like
alias gh='history|grep'
# lol
alias please='sudo'
# sometimes it feels good
alias fucking='sudo'
# Install bat. It's better.
alias cat='batcat'
# Source this very file
alias src='source ~/.bashrc'
# Big Boy edit something
alias svim='sudo vim'
# Ping but with sounds
alias ding='ping -i 5 -a'
# An extremely useful benchmark script
alias yabs='curl -sL yabs.sh | bash'
# Utilities
# A faster way to do the thing it does
alias sysres='sudo systemctl restart'
# This one too
alias sysup='sudo systemctl enable --now'
# Also this one
alias sysdn='sudo systemctl disable --now'
#opens specified command in new window in screen session
alias s='screen -X screen '
# press enter to continue. Occasionally useful
alias cnfrm='read -p "Press enter to proceed" '
# A more intense ping for the professional on the go
alias pang='ping -i 10 -v -a'
# List the mounted things
alias mnts='mount | column -t'
# The history command but shorter
alias h='history'
# Type way fewer letters
alias doco='docker compose'
# One of my most used commands. Restart a docker compose situation entirely
alias redoco='docker compose down; docker compose up -d'
# Regain all that space taken up by projects you abandoned
alias docprune='docker image prune && docker network prune && docker container prune && docker volume prune'
# Send things instantly to a pastebin. Pipe other commands into this to share their output.
alias bin='nc termbin.com 9999'
# Quicker Docker exec
alias dex='docker exec'
# Misc
# Get the weather. Put your location after the command
alias wttr='ansiweather -u imperial -s false -l'
#Read the fucking manual
rtfm() { help $@ || info $@ || man $@ || curl "http://cheat.sh/$@"; }
# Get your public IP
extip(){ ip=$(curl -s http://api.ipify.org);
echo "Public IP address is $ip"
}
# Cheatsheet for linux commands
ch() { curl "http://cheat.sh/$@"; }
# You can go to noti.toad.city and generate your own code to get browser notifications. It's all explained there. You'll need to modify this value
notica() { curl --data "d:$*" "https://noti.toad.city/?VFvu53" ; }
# A quick lil speedyboi
alias speedTest='curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 -'
# If you're runnng my exact mastodon setup, this will be useful
alias tootctl='docker exec -it -w /app/www mastodon bin/tootctl'
# HAHAHA Go for it. Hours of fun and profit or ruining all your stuff
alias hackingtool='docker run -it --net=host --security-opt seccomp=unconfined --privileged blackarchlinux/blackarch:latest'
# Do you need to reboot? Find out here!
alias needrs='[ -f /var/run/reboot-required ] && echo "You need to reboot"'
# Countdown Timer
countdown() {
start="$(( $(date '+%s') + $1))"
while [ $start -ge $(date +%s) ]; do
time="$(( $start - $(date +%s) ))"
printf '%s\r' "$(date -u -d "@$time" +%H:%M:%S)"
sleep 0.1
done
}
# Random quote to avoid making useful commit messages
function rgcm() {
api="https://whatthecommit.com/index.txt"
message=$(curl -s $api)
if [[ -z $message ]]; then
echo "Error: Failed to retrieve a random commit message"
return 1
fi
git add .
git commit -m "$message"
echo "Git commit submitted with message: $message"
function cntdn() {
local count=$1
while [ $count -gt 0 ]; do
echo -en "\n$count... "
if [ $count -eq 3 ]; then
echo "You've still got a few seconds to live it up before your time runs out!"
elif [ $count -eq 2 ]; then
echo "Tick-tock, tick-tock, time's running out!"
elif [ $count -eq 1 ]; then
echo "You had a good run, but it's time to face the music!"
fi
sleep 1
((count--))
done
echo "Time's up!"
}