«   2021/05   »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
05-08 05:43
Notice
Today
9
Total
1,423,023
관리 메뉴

변군이글루

[명령어] history 명령어 본문

* 리눅스

[명령어] history 명령어

변군 변군이글루 2021. 1. 28. 21:55

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

 

1 Comments
댓글쓰기 폼