[Solved] How to clear "history" command entries??


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers [Solved] How to clear "history" command entries??
# 1  
Old 01-20-2014
[Solved] How to clear "history" command entries??

As in the title, how to clear the history entries?

For eg: if i enter history, series of linux commands getting displayed from day 1. I need to clear those entries and want linux commands to be stored freshly.

Thanks in advance
# 2  
Old 01-20-2014
history -c
# 3  
Old 01-20-2014
Wonderful.

Thanks. Simultaneously, can I know how to get history of linux commands entered on a particular date?

For eg, I want history of linux commands used on 01-01-2014.

Can you help me?
# 4  
Old 01-20-2014
Yes, if HISTTIMEFORMAT is set.

If it's not set, you can set it to the desired format. Previous history entries might not have the proper dates, though.

Code:
HISTTIMEFORMAT="%Y.%m.%d %T "

You can then grep on the output of history.
# 5  
Old 01-20-2014
Thanks.

Plz can you explain me in detail. Plz.

Just give the entire commands so that I can get history entered on 01-01-2014.

Thanks in advance
# 6  
Old 01-20-2014
If the timestamps are stored in the history file, set the variable then grep on the output of history
Code:
HISTTIMEFORMAT='%d-%m-%Y '
history | grep "[0]1-01-2014"

(changing the order of %d and %m if you're using the United States date format)
# 7  
Old 01-20-2014
You already asked that question, and Scott already replied:
Want to get list of Linux commands used on specific date through HISTORY command | Unix Linux Forums | UNIX for Dummies Questions & Answers
Why ask again, what do you expect???
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to get the "history" command to show all that is in the .bash_history file?

I am using the bash shell. When I view my recent command history using the "history" command from the prompt, it only shows me the commands starting at #928. The commands I need are earlier than that, but I can't figure out how to make the other 927 display. They are in my .bash_history... (1 Reply)
Discussion started by: Twinklefingers
1 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Problem With "xhost +" command-FreeBSD

Does anyone no why "xhost +" would not be working in freebsd? Could it be to do with a certain xorg package not being installed etc.. I am getting error "xhost: command not found" Thanks Anyone (2 Replies)
Discussion started by: Browser
2 Replies

4. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

What is the ksh equivalent to bash's "history -c" command?

Hi, What is the korn shell equivalent of bash shell's "history -c" command? I do know, how to clear the history list in ksh, I can do the following: > ~/.sh_historybut still, I am interested to know the single one line command as 'history -c' gives error on my ksh (1 Reply)
Discussion started by: royalibrahim
1 Replies

7. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

8. UNIX for Advanced & Expert Users

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

9. UNIX for Dummies Questions & Answers

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

10. UNIX for Dummies Questions & Answers

"@" will clear the current line in terminal

I just found that the current command line will be cleared when trying to input the "@" sign to the terminal. I checked current alias, but found nothing. Would you please provide some suggestion about it? (4 Replies)
Discussion started by: sleepy_11
4 Replies
Login or Register to Ask a Question