|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Easier navigation: .., ..., ...., ....., ~ and - |
| 4 | +alias ..="cd .." |
| 5 | +alias ...="cd ../.." |
| 6 | +alias ....="cd ../../.." |
| 7 | +alias .....="cd ../../../.." |
| 8 | +alias ~="cd ~" # `cd` is probably faster to type though |
| 9 | +alias -- -="cd -" |
| 10 | + |
| 11 | +# Shortcuts |
| 12 | +alias g="git" |
| 13 | +alias h="history" |
| 14 | + |
| 15 | +# Detect which `ls` flavor is in use |
| 16 | +if ls --color > /dev/null 2>&1; then # GNU `ls` |
| 17 | + colorflag="--color" |
| 18 | +else # OS X `ls` |
| 19 | + colorflag="-G" |
| 20 | +fi |
| 21 | + |
| 22 | +# List all files colorized in long format |
| 23 | +# shellcheck disable=SC2139 |
| 24 | +alias l="ls -lF ${colorflag}" |
| 25 | + |
| 26 | +# List all files colorized in long format, including dot files |
| 27 | +# shellcheck disable=SC2139 |
| 28 | +alias la="ls -laF ${colorflag}" |
| 29 | + |
| 30 | +# List only directories |
| 31 | +# shellcheck disable=SC2139 |
| 32 | +alias lsd="ls -lF ${colorflag} | grep --color=never '^d'" |
| 33 | + |
| 34 | +# See: https://superuser.com/a/656746/280737 |
| 35 | +alias ll='LC_ALL="C.UTF-8" ls -alF' |
| 36 | + |
| 37 | +# Always use color output for `ls` |
| 38 | +# shellcheck disable=SC2139 |
| 39 | +alias ls="command ls ${colorflag}" |
| 40 | +export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:' |
| 41 | + |
| 42 | +# Always enable colored `grep` output |
| 43 | +alias grep='grep --color=auto ' |
| 44 | + |
| 45 | +# Enable aliases to be sudo’ed |
| 46 | +alias sudo='sudo ' |
| 47 | + |
| 48 | +# Get week number |
| 49 | +alias week='date +%V' |
| 50 | + |
| 51 | +# Stopwatch |
| 52 | +alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' |
| 53 | + |
| 54 | +# Canonical hex dump; some systems have this symlinked |
| 55 | +command -v hd > /dev/null || alias hd="hexdump -C" |
| 56 | + |
| 57 | +# vhosts |
| 58 | +alias hosts='sudo nano /etc/hosts' |
| 59 | + |
| 60 | +# copy working directory |
| 61 | +alias cwd='pwd | tr -d "\r\n" | xclip -selection clipboard' |
| 62 | + |
| 63 | +# copy file interactive |
| 64 | +alias cp='cp -i' |
| 65 | + |
| 66 | +# move file interactive |
| 67 | +alias mv='mv -i' |
| 68 | + |
| 69 | +# untar |
| 70 | +alias untar='tar xvf' |
| 71 | + |
| 72 | +# Zephir related |
| 73 | +alias untar='tar xvf' |
| 74 | + |
| 75 | +PATH=$PATH:./vendor/bin |
0 commit comments