calshp> vi filename
a : append after the cursor
i : insert before the cursor
o : start a new line below the cursor
O : start a new line above the cursor
The "esc" key must be used to end any of the above commands or to begin any of the following commands
(depending on which way you look at it). You must also hit the "esc" key prior to any cursor movement.
When in doubt, hit the "esc" key and proceed.
3. How to delete information from a file:
x : deletes the character the cursor is under
dd : deletes the line the cursor is on
4. How to make corrections:
r : followed by a single character, replaces the character the cursor is on
R : followed by many characters until an "esc" key is typed, writes over all the previous characters
5. More edit commands
CTRL-f : scroll down ndd delete n lines
CTRL-b : scroll up nG go to line n
^ : go to beginning of line nY copy n lines
$ : go to end of line p put copied lines below cursor
ndd : delete n lines
nG : go to line n
nY : copy n lines
p : put copied lines below cursor
6. How to exit from vi:
Depress the escape key; then type a colon ":" and you are ready to use one of the line commands.
ZZ : saves the current changes and exits vi
:wq : saves the current changes and exits vi
:w! : saves the current changes but does not exit vi
:q! : exits vi without saving any change
7. More line commands:
:1 : goes to the top line of your file
:5 : goes to the fifth line of your file
:$ : goes to the bottom line of your file
:set nu : will number all your lines
:set nonu : will turn off the line numbering
:1,$s/oldstr/newstr/g : how to make global substitution
:vi : returns to the full screen editor
'구 블로그 보관처' 카테고리의 다른 글
CentOS 설치 2 - Minimal 기본 설치 후 해야 할 일들 (1/2) (0) | 2020.07.17 |
---|---|
CentOS 설치 1 - Minimal 설치 (0) | 2020.07.16 |
CentOS 파티션 분할 셋팅 (0) | 2020.07.16 |
CentOS 설치 도움 URL 정리 (0) | 2020.06.22 |
Linux - 네트워크 설정 관련 (0) | 2020.05.17 |
댓글