# Where is saved the commands that I issue every day as root and as a regular user ?



## ziomario (Aug 30, 2021)

Hello.

Coming from Ubuntu If I want to have the list of the every command that I have issued during the job session I read the file called .bash_history. This file is located on /home/user and on /root. Nothing can be easier. What about FreeBSD ? Where the root and regular user commands are saved ? (I'm using the csh shell)


----------



## mer (Aug 30, 2021)

for csh (the default shell) it's $HOME/.history
if you changed your default shell to bash, it will be in .bash_history
ls -altr  shows you all the files including ones starting with a "."

But of course some folks say that saving your commands to a history file is a potential security risk.


----------



## Menelkir (Aug 30, 2021)

It's not about being FreeBSD, it's about the shell used. A good tip is using something like this:

```
ls $HOME/*history*
```


----------



## eternal_noob (Aug 30, 2021)

I kinda like bash despite it's a bit bloated and one of the first things i do on every new FreeBSD system is to install it.








						Chapter 3. FreeBSD Basics
					

Basic commands and functionality of the FreeBSD operating system




					docs.freebsd.org


----------



## ziomario (Aug 30, 2021)

It didn't save the commands that I have issued as a default user. On /home/marietto there isn't any .history file and under /root  the .history file is partially full with the commands that I have issued. On /root ; I have a lot of .history* files,but a lot of them are empty.


----------



## eternal_noob (Aug 30, 2021)

ziomario said:


> It didn't save the commands that I have issued as a default user.





SirDice said:


> History is saved when you exit(1) the shell, not when you close it. So type `exit` (or use CTRL-D).
> 
> With csh(1) you can also force a history save with `history -S`.


----------



## Alain De Vos (Aug 30, 2021)

eternal_noob said:


> I kinda like bash despite it's a bit bloated and one of the first things i do on every new FreeBSD system is to install it.
> 
> 
> 
> ...


zsh is not bloated


----------



## eternal_noob (Aug 30, 2021)

Alain De Vos said:


> zsh is not bloated


Bash arrays are indexed from 0 to (length-1). Zsh arrays are indexed from 1 to length. This enough reason for me to not use zsh.
Everything that indexes arrays from 1 is suspicious.


----------



## ziomario (Aug 30, 2021)

I never typed exit,so no commands should have been saved. Instead there are some.


----------



## eternal_noob (Aug 30, 2021)

ziomario said:


> On /home/marietto there isn't any .history file and under /root the .history file is partially full with the commands that I have issued.





ziomario said:


> I never typed exit,so no commands should have been saved. Instead there are some.


If you have history for root and not for the normal user, try to create the .history file manually as user.
`touch .history`


----------

