Initial commit.
This commit is contained in:
46
bash/bash_aliases
Normal file
46
bash/bash_aliases
Normal file
@@ -0,0 +1,46 @@
|
||||
# File to define bash aliases. Read by ~/.bashrc.
|
||||
|
||||
alias ll='ls -AlF'
|
||||
alias la='ls -A'
|
||||
|
||||
alias ls='ls --group-directories-first --classify --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
|
||||
alias rm='rm -v'
|
||||
alias cp='cp -v'
|
||||
alias mv='mv -v'
|
||||
alias ln='ln -v'
|
||||
|
||||
#alias 'sudo rm -rf --no-preserve-root /'='echo "..."'
|
||||
#alias 'sudo find / -delete'='echo "..."'
|
||||
|
||||
alias du='du -h'
|
||||
alias df='df -h'
|
||||
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
alias .....='cd ../../../..'
|
||||
|
||||
alias root='sudo -sE'
|
||||
|
||||
alias back='cd $OLDPWD'
|
||||
|
||||
alias more='less'
|
||||
|
||||
alias sag='sudo apt-get'
|
||||
alias sagi='sudo apt-get install'
|
||||
alias sagu='sudo apt-get update'
|
||||
alias sagug='sudo apt-get upgrade'
|
||||
alias sagdug='sudo apt-get dist-upgrade'
|
||||
alias sources='cat /etc/apt/sources.list /etc/apt/sources.list.d/*'
|
||||
|
||||
alias cs="cryptsetup"
|
||||
|
||||
alias le_haxxor_1='clear && dmesg | pv -qL $[15 + (RANDOM % 10)]'
|
||||
alias le_haxxor_2='clear && hexdump -C /dev/urandom | grep "1e 4c"'
|
||||
|
||||
alias YOLO="pacman -Syu --force"
|
||||
91
bash/bash_functions
Normal file
91
bash/bash_functions
Normal file
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
# File to define bash functions. Read by ~/.bashrc.
|
||||
|
||||
function mount() {
|
||||
if [[ $# == 0 ]] ; then
|
||||
/usr/bin/env mount | column -t
|
||||
else
|
||||
/usr/bin/env mount $*
|
||||
fi
|
||||
}
|
||||
|
||||
ff() {
|
||||
find . -type f -iname "*"$*"*" ;
|
||||
}
|
||||
|
||||
ffcs() {
|
||||
find . -type f -name "*"$*"*" ;
|
||||
}
|
||||
|
||||
extract() # Handy Extract Program.
|
||||
{
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2 ) tar xvjf $1 ;;
|
||||
*.tar.gz ) tar xvzf $1 ;;
|
||||
*.bz2 ) bunzip2 $1 ;;
|
||||
*.rar ) unrar x $1 ;;
|
||||
*.gz ) gunzip $1 ;;
|
||||
*.tar ) tar xvf $1 ;;
|
||||
*.tbz2 ) tar xvjf $1 ;;
|
||||
*.tgz ) tar xvzf $1 ;;
|
||||
*.zip ) unzip $1 ;;
|
||||
*.Z ) uncompress $1 ;;
|
||||
*.7z ) 7z x $1 ;;
|
||||
*) echo "$1 cannot be extracted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "$1 is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
sudo bash -c "apt-get update && apt-get -y dist-upgrade && apt-get -y autoremove"
|
||||
}
|
||||
|
||||
showclock() {
|
||||
while : ; do
|
||||
clear
|
||||
echo "========"
|
||||
date +"%T"
|
||||
echo "========"
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
ruler() {
|
||||
for s in '....^....|' '1234567890'; do
|
||||
w=${#s}
|
||||
str=$(for (( i=1; $i<=$(( ($COLUMNS + $w) / $w )) ; i=$i+1 )); do echo -n $s; done )
|
||||
str=$(echo $str | cut -c -$COLUMNS)
|
||||
echo $str
|
||||
done
|
||||
}
|
||||
|
||||
up() {
|
||||
[ "${1/[^0-9]/}" == "$1" ] && {
|
||||
local ups=""
|
||||
for i in $(seq 1 $1)
|
||||
do
|
||||
ups=$ups"../"
|
||||
done
|
||||
cd $ups
|
||||
} || echo "usage: up <INTEGER>"
|
||||
}
|
||||
|
||||
ckwww() {
|
||||
ping -c 3 www.google.com
|
||||
}
|
||||
|
||||
topcmds() {
|
||||
history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -nr | head
|
||||
}
|
||||
|
||||
fnottype() {
|
||||
find . -maxdepth 1 ! -type $1
|
||||
}
|
||||
|
||||
# simple calculator
|
||||
? () {
|
||||
echo "$*" | bc -l
|
||||
}
|
||||
11
bash/bash_greeting
Normal file
11
bash/bash_greeting
Normal file
@@ -0,0 +1,11 @@
|
||||
# File with instructions to greet the user. Read at the end of ~/.bashrc
|
||||
|
||||
#COUNTER_DESTROYED=3
|
||||
|
||||
|
||||
clear
|
||||
#echo -ne "${NC}Hello, $USER. Today is $(date +"%A, %-d %B %Y, %T")\n\n"
|
||||
#echo -ne "${NC}" ; ncal -MC
|
||||
#echo -ne "${NC}System is $(uptime | grep -o "up.*:[[:digit:]][[:digit:]]" | tr -s " ") hours\n"
|
||||
#echo -ne "${NC}Your personal counter for destroyed linuxes is: $COUNTER_DESTROYED\n"
|
||||
#echo -ne "${NC}Keep it up and have fun.\n"
|
||||
7
bash/bash_logout
Normal file
7
bash/bash_logout
Normal file
@@ -0,0 +1,7 @@
|
||||
# ~/.bash_logout: executed by bash(1) when login shell exits.
|
||||
|
||||
# when leaving the console clear the screen to increase privacy
|
||||
|
||||
if [ "$SHLVL" = 1 ]; then
|
||||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
||||
fi
|
||||
0
bash/bash_profile
Normal file
0
bash/bash_profile
Normal file
18
bash/bash_prompt
Normal file
18
bash/bash_prompt
Normal file
@@ -0,0 +1,18 @@
|
||||
### File to set the prompt of bash. Read by ~/.bashrc
|
||||
###
|
||||
### Usable veriables:
|
||||
### \h Hostname auf dem die Shell läuft bis zum ersten "."
|
||||
### \H Hostname komplett
|
||||
### \t Uhrzeit im 24-Stunden Format (hh:mm:ss)
|
||||
### \T Uhrzeit im 12-Stunden Format (hh:mm:ss)
|
||||
### \u Name des Nutzers, der die Shell gestartet hat
|
||||
### \w momentanes Arbeitsverzeichnis
|
||||
### \W letzte Komponente des Arbeitsverzeichnisses
|
||||
### \$ Wenn root ein "#", sonst ein "$"
|
||||
### \\ Backslash
|
||||
|
||||
export PS1="\[${BLUE}\][\t] [\!] \[${GREEN}\]\u\[${NC}\]@\[${RED}\]\h\[${NC}\]:\[${YELLOW}\] \w \[${NC}\]\$> "
|
||||
|
||||
#export PS1=">"
|
||||
|
||||
#export PS1="[\t] [\!] \u@\h: \w \$> "
|
||||
7
bash/bash_variables
Normal file
7
bash/bash_variables
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
export USERBIN=$HOME/bin
|
||||
|
||||
export ENCFS_MOUNT="$HOME/.crypt/encfs/mount"
|
||||
export ENCFS_DEV="$HOME/.crypt/encfs/dev"
|
||||
|
||||
export MOZ_DISABLE_PANGO=1
|
||||
60
bash/bashrc
Normal file
60
bash/bashrc
Normal file
@@ -0,0 +1,60 @@
|
||||
# If not interactive, do nothing.
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
HISTCONTROL=ignoreboth
|
||||
shopt -s histappend
|
||||
HISTSIZE="unlimited"
|
||||
HISTFILESIZE="unlimited"
|
||||
HISTCONTROL=ignorespace
|
||||
|
||||
# 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
|
||||
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
BLACK='\e[0;30m'
|
||||
BLUE='\e[0;34m'
|
||||
GREEN='\e[0;32m'
|
||||
CYAN='\e[0;36m'
|
||||
RED='\e[0;31m'
|
||||
PURPLE='\e[0;35m'
|
||||
BROWN='\e[0;33m'
|
||||
LIGHTGRAY='\e[0;37m'
|
||||
DARKGRAY='\e[1;30m'
|
||||
LIGHTBLUE='\e[1;34m'
|
||||
LIGHTGREEN='\e[1;32m'
|
||||
LIGHTCYAN='\e[1;36m'
|
||||
LIGHTRED='\e[1;31m'
|
||||
LIGHTPURPLE='\e[1;35m'
|
||||
YELLOW='\e[1;33m'
|
||||
WHITE='\e[1;37m'
|
||||
NC='\e[0m' # No Color
|
||||
|
||||
# Sets default editor.
|
||||
export EDITOR=vim
|
||||
|
||||
# adding some other program paths to PATH
|
||||
export PATH=${PATH}:/sbin:/usr/sbin:usr/local/bin
|
||||
# adding a user's private path if it exists
|
||||
[ -d ~/bin/ ] && export PATH=${PATH}:${HOME}/bin
|
||||
|
||||
[ -f /etc/bash_completion ] && . /etc/bash_completion
|
||||
|
||||
export BASH_ALIASES="$HOME/.bash_aliases"
|
||||
export BASH_FUNCTIONS="$HOME/.bash_functions"
|
||||
export BASH_PROMPT="$HOME/.bash_prompt"
|
||||
export BASH_GREETING="$HOME/.bash_greeting"
|
||||
export BASH_VARIABLES="$HOME/.bash_variables"
|
||||
|
||||
[ -f "$BASH_ALIASES" ] && . "$BASH_ALIASES"
|
||||
[ -f "$BASH_FUNCTIONS" ] && . "$BASH_FUNCTIONS"
|
||||
[ -f "$BASH_PROMPT" ] && . "$BASH_PROMPT"
|
||||
[ -f "$BASH_GREETING" ] && . "$BASH_GREETING"
|
||||
[ -f "$BASH_VARIABLES" ] && . "$BASH_VARIABLES"
|
||||
Reference in New Issue
Block a user