Last active
September 30, 2015 08:38
-
-
Save ScrambledBits/1753697 to your computer and use it in GitHub Desktop.
This is my .bashrc file, feel free to use it all or parts of it in your own .bashrc file. If you have any improvements, let me know. This is for an Ubuntu system, but it could work on any system with some tweaking.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prefix | |
export PS1="\[$(tput setaf 7) $(tput setab 1)\][\@]\[$(tput bold)\] [\u@\H: \w] # \[$(tput sgr0)\]" | |
# environment variable | |
export PATH=$PATH:$HOME/bin/ | |
# remove duplicates from history | |
export HISTCONTROL=ignoreboth | |
# colors | |
export TERM=xterm-256color | |
export LS_OPTIONS='--color=auto' | |
eval "`dircolors -b`" | |
alias ls='ls $LS_OPTIONS' | |
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' | |
# WWW path | |
export WWW=/var/www/ | |
#colored man pages | |
export LESS_TERMCAP_mb=$'\E[01;31m' | |
export LESS_TERMCAP_md=$'\E[01;37m' | |
export LESS_TERMCAP_me=$'\E[0m' | |
export LESS_TERMCAP_se=$'\E[0m' | |
export LESS_TERMCAP_so=$'\E[01;44;33m' | |
export LESS_TERMCAP_ue=$'\E[0m' | |
export LESS_TERMCAP_us=$'\E[01;32m' | |
#set Hostname | |
hostname -F /etc/hostname | |
# custom shortcuts | |
alias ?='history | more' # displays history | |
alias c='clear' | |
alias screen='screen -s /bin/bash' # exec bash on screen | |
alias s='screen' # one character screen | |
alias ss='s -dRR' | |
alias ..='cd ..' | |
alias update_all='aptitude update && aptitude upgrade' | |
alias clean_packages='aptitude clean && aptitude autoclean && aptitude purge' | |
alias aptclean='aptitude clean && aptitude autoclean && aptitude purge' | |
#Custom Functions | |
function local_ips(){ | |
ifconfig | grep "inet addr" | awk '{print $2}' | awk -F: '{print $2}' | |
} | |
function connected_ips(){ | |
netstat -lantp | grep ESTABLISHED |awk '{print $5}' | awk -F: '{print $1}' | sort -u | |
} | |
function mirror_site() { | |
wget --mirror -p --convert-links -P ./ $1 | |
} | |
function get_links() { | |
lynx -dump http://$1 | awk '/http/{print $2}' | sort -u | |
} | |
function new_script() | |
{ | |
if [ $# -lt 2 ] | |
then | |
echo -e "ERROR: Not enough arguments\n\nUSAGE: $0 LANGUAGE FILENAME\n\nWHERE:\nLANGUAGE = The language the script will be written in.\nFILENAME = The name of the file to create." | |
else | |
LANGUAGE=$(which $1) | |
FILENAME=$2 | |
echo "#!$LANGUAGE" > $FILENAME | |
chmod +x $FILENAME | |
nano $FILENAME | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment