|
| 1 | +#-------------------------------------------------------------------------------# |
| 2 | +##DL |
| 3 | +# curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/.bashrc" |
| 4 | +##Loc: |
| 5 | +# "$HOME/.bashrc" |
| 6 | +# "/root/.bashrc" |
| 7 | +# "/etc/bash.bashrc" |
| 8 | +##REF: |
| 9 | +# https://github.com/bluz71/dotfiles/blob/master/bashrc |
| 10 | +# https://github.com/liskin/dotfiles/tree/home/.bashrc.d |
| 11 | +# https://github.com/ashishb/dotfiles |
| 12 | +# https://github.com/yorevs/homesetup/tree/master/dotfiles/bash |
| 13 | +# https://github.com/fnichol/bashrc/blob/master/bashrc |
| 14 | +#-------------------------------------------------------------------------------# |
1 | 15 |
|
| 16 | +#-------------------------------------------------------------------------------# |
| 17 | +##Apperance |
| 18 | +export TERM="xterm-256color" |
| 19 | +export EDITOR="/usr/bin/nano" |
| 20 | +#Colours |
| 21 | +txtblk='\[\e[0;30m\]' # Black - Regular |
| 22 | +txtred='\[\e[0;31m\]' # Red |
| 23 | +txtgrn='\[\e[0;32m\]' # Green |
| 24 | +txtylw='\[\e[0;33m\]' # Yellow |
| 25 | +txtblu='\[\e[0;34m\]' # Blue |
| 26 | +txtpur='\[\e[0;35m\]' # Purple |
| 27 | +txtcyn='\[\e[0;36m\]' # Cyan |
| 28 | +txtwht='\[\e[0;37m\]' # White |
| 29 | +bldblk='\[\e[1;30m\]' # Black - Bold |
| 30 | +bldred='\[\e[1;31m\]' # Red |
| 31 | +bldgrn='\[\e[1;32m\]' # Green |
| 32 | +bldylw='\[\e[1;33m\]' # Yellow |
| 33 | +bldblu='\[\e[1;34m\]' # Blue |
| 34 | +bldpur='\[\e[1;35m\]' # Purple |
| 35 | +bldcyn='\[\e[1;36m\]' # Cyan |
| 36 | +bldwht='\[\e[1;37m\]' # White |
| 37 | +unkblk='\[\e[4;30m\]' # Black - Underline |
| 38 | +undred='\[\e[4;31m\]' # Red |
| 39 | +undgrn='\[\e[4;32m\]' # Green |
| 40 | +undylw='\[\e[4;33m\]' # Yellow |
| 41 | +undblu='\[\e[4;34m\]' # Blue |
| 42 | +undpur='\[\e[4;35m\]' # Purple |
| 43 | +undcyn='\[\e[4;36m\]' # Cyan |
| 44 | +undwht='\[\e[4;37m\]' # White |
| 45 | +bakblk='\[\e[40m\]' # Black - Background |
| 46 | +bakred='\[\e[41m\]' # Red |
| 47 | +badgrn='\[\e[42m\]' # Green |
| 48 | +bakylw='\[\e[43m\]' # Yellow |
| 49 | +bakblu='\[\e[44m\]' # Blue |
| 50 | +bakpur='\[\e[45m\]' # Purple |
| 51 | +bakcyn='\[\e[46m\]' # Cyan |
| 52 | +bakwht='\[\e[47m\]' # White |
| 53 | +txtrst='\[\e[0m\]' # Text Reset |
| 54 | +#Prompt colours |
| 55 | +atC="${txtgrn}" |
| 56 | +nameC="${txtgrn}" |
| 57 | +hostC="${txtgrn}" |
| 58 | +pathC="${txtblu}" |
| 59 | +pointerC="${bldwht}" |
| 60 | +normalC="${txtwht}" |
| 61 | +#Red name for root |
| 62 | +if [ "${UID}" -eq "0" ]; then |
| 63 | + nameC="${txtred}" |
| 64 | +fi |
| 65 | +#Prompt |
| 66 | +export PS1="${nameC}\u${atC}@${hostC}\h${normalC}:${pathC}\w${pointerC}$ ${normalC}" |
| 67 | +#-------------------------------------------------------------------------------# |
| 68 | + |
| 69 | +#-------------------------------------------------------------------------------# |
| 70 | +##ENV VARS |
| 71 | +if [ -z "${USER}" ]; then |
| 72 | + USER="$(whoami)" && export USER="$USER" |
| 73 | +fi |
| 74 | +if [ -z "${HOME}" ]; then |
| 75 | + HOME="$(getent passwd $USER | cut -d: -f6)" && export HOME="$HOME" |
| 76 | +fi |
| 77 | +if [ -z "${USER_AGENT}" ]; then |
| 78 | + USER_AGENT="$(curl -qfsSL 'https://pub.ajam.dev/repos/Azathothas/Wordlists/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" |
| 79 | +fi |
| 80 | +SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" |
| 81 | +#Core |
| 82 | +export LANGUAGE=${LANGUAGE:-en_US:en} |
| 83 | +export LANG=${LANG:-en_US.UTF-8} |
| 84 | +export LC_ALL=${LC_ALL:-${LANG}} |
| 85 | + |
| 86 | +BW_INTERFACE="$(ip route | grep -i 'default' | awk '{print $5}' | tr -d '[:space:]')" && export BW_INTERFACE="${BW_INTERFACE}" |
| 87 | +current_dir="$(pwd)" |
| 88 | +##PATHS (Only Required) |
| 89 | +export GOROOT="$HOME/.go" |
| 90 | +export GOPATH="$HOME/go" |
| 91 | +export PATH="$HOME/bin:$HOME/.cargo/bin:$HOME/.cargo/env:$HOME/.go/bin:$HOME/go/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$HOME/.local/bin:$HOME/miniconda3/bin:$HOME/miniconda3/condabin:/usr/local/zig:/usr/local/zig/lib:/usr/local/zig/lib/include:/usr/local/musl/bin:/usr/local/musl/lib:/usr/local/musl/include:$PATH" |
| 92 | +#-------------------------------------------------------------------------------# |
| 93 | + |
| 94 | + |
| 95 | +#-------------------------------------------------------------------------------# |
| 96 | +##Aliases |
| 97 | +if [ -f ~/.bash_aliases ]; then |
| 98 | + . ~/.bash_aliases |
| 99 | +fi |
| 100 | +alias 7z_archive='7z a -t7z -mx="9" -mmt="$(($(nproc)+1))" -bsp1 -bt $1 $2' |
| 101 | +alias bat='batcat' |
| 102 | +alias benchmarkQ='curl -qfsSL bench.sh | bash' |
| 103 | +alias benchmarkX='curl -qfsSL yabs.sh | bash -s -- -i' |
| 104 | +alias cf_warp_trace='echo ; curl -qfsSL "https://1.1.1.1/cdn-cgi/trace" ; echo' |
| 105 | +#alias df='duf' |
| 106 | +alias dir='dir --color=auto' |
| 107 | +alias du_dir='du -h --max-depth=1 | sort -h' |
| 108 | +alias esort='for file in ./* ; do sort -u "$file" -o "$file"; done' |
| 109 | +alias egrep='egrep --color=auto' |
| 110 | +alias fdfind='fd' |
| 111 | +alias fgrep='fgrep --color=auto' |
| 112 | +alias file_size='stat -c "%s" "$1" "$2" | numfmt --to="iec" --suffix="B"' |
| 113 | +alias grep='grep --color=auto' |
| 114 | +alias history_purge='history -c 2>/dev/null ; rm -rf "$HOME/.bash_history"' |
| 115 | +alias ip_ifconfig='ip -a -d -h -p -s address' |
| 116 | +alias ip_ifconfig_resolve='ip -a -d -h -p -r -s address' |
| 117 | +alias ip_ifconfig_netconf='ip -a -d -h -p -s netconf' |
| 118 | +alias ip_quality='bash <(curl -qfskSL "https://raw.githubusercontent.com/xykt/IPQuality/main/ip.sh") -l en' |
| 119 | +alias ls='ls -lh --color=auto' |
| 120 | +alias ls_ports='sudo netstat -lntup' |
| 121 | +alias ls_ports_hosts='sudo lsof -i -l -R' |
| 122 | +alias ls_ports_progs='sudo netstat -atulpen' |
| 123 | +alias ls_ports_ip='sudo lsof -i -l -R -n' |
| 124 | +alias list_ports_netstat='sudo netstat -atulpen' |
| 125 | +alias list_procs='sudo ps aux' |
| 126 | +alias miniserve_dl='miniserve --port 9977 --title "Files" --header "Miniserved: yes" --color-scheme-dark monokai --hide-theme-selector --qrcode --show-wget-footer --hide-version-footer --verbose' |
| 127 | +alias miniserve_up='miniserve --port 9977 --title "Files" --header "Miniserved: yes" --color-scheme-dark monokai --hide-theme-selector --qrcode --show-wget-footer --hide-version-footer --upload-files --verbose' |
| 128 | +alias my_ipv4='curl --ipv4 -qfsSL "http://ipv4.whatismyip.akamai.com" ; echo' |
| 129 | +alias my_ipv6='curl --ipv6 -qfsSL "http://ipv6.whatismyip.akamai.com" ; echo' |
| 130 | +alias ssh_logs='grep -rsh "ssh" "/var/log" | grep -i "auth" | sort | less' |
| 131 | +alias rdp_logs='grep -rsh "rdp" "/var/log" | sort | less' |
| 132 | +alias tail_log='tail -f -n +1' |
| 133 | +alias tmpdir='cd $(mktemp -d)' |
| 134 | +alias tmpdir_du='du -h --max-depth="1" "/tmp" 2>/dev/null | sort -hr' |
| 135 | +alias tmpdir_push='pushd "$(mktemp -d)" >/dev/null 2>&1' |
| 136 | +alias tmpdir_pop='popd >/dev/null 2>&1' |
| 137 | +alias scb='xclip -selection c' |
| 138 | +alias vdir='vdir --color=auto' |
| 139 | +#-------------------------------------------------------------------------------# |
| 140 | + |
| 141 | +#-------------------------------------------------------------------------------# |
| 142 | +##Completions |
| 143 | +if [ -f "/etc/bash_completion" ] && ! shopt -oq posix; then |
| 144 | + . "/etc/bash_completion" |
| 145 | +fi |
| 146 | +#-------------------------------------------------------------------------------# |
| 147 | + |
| 148 | +#-------------------------------------------------------------------------------# |
| 149 | +#Functions |
| 150 | +#-------------------------------------------------------------------------------# |
| 151 | + |
| 152 | +#-------------------------------------------------------------------------------# |
| 153 | +##Misc |
| 154 | +#don't put duplicate lines or lines starting with space in the history. |
| 155 | +export HISTCONTROL=ignoreboth:erasedups |
| 156 | +#History Size |
| 157 | +export HISTSIZE=999999 |
| 158 | +export HISTFILESIZE=9999999 |
| 159 | +#append to the history file, don't overwrite it |
| 160 | +shopt -s histappend |
| 161 | +#Setting history format: Index [<User>, <Date> <Time>] command |
| 162 | +export HISTTIMEFORMAT="[${USER}, %F %T] " |
| 163 | +#Check the window size after each command and, if necessary, |
| 164 | +#update the values of LINES and COLUMNS. |
| 165 | +shopt -s checkwinsize |
| 166 | +#-------------------------------------------------------------------------------# |
| 167 | + |
| 168 | +#-------------------------------------------------------------------------------# |
| 169 | +##Dedupe & Fix Path |
| 170 | +PATH="$(echo "${PATH}" | awk 'BEGIN{RS=":";ORS=":"}{gsub(/\n/,"");if(!a[$0]++)print}' | sed 's/:*$//')" ; export PATH |
| 171 | +#-------------------------------------------------------------------------------# |
0 commit comments