A comprehensive collection of bash aliases and functions to enhance your command-line experience, extracted from the NetServa management system. This lightweight shell enhancement system provides useful shortcuts, cross-platform package management aliases, and powerful utility functions.
- Cross-platform support: Works on Linux (Debian/Ubuntu, Arch/Manjaro/CachyOS, Alpine), macOS, and OpenWRT
- Smart package management: Unified aliases that adapt to your system's package manager
- Useful aliases: Shortcuts for common tasks, navigation, editing, and system monitoring
- Utility functions: Enhanced file finding, service management, and more
- SSH management: Comprehensive SSH config and key management tool (sshm)
- Customization: Easy to extend with your own aliases and functions
- Clone this repository to your home directory:
git clone https://github.com/yourusername/sh.git ~/.sh
-
Add the following line to your shell startup file:
For ~/.bashrc (most common):
[[ -f ~/.sh/shrc.sh ]] && . ~/.sh/shrc.sh
For ~/.bash_profile or ~/.profile:
[[ -f ~/.sh/shrc.sh ]] && . ~/.sh/shrc.sh
-
(Optional) Install the SSH manager tool system-wide:
sudo cp ~/.sh/sshm /usr/local/bin/
sudo chmod +x /usr/local/bin/sshm
- Reload your shell or source your startup file:
source ~/.bashrc # or whichever file you modified
- ~/.bashrc: Executed for interactive non-login shells (e.g., opening a new terminal window)
- ~/.bash_profile: Executed for login shells (e.g., SSH sessions, console login)
- ~/.profile: Generic shell profile, used when bash_profile doesn't exist
Most desktop Linux users should add the source line to ~/.bashrc
. Server users who primarily connect via SSH might prefer ~/.bash_profile
.
- shrc.sh: Main shell resource file containing all aliases and functions
- myrc.sh: Your personal customization file (sourced after shrc.sh)
- sshm: SSH management utility script
- sshm.md: Detailed documentation for the SSH manager
..
- Go up one directoryla
- List all files with details (including hidden)ll
- List files with detailsf <pattern>
- Find files matching pattern (recursive)
e
- Edit with nano (or $EDITOR)se
- Edit with sudoes
- Edit your custom shell config (myrc.sh) and reload
ff
- Fast system info (via fastfetch)ram
- Show memory usage by processp <pattern>
- Find processes matching pattern
The following aliases adapt to your system:
i <package>
- Install packager <package>
- Remove packages <pattern>
- Search for packagesu
- Update system packageslspkg <pattern>
- List installed packages
sc <action> <service>
- Service control (start/stop/restart/status)
Add your own aliases and functions to ~/.sh/myrc.sh
:
# Example custom aliases
alias myproject='cd ~/projects/myapp'
alias gs='git status'
# Example custom function
mybackup() {
tar -czf backup-$(date +%Y%m%d).tar.gz "$@"
}
Your customizations in myrc.sh
will override any defaults from shrc.sh
.
The included sshm
tool helps manage SSH configurations and keys:
# Initialize SSH config structure
sshm init
# Create a new SSH host entry
sshm create myserver example.com 22 john
# List all configured hosts
sshm list
# Create a new SSH key
sshm key_create mykey
See sshm.md for complete documentation.
The system automatically detects your OS and configures appropriate aliases:
- Debian/Ubuntu: apt-based package management
- Arch/Manjaro/CachyOS: pacman/yay package management
- Alpine Linux: apk package management
- OpenWRT: opkg package management
- macOS: Basic support (no package manager aliases)
- Use
es
to quickly edit your personal configuration - The
f
function is great for finding files:f "*.txt"
- Package aliases work consistently across platforms:
i nginx
installs nginx on any supported OS - Check
ram
to see memory usage sorted by consumption - Use
sc
for service management:sc restart nginx
Feel free to submit issues and pull requests. When contributing:
- Keep changes minimal and focused
- Test on multiple platforms if possible
- Document new features in this README
- Follow the existing code style
MIT License - See individual file headers for copyright information.# sh