Це стара версія документу!
ncurses-term tree wget curl bash-completion git htop whois bzip2 mlocate pv unrar unzip anacron mc
apt-file
command -v vim > /dev/null || sudo apt install vim-nox
mkdir -v ~/{.ssh,temp,scripts,backup,.vim}
chmod 700 ~/{.ssh,temp,scripts,backup,.vim}
######################
# Configure PATH ENV #
######################
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# prepend additional user directories
path_array=("/usr/local/scripts" "$HOME/bin" "$HOME/.local/bin" "$HOME/scripts")
for item in "${path_array[*]}"
do
if [ -d "$item" ] ; then
PATH="$item:$PATH"
fi
done
unset path_array
export PATH
##########################
# Configure shell prompt #
##########################
# Colors
# 0 - Black
# 1 - Red
# 2 - Green
# 3 - Yellow
# 4 - Blue
# 5 - Magenta
# 6 - Cyan
# 7 - White
# you can make it lighter with BOLD attribute
#
CNORM="\[$(tput sgr0)\]"
CLIGHTGREEN="\[$(tput bold)$(tput setaf 2)\]"
CGREEN="$CNORM\[$(tput setaf 2)\]"
CLIGHTCYAN="\[$(tput bold)$(tput setaf 6)\]"
CCYAN="$CNORM\[$(tput setaf 6)\]"
CGRAY="$CNORM\[$(tput setaf 7)\]"
CWHITE="\[$(tput bold)$(tput setaf 7)\]"
CLIGHTRED="\[$(tput bold)$(tput setaf 1)\]"
# assign colors to data
DAYC=$CLIGHTGREEN
DATEC=$CGREEN
PATHC=$CLIGHTGREEN
HOSTC=$CLIGHTCYAN
EVENTC=$CCYAN
TIMEC=$CGREEN
GTC=$CWHITE
LASTEXITC=$CLIGHTGREEN
SUCOLOR=$CLIGHTRED
# Prepare prompt
PRUSER="-"
if [ "$EUID" = "0" ]; then
PRUSER="${SUCOLOR}#${CNORM}"
fi
PS1="$DAYC\D{%a}$DATEC/\D{%b,%d}:pts/\l:$PATHC\w\n\
${HOSTC}\h$CNORM:$PRUSER$EVENTC\!$TIMEC/\A$CNORM|$LASTEXITC\$?$GTC>$CNORM"
export PS1
# PS2 – Continuation interactive prompt
export PS2="continue-> "
# The PS4 shell variable defines the prompt that gets displayed, when you execute a shell script in debug mode
export PS4='$0.$LINENO+ '
########
# MISC #
########
export HISTSIZE=1000
export HISTTIMEFORMAT="%t%d.%m.%y %H:%M:%S%t"
unalias ls
alias ls="/bin/ls --color=never -F --group-directories-first"
alias dir="ls -a"
alias l="ls -la"
alias cw="clear; w"
alias x="exit"
alias cls="clear"
alias bc="bc -ql"
alias tt=traceroute
# Open last modified file in vim (not checked!)
alias Vim="vim `ls -t | head -1`"
# Find top 5 big files
alias findbig="find . -type f -exec ls -s {} \; | sort -n -r | head -5"
# To clear all the history and screen
alias hcl='history -c; clear'
# Make basic commands verbose
alias cp="cp -v"
alias rm="rm -v"
alias mv="mv -v"
# To navigate to the different directories
alias ..='cd ..'
alias ...='cd ../..'
# Create and change to a new directory
mcd ()
{
if [ "$1" == "" ]; then
echo "mcd directory-name";
else
if [ ! -d $1 ]; then
mkdir $1;
cd $1;
else
echo "$1 directory exists";
fi;
fi
}
# display currently mounted file systems nicely
showmounted() { (echo "DEVICE PATH TYPE FLAGS" && mount | awk '$2=$4="";1') | column -t; }