Differences

This shows you the differences between two versions of the page.


tech:linux:etc_skel [2023/09/24 11:30] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== 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
 +<code>
 +s 1
 +1
 +z
 +SHIFT+W
 +</code>
 +
 +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.\\
 +
 +<code>
 +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
 +</code>
 +
 +===== 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
 +<code>
 +echo "sudo PATH=\$PATH WINDOW=\$WINDOW /bin/bash" > $HOME/isudo
 +chmod 744 $HOME/isudo
 +</code>
 +
 +For Debian, root PATH is different hence we are not including PATH
 +<code>
 +echo "sudo WINDOW=\$WINDOW /bin/bash" > $HOME/isudo
 +chmod 744 $HOME/isudo
 +</code>
 +
 +
 +End Users can Run this as
 +<code>
 +. ~/isudo
 +</code>
 +
 +===== 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.
 +<code>
 +defscrollback 20000
 +#deflog on
 +#log on
 +#logfile flush 60
 +#logtstamp on
 +#logtstamp after 3600
 +ignorecase on
 +</code>
 +
 +===== 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
 +
 +<code>
 +" 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>
 +</code>
 +
 +
 +===== dot bashrc =====
 +Customize bash history settings and color prompt.  Append this to the end of .bashrc file for root and each user.
 +<code>
 +# Custom settings
 +. ~/.bashrc_ext
 +#
 +</code>
 +
 +Create new file .bashrc_ext with the below settings.
 +<code bash>
 +# 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'
 +</code>
 +
 +Color Prompt for root user - make this change to /root/.bashrc_ext
 +<code bash>
 +# 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\]\$ '
 +</code>
 +===== sudo without password =====
 +Run ''visudo'' to edit ''/etc/sudoers'' file
 +
 +Edit file as shown in the below diff:
 +<code diff>
 +< %sudo ALL=(ALL:ALL) NOPASSWD: ALL
 +---
 +> %sudo ALL=(ALL:ALL) ALL
 +</code>
 +
 +Add user (e.g. senthil) to sudo group
 +<code bash>
 +usermod -a -G sudo <username>
 +</code>
  

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