Clearing the history in terminal ? [SOLVED]

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
User avatar
Jasper
Posts: 2067
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 854 times
Been thanked: 480 times

Clearing the history in terminal ? [SOLVED]

Post by Jasper »

Hi there

I wanted to clear the history of entries that I have used in terminal (Fossapup64-95)

history -c

however when I run the same command

history

it shows that it is still populated with entries.

The Help file does state the

-c

is the correct input variable to enter to clear entries/history

Any ideas/suggestions?

Last edited by Jasper on Tue Mar 14, 2023 5:27 am, edited 1 time in total.
Burunduk
Posts: 251
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 7 times
Been thanked: 127 times

Re: Clearing the history in terminal ?

Post by Burunduk »

Jasper wrote: Mon Mar 13, 2023 4:24 pm

-c

is the correct input variable to enter to clear entries/history

It clears the history for the current session. You also need to write it back to the history file (empty it): history -c && history -w
You can make an alias for it: alias nohist='history -c && history -w'
I prefer to delete the current session history only if it's full of garbage, so I have an alias nohist='history -c && history -r' in my .bashrc

By the way, if you don't need a bash history at all, add unset HISTFILE to the /root/.bashrc file.

User avatar
Jasper
Posts: 2067
Joined: Wed Sep 07, 2022 1:20 pm
Has thanked: 854 times
Been thanked: 480 times

Re: Clearing the history in terminal ?

Post by Jasper »

@Burunduk

Thank you so much, that was exactly what I was looking for.

Also, for the additional tip :thumbup2:

Post Reply

Return to “Users”