paperlined.org
new_computer_setup > unix
document updated a month ago, on Jan 7, 2025
Minimal settings for me to be comfortable.

prompt

PS1="\[\033[7m\]\u@\h:\w\\$\[\033[0m\] "

If you want to customize it, see https://bash-prompt-generator.org/.

For Ksh, remove the square brackets:

export PS1="`tput rev`$USER@$HOSTNAME:\$PWD \$`tput sgr0` "

~/.bashrc

[ -z "$PS1" ] && return
#export PS1="\t \u@\h:\w \$ "
#export PS1="\[$(tput rev)\]\t \u@\h:\w \$\[$(tput sgr0)\] "
export PS1="\[\033]0;\h -- \u -- $(uname)\007\]\[\033[102;30m\]\t \u@\h:\w \$\[\033[00m\] "
set -o vi
bind -m vi-insert \\C-l:clear-screen
export EDITOR=vim
export PAGER=less   LESS=-i
[ -f ~/.bash_aliases ] && . ~/.bash_aliases

~/.bash_profile

[ -f ~/.bashrc ] && . ~/.bashrc

ksh's ~/.profile

typeset -RZ2 _x1 _x2 _x3; let SECONDS=$(date '+3600*%H+60*%M+%S');
_s='(_x1=(SECONDS/3600)%24)==(_x2=(SECONDS/60)%60)==(_x3=SECONDS%60)';
export HOSTNAME=$(hostname|sed 's/\..*//');
export PS1="$(printf "\033]0;${HOSTNAME} -- $USER -- $(uname)\007\033[102;30m\${_d[_s]}\$_x1:\$_x2:\$_x3 ${USER}@${HOSTNAME}:\${PWD} === \033[0m ")"

~/.vimrc

set tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent   " tab and indent settings
set nocompatible                                                " turn off vi-compatibility mode
set nobackup
set ignorecase hlsearch                                         " search settings
" swap the : and ; keys                                                                              
nnoremap ; :| nnoremap : ;                                                                           
vnoremap ; :| vnoremap : ;

~/.xinitrc

(be sure to run ln -s ~/.xinitrc ~/.xsession)
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'          # Caps-lock works as an Escape key

~/.lesskey

Copy-n-paste this at the command line:
printf "[ prev-file\n] next-file\n" > ~/.lesskey;  lesskey

~/.screenrc

startup_message off     # don't display the copyright page
escape ``               # use ` for the escape key
defscrollback 1000      # use a bigger scrollback buffer!
msgwait 1               # how long to display temporary messages for.

hardstatus alwayslastline "%= %3n %t%? [%h]%? %="
caption always "%= %-w%L>%{= BW}%n*%t%{-}%52<%+w %L="

~/.inputrc

C-L: clear-screen
set bell-style none

Bash history

Add this to ~/.bashrc:
# Make sure that ALL Bash history is recorded, even when there are multiple
# concurrent sessions by a person, different people su'd at the same time, etc.
history -r                  # read in existing history from the file
shopt -s histappend         # support multiple sessions / users
HISTSIZE=10000              # remember the last 10,000 commands
HISTFILESIZE=$HISTSIZE      # the differences between these two is confusing,
                            # see https://stackoverflow.com/q/19454837/1042525
HISTTIMEFORMAT="%F %T -- "  # timestamps are normally disabled; enable them
if [ -e "$HISTFILE"  -a  ! -w "$HISTFILE" ]; then
    echo
    echo -ne "\033[41m"     # red background
    echo -ne "\033[97m"     # bright white foreground
    echo -n  "ERROR: The permissions on $HISTFILE mean Bash history won't be saved."
    echo -e  "\033[0m"      # reset color
    echo
fi
# record extra info about this new login or new su
[ -n "$PS1" ] && history -s "# new shell -- Bash pid $BASHPID -- $(who am i)"
# for a more complex history solution, see https://unix.stackexchange.com/a/375092/52831

~/.bash_aliases

##  easily edit & reload aliases
alias rl='. ~/.bash_aliases'
alias ea='${EDITOR:-vi} ~/.bash_aliases; rl'


# gnome-open, kde-open, etc
function go() { xdg-open "$@"; }


## combinations of less/grep/find/xargs
function lgrep()  { grep -Zls  "$@" | xargs -0 less    -p "$1"; }
function lgrepi() { grep -Zlsi "$@" | xargs -0 less -i -p "$1"; }
function xgrep() { xargs -i grep "$@" /dev/null {} ; }          # Solaris version only, needed for its braindead find/xargs/grep arguments.


function vimwhich()  { vim  `which $1`; }
function lesswhich() { less `which $1`; }


function largefiles() { find ${1:-~} -type f -print0 | xargs -0 ls -l | sort -n +4 | tail -100 | perl -ple 's/^.{32}\s*//; s/$ENV{HOME}/~/'; }
function largedirs() { du -k ${1:-~} | sort -n; }
function largeindividualdirs() { du -Sk ${1:-~} | sort -n | tail -1000; }

~/.gitconfig

[color]
    ui = auto

ack

export ACK_PAGER='less -R'

CPAN modules

See CPAN settings here.

cpanm   Getopt::Casual   JSON::XS

Modules I use now, but may not use forever: ("view source" to see the rationale for each)

cpanm   String::Formatter