Skip to content
5 changes: 5 additions & 0 deletions aliases/available/general.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ alias _='sudo'
alias vbrc='${VISUAL:-vim} ~/.bashrc'
alias vbpf='${VISUAL:-vim} ~/.bash_profile'


# colored grep
# Need to check an existing file for a pattern that will be found to ensure
# that the check works when on an OS that supports the color option
Expand Down Expand Up @@ -55,6 +56,7 @@ alias cd..='cd ..' # Common misspelling for going up one directory
alias ...='cd ../..' # Go up two directories
alias ....='cd ../../..' # Go up three directories
alias -- -='cd -' # Go back
alias d='cd /home/$USER/Downloads' # Go to the Downloads directory

# Shell History
alias h='history'
Expand All @@ -68,6 +70,9 @@ fi
alias md='mkdir -p'
alias rd='rmdir'

# Remove
alias rmrf='rm -rf'

# Shorten extract
alias xt='extract'

Expand Down
13 changes: 13 additions & 0 deletions plugins/available/base.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,16 @@ if ! _command_exists del; then
mkdir -p /tmp/.trash && mv "$@" /tmp/.trash
}
fi

# replace multiple file extensions at once
function rex() {
about 'mass replace of the extension of multiple files'
param '1: extension to replace'
param '2: new extenstion'
example 'rex txt md'
group 'base'
local ext2replace="${1:-}"
local newext="${2:-}"
local files=(`ls *.$ext2replace`)
for file in "${files[@]}"; do mv "$file" "${file/%.$ext2replace/.$newext}"; done
}