Last active
April 30, 2018 11:13
-
-
Save natanshalva/5635309 to your computer and use it in GitHub Desktop.
My version of bash_aliases file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# All the alias for you linux | |
# | |
# Script written by Natan Shalva | |
# 27.5.2013 natan.shalva@gmail.com | |
# | |
# | |
# WELCOME SCREEN | |
####################################################### | |
clear | |
echo -ne "${LIGHTGREEN}" "Hello, $USER. today is, "; date | |
echo -e "${WHITE}"; cal ; | |
echo -ne "${CYAN}"; | |
echo -ne "${LIGHTPURPLE}Sysinfo:";uptime ;echo "" | |
# Files | |
####################################################### | |
# sort by time | |
alias ll='ls -laFh --time-style="+%d-%m-%y" --sort=time -r' | |
# sort by name | |
alias llab='ls -laFh --time-style="+%d-%m-%y"' | |
# show only dir | |
alias ld=' ls -la --time-style="+%d-%m-%y" | sed "s/4096//g" | grep ^d' | |
alias la='ls -A' | |
alias l='ls -CF' | |
# Exit | |
####################################################### | |
alias e='exit' | |
####################################################### | |
# To see all the aliases list just type "ali" | |
alias ali="cat /home/$USER/.bash_aliases | grep '^alias' | sed 's/alias //g' | grep -e '^[^=]*' " | |
####################################################### | |
# Clear the terminal | |
alias c="clear" | |
####################################################### | |
# To open the last edited file with vim | |
alias lvim="vim -c \"normal '0\"" | |
####################################################### | |
# Handy shortcuts | |
alias h='history' | |
alias j='jobs -l' | |
####################################################### | |
# cd stuff | |
## Get rid of command not found ## | |
alias cd..='cd ..' | |
## a quick way to get out of current directory (and get list of all files in the upper dir) | |
cdl() { | |
cd "$@"; | |
ll; | |
} | |
alias ..='cdl ..' | |
alias ...='cdl ../../../' | |
alias ....='cdl ../../../../' | |
alias .....='cdl ../../../../' | |
alias .4='cdl ../../../../' | |
alias .5='cdl ../../../../..' | |
####################################################### | |
up(){ | |
dir="" | |
if [ -z "$1" ]; then | |
dir=.. | |
elif [[ $1 =~ ^[0-9]+$ ]]; then | |
x=0 | |
while [ $x -lt ${1:-1} ]; do | |
dir=${dir}../ | |
x=$(($x+1)) | |
done | |
else | |
dir=${PWD%/$1/*}/$1 | |
fi | |
cd "$dir"; | |
} | |
alias up="up" | |
####################################################### | |
alias 7="chmod 777 -R ." | |
alias s7="sudo chmod 777 -R ." | |
####################################################### | |
# A quick way to list all files in the directory | |
cdls(){ | |
if [ -z "$1" ]; then | |
cd ~/ ; | |
else | |
cd "$1"; | |
ls -la; | |
fi | |
} | |
# alias cd='cdls' | |
####################################################### | |
# NPM | |
alias rd="npm run dev" | |
alias rp="npm run production" | |
####################################################### | |
# Alias for apatch2 server | |
alias web="cd /home/$USER/www ; ls -ar --sort=time | cat" | |
alias log='cd /var/log/apache2/ ; ls -a | cat ' | |
alias solr='cd /home/solr/apache-solr-3.6.0/example/solr' | |
####################################################### | |
# Drupal drush stuff | |
alias dc='drush cc all' | |
alias db='drush archive-dump --tar-options="--exclude=sites/default/files"' | |
alias dw='drush watchdog-list' | |
alias dwt='drush watchdog-show --tail --sleep-delay=2' | |
alias dl='drush pm-list' | |
# *** Git *** | |
alias gs='git status' | |
alias gc="/home/$USER/bin/git_commit" | |
alias ga="git add" | |
alias gaa="git add -A" | |
alias gp="git push origin master" | |
alias gl="git log" | |
alias gb="git branch" | |
# starting and restarting apache2 | |
alias rs='sudo /etc/init.d/apache2 restart' | |
alias ss='sudo cd /home/solr/apache-solr-3.6.0/example/ ; java -jar start.jar' | |
# PS1 - Data and user in the terminal | |
# export PS1="\u \w > " | |
export PS1="\[\033[34m\] \u \[\033[31m\]\w \033[32m" | |
# Laravel stuff | |
alias pa="php artisan" | |
alias artisan="php artisan" | |
alias migrate="php artisan migrate" | |
alias serve="php artisan serve" | |
alias dump="php artisan dump" | |
alias t="phpunit" | |
# Laravel Generators Package | |
alias g:c="php artisan generate:controller" | |
alias g:m="php artisan generate:model" | |
alias g:v="php artisan generate:view" | |
alias g:mig="php artisan generate:migration" | |
alias g:t="php artisan generate:test" | |
alias g:r="php artisan generate:resource" | |
alias g:s="php artisan generate:scaffold" | |
alias g:f="php artisan generate:form" | |
# create alias for files | |
# please notes that this function execute script /bin/create_alias.sh | |
function mkdir_alias() { | |
if [ -f /home/$USER/bin/create_alias.sh ] ; then | |
dir=${PWD}; | |
mkdir "$1" && /home/$USER/bin/create_alias.sh "$1" $dir ; | |
cd "$1"; | |
else | |
printf "It look likes the script create_alias.sh - is missing \n" ; | |
fi | |
} | |
alias mkdir_alias="mkdir_alias" | |
alias web='cd /var/www/' | |
alias log='cd /var/log/apache2' | |
alias apa='cd /etc/apatch2/' | |
# ---------------------------------------------------------------- | |
# **** Do NOT **** edit after this line. | |
# the Alias script will append alias in the end of this file. | |
# | |
# list of alias to files | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment