linux command to delete history records & files using grep search with a keyword & find the basic query

Today, new recruits to the company, just started a little nervous with excitement - and then distribute office supplies, give a laptop, office as saying in the company, or accustomed to using a desktop, laptop cooling stand for the kind of whining loud voice, listening to people anxiety, especially when handling bug, this is not the key, the key is particularly dirty notebook, and made my day very anxious, very empty, have been thinking about what tomorrow come to work when the band come to the notebook so dirty clean, jiaojiao, it was really dirty. There is actually an operating system windows10, in fact I have not done for a long time already developed in the windows system environment, either ubuntu desktop, either mac, a time and go back to windows, it is really not very accustomed to. Nonetheless, the job still requires us to enter the state as soon as possible, to achieve as soon as possible to develop, produce results as soon as possible, the company can not raise the white people, ah! Pressure can not say it small, flat-head study brother, anyway, the hard top.

 

Record two practical linux command, what compensation so empty today:

 

1.linux delete command history record information

rm /root/.bash_history
rm ~/.bash_history
history -c

ubuntu 18.04 to perform complete history -c take effect immediately, the use of history is no longer listed in the previous history command, my mac will be prompted:

History file deleted. Reload the session to see its effects.

Close the current terminal, re-open, the operation was successful

 

2. grep recursive search with a key file (not a directory) under a parent directory

-r grep " a keyword " / yourpath

 

3. find query a file in a directory

find yourpath -name {filename} # -iname case insensitive

 

4. find a directory inquiries in a directory

find yourpath -type d -name {dirname} # d to find the file is replaced f

 

find other parameters:

  -user: Queries belonging to the user

  -group: Query belong to a user group

 

Guess you like

Origin www.cnblogs.com/lowmanisbusy/p/12562771.html
Recommended