Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
25
rated 0 times [  25] [ 0]  / answers: 1 / hits: 21216  / 2 Years ago, mon, june 13, 2022, 6:46:47

I run Ubuntu 12.04, and for some reason bash does not keep my command history. the ~/.bash_history file contains only 3 commands that I typed a few months ago.



How can I fix this?



EDIT:
here's the relevant content of my .bashrc:



# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

More From » bash

 Answers
4

It could also be that root:root owns your .bash_history (ROOT SHOULDN'T BE THE OWNER, YOUR USER SHOULD BE THE OWNER!), in that case you need to:


$ chown user:user .bash_history

This apparently could happen magically when you do sudo bash a lot!


[#34738] Tuesday, June 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
heaco

Total Points: 479
Total Questions: 124
Total Answers: 114

Location: Lesotho
Member since Sat, Oct 1, 2022
2 Years ago
;