forked from lemonade512/DotFiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_aliases
81 lines (63 loc) · 2.21 KB
/
.bash_aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# reload zsh config
alias reload!='source ~/.bashrc'
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # OS X `ls`
colorflag="-G"
fi
# Filesystem aliases
alias ..='cd ..'
alias ...='cd ../..'
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias l="ls -lah ${colorflag}"
alias la="ls -AF ${colorflag}"
alias ll="ls -lFh ${colorflag}"
alias lld="ls -l | grep ^d"
alias rmf="rm -rf"
alias ls="ls --color=auto"
# General Commands {{{
# Helpers
alias grep='grep --color=auto'
alias df='df -h' # disk free, in Gigabytes, not bytes
alias du='du -h -c' # calculate disk usage for a folder
# Prompt if overrite
alias mv="mv -i"
alias cp="cp -i"
alias rm="rm -I"
#NOTE this overrides an existing linux command called open
alias open="file_open"
# Example usage: grep "Some string" * && alert "Message"
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias pylint="pylint --rcfile ~/.pylintrc"
# Add colors for filetype and human-readable sizes
alias ls="ls --color=auto -h"
alias la="ls -A"
alias lx="ls -lXB" # Sort by extension
alias lk="ls -lSr" # Sort by size, biggest last
alias lt="ls -ltr" # Sort by date, most recent last
alias lc="ls -ltcr" # Sort by/show change time, most recent last
alias lu="ls -ltur" # Sort by/show access time, most recent last
alias ll="ls -alF"
# File size
alias fs="stat -f \"%z bytes\""
# }}}
# Shortcuts {{{
alias vbrc="vim ~/.bashrc && source ~/.bashrc"
alias back="cd - > /dev/null"
alias h="history | grep"
alias reload="source ~/.bashrc"
alias realias="$EDITOR ~/.bash_aliases; source ~/.bash_aliases"
alias kaenv="source ~/.virtualenv/khan27/bin/activate"
# }}}
# Package Management {{{
alias install="sudo apt-get install"
alias remove="sudo apt-get remove"
# }}}
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias mnemosyne='mnemosyne -d ~/Mnemosyne-2.3.5/mnemosyne'
# vim:foldmethod=marker:foldlevel=0