[dropcap]T[/dropcap]he Mac or the Linux have the very convenient terminal service through which the various command actions could be completed through inputting different kind of pre-defined commands. The commands could be no easy task to input through the keyboard as these could be very complex at times and if for some reason these commands are to be put for several times then you might get up frustrated very soon. But for that purpose, the developers of these systems have ejected inside the feature of saving the commands as history through which the users could easily press the UP arrow button to get their last used command on the screen of the terminal. It could be continuously done to get back to many other commands from the history. This history of the commands would be rather very useful, but at times it could also prove to be fatal when if you suddenly put in any other command by mistake, so to solve this you could prefer to delete up to the history of the terminal. Here in this article, we have written the method with which you could clear the Terminal History on Linux or Mac OS.
Learn how to clear the terminal history on Linux or Mac OS and to know about the method just head on to the main part of the article which is given below, read about it after that.
Also Read: Top 15 Best Hacking Tools For Linux
How to Clear the Terminal History on Linux or Mac OS
The method is quite simple and easy, and you just need to follow some of the simple steps by step guide discussed below to proceed.
Steps to Clear the Terminal History on Linux or Mac OS:
- To clear the history of the current session of the terminal on your Mac or Linux use up the command “history -c“. This is the command built into bash itself and deals with the history of the commands in the terminal and hence tells to delete or clear that all for the current session.
- Now if you have any of your command histories on the terminal for the all-new session, then you could easily clear it up through the command given above.
- To clear the entire history of your terminal bash then you would require using the command “rm -/.bash_history“. This command deals with the whole stored history of the commands inside the terminal app for the new session as well as you could use this command to delete the history of commands stored into the bash in the form of text files which were from the previous sessions.
- To manually open the history text file and delete the items or the commands from it, just type in the command “open ~/.bash_history” or use up the name of text editor in the place of open in the command for using in Linux.
- The another useful command which you could be probably familiar with “Clear” command which would rather not clear up the history of your terminal commands but would help you to give up the terminal whole new like look which means you won’t see any used or spelled commands on the terminal screen! This makes it easier to work with the commands without getting confused.
So this was the method through which you could clear the whole terminal History either on Linux or Mac OS. As from the article, you have got up that the method isn’t too difficult or complex, but any moderate user could apply it without any issues. It’s now your time to apply this method and hence remove all that cached history in the terminal app on your Mac or Linux. Hope you would like up the method, don’t forget to share your views.