How To Clear Linux / UNIX BASH Shell Command Line Cache / History

Article By: tommy


img

Shell VPS Command Line

Introduction to Shell

Q. I just noticed faq about clearing dns cache and there are lots of commands stored in my cache. Can you tell me the command to clear out my command history or cache from a shell prompt?



A. Many programs read input from the user a line at a time. The GNU history library is able to keep track of those lines, associate arbitrary data with each line, and utilize information from previous lines in composing new ones. Bash and other shell may use this history library. The default fie is ~/.history or ~/.bash_history.

To display the history list with line numbers, enter

$ history


Output:

....
..
  4  cd /tmp/
    5  wget http://downloads.wordpress.org/plugin/cleaner-dashboard.1.1.zip
    6  unzip cleaner-dashboard.1.1.zip
    7  su -
    8  vi /etc/httpd/testing.lan.cyberciti.biz.conf
    9  service httpd restart
.....
..
 997  vnstat -m -i eth1
  998  date
  999  yum update
 1000  w
 1001  ~/scripts/clean.cache rss squid web
 1002  history
Note: Lines listed with the a * have been modified.

To clear the history, enter:

$ history -c


The -c option causes the history list to be cleared by deleting all of the entries. For more information, enter:
$ help history
 


Tags: , , , , , , , ,


Welcome to the healthcare-only HIPAA - GDPR compliant cloud. Exclusively hosted on a HPC environment!

Learn more or start today by choosing your secure HIPAA - GDPR compliant server's Operating System bellow and pick the package that's best for you.

BIPmd makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine, thousand or more.



Windows VPS options and add ons
Linux VPS options and add ons

>

Looking for a custom solution?

Our technicians can provide you with the best custom-made solutionss on the market, no matter whether you're a small business or large enterprise.

Get in touch

Leave a Reply



Feedbacks