csh command history

Trihexagonal

Son of Beastie

Reaction score: 2,497
Messages: 3,057

On my World, I have a ~/.cshrc and a ~/.shrc config file but no ~/.history.

The_Past_sure _is _tense.jpg


I use the up arrow to re-issue commands I've already used during that session from the usr or root account going back to when I first logged on. And there it is on tcsh 6.21.00 to bring up a command just ran in that terminal.
 

jmos

Well-Known Member

Reaction score: 262
Messages: 331

The screenshot says the shell is "sh", not "(t)csh"; The corresponding manpage doesn't mention a history file, so IMO it's logic that there is none.
 

Trihexagonal

Son of Beastie

Reaction score: 2,497
Messages: 3,057

By default.
If there isn't one and everything is working as it should, how could I miss it? Much less know I was missing something I never needed in the first place?

I'm going to have to do a search on my posts and document how many things I do differently or not at all that seem to be SOP for everyone else. There are several files I'd never touched before somebody else mentioned using them. fstab only one among them.

That comes from teaching myself how to use it as a PC-BSD use rand many of the things I do carried over from then. I did not think the Handbook applied and never read it. Teaching myself to use ports what was hardest. a post asking where to find portsnap in the ports tree where I was at in 2005.

Determination and a desire to use UNIX, the association with Ma Bell what impressed me, Trial and Error, google-fu, and natural ability and aptitude by birthright what got me, Asking questions embarrassing for me, kept me quiet and hidden among you while I learned how to do things that came hardest of all, like setting my email alias.

That finally figured out well after I joined, I'm talking maybe 2 years, and still did not read the Handbook. Now it all comes together for me easily when nothing is easy anymore.
 

Trihexagonal

Son of Beastie

Reaction score: 2,497
Messages: 3,057

The tcsh --version command taken from the post of SirDice, ran from my user account and using the up arrow to scroll back through commands I had entered into that terminal as shown by screenfetch.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 14,000
Messages: 40,724

FreeBSD's sh(1) has some rudimentary command line history but as far as I know that history is not saved. It's for that session only and is stored in memory. If you exit that shell the history is lost. The history of tcsh(1) is saved to ~/.history and persists after closing the shell and reopening it. Bash uses ~/.bash_history to store its persistent history.
 

Profighost

Active Member

Reaction score: 86
Messages: 156

Under FreeBSD13 I have no saved history as root.
Of course my root's shell is csh, and also when I change it to tsch no .history exists.

Besides the fact that is very annoying, especially if one has to do some work as root such as setting up a new system on a new machine...
Was there anything changed with the new FreeBSD or may I activated a "system hardening option" while installation which prevents root's history?
 

grahamperrin

Beastie's Twin

Reaction score: 1,688
Messages: 5,062

… my root's shell is csh,

sudo grep set\ history /root/.cshrc

What's yours?

Here, with FreeBSD 14.0-CURRENT:

Code:
% grep set\ history ~/.cshrc
        set history = 2000
% sudo grep set\ history /root/.cshrc
grahamperrin's password:
        set history = 2000
%

and also when I change it to tsch no .history exists. …

Code:
root@mowa219-gjp4-8570p-freebsd:~ # echo $SHELL
/bin/csh
root@mowa219-gjp4-8570p-freebsd:~ # /bin/tcsh
root@mowa219-gjp4-8570p-freebsd:~ # echo $SHELL
/bin/csh
root@mowa219-gjp4-8570p-freebsd:~ # history | tail -n 2
  2001  8:45    echo $SHELL
  2002  8:46    history | tail -n 2
root@mowa219-gjp4-8570p-freebsd:~ # exit
exit
root@mowa219-gjp4-8570p-freebsd:~ # exit
logout
%
 

Profighost

Active Member

Reaction score: 86
Messages: 156

The .cshrs is the same as on my old 12.3-RELEASE machine:

set history = 1000
set savehist = (1000 merge)
set autolist = ambiguous

and yes, echo $SHELL shows me I'm using tcsh or csh - that's why I am puzzled

there simply is no .history-file within my root's ~
 

Profighost

Active Member

Reaction score: 86
Messages: 156

freebsd-version shows me, what I already know:
13.0-RELEASE-p7
freebsd-version -kru shows me:
13.0-RELEASE-p7
13.0-RELEASE-p7
13.0-RELEASE-p7
...I don't see the point.
(I have to manually type all this, since I neither have x-server running yet on that machine, not even ssh configured yet.)

No root-history, no xserver running...
I'am now trying to install FreeBSD 12.3
 

Profighost

Active Member

Reaction score: 86
Messages: 156

Suspicion:
I am still within the console - no xserver, no xterm.
May .history only functions within "higher" terminals?
 

Profighost

Active Member

Reaction score: 86
Messages: 156

Both correctly pointing to /root

After #history -S I do have also a .history after reboot and also the history seems to work as usual.
THANKS

I'll continue to watch this thread.
Maybe additonal ideas will be brought up with further explanations, what causes my issue.
I'm not satisfied with just copy solutions from the internet but try to understand things.
As far as I understand this issue:
There simply was no .history (I actually didn't had one). Without a .history also non is written.
Now since one is generated with #histroy -S there is one and now it works.

I can't help it that there something really stupid, silly and very simple is not in the right order...
(Maybe within 13 it was simply forgotten to intialize a root's .history by default - I presume most of you guys updated to and moved to the higher version, but not actually restarted with 13 at completely zero, so this issues wasn't detected yet[?])
(I can tell you, if you are used to history and then there suddenly is none anymore, especially while getting up a new system, you'll start getting very p#$$** in no time! 😂 )

However - it seems to work now.
So I'll continue with my main target and get this xserver up and running.


Thanks again all for all your effort and help so far:
Thank you

(btw: your cat is sweet🥰)
 

Erichans

Active Member

Reaction score: 207
Messages: 235

Under FreeBSD13 I have no saved history as root.
The .cshrs is the same as on my old 12.3-RELEASE machine:

set history = 1000
set savehist = (1000 merge)
set autolist = ambiguous
As you're moving between 12.3-RELEASE and 13.0-RELEASE the (t)csh version number will be different (in this particular case the tcsh-version number of 13.0 is lower because 13.0 came out first, before 12.3), this may be of interest to you with respect to the correct functioning of the history mechanism, see here
 
Top