Last active
February 20, 2025 02:45
-
-
Save felipeccastro/f7bd94cd6bc01e9120e1b938d8277b17 to your computer and use it in GitHub Desktop.
Human-friendly UNIX aliases & functions
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
#!/bin/bash | |
# Human-friendly UNIX aliases & functions | |
# Navigation | |
alias up='cd ..' # Move up one directory | |
alias home='cd ~' # Move to home directory | |
# File & Directory Operations | |
alias list='ls -A' # Show all files | |
alias newdir='mkdir -p' # Create directory (including parents) | |
alias delete='rm -rf' # Remove permanently | |
alias archive='mv -t ~/.Trash' # Move to trash | |
alias move='mv' # Move file or folder | |
alias copy='cp -r' # Copy files/folders | |
alias replace='cp -ru' # Copy only updated files | |
# File Viewing & Editing | |
alias show='cat' # Show file contents | |
alias view='less' # View file interactively | |
alias edit='nano' # Open file in nano editor | |
# Permissions & Ownership | |
alias setperm='chmod 777' # Make file fully accessible | |
alias setexec='chmod +x' # Make file executable | |
alias setowner='chown' # Change ownership | |
# Searching (Functions to allow arguments) | |
search() { find . -type f -iname "*$1*" ; } # search "notes.txt" | |
search_size() { find . -type f -size +"$1" ; } # search_size "10M" (files larger than 10MB) | |
search_date() { find . -type f -newermt "$1" ; } # search_date "2024-01-01" (created after date) | |
search_mod() { find . -type f -mtime -"$1" ; } # search_mod "7" (modified in last 7 days) | |
search_type() { find . -type f -iname "*.$1" ; } # search_type "jpg" (all JPG files) | |
search_text() { grep -ril "$1" . ; } # search_text "timeout error" (files containing text) | |
# Networking & Sharing | |
alias fetch='curl -O' # Download file | |
alias download='wget -c' # Resumeable download | |
alias send='scp -r' # Send files over SSH | |
# Process & System Management | |
procs() { ps aux | grep -i --color=auto "$1" ; } # procs "nginx" | |
stop() { pkill -f "$1" ; } # stop "nginx" | |
forcekill() { pkill -9 -f "$1" ; } # forcekill "nginx" | |
alias disk='df -h' # Show disk usage | |
# Sorting & Data Operations | |
alias arrange='sort' # Sort alphabetically | |
alias arrange_desc='sort -r' # Sort in reverse | |
alias extract='cut -d"," -f' # Extract CSV column | |
# Live Monitoring | |
alias watch='tail -n 100 -f' # View last 100 lines of a file live |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Enable these on your terminal by running
source hunix.sh
, or add this line to your~/.bashrc
or~/.bash_profile
to load it automatically.