----------------------------------- building a base for BASH ----------------------------------- 1) Establish Baseline - config files a) .bashrc Path, Prompt, Permissions, History, Editor, Alias, Shell options and Functions COPY FILE FROM: http://johnmeister.com/linux/bashrc-basic.html ################################################################################## export PS1=" ------------------------------------------------ $(whoami)@`hostname` [\$PWD] ------------------------------------------------ --> " #====================================================================================== umask 022 # umask 022 sets new files: 644 & dirs: 755 #====================================================================================== # NOTE - careful the "tilde" (~) may not copy over correctly - use the full path #====================================================================================== if [ ! -d ~/.History ] # tests for directory, if not, then... then mkdir ~/.History echo "history directory made" fi # sets up history file for each instance e.g.: 2017_10_Oct_01_1515.history HISTFILE="~/.History/`date '+%Y_%m_%b_%d_%H:%M'.history`" ; export HISTFILE HISTSIZE=2048; export HISTSIZE # default is usually 1024, acceptable # on MacOSx, block appendable history: SHELL_SESSION_HISTORY=0 #====================================================================================== EDITOR=vi; export EDITOR # verify location if necessary by typing: which vi VISUAL=vi; export VISUAL set -o vi # allows recall of commands via vi commands and inline editing #====================================================================================== # optional aliases - use to create simple commands or alternate OS commands alias l="ls -al" ; alias ll="ls -l" # can separate commands with ; alias lm="ls -l | more" alias md="mkdir -p" # creates full path alias mv="mv -i" # -i prevents overwriting files, use full path or \ to override alias cp="cp -i" # -i prevents overwriting files, use full path to override alias rm="rm -i" # -i prevents overwriting files, use full path to override alias dfh='df -h | grep disk' # modify to show primary file systems alias vi="vim" # type which vi or which vim, set accordingly (VIM not on all systems!) alias mroe=more # add any other words you mistype often #======================================================================================= # SHELL OPTIONS shopt -s histverify # allows recall historical commands, edit, then use, type: history shopt -s checkwinsize #========================================================================================== # creates a directory structure and changes to the lowest level - be aware of keywords function dir-mkcd () { mkdir -p "$@" && eval cd "\"\$$#\""; } #========================================================================================== b) .exrc (configuratin file for the vi editor - ex is an editor within vi) set tabstop=4 shiftwidth=4 expandtab syntax off set ruler ----------------------------------- tabstops - determines how many spaces per tab (normal is 5) shiftwidth - determines shift width, on type writers there were tabs, and tabstops, manually set rule - provides digital count of lines and spaces in lower right - very useful! ------- norule - ( JohnMeister.com Today's Date: |