본문 바로가기

리눅스-기초명령어/명령어 관리

(3)
리눅스 명령어 단축키 명령어를 입력할 때 사용 가능한 단축키 ctrl + a 명령어 맨앞칸으로 이동 ctrl + e 명령어 맨뒷칸으로 이동 ctrl + u 커서를 기준으로 앞을 삭제 ex) 뒤쪽 c에 커서를 맞춘 후 실행 [root@Linux ~]# cat hi.txt; cat hello.txt [root@Linux ~]# cat hello.txt ctrl + k 커서를 기준으로 뒤를 삭제 ex) 뒤쪽 c에 커서를 맞춘 후 실행 [root@Linux ~]# cat hi.txt; cat hello.txt [root@Linux ~]# cat hi.txt; ctrl + r 본인이 친 명령어를 역순으로 검색해준다. Ctrl + c 강제 종료 > > > > 이런식으로 엔터를 쳐도 빠져나올수 없을때는 ctrl + c 를 쓰면 빠져나온다..
grep 문자열 또는 정규식을 포함하는 텍스트를 검색하는 명령어이다. 사용법 grep [옵션] [패턴] [파일] 옵션 기본 [root@Linux ~]# history | grep cl 54 clear 78 history | grep cl -c : 지정한 패턴과 일치하는 텍스트의 수를 출력한다. [root@Linux ~]# grep -c 1 A.txt 7 -i : 대소문자를 구별하지 않는다. [root@Linux ~]# grep -i apple A.txt apple APPLE -v : 일치하지 않는 행만 출력한다. [root@Linux ~]# cat A.txt apple banana pineapple [root@Linux ~]# grep -v apple A.txt banana -n : 행의 번호를 함께 출력한다. ..
history 지금까지 입력했던 명령어들이 표시된다. history -c 히스토리 삭제 [root@Linux ~]# history -c [root@Linux ~]# history 1 history !명령어 번호 히스토리에 기록된 번호의 명령어가 실행된다. [root@Linux ~]# history 1 history ... 107 echo \#comment #comment 108 history [root@Linux ~]# !107 echo \#comment #comment #comment !! 바로 직전의 명령어를 재실행한다. [root@Linux ~]# ls -l total 0 drwxr-xr-x. 2 root root 6 Apr 28 12:48 test [root@Linux ~]# !! ls -l total 0 dr..