bashrc   397

« earlier    

Remember all your bash history forever |
WATCH OUT! Old-ass versions of Bash (4.1.x on CentOS 6, for example) will truncate your damn history file if you use HISTFILESIZE=-1 or HISTSIZE=-1.
Append the following lines to /etc/bash.bashrc:
<code class="language-bash">HISTTIMEFORMAT='%F %T '
shopt -s histappend # append to history, don't overwrite it
# attempt to save all lines of a multiple-line command in the same history entry
shopt -s cmdhist
# save multi-line commands to the history with embedded newlines
shopt -s lithist</code>

This configures bash to save every command line typed at the interactive shell prompt (HISTFILESIZE) to ~/.bash_history (default), including a timestamp (HISTTIMEFORMAT) and ignoring consecutive duplicate entries (HISTCONTROL). By setting HISTSIZE to the same value as HISTFILESIZE, all saved commands are read back to memory when a new interactive shell starts. The default value for HISTSIZE (500) would load only a fraction of the saved history.

When saving the history at shell exit, history lines are appended to existing ones, instead of replacing them (shopt -s histappend).

By setting HISTIGNORE=?:??, lines consisting of just one or two characters are discarded from the history (e.g. ls commands).
bash  history  tipsandtricks  configsettings  essential  movein  bashrc 
5 weeks ago by kme
Bash Reference Manual: Bash History Builtins |
A useful alias to use with the fc command is r='fc -s', so that typing ‘r cc’ runs the last command beginning with cc and typing ‘r’ re-executes the last command (see Aliases).
bash  history  tipsandtricks  bashrc  bash_aliases  movein  essential 
5 weeks ago by kme
puphpet bash files
honestly, not a bad default
bash  bashrc 
february 2018 by timotheus

« earlier    

related tags

/etc/default/useradd  /etc/profile  /etc/skel  accept  adduser  alias  aliases  another  ansible  automation  back_profile  bash.bashrc  bash  bash_aliases  bash_env  bash_login  bash_logout  bash_profile  bootstrap  cache  calendar  chmod  chown  cleanup  cli  cmder  color  colorization  command-line  completion  composer  config  configfile  configsettings  configuration  configure  console  contrib  cpan  cpanm  current  customization  customize  dammitbrain  decline  default  define  delicious  dircolors  directory  distribution  dot  dotfile  dotfiles  drush  elisp  emacs  environment  eshell  essential  etc  example  execution  explained  files  generate  generator  ghar  git  gnus  go  golang  gopath  goroot  graph  graphviz  history  homesick  hostname  ical  imap  important  initialization  inputrc  installation  interactive-shell  interactive  interesting  itip  josh  laravel  large  linux  lisp  local::lib  log  login-shell  login  mac  macos  manager  maybesolution  movein  mutt  newbie  non-login  northpointe  online  openshift  opensuse  order  org  orgmode  osx  osx_tips  outlook  perl  permissions  php  planner  port  postgresql  profile  prompt  promptstring  ps1  psql  reference  scripts  sequence  server  set  setup  sh  shell  shellfunctions  shells  shortcut  shortcuts  skel  skeleton  so_you_want_to_learn_x  solution  source  ssh  sshd  staiger  startup  sudo  sysadmin  taller  template  terminal  termux  tips  tipsandtricks  todo  tool  tramp  troubleshooting  ubuntu  unarchive  unix  unlimited  useful  user  useradd  usergroup  vcsh  vimrc  webcal  windows  xclip  xterm  yadm  yet  zlogin  zprofile  zsh  zshenv  zshrc 

Copy this bookmark: