Update /etc/skel

Set the default user parameters as follows

dot toprc

Below are the manual settings in the order of

  • Refresh every 1 second
  • Show individual CPUs
  • Color
  • Save settings permanently
s 1
1
z
SHIFT+W

Setup top to custom specifications by create a .toprc file in /etc/skel

This sets the refresh to 1 second. Also identifies each CPU usage,etc.

RCfile for "top with windows"           # shameless braggin'
Id:a, Mode_altscr=0, Mode_irixps=1, Delay_time=1.000, Curwin=0
Def     fieldscur=AEHIOQTWKNMbcdfgjplrsuvyzX
        winflags=32057, sortindx=10, maxtasks=0
        summclr=1, msgsclr=1, headclr=3, taskclr=1
Job     fieldscur=ABcefgjlrstuvyzMKNHIWOPQDX
        winflags=62777, sortindx=0, maxtasks=0
        summclr=6, msgsclr=6, headclr=7, taskclr=6
Mem     fieldscur=ANOPQRSTUVbcdefgjlmyzWHIKX
        winflags=62777, sortindx=13, maxtasks=0
        summclr=5, msgsclr=5, headclr=4, taskclr=5
Usr     fieldscur=ABDECGfhijlopqrstuvyzMKNWX
        winflags=62777, sortindx=4, maxtasks=0
        summclr=3, msgsclr=3, headclr=2, taskclr=3

sudo

Create a small file called isudo in the home directory to help with sudo. Below is the single line content of the isudo file

echo "sudo PATH=\$PATH WINDOW=\$WINDOW /bin/bash" > $HOME/isudo
chmod 744 $HOME/isudo

For Debian, root PATH is different hence we are not including PATH

echo "sudo WINDOW=\$WINDOW /bin/bash" > $HOME/isudo
chmod 744 $HOME/isudo

End Users can Run this as

. ~/isudo

dot screenrc

Below are the settings for screen using .screenrc

As you can see a number of these are commented out but may be useful for someone to enable quickly.

defscrollback 20000
#deflog on
#log on
#logfile flush 60
#logtstamp on
#logtstamp after 3600
ignorecase on

dot vimrc

Below are the settings for .vimrc for vim

Make sure the backup directory is updated to the user's home directory + a suitable backup directory under it

" Handles the settings for indentation
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
"set autoindent smartindent

" Turn on line numbering
"set number

" Pattern searches should ignore case
set ignorecase

" Turns on syntax highlighting.
syntax on

" Flash when errors occur
set visualbell
" set errorbells

"Incremental search
set incsearch

" Cool tab completion stuff
set wildmenu
set wildmode=list:longest,full

" Backups
set backup
" Create a suitable directory location for backups
" set backupdir=/home/<userdir>/temp_files/vimbackups,.,/tmp
set backupdir=/tmp
au BufWritePre * let &bex = '-' . strftime("%F-%H-%M-%S") . '.vimbak'

" Mappings
" :map <F11> :tabp<CR>
" :map <F12> :tabn<CR>
:map [[ :tabp<CR>
:map ]] :tabn<CR>

dot bashrc

Customize bash history settings and color prompt. Append this to the end of .bashrc file for root and each user.

# Custom settings
. ~/.bashrc_ext
#

Create new file .bashrc_ext with the below settings.

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=20000
HISTFILESIZE=40000
#
# append to ~/.bash_history any commands in the current terminal that aren't already in there
# read any new lines that have appeared in ~/.bash_history since the last time it looked.
PROMPT_COMMAND="history -a; history -n"
#
# History timestamp
HISTTIMEFORMAT='%F %T '
# Multi-line commands in one line
shopt -s cmdhist
shopt -s lithist
#
# Color prompt
#                                           red - date               green - host@user             blue - path        yellow - #
PS1='${debian_chroot:+($debian_chroot)}\[\e[0;31m\][$(date +%r)]\[\e[0;36m\][\u@\h]\[\033[00m\]:\[\033[01;34m\]\w\[\e[0;33m\][${WINDOW}]\[\033[00m\]\$ '
#
export EDITOR=vim
#
#History ignore - does not keep record of rm commands
HISTIGNORE='rm *:[ \t]*'
#
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias diff='diff --color=auto'

Color Prompt for root user - make this change to /root/.bashrc_ext

# Color prompt
#                                           red - date          pink/white - host@user             blue - path        yellow - #
PS1='${debian_chroot:+($debian_chroot)}\[\e[0;31m\][$(date +%r)]\[\e[0;45m\][\u@\h]\[\033[00m\]:\[\033[01;34m\]\w\[\e[0;33m\][${WINDOW}]\[\033[00m\]\$ '

sudo without password

Run visudo to edit /etc/sudoers file

Edit file as shown in the below diff:

< %sudo ALL=(ALL:ALL) NOPASSWD: ALL
---
> %sudo ALL=(ALL:ALL) ALL

Add user (e.g. senthil) to sudo group

usermod -a -G sudo <username>

QR Code
QR Code tech:linux:etc_skel (generated for current page)