Share Your BASH Aliases

Here you can discuss every aspect of Debian. Note: not for support requests!
Post Reply
Message
Author
User avatar
craigevil
Posts: 5257
Joined: 2006-09-17 03:17
Location: Oz
Has thanked: 3 times
Been thanked: 3 times

Share Your BASH Aliases

#1 Post by craigevil »

Here are the ones that I personally use:

Code: Select all

# Start gomuks Matrix Client
alias gomuks=/home/pi/Downloads/gomuks-linux-arm64

# Show open ports
alias ports='netstat -tulanp'

# Refresh .bashrc
alias bashrc="nano ~/.bashrc && source ~/.bashrc"

# become root #
alias root='sudo -i'
alias su='sudo -i'

# if user is not root, pass all commands via sudo #
if [ $UID -ne 0 ]; then
    alias update='sudo apt update'
    alias ainstall='sudo apt install'
    alias apurge='sudo apt purge'
    alias upgrade='sudo apt upgrade'
    alias aremove='sudo apt autoremove -y'
    alias reboot='sudo reboot'
    alias shutdown="sudo shutdown -P now"
fi

# APT User Commands
alias asearch='apt search'
alias afile='apt-file search'
alias apolicy='apt policy'

# Create Python virtual environment
alias ve='python3 -m venv ./venv'
alias va='source ./venv/bin/activate'

# Ping Commands
# Stop after sending count ECHO_REQUEST packets #
alias ping='ping -c 5'
alias pg="ping google.com -c 5"

## set some other defaults ##
alias df='df -H'
alias du='du -ch'

# ls Commands
## Colorize the ls output and human readable sizes ##
alias ls='ls --color=auto --human-readable -al' 
 
## Use a long listing format ##
alias ll='ls -la'
 
## Show hidden files ##
alias l.='ls -d .* --color=auto'

# Clipboard
alias cpy="xclip -selection clipboard"

# Calculator
alias bc="bc -l"

# Resume wget by default
alias wget="wget -c"

# ps Commands
alias ps="ps auxf"
# Get top process eating cpu
alias pscpu="ps auxf | sort -nr -k 3"
alias pscpu10="ps auxf | sort -nr -k 3 | head -10"

# Get top process eating memory
alias psmem="ps auxf | sort -nr -k 4"
alias psmem10="ps auxf | sort -nr -k 4 | head -10"

# Free and Used Ram
alias meminfo="free -m -l -t"
alias free="free -mt"
Raspberry PI 400 Distro: Raspberry Pi OS (Unstable) Kernel: 5.10.52-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"

User avatar
edbarx
Posts: 5410
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E

Re: Share Your BASH Aliases

#2 Post by edbarx »

I almost never used aliases. Terminals have a nice feature which allows me to navigate the history of commands. It is easy to use and helps me remember full commands.

Since .bash_history contains bash's command history, it is a good idea to occasionally backup this file for future reference. The other way is to use a large number for maximum number of saved commands.
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.

Bulkley
Posts: 6146
Joined: 2006-02-11 18:35

Re: Share Your BASH Aliases

#3 Post by Bulkley »

I don't use a DM so I use

Code: Select all

alias sx="startx"


After logging in I use sx to start X.

User avatar
RU55EL
Posts: 539
Joined: 2014-04-07 03:42
Location: /home/russel

Re: Share Your BASH Aliases

#4 Post by RU55EL »

Code: Select all

alias cw.practice='morse -r -s -T -d -w 5 -F 25 -p 5 -E 0'
alias dir='dir --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -l'
alias ls='ls --color=auto'
alias pi='ssh pi@xx.xxx.xxx.xx'
alias temp='sudo sensors'
alias update='sudo apt update && sudo apt upgrade && apt moo && cowsay updates are done && cat /etc/debian_version && uname -r'
alias vdir='vdir --color=auto'

Post Reply