mydotfiles/bash_aliases

106 lines
2.6 KiB
Bash
Raw Normal View History

2024-04-14 22:59:42 +03:00
# -*- mode: sh;-*-
2024-03-28 00:26:52 +03:00
# SHOPT
shopt -s autocd # Automatically enter the written directory
shopt -s cdspell # Automatically detect folder even if it is misspelled
shopt -s histverify # Reruns the previous command (e.g !!123)
shopt -s expand_aliases # expand aliases
# Flatpak
2024-11-03 21:49:48 +03:00
alias fpu='flatpak update'
alias fpi='flatpak install'
alias fpl='flatpak list'
2024-12-24 19:38:25 +03:00
alias fpr='flatpak uninstall'
2024-11-03 21:49:48 +03:00
# DNF
alias upd='fpu && sudo dnf update'
alias upg='upd'
alias ins='sudo dnf install'
alias rem='sudo dnf remove'
alias sea='dnf search'
2023-11-15 12:57:11 +03:00
2024-03-28 00:20:56 +03:00
# History
2023-11-15 12:57:11 +03:00
cl () {
2024-03-28 00:20:56 +03:00
HISFIL=$HOME/.bash_history
if [ -f "$HISFIL" ]; then
rm $HISFIL
2023-11-15 12:57:11 +03:00
clear
2024-11-03 21:50:35 +03:00
history -cw
2023-11-15 12:57:11 +03:00
else
clear
2024-11-03 21:50:35 +03:00
history -cw
2023-11-15 12:57:11 +03:00
fi
2024-03-28 00:30:06 +03:00
}
# ARCHIVE EXTRACTION
# usage: ex <file>
ex ()
{
if [ -f "$1" ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*.deb) ar x $1 ;;
*.tar.xz) tar xf $1 ;;
*.tar.zst) unzstd $1 ;;
*) echo "'$1' ex() aracılığıyla çıkarılamıyor" ;;
esac
else
echo "'$1' geçerli bir dosya değil"
fi
}
2023-11-15 12:57:11 +03:00
2024-03-28 00:22:46 +03:00
# Emacs
2024-11-03 21:49:48 +03:00
alias e='emacs -nw'
2023-11-15 12:57:11 +03:00
2024-03-28 00:33:28 +03:00
# Edit bash aliases
2024-11-03 21:49:48 +03:00
alias ba='e ~/.bash_aliases'
2023-11-15 12:57:11 +03:00
2024-12-24 19:38:25 +03:00
# Guile alias
alias guile='guile3.0'
2023-11-15 12:57:11 +03:00
# Colorize the grep command output for ease of use (good for log files)
2024-11-03 21:49:48 +03:00
alias grep='grep --color=auto'
2023-11-15 12:57:11 +03:00
# Make mount command output pretty and human readable format
2024-11-03 21:49:48 +03:00
alias mount='mount |column -t'
2023-11-15 12:57:11 +03:00
# Stop after sending count ECHO_REQUEST packets
2024-11-03 21:49:48 +03:00
alias ping='ping -c 5'
2023-11-15 12:57:11 +03:00
# Copy progress bar
alias cpv='rsync -ah --info=progress2'
2024-03-23 20:51:38 +03:00
2024-11-03 21:49:48 +03:00
# Change 'ls' to 'eza'
alias la='eza -al --color=always --group-directories-first' # Default list alias
alias ls='eza -a --color=always --group-directories-first' # All files and dirs
2024-03-28 00:34:30 +03:00
alias ll='eza -l --color=always --group-directories-first' # Long format
alias lt='eza -aT --color=always --group-directories-first' # Tree listing
alias l.='eza -a | egrep "^\."'
2024-11-03 21:49:48 +03:00
# Change 'cat' to 'bat'
alias cat='bat'
2024-03-28 00:35:27 +03:00
# Git
alias addup='git add -u'
alias addall='git add .'
alias branch='git branch'
alias checkout='git checkout'
alias clone='git clone'
alias commit='git commit -m'
alias fetch='git fetch'
alias pull='git pull origin'
alias push='git push origin'
alias stat='git status' # 'status' is protected name so using 'stat' instead
alias tag='git tag'
alias newtag='git tag -a'