| @@ -96,3 +96,9 @@ alias e-tada="printf \"🎉\" | pbcopy && echo \"🎉 copied to the clipboard\" | |||
| 96 | 96 | alias e-lightning="printf \"⚡\" | pbcopy && echo \"⚡ copied to the clipboard\"" | |
| 97 | 97 | alias shruggie="printf \"¯\_(ツ)_/¯\" | pbcopy && echo \"¯\_(ツ)_/¯ copied to clipboard\"" | |
| 98 | 98 | ||
| 99 | + | if [ -x /usr/bin/termsaver ]; then | |
| 100 | + | alias tsm="termsaver matrix" | |
| 101 | + | fi | |
| 102 | + | ||
| 103 | + | # if you're on WSL you may want to see information from MOTD such as pending updates | |
| 104 | + | #sudo run-parts /etc/update-motd.d/ | |
willpower232 / bash.bashrc
Last active 1 month ago
I am making my .bashrc portable as inspired by this https://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html
Will Power revised this gist 8 years ago · dc91a48
1 file changed, 6 insertions
Will Power revised this gist 9 years ago · ef8ca7b
1 file changed, 1 insertion
| @@ -60,6 +60,7 @@ fi | |||
| 60 | 60 | ||
| 61 | 61 | alias nano='nano --nowrap --smooth -T 4' | |
| 62 | 62 | alias plz='sudo' | |
| 63 | + | alias dammit='sudo !!' | |
| 63 | 64 | ||
| 64 | 65 | # stop yourself from breaking the server by accident | |
| 65 | 66 | alias mv='mv -i' | |
Will Power revised this gist 9 years ago · 930f01d
1 file changed, 1 insertion, 1 deletion
| @@ -59,7 +59,7 @@ if [ -x /usr/bin/dircolors ]; then | |||
| 59 | 59 | fi | |
| 60 | 60 | ||
| 61 | 61 | alias nano='nano --nowrap --smooth -T 4' | |
| 62 | - | alias please='sudo' | |
| 62 | + | alias plz='sudo' | |
| 63 | 63 | ||
| 64 | 64 | # stop yourself from breaking the server by accident | |
| 65 | 65 | alias mv='mv -i' | |
Will Power revised this gist 9 years ago · 42624e5
1 file changed, 21 insertions
| @@ -74,3 +74,24 @@ function findinfiles() { find ./ -type f -print0 | xargs -0 grep -i "$1"; } | |||
| 74 | 74 | function findinphpfiles() { find ./ -type f -name "*.php" -print0 | xargs -0 grep -i "$1"; } | |
| 75 | 75 | ||
| 76 | 76 | complete -W "$(echo $(grep '^ssh ' ~/.bash_history | sort -u | sed 's/^ssh //'))" ssh | |
| 77 | + | ||
| 78 | + | if [ "$(uname)" == "Darwin" ]; then | |
| 79 | + | # got pbcopy | |
| 80 | + | : | |
| 81 | + | elif grep -q Microsoft /proc/version; then | |
| 82 | + | # route error to /dev/null because thanks microsoft | |
| 83 | + | alias pbcopy='clip.exe > /dev/null 2>&1' | |
| 84 | + | else | |
| 85 | + | # install xclip through apt first | |
| 86 | + | alias pbcopy='xclip -selection clipboard' | |
| 87 | + | fi | |
| 88 | + | ||
| 89 | + | # thanks @jamesdoc | |
| 90 | + | alias e-thumbsup="printf \"👍\" | pbcopy && echo \"👍 copied to the clipboard\"" | |
| 91 | + | alias e-pointup="printf \"👆\" | pbcopy && echo \"👆 copied to the clipboard\"" | |
| 92 | + | alias e-pointdown="printf \"👇\" | pbcopy && echo \"👇 copied to the clipboard\"" | |
| 93 | + | alias e-rocket="printf \"🚀\" | pbcopy && echo \"🚀 copied to the clipboard\"" | |
| 94 | + | alias e-tada="printf \"🎉\" | pbcopy && echo \"🎉 copied to the clipboard\"" | |
| 95 | + | alias e-lightning="printf \"⚡\" | pbcopy && echo \"⚡ copied to the clipboard\"" | |
| 96 | + | alias shruggie="printf \"¯\_(ツ)_/¯\" | pbcopy && echo \"¯\_(ツ)_/¯ copied to clipboard\"" | |
| 97 | + | ||
Will Power revised this gist 9 years ago · 822b926
1 file changed, 4 insertions, 4 deletions
| @@ -26,15 +26,15 @@ fi | |||
| 26 | 26 | ||
| 27 | 27 | if [ "$color_prompt" = yes ]; then | |
| 28 | 28 | if [ "$EUID" -ne 0 ]; then | |
| 29 | - | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) \u@\h \e[32m[\w]\e[0m\n$ ' | |
| 29 | + | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) \u@\h {\A} \e[32m[\w]\e[0m\n$ ' | |
| 30 | 30 | else | |
| 31 | - | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) \u@\h \e[31m[\w]\e[0m\n# ' | |
| 31 | + | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) \u@\h {\A} \e[31m[\w]\e[0m\n# ' | |
| 32 | 32 | fi | |
| 33 | 33 | else | |
| 34 | 34 | if [ "$EUID" -ne 0 ]; then | |
| 35 | - | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) u@h [w]\n$ ' | |
| 35 | + | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) u@h {A} [w]\n$ ' | |
| 36 | 36 | else | |
| 37 | - | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) u@h [w]\n# ' | |
| 37 | + | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) u@h {A} [w]\n# ' | |
| 38 | 38 | fi | |
| 39 | 39 | fi | |
| 40 | 40 | unset color_prompt force_color_prompt | |
Will Power revised this gist 9 years ago · 6d9e0b5
1 file changed, 9 insertions
| @@ -61,6 +61,15 @@ fi | |||
| 61 | 61 | alias nano='nano --nowrap --smooth -T 4' | |
| 62 | 62 | alias please='sudo' | |
| 63 | 63 | ||
| 64 | + | # stop yourself from breaking the server by accident | |
| 65 | + | alias mv='mv -i' | |
| 66 | + | alias cp='cp -i' | |
| 67 | + | alias ln='ln -i' | |
| 68 | + | alias rm='rm -I --preserve-root' | |
| 69 | + | alias chown='chown --preserve-root' | |
| 70 | + | alias chmod='chmod --preserve-root' | |
| 71 | + | alias chgrp='chgrp --preserve-root' | |
| 72 | + | ||
| 64 | 73 | function findinfiles() { find ./ -type f -print0 | xargs -0 grep -i "$1"; } | |
| 65 | 74 | function findinphpfiles() { find ./ -type f -name "*.php" -print0 | xargs -0 grep -i "$1"; } | |
| 66 | 75 | ||
Will Power revised this gist 9 years ago · 0b170bf
1 file changed, 10 insertions, 2 deletions
| @@ -25,9 +25,17 @@ if [ -n "$force_color_prompt" ]; then | |||
| 25 | 25 | fi | |
| 26 | 26 | ||
| 27 | 27 | if [ "$color_prompt" = yes ]; then | |
| 28 | - | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) \u@\h \e[32m[\w]\e[0m\n$ ' | |
| 28 | + | if [ "$EUID" -ne 0 ]; then | |
| 29 | + | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) \u@\h \e[32m[\w]\e[0m\n$ ' | |
| 30 | + | else | |
| 31 | + | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) \u@\h \e[31m[\w]\e[0m\n# ' | |
| 32 | + | fi | |
| 29 | 33 | else | |
| 30 | - | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) u@h [w]\n$ ' | |
| 34 | + | if [ "$EUID" -ne 0 ]; then | |
| 35 | + | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) u@h [w]\n$ ' | |
| 36 | + | else | |
| 37 | + | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) u@h [w]\n# ' | |
| 38 | + | fi | |
| 31 | 39 | fi | |
| 32 | 40 | unset color_prompt force_color_prompt | |
| 33 | 41 | ||
Will Power revised this gist 9 years ago · b8d0381
1 file changed, 59 insertions
| @@ -0,0 +1,59 @@ | |||
| 1 | + | # set variable identifying the chroot you work in (used in the prompt below) | |
| 2 | + | if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then | |
| 3 | + | debian_chroot=$(cat /etc/debian_chroot) | |
| 4 | + | fi | |
| 5 | + | ||
| 6 | + | # set a fancy prompt (non-color, unless we know we "want" color) | |
| 7 | + | case "$TERM" in | |
| 8 | + | xterm-color) color_prompt=yes;; | |
| 9 | + | esac | |
| 10 | + | ||
| 11 | + | # uncomment for a colored prompt, if the terminal has the capability; turned | |
| 12 | + | # off by default to not distract the user: the focus in a terminal window | |
| 13 | + | # should be on the output of commands, not on the prompt | |
| 14 | + | force_color_prompt=yes | |
| 15 | + | ||
| 16 | + | if [ -n "$force_color_prompt" ]; then | |
| 17 | + | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | |
| 18 | + | # We have color support; assume it's compliant with Ecma-48 | |
| 19 | + | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such | |
| 20 | + | # a case would tend to support setf rather than setaf.) | |
| 21 | + | color_prompt=yes | |
| 22 | + | else | |
| 23 | + | color_prompt= | |
| 24 | + | fi | |
| 25 | + | fi | |
| 26 | + | ||
| 27 | + | if [ "$color_prompt" = yes ]; then | |
| 28 | + | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) \u@\h \e[32m[\w]\e[0m\n$ ' | |
| 29 | + | else | |
| 30 | + | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) u@h [w]\n$ ' | |
| 31 | + | fi | |
| 32 | + | unset color_prompt force_color_prompt | |
| 33 | + | ||
| 34 | + | case "$TERM" in | |
| 35 | + | xterm*|rxvt*) | |
| 36 | + | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1";; | |
| 37 | + | *) | |
| 38 | + | ;; | |
| 39 | + | esac | |
| 40 | + | ||
| 41 | + | # enable color support of ls and also add handy aliases | |
| 42 | + | if [ -x /usr/bin/dircolors ]; then | |
| 43 | + | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
| 44 | + | alias ls='ls --color=auto' | |
| 45 | + | alias dir='dir --color=auto' | |
| 46 | + | alias vdir='vdir --color=auto' | |
| 47 | + | ||
| 48 | + | alias grep='grep --color=auto' | |
| 49 | + | alias fgrep='fgrep --color=auto' | |
| 50 | + | alias egrep='egrep --color=auto' | |
| 51 | + | fi | |
| 52 | + | ||
| 53 | + | alias nano='nano --nowrap --smooth -T 4' | |
| 54 | + | alias please='sudo' | |
| 55 | + | ||
| 56 | + | function findinfiles() { find ./ -type f -print0 | xargs -0 grep -i "$1"; } | |
| 57 | + | function findinphpfiles() { find ./ -type f -name "*.php" -print0 | xargs -0 grep -i "$1"; } | |
| 58 | + | ||
| 59 | + | complete -W "$(echo $(grep '^ssh ' ~/.bash_history | sort -u | sed 's/^ssh //'))" ssh | |