Trying to understand the functionality of bash_history:
/home/user# ls -a
. .. .bash_history .bash_logout .bashrc .cache .profile pylabs .viminfo .Xauthority
I do see a .bash_history
file in the /home/user
folder. But why doesn't it have the entire history of the executed commands, output below ?
/home/user# cat .bash_history
su
/home/user#
But the same history is available in the .bash_history
file in the /root
folder.
# ls -a
. .. .bash_history .bashrc .cache .profile .ssh .viminfo
/home/user# cd /root/
# cat .bash_history
bash script.sh
ls
cd pylabs/
ls
...
...
ls -a
cat .bash_history
cd /root/
#
Question 2: Will the .bash_history
be available in some particular folders only, and how does it store all the commands executed in different directories?
/home/user/pylabs# ls -a
. .. backup bkupscript.py mybackup.py __pycache__ solution.py