このエントリーをはてなブックマークに追加


historyの履歴を削除する

historyコマンドを利用して過去に入力したコマンド一覧を確認することができます。
このコマンド履歴を削除する方法を以下に記します。


関連資料

historyの履歴を削除するオプション

以下のオプションによりhistoryの履歴を削除することができます。

history -c

manコマンドで確認してみたところ、以下のように記述されています。

$ man history
<snip>
      history [n]
      history -c
      history -d offset
      history -anrw [filename]
      history -p arg [arg ...]
      history -s arg [arg ...]
             With  no options, display the command history list with line numbers.  Lines listed with a * have been modified.  An argument
             of n lists only the last n lines.  If the shell variable HISTTIMEFORMAT is set and not null, it is used as  a  format  string
             for  strftime(3)  to  display  the  time stamp associated with each displayed history entry.  No intervening blank is printed
             between the formatted time stamp and the history line. If filename is supplied, it is used as the name of the history  file;
             if not, the value of HISTFILE is used.  Options, if supplied, have the following meanings:
             -c     Clear the history list by deleting all the entries.
             -d     offset
                    Delete the history entry at position offset.
             -a     Append  the  ‘‘new’’ history lines (history lines entered since the beginning of the current bash session) to the his-
                    tory file.
             -n     Read the history lines not already read from the history file into the current history list.  These are lines appended
                    to the history file since the beginning of the current bash session.

他にもオプションがあるので試してみてはいかがでしょうか!?

 

 

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2015-03-20 (金) 22:28:14