Commit 553c2ea02165a4f5d7ae7c5fa704c5568fc29063
1 parent
8f67a737b1
Exists in
master
and in
2 other branches
bash: update aliases
bash: OWN HISTORY AGAIN!
Showing 2 changed files with 3 additions and 1 deletions Inline Diff
templates/bash_aliases.sh
1 | # nav: | 1 | # nav: |
2 | alias ..="cd ../" | 2 | alias ..="cd ../" |
3 | alias ...="cd ../../" | 3 | alias ...="cd ../../" |
4 | alias ....="cd ../../../" | 4 | alias ....="cd ../../../" |
5 | alias .....="cd ../../../../" | 5 | alias .....="cd ../../../../" |
6 | 6 | ||
7 | alias ch="cat /etc/hosts" | 7 | alias ch="cat /etc/hosts" |
8 | alias lh="less /etc/hosts" | 8 | alias lh="less /etc/hosts" |
9 | alias nh="sudo nano /etc/hosts" | 9 | alias nh="sudo nano /etc/hosts" |
10 | 10 | ||
11 | alias na="nano ~/.bash_aliases" | 11 | alias na="nano ~/.bash_aliases" |
12 | alias nz="nano ~/.zshrc" | 12 | alias nz="nano ~/.zshrc" |
13 | 13 | ||
14 | alias c="cat" | 14 | alias c="cat" |
15 | 15 | ||
16 | # docker: | 16 | # docker: |
17 | alias docker="sudo docker" | 17 | alias docker="sudo docker" |
18 | 18 | ||
19 | alias de="sudo docker execute" | 19 | alias de="sudo docker execute" |
20 | alias di="sudo docker inspect" | 20 | alias di="sudo docker inspect" |
21 | alias dim="sudo docker images" | 21 | alias dim="sudo docker images" |
22 | alias dl="sudo docker logs -f" | 22 | alias dl="sudo docker logs -f" |
23 | alias dr="sudo docker rm" | 23 | alias dr="sudo docker rm" |
24 | alias dri="sudo docker rmi" | 24 | alias dri="sudo docker rmi" |
25 | alias ds="sudo docker stop" | 25 | alias ds="sudo docker stop" |
26 | alias dsta="sudo docker start" | 26 | alias dsta="sudo docker start" |
27 | alias dps="sudo docker ps" | 27 | alias dps="sudo docker ps" |
28 | alias fig="sudo fig" | 28 | alias fig="sudo fig" |
29 | 29 | ||
30 | export LS_OPTIONS='--color=always' | 30 | export LS_OPTIONS='--color=always' |
31 | alias ll="ls $LS_OPTIONS -Alh" | 31 | alias ll="ls $LS_OPTIONS -Alh" |
32 | alias l="ls $LS_OPTIONS -lh" | 32 | alias l="ls $LS_OPTIONS -lh" |
33 | 33 | ||
34 | # misc: | 34 | # misc: |
35 | alias e="exit" | 35 | alias e="exit" |
36 | alias mkp="makepasswd --chars" | 36 | alias mkp="makepasswd --chars" |
37 | alias n="nano" | 37 | alias n="nano" |
38 | alias p="python" | 38 | alias p="python" |
39 | alias ports="netstat -tulanp" | 39 | alias ports="netstat -tulanp" |
40 | 40 | ||
41 | alias tt="touch" | ||
42 | |||
41 | # OpenVZ: | 43 | # OpenVZ: |
42 | alias vl="vzlist" | 44 | alias vl="vzlist" |
43 | alias ve="vzctl enter" | 45 | alias ve="vzctl enter" |
44 | 46 | ||
45 | # fix common_aliases (zsh): | 47 | # fix common_aliases (zsh): |
46 | alias rm='rm' | 48 | alias rm='rm' |
47 | alias cp='cp' | 49 | alias cp='cp' |
48 | alias mv='mv' | 50 | alias mv='mv' |
templates/bashrc.sh
1 | # If not running interactively, don't do anything | 1 | # If not running interactively, don't do anything |
2 | case $- in | 2 | case $- in |
3 | *i*) ;; | 3 | *i*) ;; |
4 | *) return;; | 4 | *) return;; |
5 | esac | 5 | esac |
6 | 6 | ||
7 | ######################## | 7 | ######################## |
8 | # ******************** # | 8 | # ******************** # |
9 | # * * # | 9 | # * * # |
10 | # * COMPLETION * # | 10 | # * COMPLETION * # |
11 | # * * # | 11 | # * * # |
12 | # ******************** # | 12 | # ******************** # |
13 | ######################## | 13 | ######################## |
14 | 14 | ||
15 | # enable bash completion in interactive shells | 15 | # enable bash completion in interactive shells |
16 | if [ -f /etc/bash_completion ]; then | 16 | if [ -f /etc/bash_completion ]; then |
17 | . /etc/bash_completion | 17 | . /etc/bash_completion |
18 | fi | 18 | fi |
19 | 19 | ||
20 | # if the command-not-found package is installed, use it | 20 | # if the command-not-found package is installed, use it |
21 | if [ -x /usr/lib/command-not-found ]; then | 21 | if [ -x /usr/lib/command-not-found ]; then |
22 | function command_not_found_handle { | 22 | function command_not_found_handle { |
23 | # check because c-n-f could've been removed in the meantime | 23 | # check because c-n-f could've been removed in the meantime |
24 | if [ -x /usr/lib/command-not-found ]; then | 24 | if [ -x /usr/lib/command-not-found ]; then |
25 | /usr/bin/python /usr/lib/command-not-found -- $1 | 25 | /usr/bin/python /usr/lib/command-not-found -- $1 |
26 | return $? | 26 | return $? |
27 | else | 27 | else |
28 | return 127 | 28 | return 127 |
29 | fi | 29 | fi |
30 | } | 30 | } |
31 | fi | 31 | fi |
32 | 32 | ||
33 | ######################## | 33 | ######################## |
34 | # ******************** # | 34 | # ******************** # |
35 | # * * # | 35 | # * * # |
36 | # * HISTORY * # | 36 | # * HISTORY * # |
37 | # * * # | 37 | # * * # |
38 | # ******************** # | 38 | # ******************** # |
39 | ######################## | 39 | ######################## |
40 | 40 | ||
41 | # Eternal bash history. | 41 | # Eternal bash history. |
42 | # --------------------- | 42 | # --------------------- |
43 | export HISTFILESIZE= | 43 | export HISTFILESIZE= |
44 | export HISTSIZE= | 44 | export HISTSIZE= |
45 | export HISTTIMEFORMAT="[%F %T] " | 45 | export HISTTIMEFORMAT="[%F %T] " |
46 | # Change the file location | 46 | # Change the file location |
47 | export HISTFILE=~/.history | 47 | export HISTFILE=~/.new_bash_history |
48 | # Force prompt to write history after every command | 48 | # Force prompt to write history after every command |
49 | PROMPT_COMMAND="history -a; $PROMPT_COMMAND" | 49 | PROMPT_COMMAND="history -a; $PROMPT_COMMAND" |
50 | 50 | ||
51 | 51 | ||
52 | # check the window size after each command | 52 | # check the window size after each command |
53 | shopt -s checkwinsize | 53 | shopt -s checkwinsize |
54 | 54 | ||
55 | # If set, the pattern "**" used in a pathname expansion context will | 55 | # If set, the pattern "**" used in a pathname expansion context will |
56 | # match all files and zero or more directories and subdirectories. | 56 | # match all files and zero or more directories and subdirectories. |
57 | #shopt -s globstar | 57 | #shopt -s globstar |
58 | 58 | ||
59 | # set variable identifying the chroot you work in (used in the prompt below) | 59 | # set variable identifying the chroot you work in (used in the prompt below) |
60 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | 60 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then |
61 | debian_chroot=$(cat /etc/debian_chroot) | 61 | debian_chroot=$(cat /etc/debian_chroot) |
62 | fi | 62 | fi |
63 | 63 | ||
64 | # set a fancy prompt | 64 | # set a fancy prompt |
65 | case "$TERM" in | 65 | case "$TERM" in |
66 | xterm-color) color_prompt=yes;; | 66 | xterm-color) color_prompt=yes;; |
67 | esac | 67 | esac |
68 | 68 | ||
69 | # colored prompt | 69 | # colored prompt |
70 | force_color_prompt=yes | 70 | force_color_prompt=yes |
71 | 71 | ||
72 | if [ -n "$force_color_prompt" ]; then | 72 | if [ -n "$force_color_prompt" ]; then |
73 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | 73 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then |
74 | # We have color support; assume it's compliant with Ecma-48 | 74 | # We have color support; assume it's compliant with Ecma-48 |
75 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such | 75 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such |
76 | # a case would tend to support setf rather than setaf.) | 76 | # a case would tend to support setf rather than setaf.) |
77 | color_prompt=yes | 77 | color_prompt=yes |
78 | else | 78 | else |
79 | color_prompt= | 79 | color_prompt= |
80 | fi | 80 | fi |
81 | fi | 81 | fi |
82 | 82 | ||
83 | if [ "$color_prompt" = yes ]; then | 83 | if [ "$color_prompt" = yes ]; then |
84 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | 84 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |
85 | else | 85 | else |
86 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | 86 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' |
87 | fi | 87 | fi |
88 | #unset color_prompt force_color_prompt | 88 | #unset color_prompt force_color_prompt |
89 | 89 | ||
90 | # enable color support of ls and also add handy aliases | 90 | # enable color support of ls and also add handy aliases |
91 | if [ -x /usr/bin/dircolors ]; then | 91 | if [ -x /usr/bin/dircolors ]; then |
92 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | 92 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" |
93 | alias ls='ls --color=auto' | 93 | alias ls='ls --color=auto' |
94 | alias dir='dir --color=auto' | 94 | alias dir='dir --color=auto' |
95 | alias vdir='vdir --color=auto' | 95 | alias vdir='vdir --color=auto' |
96 | 96 | ||
97 | alias grep='grep --color=auto' | 97 | alias grep='grep --color=auto' |
98 | alias fgrep='fgrep --color=auto' | 98 | alias fgrep='fgrep --color=auto' |
99 | alias egrep='egrep --color=auto' | 99 | alias egrep='egrep --color=auto' |
100 | fi | 100 | fi |
101 | 101 | ||
102 | 102 | ||
103 | # Alias definitions | 103 | # Alias definitions |
104 | 104 | ||
105 | if [ -f ~/.bash_aliases ]; then | 105 | if [ -f ~/.bash_aliases ]; then |
106 | . ~/.bash_aliases | 106 | . ~/.bash_aliases |
107 | fi | 107 | fi |
108 | 108 |