Files from bash: Are you little lost?

This commit is contained in:
Mika Suomalainen 2011-09-29 16:19:01 +03:00
parent 59f46c50ab
commit 166f1ae2d1
5 changed files with 0 additions and 284 deletions

View File

@ -1,86 +0,0 @@
# This file contains aliases which my bashrc uses. You might need to edit something (for example: if you use vi or don't have nmap).
# To get sudo work with aliases.
alias sudo="sudo "
# Moving between directories:
alias ..="cd .."
alias .="cd ."
# As you can see, I don't use/like Vi(m) :)
alias editor="nano"
alias vi="nano"
alias vim="nano"
# Use htop instead of top, it's better. Requires htop.
alias top="htop"
# Automaticly adds title to Youtube-dl when downloading videos with it. Requires youtube-dl.
alias youtube-dl="youtube-dl -t"
# git specific. This is the command which I use when git asks me to commit something and says that I have modified files, even when I haven't.
alias gdrop="git stash && git stash drop"
alias gitk="gitg" # Requires gitg . I just think that it looks nicer than gitk.
# Usually when I run "time", I want to know the current time.
alias time="date"
# If I run nautilus, I want it to open in folder where I am.
alias nautilus="nautilus ./"
# Why I must write "weechat-curses" to start it?
alias weechat="weechat-curses"
#NMAP specific. All nmap things should be run as root, so it's probably best to copy these aliases to root's .bashrc. Things which don't run without root ask for sudo password.
alias nmap-intense="nmap -T4 -A -v -PE -PS22,25,80 -PA21,23,80,3389 "
alias nmap-intense-udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,3389 "
alias nmap-intense-all-tcp="nmap -p 1-65535 -T4 -A -v -PE -PS22,25,80 -PA21,23,80,3389 "
alias nmap-intense-no-ping="nmap -T4 -A -v -PN "
alias nmap-ping="nmap -sP -PE -PA21,23,80,3389 "
alias nmap-quick="nmap -T4 -F "
alias nmap-quick-plus="sudo nmap -sV -T4 -O -F --version-light "
alias nmap-traceroute="sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
alias nmap-regular="nmap "
alias nmap-comprehensive="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
alias ping="nping "
alias netcat="ncat "
# More nmap specific things, but these also require proxychains. WANTED: better abreviation (than pc) for proxyc.
alias proxyc-nmap-intense="proxychains nmap -T4 -A -v -PE -PS22,25,80 -PA21,23,80,3389 "
alias proxyc-nmap-intense-udp="sudo proxychains nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,3389 "
alias proxyc-nmap-intense-all-tcp="proxychains nmap -p 1-65535 -T4 -A -v -PE -PS22,25,80 -PA21,23,80,3389 "
alias proxyc-nmap-intense-no-ping="proxychains nmap -T4 -A -v -PN "
alias proxyc-nmap-ping="proxychains nmap -sP -PE -PA21,23,80,3389 "
alias proxyc-nmap-quick="proxychains nmap -T4 -F "
alias proxyc-nmap-quick-plus="sudo proxychains nmap -sV -T4 -O -F --version-light "
alias proxyc-nmap-traceroute="sudo proxychains nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
alias proxyc-nmap-regular="proxychains nmap "
alias proxyc-nmap-comprehensive="sudo proxychains nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
alias proxyc-nmap="proxychains nmap"
alias proxyc-nmapfe="proxychains nmapfe"
alias proxyc-ping="proxychains nmap nping "
alias proxyc-netcat="proxychains nmap ncat "
# TOR (The Onion Router) specific.
alias usewithtor="proxychains "
alias torsocks="proxychains "
# Because I have so many proxyc aliasses and some people want to access proxychains quickly.
alias proxyc="proxychains "
# Downloads folder over SSH. Usage: rdownload <host>:<remotefolder> <local_destination> | TIP: use ~/ssh/config to configure hosts.
alias rdownload="rsync -avz "
# TMUX specific
alias attach="tmux -u attach-session"
alias detach="tmux -u detach"
alias tmux="tmux -u"
# I am always typoing "aptitude" with my phone...
alias aptitute="aptitude "
# This is the checkinstall rule which I like to use.
alias checkinstall="sudo checkinstall -D --install=no "
# The Battle for Wesnoth specific, http://wesnoth.org/
# It seems to be an good idea to have debug logs on terminal with svn version.
alias wesnoth="wesnoth --debug"

View File

@ -1,19 +0,0 @@
# This file exports everything in my bashrc. You probably want to edit somethings here, like line 14, which sets timezone to Europe/Helsinki.
# Sets the default editor. I prefer nano to vim and so on, so I want it to be nano. If you don't like terminal based text editors, change "nano" to gedit (Gnome) or Kate (KDE).
export EDITOR=nano
# Sets user specifig PYTHONPATH. Replace 2.X with your Python version. For example with Python 2.7 you replace X with 7.
#export PYTHONPATH=$HOME/.packages/lib/python2.X/site-packages
# Fixes locale problems (for example) when SSHing in with different locale. (Another example: Hailo plugin for supybot gives locale errors, this fixes it.)
# Replace "C" with your locale. You can get list of locales by running "locale -a". Replace "C" with your language. For example: fi_FI.utf8 )
LC_ALL=C
export LC_ALL
# Sets your timezone. Set in format <Region/City>, or just timezone like UTC.
#export TZ="/usr/share/zoneinfo/Europe/Helsinki"
# Sets PATH. To add another path, add :</path/to/new/path> to string below.
# Yes, I know that this isn't exporting, but I don't want PYTHONPATH to be alone here and PATH matches with nature of this file.
PATH=$PATH

View File

@ -1,53 +0,0 @@
# This file contains functions of my bashrc. You probably don't need to edit anything here.
#
# To disable function, just comment everything after description.
# GEOIP lookup, copied from the ultimate bashrc http://goo.gl/qGK5j
function geoip() {
geoiplookup $1
}
# MYIP, copied from the ultimate bashrc http://goo.gl/qGK5j . I think that it requires lynx.
function myip()
{
lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g'
}
# Checks which package the command comes from. Copied from the ultimate bashrc http://goo.gl/qGK5j
function cmdpkg() { PACKAGE=$(dpkg -S $(which $1) | cut -d':' -f1); echo "[${PACKAGE}]"; dpkg -s "${PACKAGE}" ;}
# ROT13, copied from the ultimate bashrc http://goo.gl/qGK5j
function rot13()
{
if [ $# -lt 1 ] || [ $# -gt 1 ]; then
echo "Seriously? You don't know what rot13 does?"
else
echo $@ | tr A-Za-z N-ZA-Mn-za-m
fi
}
# Down for everyone or just me? Copied from the ultimate bashrc http://goo.gl/qGK5j
function downforme() {
RED='\e[1;31m'
GREEN='\e[1;32m'
YELLOW='\e[1;33m'
NC='\e[0m'
if [ $# = 0 ]
then
echo -e "${YELLOW}usage:${NC} downforme website_url"
else
JUSTYOUARRAY=(`lynx -dump http://downforeveryoneorjustme.com/$1 | grep -o "It's just you"`)
if [ ${#JUSTYOUARRAY} != 0 ]
then
echo -e "${RED}It's just you. \n${NC}$1 is up."
else
echo -e "${GREEN}It's not just you! \n${NC}$1 looks down from here."
fi
fi
}
# Topt10 commands, copied from the ultimate bashrc http://goo.gl/qGK5j
function top10() {
# copyright 2007 - 2010 Christopher Bratusek
history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}' | sort -rn | head
}

View File

@ -1,2 +0,0 @@
# You might think that this file is useless, because bash automaticly reads bashrc. If yes, then you are wrong. Bash in Mac OS X reads settings from ~/.bash_profile.
source ~/.bashrc

124
bashrc
View File

@ -1,124 +0,0 @@
echo "Please see the README file."
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# 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
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if which tput >&/dev/null && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and 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 dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
#Shopt settings.
#shopt -s autocd
# Sources everything.
source ~/.bash_aliases
source ~/.bash_exports
source ~/.bash_functions
## DO NOT PUT ANYTHING BELOW THIS LINE OR YOUR CHANGES MAY GET IGNORED BY BASH!
sleep 1;
# Gives three seconds time to press CTRL + C in case you want to prevent action by tmux.
# Starts tmux always on start of bash, not only on SSH login, and quits from bash when tmux quits. WARNING: I DON'T KNOW WHAT HAPPENS IF YOU DON'T HAVE TMUX INSTALLED! (Modified from Cubox's script and William Shallum's tmux on SSH login http://william.shallum.net/random-notes/automatically-start-tmux-on-ssh-login )
if [[ $TERM != "screen" ]]
then
tmux has-session -t 0 && tmux attach-session -t 0 || tmux new-session -s 0 && exit
fi