# Show the hostname, uptime and users logged in on shell start
(hostname&)
(uptime&)
(echo"")
if[[$UNAME != Darwin ]];then
(who -H -w -u|head -n10&)
(echo"")
(last -10 -w -x&)
fi
if[[$UNAME= Darwin ]];then
(who -H -u|head -n10&)
(echo"")
(last -10&)
fi
##### Environment 7RS56S #####
# Environment should be placed to .environment or .bash_environment.
# Source before mentioned locations if they exist.
# .environment
if[ -f ~/.environment ];then
source ~/.environment
fi
# .bash_environment
if[ -f ~/.bash_environment ];then
source ~/.bash_environment
fi
# Enable core files.
(ulimit -c unlimited&)
# More colours :D
if[[$TERM=='xterm']];then
exportTERM=xterm-256color
fi
if[[$TERM=='screen']];then
exportTERM=screen-256color
fi
# Things after this are just examples and should be put to some other file, which is sourced above.
# Sets the default editor. I am vim user, so I want it to be vim. If you don't like terminal based text editors, change "" to gedit (Gnome) or Kate (KDE).
# Add title to youtube-dl & make yle-dl Windows-friendly
alias youtube-dl="youtube-dl -t"
alias yle-dl="yle-dl --vfat"
# 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.
aliasgdrop="git stash && git stash drop"
#alias gitk="gitg" # Requires gitg . I just think that it looks nicer than gitk. #MIKAELA_GREP # MIKAELA_GREP_ALIAS
# If I run nautilus, I want it to open in folder where I am.
#alias nautilus="nautilus ./"
#SHow compilation date of WeeChat.
alias weechat-version="weechat --help|head -n2"
#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-comprehensive="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
# Little "safer" scan as connecting to only HTTP and HTTPS ports doesn't look so attacking. Copy-paste to .bash_custom and remove " -p 80,443" if you want to scan all ports which nmap scans by default.
alias nmap-osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy "
# Downloads folder over SSH. Usage: rdownload <host>:<remotefolder> <local_destination> | TIP: use ~/ssh/config to configure hosts.
aliasrdownload="rsync -h --progress -avz "
aliasrscp='rsync -h --progress -avz '
aliasrscpr='rsync -h --progress -azvv '
# TMUX specific
aliastmux="tmux -u"
aliasattach="tmux attach-session"
aliasdetach="tmux detach"
# I am always typoing "aptitude" with my phone...
aliasaptitute="aptitude "
# The Battle for Wesnoth specific, http://wesnoth.org/
# It seems to be an good idea to have debug logs on terminal with svn version.
aliaswesnoth="wesnoth --debug"
# For copy-pasting directly from somewhere
alias %=" "
alias\#=" "
# Supybot specifig. Why to write long command, if you can write short command?
alias supybot-config-reload="killall -HUP supybot "
alias supybot-owner-quit="killall -INT supybot "
# Translating plugins in Limnoria
alias supybot-generate-messages.pot="pygettext --docstrings config.py plugin.py"
alias supybot-generate-messages.pot-xgettext="xgettext --language=Python config.py plugin.py && mv -f messages.po messages.pot"
alias supybot-check-plugin-trans="sandbox/check_trans.py plugins/"
alias supybot-check-core-trans="sandbox/check_trans.py --core"
alias supybot-generate-messages.pot-mass="find . -type d -exec sh -c '(cd {} && pygettext --docstrings config.py plugin.py)' ';'"
## -- Start of aliases which are saved from Ubuntu default bashrc. --
# enable color support of ls and also add handy aliases
if[[$UNAME != Darwin ]];then
aliasls='ls --color=always'
fi
aliasdir='dir --color=always'
aliasvdir='vdir --color=always'
aliasgrep='grep --color=always'
aliasfgrep='fgrep --color=always'
aliasegrep='egrep --color=always'
# some more ls aliases
if[[$UNAME != Darwin ]];then
aliasll='ls -alFh --color=always'&&aliasla='ls -A --color=always'&&aliasl='ls -CF --color=always'
fi
## -- End of aliases which are saved from Ubuntu default bashrc. --
# Copying command in Supybot (Internet.DNS)
aliasdns="nslookup "
aliasdns6="nslookup -type=AAAA "
aliasnslookup6="nslookup -type=AAAA "
# If I have nslookup6...
aliasdig6="dig AAAA "
# SSHGuard specific
alias sshguard-show-bans="sudo iptables -L sshguard --line-numbers"
# Enter ban number as arguement. You can see ban numbers with previous command.
alias sshguard-unban="sudo iptables -D sshguard "
# This needs something which makes it easy to remember.
aliasKILL="killall -KILL "
# For locally rsync copying folder1 to folder2.
alias rsync-folder="rsync -h --progress -azvv "
# SSHGuard seems to prefer users to run this always when connecting with keys in ssh-agent...
if[[$UNAME != Darwin ]];then
alias ssh-add="\ssh-add -D && \ssh-add "
fi
# Use GPG2 instead of GPG!
aliasgpg=gpg2
exportKEYBASE_GPG=gpg2
alias gpg-fix-tty='export GPG_TTY=$(tty)'
# For userspecific installation of mosh on remote server.
alias apt-key-refresh-keys="apt-key adv --keyserver pool.sks-keyservers.net --refresh-keys"
# To see which mirror http.debian.net puts you to. The file which has the latest update time is the mirror which you are using.
alias http.debian.net="curl -sL http://http.debian.net/debian/project/trace/|pandoc -f html -t markdown"
# Amount of keys in GPG keyring.
alias gpg-key-amount="gpg --list-keys|grep '^pub'|wc -l"
alias gpg-key-count="gpg --export -a|gpg --import"
aliasfollow="tail -F"
#myip shows current IP. This was a function.
aliasmyip="curl -s http://icanhazip.com"
aliasmyip4="dig A +short myip.opendns.com @resolver1.opendns.com"
aliasmyip6="curl -s6 http://icanhazip.com"
# Update groups without logging out. Requires entering password. Source: http://blog.edwards-research.com/2010/10/linux-refresh-group-membership-without-logging-out/
aliasrefreshgroups="exec su -l $USER"
# Incasesensitive grepping
aliasgrep="grep -i"
# Get public key lenght of (public) SSH key
alias ssh-pubkey-length="ssh-keygen -lf "
# MSDOS commands. MSDOS is after every alias line to get these lines easily by grepping.
aliascls=clear # MSDOS
aliashelp=man # MSDOS
aliasipconfig=ifconfig # MSDOS
aliascopy=cp # MSDOS
aliasmove=mv # MSDOS
# List git committers of repository
alias git-committers="git shortlog -s"
alias git-changelog="git log --oneline --decorate"
alias git-changelog-color="git log --oneline --decorate --color"
# Line ending converting with flip
aliasunixle="flip -ub "
aliasmsdosle="flip -mb "
# Making .iso bootable from CD/DVD/USB. Cat it to /dev/<DEVICE>
# MaKe Hybrid ISO
aliasmkhiso=isohybrid
# Yum
alias yum-unlock="rm -rf /var/run/yum.pid"
alias yum-rm-timedhosts="rm /var/cache/yum/$CPUARCH/17/timedhost*"
aliasyummy="yum -y "
aliasyummn="yum -n "
aliasyumy=yummy
aliasyumn=yummn
# Archiving and extracting with tar
# This is tartar to avoid conflict with tar
aliastartar="tar cfv "
aliastargz="tar cfvz "
aliastarbz2="tar cfvj "
# I have function ex so these are ex-* to avoid conflict.
# ex-tartar and ex-tar, because there is alias tartar and command tar
alias ex-tar="tar xfv "
alias ex-tartar="tar xfv "
alias ex-targz="tar xfvz "
alias ex-tarbz2="tar xfvj "
aliasinfo="echo 'I don't know anyone who likes and uses info pages, so I aliased this to pinfo. If you don't have it installed, you should install it! To override this alias run: \info <document>' && pinfo "
echo"I will now download the sources.list file from https://mkaysi.github.io/shell-things/sources.list/$RELEASE and save it as /etc/apt/sources.list ."
echo""
echo"" > /etc/apt/sources.list
\wget ${a[1]} -O /etc/apt/sources.list
#\curl -L ${a[1]} >> /etc/apt/sources.list
echo""
echo"The new sources.list file should now be installed."
echo""
echo"Finally, I will now run 'apt-get -y update' so the new sources.list is used."
echo""
apt-get update
echo"I have now finished everything that I was supposed to do."
}
# This function fixes nodejs on Debian based systems.
# (Everything expects nodejs to be called as node, but it's not with Debian.)
# Things after this are just examples and should be put to some other file, which is sourced above.
# Sets the default editor. I am vim user, so I want it to be vim. If you don't like terminal based text editors, change "" to gedit (Gnome) or Kate (KDE).