I
I
Ivan2020-09-07 20:15:21
ubuntu
Ivan, 2020-09-07 20:15:21

Is it possible to make the ubuntu terminal not remember the history of new ones, only a few old ones?

Good afternoon. Let me explain in more detail what I wanted. Before launching a terminal in Ubuntu, I almost always go into the .bash_history file and delete all but the first few commands. Then I work, a few commands are typed, the next day I go there, and delete everything except the first few pieces. So, is it possible to make it so that when the terminal starts, it pulls up several commands that I need, then for the duration of the session it saves the history of commands, it was possible to sort through the up and down arrows, but when it was closed, everything was deleted, and the next time it was started, there were only the first few commands that you need?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Saboteur, 2020-09-08
@Djonson86

1. make .bash_history read-only
2. On exit, break the connection, not disconnect - then the history in memory bash will not have time to be stored in memory
3. Explain normally what you are trying to solve, I can’t come up with a crutch solution instead of using aliases and functions

A
Andrey Barbolin, 2020-09-07
@dronmaxman

https://www.geeksforgeeks.org/source-command-in-li...

P
pfg21, 2020-09-08
@pfg21

well, then you can still put it rm ~/.bash_historyin the user's ~/.profile :)
every time you log in, the history will be deleted :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question