본문 바로가기

리눅스

리눅스 history 명령어

반응형

history 명령어

Bash History 설정

cat <<EOF >> /etc/profile

## history
export HISTSIZE=10000
export HISTTIMEFORMAT='%Y-%m-%d %H:%M:%S '
#export HISTCONTROL=erasedups
EOF

Print ‘n’ Lines

history 2
$ history 2
  919  2021-01-28 21:20:43 echo "history command"
  920  2021-01-28 21:20:59 history 2

Repeat Specific Command

!번호
$ !917
echo "history command"
history command

Repeat Most Recent Command

!!
$ !!
echo "history command"
history command

Reverse Search

^r (Crtl + r)

Delete Specific Line

history -d 925
$ echo 111
111
$ history 3
  924  2021-01-28 21:47:03 history
  925  2021-01-28 21:47:23 echo 111
  926  2021-01-28 21:47:33 history 3
$ history -d 925
$ history 3
  925  2021-01-28 21:47:33 history 3
  926  2021-01-28 21:47:45 history -d 925
  927  2021-01-28 21:47:46 history 3

 

728x90
반응형