SHOW:
|
|
- or go back to the newest paste.
| 1 | #!/bin/bash | |
| 2 | # based on a function found in bashtstyle-ng 5.0b1 | |
| 3 | # Original author Christopher Roy Bratusek (http://www.nanolx.org) | |
| 4 | # Last arranged by ayoli (http://ayozone.org) 2008-02-04 17:16:43 +0100 CET | |
| 5 | screenfetch | |
| 6 | ||
| 7 | function pre_prompt {
| |
| 8 | newPWD="${PWD}"
| |
| 9 | user="whoami" | |
| 10 | host=$(echo -n $HOSTNAME | sed -e "s/[\.].*//") | |
| 11 | datenow=$(date "+%a, %d %b %y") | |
| 12 | let promptsize=$(echo -n "┌($user@$host ddd., DD mmm YY)(${PWD})┐" \
| |
| 13 | | wc -c | tr -d " ") | |
| 14 | let fillsize=${COLUMNS}-${promptsize}
| |
| 15 | fill="" | |
| 16 | while [ "$fillsize" -gt "0" ] | |
| 17 | do | |
| 18 | fill="${fill}─"
| |
| 19 | let fillsize=${fillsize}-1
| |
| 20 | done | |
| 21 | if [ "$fillsize" -lt "0" ] | |
| 22 | then | |
| 23 | let cutt=3-${fillsize}
| |
| 24 | newPWD="...$(echo -n $PWD | sed -e "s/\(^.\{$cutt\}\)\(.*\)/\2/")"
| |
| 25 | fi | |
| 26 | } | |
| 27 | ||
| 28 | PROMPT_COMMAND=pre_prompt | |
| 29 | ||
| 30 | export black="\[\033[0;38;5;0m\]" | |
| 31 | export red="\[\033[0;38;5;1m\]" | |
| 32 | export orange="\[\033[0;38;5;130m\]" | |
| 33 | export green="\[\033[0;38;5;2m\]" | |
| 34 | export yellow="\[\033[0;38;5;3m\]" | |
| 35 | export blue="\[\033[0;38;5;4m\]" | |
| 36 | export bblue="\[\033[0;38;5;12m\]" | |
| 37 | export magenta="\[\033[0;38;5;55m\]" | |
| 38 | export cyan="\[\033[0;38;5;6m\]" | |
| 39 | export white="\[\033[0;38;5;7m\]" | |
| 40 | export coldblue="\[\033[0;38;5;33m\]" | |
| 41 | export smoothblue="\[\033[0;38;5;111m\]" | |
| 42 | export iceblue="\[\033[0;38;5;45m\]" | |
| 43 | export turqoise="\[\033[0;38;5;50m\]" | |
| 44 | export smoothgreen="\[\033[0;38;5;42m\]" | |
| 45 | ||
| 46 | ||
| 47 | ||
| 48 | case "$TERM" in | |
| 49 | xterm) | |
| 50 | PS1="$bblue┌─($orange\u@\h \$(date \"+%a, %d %b %y\")$bblue)─\${fill}─($orange\$newPWD\
| |
| 51 | $bblue)─┐\n$bblue└─($orange\$(date \"+%H:%M\") \$$bblue)─>$white " | |
| 52 | ;; | |
| 53 | screen) | |
| 54 | PS1="$bblue┌─($orange\u@\h \$(date \"+%a, %d %b %y\")$bblue)─\${fill}─($orange\$newPWD\
| |
| 55 | $bblue)─┐\n$bblue└─($orange\$(date \"+%H:%M\") \$$bblue)─>$white " | |
| 56 | ;; | |
| 57 | *) | |
| 58 | PS1="┌─(\u@\h \$(date \"+%a, %d %b %y\"))─\${fill}─(\$newPWD\
| |
| 59 | )─┐\n└─(\$(date \"+%H:%M\") \$)─> " | |
| 60 | ;; | |
| 61 | esac | |
| 62 | ||
| 63 | # bash_history settings: size and no duplicates and no lines w/ lead spaces | |
| 64 | exportHISTCONTROL="ignoreboth" | |
| 65 | export HISTSIZE=1024 | |
| 66 | ||
| 67 | # aliases ############################################# | |
| 68 | ||
| 69 | # enable color support of ls and also add handy aliases | |
| 70 | eval `dircolors -b` | |
| 71 | alias ls='ls --color=auto' | |
| 72 | alias dir='ls --color=auto --format=vertical' | |
| 73 | alias vdir='ls --color=auto --format=long' | |
| 74 | ||
| 75 | # some more ls aliases | |
| 76 | alias ll='ls -lhX' | |
| 77 | alias la='ls -A' | |
| 78 | alias ldir='ls -lhA |grep ^d' | |
| 79 | alias lfiles='ls -lhA |grep ^-' | |
| 80 | #alias l='ls -CF' | |
| 81 | alias update='yaourt -Syu --aur' | |
| 82 | alias install='yaourt -S' | |
| 83 | alias tftp='sudo python3 /home/oli/.tftpgui/tftpgui.py' | |
| 84 | alias cleanup='sudo pacman -Rns $(pacman -Qtdq) && # pacman -Sc && | |
| 85 | sudo pacman-optimize' | |
| 86 | # To see something coming into ls output: lss | |
| 87 | alias lss='ls -lrt | grep $1' | |
| 88 | alias msfconsole="sudo msfconsole --quiet -x \"db_connect ${USER}@msf\""
| |
| 89 | alias msfweb='sudo /etc/init.d/metasploit start' | |
| 90 | # cpu scaling | |
| 91 | alias low='sudo cpupower frequency-set -g powersave' | |
| 92 | alias mid='sudo cpupower frequency-set -g ondemand' | |
| 93 | alias high='sudo cpupower frequency-set -g performance' | |
| 94 | ||
| 95 | # To check a process is running in a box with a heavy load: pss | |
| 96 | alias pss='ps -ef | grep $1' | |
| 97 | ||
| 98 | # usefull alias to browse your filesystem for heavy usage quickly | |
| 99 | alias ducks='ls -A | grep -v -e '\''^\.\.$'\'' |xargs -i du -ks {} |sort -rn |head -16 | awk '\''{print $2}'\'' | xargs -i du -hs {}'
| |
| 100 | ||
| 101 | # cool colors for manpages | |
| 102 | alias man="TERMINFO=~/.terminfo TERM=mostlike LESS=C PAGER=less man" | |
| 103 | ||
| 104 | ########################################################## | |
| 105 | # enable programmable completion features (you don't need to enable | |
| 106 | # this, if it's already enabled in /etc/bash.bashrc). | |
| 107 | if [ -f /etc/bash_completion ]; then | |
| 108 | . /etc/bash_completion | |
| 109 | fi | |
| 110 | ||
| 111 | # CDPATH initialisation | |
| 112 | CDPATH=.:~:/media/store:/media/sites | |
| 113 | PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH" |