반응형
- history가 기록되는 과정
- 명령어 입력 -> buffered -> 로그아웃 시, .bash_history에 기록
- # history 의 결과
- .bash_history의 내용 + buffer에 기록된 명령어
- 로그인 후 입력한 명령어는 history에는 보이나, .bash_history 내용을 까보면 보이지 않음(로그아웃 시 기록)
-
[root@localhost system]# history 1 history 2 cd /etc/yum.repos.d/ 3 ll 4 vim CentOS-Base.repo 5 cat CentOS-Vault.repo 6 cd .. 7 ll 8 cd systemd/ 9 ll 10 cd system/ 11 ll 12 history [root@localhost system]# cat ~/.bash_history
-
- buffer의 history와 .bash_history를 동기화 하는 방법
- # history -a
-
[root@localhost system]# cat ~/.bash_history [root@localhost system]# history -a [root@localhost system]# cat ~/.bash_history history cd /etc/yum.repos.d/ ll vim CentOS-Base.repo cat CentOS-Vault.repo cd .. ll cd systemd/ ll cd system/ ll history cat ~/.bash_history history -a
-
- # history -a
- 로그인 후 입력한 명령어는 history에는 보이나, .bash_history 내용을 까보면 보이지 않음(로그아웃 시 기록)
- .bash_history의 내용 + buffer에 기록된 명령어
- 기존의 history 를 완전 삭제하는 방법
- 접속 계정의 home 디렉토리로 이동하여 .bash_history 파일 내용을 비워주고 history -c 를 사용
- # cat /dev/null > ~/.bash_history
- 이전에 기록된 history 삭제
- # history -c
- 현재 세션에서 입력한 명령어들 삭제(버퍼 내용)
- # cat /dev/null > ~/.bash_history
- .bash_history 삭제 후 버퍼 내용(history -c)까지 삭제한 결과
- 접속 계정의 home 디렉토리로 이동하여 .bash_history 파일 내용을 비워주고 history -c 를 사용
[root@localhost system]# cat /dev/null > ~/.bash_history
[root@localhost system]# history -c
[root@localhost system]# history
1 history
반응형
'Linux > CentOS' 카테고리의 다른 글
[Linux] 파일 정보 확인하기 (권한, 용량, 소유자 등) (0) | 2021.11.23 |
---|---|
Clamav 설치 및 실행 방법 (0) | 2021.01.21 |