Ready, set, go! Copy and paste snippets.sh
content into your .bashrc
or .zshrc
file and you're ready to go!
Too lazy? Run the following command in your console and you're up and running!
wget https://raw.githubusercontent.com/micheleriva/shell-snippets/copypasta.sh | sh
Clear the console using cls
instead of clear
alias cls="clear"
Shorter for ps aux | grep
alias psa="ps aux | grep"
Shorter for sm -rf
alias rmf="rm -rf"
Shorter for ls
alias l="ls"
Shorter for ls -hl
alias ll="ls -hl"
Shorter for ls -A
alias la="ls -A"
Shorter for ls -alh
alias lla="ls -alh"
Shorter for ls -Gp
alias ls="ls -Gp"
Shorter for grep --color
alias grep="grep --color"
Shorter for git
alias g="git"
Shorter for git pull <current-branch>
alias gpull="g pull origin $(git_branch_name)"
Shorter for git push origin <current-branch>
alias gpush="g push origin $(git_branch_name)"
Cd parent directory n
times.
Example: cdb 3
=> cd ../../../
function cdb() {
for ((n=0;n<$1;n++))
do cd ..
done
}"
Make new directory and enter it.
Example: mkdircd foo
=> mkdircd foo && cd foo
function mkdircd() {
mkdir $1 && cd $1
}
Run any function multiple times
function runx() {
for ((n=0;n<$1;n++))
do ${*:2}
done
}