• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / Uncategorized / Clear History In Linux Terminal Permanently

Clear History In Linux Terminal Permanently

By Sourabh / June 16, 2025 Category: Uncategorized

How to delete terminal history in Ubuntu permanently. This was you can clear history in Linux terminal permanently. Of all the Linux history, you can delete multiple lines or delete last 10 lines in Ubuntu Terminal.

We can clear history in Linux terminal permanently, read more to find out how:

How To Clear Command History In Linux

There are three ways to clear command history in Linux Ubuntu:

  1. Clear entire command line history using history command
  2. Clear specific command history using history command
  3. Clear entire command history automatically at logout

Let us learn about each one of these, one by one:

1. Clear Entire Command Line History Using History Command

To clear the entire command line history in terminal, use the history command:

$ history -c

Or

$ history -cw

The above line of commands will clear the command history or bash history.

2. Clear Specific Command History Using History Command

If you want to delete and clear some particular commands from history list (do not want to clear the entire history), run the following command:

First, run the “$ history” command to get the list of run commands along with their command prefix number.

Note down the command number (number infront of each command from the lsit). Now to clear or delete a particular command from the history, run history command with -d paramaeter and the command prefix number (see below):

$ history -d <number>

Note that the represents the command number of each command to be deleted.

3. Clear Command History Automatically at Logout

If you want to clear bash history automatically at logout you will have to edit ~/.bashrc file. Open and edit the file using the following command:

$ vi ~/.bashrc

Once the file is opne, add the following line:

unset HISTFILE

Now save and close the file.

That’s all now the bash history will be automatically deleted and cleared after you logout from the current session.

Primary Sidebar

Latest Posts

Delete Directory And Contents Recursively Without Prompt On Linux

Check User Login History In Ubuntu Linux Command Line

Use Locate Command To Find File In Linux Terminal By Name

How To Change Terminal Color In Ubuntu Command Line

How To Run Fsck Manually In Linux To Fix Unexpected Inconsistency

How To Fix Broken Packages On Ubuntu From Terminal

Re Execute The Previous Command In Linux Ubuntu Command Line

How Much RAM Is Needed For Ubuntu PC

How To Find Large Files And Directories In Linux Command Line

How To Use Clear Command History In Linux Terminal

© 2026 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap