Added some functions and aliases
This commit is contained in:
parent
f9a2c6b307
commit
79d3d4219f
7 changed files with 141 additions and 15 deletions
|
@ -1,19 +1,91 @@
|
|||
alias ll="ls -al"
|
||||
alias ln="ln -v"
|
||||
alias ls='ls --color=auto'
|
||||
alias grep='grep --color=auto'
|
||||
alias mkdir="mkdir -p"
|
||||
alias e="$EDITOR"
|
||||
alias v="$VISUAL"
|
||||
# --------------------------------------------------
|
||||
# File and Directory Management
|
||||
# --------------------------------------------------
|
||||
alias del='mv -t ~/.local/share/Trash' # Safely move files to trash
|
||||
alias ..="cd .." # Go up one directory
|
||||
alias ...="cd ../.." # Go up two directories
|
||||
alias ....="cd ../../.." # Go up three directories
|
||||
alias back="cd -" # Go back to the last directory
|
||||
alias la="ls -Ah" # List all except . and .., human-readable sizes
|
||||
alias lsd="ls -d */" # List only directories
|
||||
alias lt="ls -ltr" # List by modification time, oldest first
|
||||
|
||||
# --------------------------------------------------
|
||||
# Package Management (Pacman + Paru)
|
||||
# --------------------------------------------------
|
||||
alias update="paru -Syyu --noconfirm" # Update system packages
|
||||
alias search="paru -Ss" # Search in repositories
|
||||
alias local="paru -Q" # List installed packages
|
||||
alias orphan="paru -Qdt" # List orphaned packages
|
||||
alias cleanup="paru -Rns $(paru -Qtdq) && paru -Sc" # Clean orphaned and cached packages
|
||||
|
||||
# Pretty print the path
|
||||
alias path='echo $PATH | tr -s ":" "\n"'
|
||||
# --------------------------------------------------
|
||||
# Git Shortcuts
|
||||
# --------------------------------------------------
|
||||
alias gs="git status" # Show git status
|
||||
alias ga="git add" # Stage changes
|
||||
alias gc="git commit -m" # Commit with a message
|
||||
alias gco="git checkout" # Switch branches
|
||||
alias gp="git pull" # Pull changes
|
||||
alias gpu="git push" # Push changes
|
||||
alias gcl="git clone" # Clone repository
|
||||
alias gd="git diff" # Show changes
|
||||
alias gsh="git show" # Show details of a commit
|
||||
alias gl="git log --oneline --graph --decorate" # Pretty git log
|
||||
|
||||
# Easier navigation: ..., ...., ....., and -
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
alias -- -="cd -"
|
||||
# --------------------------------------------------
|
||||
# Network Utilities
|
||||
# --------------------------------------------------
|
||||
alias myip="curl ifconfig.me" # Display public IP address
|
||||
alias netstat="ss -tuln" # Show active network connections
|
||||
alias ping="ping -c 5" # Ping with 5 packets
|
||||
alias hosts="sudo $EDITOR /etc/hosts" # Edit hosts file
|
||||
alias flushdns="sudo systemctl restart systemd-resolved" # Flush DNS cache (systemd-resolved)
|
||||
|
||||
alias "uu"="paru -Syyu"
|
||||
# --------------------------------------------------
|
||||
# System Monitoring & Management
|
||||
# --------------------------------------------------
|
||||
alias dfh="df -h" # Disk usage (human-readable)
|
||||
alias duh="du -h --max-depth=1" # Folder sizes (human-readable)
|
||||
alias meminfo="free -m" # Memory usage in MB
|
||||
alias cpuinfo="lscpu" # Show CPU information
|
||||
alias journal="sudo journalctl -p 3 -xb" # View critical system logs
|
||||
alias reboot="sudo systemctl reboot" # Reboot the system
|
||||
alias shutdown="sudo systemctl poweroff" # Shutdown the system
|
||||
|
||||
# --------------------------------------------------
|
||||
# Custom Command Enhancements
|
||||
# --------------------------------------------------
|
||||
alias bashrc="$EDITOR ~/.bashrc" # Edit bash configuration
|
||||
alias zshrc="$EDITOR ~/.zshrc" # Edit zsh configuration
|
||||
alias vimrc="$EDITOR ~/.vimrc" # Edit Vim configuration
|
||||
alias profile="$EDITOR ~/.profile" # Edit shell profile
|
||||
alias reload="source ~/.zshrc" # Reload zsh configuration
|
||||
alias cal='cal -3' # Calendar (last, current, next month)
|
||||
|
||||
# --------------------------------------------------
|
||||
# Process and Task Management
|
||||
# --------------------------------------------------
|
||||
alias psg="ps aux | grep" # Search for a process
|
||||
alias kill9="kill -9" # Force kill a process
|
||||
alias top="htop" # Use htop if available
|
||||
alias watch="watch -n 1" # Repeat command every second
|
||||
|
||||
# --------------------------------------------------
|
||||
# Quality of Life Aliases
|
||||
# --------------------------------------------------
|
||||
alias cls="clear" # Clear terminal screen
|
||||
alias now="date +'%Y-%m-%d %H:%M:%S'" # Display current date and time
|
||||
alias timer="echo 'Timer started. Stop with Ctrl+C.' && date +%s && while true; do sleep 1; done" # Timer
|
||||
alias cwd="pwd | xclip -sel clip" # Copy current directory to clipboard
|
||||
alias please="sudo" # Fun alias for sudo
|
||||
alias s="sudo" # Short sudo
|
||||
|
||||
# --------------------------------------------------
|
||||
# Fun and Whimsical Aliases
|
||||
# --------------------------------------------------
|
||||
alias shrug='echo "¯\_(ツ)_/¯"' # Print shrug emoji
|
||||
alias lenny='echo "( ͡° ͜ʖ ͡°)"' # Print lenny face
|
||||
alias flip="echo '(╯°□°)╯︵ ┻━┻'" # Print table flip
|
||||
alias unflip="echo '┬─┬ ノ( ゜-゜ノ)'" # Print unflip
|
||||
alias coffee="echo 'Starting coffee brewing process... ☕️'" # Start coffee process
|
||||
|
|
7
usr/share/parchlinux/zsh/functions/coin.zsh
Normal file
7
usr/share/parchlinux/zsh/functions/coin.zsh
Normal file
|
@ -0,0 +1,7 @@
|
|||
function flip-coin() {
|
||||
if (( RANDOM % 2 == 0 )); then
|
||||
echo "🪙 Heads!"
|
||||
else
|
||||
echo "🪙 Tails!"
|
||||
fi
|
||||
}
|
5
usr/share/parchlinux/zsh/functions/dice.zsh
Normal file
5
usr/share/parchlinux/zsh/functions/dice.zsh
Normal file
|
@ -0,0 +1,5 @@
|
|||
function dice() {
|
||||
local sides="${1:-6}" # Default to a 6-sided die
|
||||
echo "🎲 Rolling a ${sides}-sided die..."
|
||||
echo "You got: $((RANDOM % sides + 1))"
|
||||
}
|
8
usr/share/parchlinux/zsh/functions/fireworks.zsh
Normal file
8
usr/share/parchlinux/zsh/functions/fireworks.zsh
Normal file
|
@ -0,0 +1,8 @@
|
|||
function fireworks() {
|
||||
if ! command -v lolcat &>/dev/null || ! command -v pv &>/dev/null; then
|
||||
echo "Install 'lolcat' and 'pv' to use this function: sudo pacman -S lolcat pv"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "🎆🎇 BOOM! 🎆🎇" | pv -qL 10 | lolcat
|
||||
}
|
4
usr/share/parchlinux/zsh/functions/genpass.zsh
Normal file
4
usr/share/parchlinux/zsh/functions/genpass.zsh
Normal file
|
@ -0,0 +1,4 @@
|
|||
function genpass() {
|
||||
local length="${1:-16}"
|
||||
tr -dc 'A-Za-z0-9!@#$%^&*()_+-=' </dev/urandom | head -c "$length" ; echo
|
||||
}
|
12
usr/share/parchlinux/zsh/functions/typewriter.zsh
Normal file
12
usr/share/parchlinux/zsh/functions/typewriter.zsh
Normal file
|
@ -0,0 +1,12 @@
|
|||
function typewriter() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: typewriter <text>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
for ((i=0; i<${#1}; i++)); do
|
||||
echo -n "${1:i:1}"
|
||||
sleep 0.05
|
||||
done
|
||||
echo
|
||||
}
|
18
usr/share/parchlinux/zsh/functions/weather.zsh
Normal file
18
usr/share/parchlinux/zsh/functions/weather.zsh
Normal file
|
@ -0,0 +1,18 @@
|
|||
function weather() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: weather <city>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local weather
|
||||
weather=$(curl -s "wttr.in/$1?format=%C")
|
||||
|
||||
case "$weather" in
|
||||
*Clear*) echo "☀️ It's sunny in $1!" ;;
|
||||
*Cloud*) echo "☁️ It's cloudy in $1!" ;;
|
||||
*Rain*) echo "🌧️ It's raining in $1!" ;;
|
||||
*Snow*) echo "❄️ It's snowing in $1!" ;;
|
||||
*Storm*) echo "⛈️ There's a storm in $1!" ;;
|
||||
*) echo "🌦️ The weather in $1 is: $weather" ;;
|
||||
esac
|
||||
}
|
Loading…
Add table
Reference in a new issue