#navi(../)
* historyの履歴を削除する [#t3f5bd7f]

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

#contents
#htmlinsertpcsp(linux_ads_top.html,linux-sp.html)

* 関連資料 [#h8e8413e]
-[[以前実行したコマンドの履歴を確認したい・historyコマンド>逆引きUNIXコマンド/以前実行したコマンドの履歴を確認したい]]
-[[特定番号のhistoryを削除する方法>逆引きUNIXコマンド/特定番号のhistoryを削除する方法]]


* historyの履歴を削除するオプション [#d46aa8d5]
以下のオプションにより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.

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

#br
#htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)
#br

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS