# History file gibberish



## lattimro (Jun 21, 2021)

Hi,

why the content of my /root/.history is full of gibberish like this? I guess I am doing something wrong ...Thanks!


----------



## SirDice (Jun 21, 2021)

It's misc/mc, more specifically, the subshell option (CTRL-O) it has. Did you change root's shell to something else?


----------



## lattimro (Jun 21, 2021)

I did not changed root shell. So I understand the gibberish is coming from mc, is that right? Can I do something to avoid it?

user's shell: sh
root;s shell: csh

this is how is look like:




Thanks!


----------



## SirDice (Jun 22, 2021)

lattimro said:


> So I understand the gibberish is coming from mc, is that right?


That is correct. Specifically caused by the subshell function of mc. Not sure why it happens, I've been using mc for years and I've never had this problem.



lattimro said:


> user's shell: sh


Try setting your user's shell to tcsh(1), it's a much easier shell to use than a plain sh(1). It'll take some getting used to though. But it has some really useful features for interactive use. Other's like to use shells/bash or shells/zsh,


----------



## mtu (Jun 22, 2021)

You might find an answer in this thread:








						misc/mc problem
					

For a week or a couple of weeks, after upgrade of misc/mc port, I can't start mc from ordinary user, only from root. I tried doing it from different shells. The error states:common.c: unimplemented subshell type 1 read (subshell_pty...): No error: 0 (0) May be something wrong was during upgrade...




					forums.freebsd.org


----------



## lattimro (Jun 22, 2021)

I changed the shell to csh/tcsh/zsh but issue still persisted, there is something with CTRL-O. Is there any safe way to clean of that gibberish the /root/.history? It is very unproductive to get the previous commands.


----------



## Alain De Vos (Jun 22, 2021)

I have set the root shell to zsh.
[My recovery user is toor with shell oksh which i copied in the /bin directory ]
Here the relevent lines in my /root/.zshrc,

```
HISTFILE=/root/.histfile  # Where to save history to disk
HISTSIZE=1000000      # How many lines of history to keep in memory
SAVEHIST=1000000      # Number of history entries to save to disk
setopt APPEND_HISTORY     # Append history to the history file (no overwriting)
setopt SHARE_HISTORY      # Share history across terminals
setopt INC_APPEND_HISTORY # Immediately append to the history file, not just when a term is killed
```
Then you just have one .histfile in your root directory.
I also have one .history file , i think thats when zsh spawns sh.


----------



## SirDice (Jun 23, 2021)

~/.history is used by csh(1)/tcsh(1).


----------



## Sevendogsbsd (Jun 23, 2021)

Building mc from ports and not selecting subshell solved it for me but there are other ramifications of mixing ports and packages.


----------



## lattimro (Jun 24, 2021)

since I changed to shells/bash (perhaps other shells  works too) no more gibberish ...


----------



## balanga (Jun 25, 2021)

lattimro said:


> since I changed to shells/bash (perhaps other shells works too) no more gibberish ...


How did you do this? This has been an ongoing problem for me for ages.


----------



## Menelkir (Jun 25, 2021)

balanga said:


> How did you do this? This has been an ongoing problem for me for ages.


chsh -s shell/with/path user


----------



## balanga (Jun 25, 2021)

Menelkir said:


> chsh -s shell/with/path user


Presumably I need to clear my history after doing this since it will still hold all the gibberish...


----------



## Menelkir (Jun 26, 2021)

balanga said:


> Presumably I need to clear my history after doing this since it will still hold all the gibberish...


Well, yes? Changing a shell for an user isn't supposed to clean an history file, right?


----------



## Alain De Vos (Jun 26, 2021)

Stating the obvious


----------



## balanga (Jun 26, 2021)

Menelkir said:


> Well, yes? Changing a shell for an user isn't supposed to clean an history file, right?


Just wondered how a history file should be cleaned... should I just delete it?


----------



## Alain De Vos (Jun 26, 2021)

For me there are three kinds of data.
Normal data.
Important data , /etc ; /usr/local/etc
Un-important data , which you can delete as you please.
- Log files, you can always "truncate -s 0", so their length is zero
- The contents of /var/cache or ~/.cache , you can delete as you please.
- History files you can delete as you please. But it is more important to know which shell created the history file, and which configuration of the shell made the history file to exist. I have had problems myself and removed all references to history files out of the configuration files of all shells. To problem is gone. Than i added a history config to my zsh. So history works again as it should.


----------



## balanga (Jun 26, 2021)

I'm not aware of any history config...


----------



## Alain De Vos (Jun 26, 2021)

Alain De Vos said:


> I have set the root shell to zsh.
> [My recovery user is toor with shell oksh which i copied in the /bin directory ]
> Here the relevent lines in my /root/.zshrc,
> 
> ...


----------



## grahamperrin@ (Jun 26, 2021)

balanga said:


> I'm not aware of any history config...




```
% file ~/.history
/home/grahamperrin/.history: ASCII text
%
```


----------

