Linux
-
-
vim editor(vim 편집기) - 정적 라이브러리Linux/vim 편집기 2020. 7. 10. 08:53
위의 코드로 정적라이브러리를 이용한 컴파일을 해본다 우선 위의 4개의 c 파일로 분할해 준다. | 정적 라이브러리에 포함해줄 c 파일 컴파일 정적 라이브러리에 포함해줄 calc.c 와 input.c 파일을 컴파일 해준다 ***warning 부분은 아직 더 봐야 한다 ..검색중 .. 컴파일에는 문제 없음! | 정적 라이브러리 생성 명령어 ar rscv 를 이용해 정적 라이브러리를 생성해준다. lib( ).a 의 틀을 유지하고 ( ) 안에 라이브러리 이름을 넣어준다 | 정적 라이브러리를 포함한 컴파일 정적 라이브러리를 포함해서 test라는 이름의 실행 파일을 생성 -L./ -l( ) 를 이용해서 정적 라이브러리를 포함해준다 ( ) 안에는 지정한 라이브러리 이름을 넣어준다 | 실행 결과 완성! | Makefi..
-
NFS(network file system) - mount/ unmountLinux/NFS(network file system) 2020. 7. 7. 21:30
| 마운트 포인트로 이동하기 명령어 : cd /mnt 리눅스의 루트디렉토리( / ) 하위에 있는 mnt 디렉토리에 마운트 하려고 합니다 명령어 : sudo mkdir /mnt/lect_nfs 아래 그림처럼 mnt 디렉토리의 권한이 root에 있으므로 sudo를 사용해서 lect_nfs 파일을 만들어 마운트 준비를 합니다 | 마운트 하기 : mount 명령어 : ~$sudo mount -t nfs 192.168.1.40:/srv/nfs /mnt/lect_nfs df df 명령어를 사용하면 마운트 결과를 위 그림의 분홍색으로 표시된 부분처럼 확인 할 수 있다 | 마운트 해제 하기 : umount 명령어 : ~$sudo umount /mnt/lect_nfs df df 명령어를 입력해서 마운트가 해제되어 바로 ..
-
NFS(network file system) 사용하기Linux/NFS(network file system) 2020. 7. 7. 19:51
NFS(network file system)은 리눅스 서버 간의 디스크를 공유하는 방법이다. | NFS 서버 설치하기 ~$sudo apt-get install nfs-common nfs-kernel-server rpcbind 위의 명령어를 입력해서 NFS 서버를 설치해준다. 미리 만들어 놓은 srv 디렉토리 안에 nfs 디렉토리를 만들어 준다. (samba 파일은 samba 서버 구축을 할 때 생성되었으므로 지금은 신경 안 써도 된다.) | 마운트를 위한 권한 변경 권한 변경 전, ls -l 명령어를 입력하면 파일들의 허용 권한을 볼 수 있다. 3행 : drwxr-xr-x 는 nfs 파일에 group과 others에 쓰기 권한이 없다 5행 : sudo chmod go+w nfs 명령어를 이용해 쓰기 권한..
-
vim editor(vim 편집기) - Makefile을 이용한 분할 컴파일Linux/vim 편집기 2020. 7. 6. 22:39
위의 코드를 vim 편집기에서 Makefile 을 이용해 분할 컴파일 해본다. 11) vim 편집기를 통해 main.c , grade_estimate.c, common.h를 작성해 준다. 2) 명령어를 통해 Makefile 을 작성해준다. 1행 : execute : 실행 파일의 이름 5행 : 반드시 맨 앞을 Tab으로 띄어야 한다 | 오류 코드를 작성하다가 6행의 object 파일을 만드는 과정에서 grade_estimete.c 가 아니라 grade_estimate.o 로 잘 못 기입하면 상호 의존성은 무시된다는 메세지가 뜬다. 컴파일은 잘 되지만 주의 할것! 컴파일을 할때 make를 해주기 전에 make clean을 해주면 생성되었던 object 파일들과 실행 파일이 삭제 된다. | 실행결과 |매크로 ..
-
vim editor(vim 편집기) - 명령어Linux/vim 편집기 2020. 7. 6. 22:02
1) 특정 행 잘라내기 일반 모드에서 :(line number)d 를 입력하면 (위의 그림에서는) 13행이 삭제된다. 2) 특정 행부터 잘라내기 :(line number), $d 를 입력하면 입력된 행부터 아래의 모든 행이 삭제 된다. (오른쪽 그림 참고) 3) 줄번호 (line number) 붙이기 :(콜론)을 통해 줄 번호 명령어를 입력한다. :set number 또는 :set nu 4) set number(nu) - 라인넘버 표시하기 5) set tabstop=5(ts) - 탭을 5칸으로 하기 6) set cindent(ai) – 블록의 처음 시작 및 라인 자동 들여쓰기 7) set title - 제목을 표시