Skip to content

Instantly share code, notes, and snippets.

@elswerky
Forked from brainfucksec/bash.bashrc
Created November 15, 2021 10:03
Show Gist options
  • Save elswerky/67786278aa2ab99024107538743a82ad to your computer and use it in GitHub Desktop.
Save elswerky/67786278aa2ab99024107538743a82ad to your computer and use it in GitHub Desktop.
Termux Android .bashrc file
#################################################
#
# Termux $HOME/.bashrc FILE
# By Brainfuck
#
# Last modified: Fri Apr 9 05:42:26 PM UTC 2021
#################################################
# Handle commands not found
if [ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]; then
command_not_found_handle() {
/data/data/com.termux/files/usr/libexec/termux/command-not-found "$1"
}
fi
# History settings
#
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# Autocompletion
#
# cycle through all matches with 'TAB' key
bind 'TAB:menu-complete'
shopt -s extglob # necessary for programmable completion
shopt -s autocd # cd when entering just a path in the shell
# Color definitions
export red="$(tput setaf 1)"
export green="$(tput setaf 2)"
export yellow="$(tput setaf 3)"
export blue="$(tput setaf 4)"
export magenta="$(tput setaf 5)"
export cyan="$(tput setaf 6)"
export white="$(tput setaf 7)"
export b="$(tput bold)"
export reset="$(tput sgr0)"
# set color for current user
if [[ "$UID" -eq 0 ]]; then
usercolor="${red}"
else
usercolor="${green}"
fi
# enable color support of ls, grep and ip, also add handy aliases
if [[ -x /usr/bin/dircolors ]]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias ip='ip -color'
fi
# Default prompt
PS1='\S '
# Aliases
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias lm='ls | more'
alias ll='ls -lFh'
alias la='ls -alFh --group-directories-first'
alias l1='ls -1F --group-directories-first'
alias l1m='ls -1F --group-directories-first | more'
alias lh='ls -ld .??*'
alias lsn='ls | cat -n'
alias mkdir='mkdir -p -v'
alias cp='cp --preserve=all'
alias cpv='cp --preserve=all -v'
alias cpr='cp --preserve=all -R'
alias rmi='rm -i'
alias cpp='rsync -ahW --info=progress2'
alias cs='printf "\033c"'
alias src='source ~/.bashrc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment