시스템프로그래밍 중간정리(lect3,4)
Vi & simple C
vi란 무엇인가....?
챗지피티 선생이 말씀하시길
vi는 리눅스와 유닉스 계열 운영체제에서 기본적으로 제공되는 텍스트 편집기(text editor)입니다.
세 가지 모드가 있습니다. (command mode, insert mode, status-line mode)
- command mode:
cusor moving: j(down), k(up), h(left), l(right)
deletion: x(delete one character), dd(delete a line)
copy and paste:
3yy : copy 3 lines starting from the current line
p : paste them after the current line
recover
u : recover what you have just deleted
- command mode -> insertion mode : i, a, o
i: start insertion from the current cursor
a: start insertion after the current cursor
o: insert a new line
- insertion mode -> command mode: ESC key
- In status-line mode, we can store data, go to certain line number,
search string, etc.
- command mode -> status-line mode: / or :
- status-line mode:
:q! : quit without saving
:w : write
:wq : save and exit
/pat : search the pattern in "pat"
:set number : display line numbers
:40 : go to line 40
리눅스에서 C를 다뤄보자.
gcc : compile a c program (gcc ex1.c 만 입력할 경우에는 a.out이라는 이름의 실행파일이 생성된다.)
gcc -o ex1 ex1.c
: compile ex1.c and produce an object (executable) file“ex1”
: -o ex1 means the executable file name is ex1
g++ : compile a c++ program
g++ -o ex1 ex1.cpp
kill : send a signal to a process
kill 1234 : kill process whose pid is 1234
^c : kill the current running process