'디버깅을 통해 배우는 리눅스 커널의 구조와 원리' 책에 대해 궁금한 점이 있으면 이 포스트에 댓글로 질문을 남겨주시기 바랍니다. 질문을 남겨주시면 최대한 빠른 시일 내에 댓글로 답신 드리겠습니다.

'디버깅을 통해 배우는 리눅스 커널의 구조와 원리' 저자 김동현 올림

라즈비안(데비안 기반)에서 vim 에디터를 사용하면 visual 모드가 
by default로 설정돼 있어 쓰기 불편합니다. 
 
이번 포스트에서는 vi(vim) 에디터에서 visual mode를 삭제하는 방법을 소개합니다.
 
1. vi 에디터 편집창에서 명령어 입력

 

vi를 실행한 다음에 편집창 안에서 다음 명령어를 입력합니다. 
 
":set mouse="
":set mouse-=a"
 
2. $HOME/.vimrc 수정
 
'$HOME/.vimrc' 파일을 수정하는 방법도 있습니다. 이 방법을 적용하면 vi 에디터를 
사용할 때 마다 ":set mouse=" 명령어를 입력할 필요가 없으니 더 편한 것 같아요.
 
'$HOME/.vimrc' 파일을 열고 다음 명령어를 입력합시다.
 
set mouse=
 
root 계정으로 사용 중이면 다음 명령어를 입력하면 됩니다.
 
root@raspberrypi:/home/pi# vi /root/.vimrc
root@raspberrypi:/home/pi# source /root/.vimrc

solarianprogrammer.com/2018/04/22/raspberry-pi-raspbian-install-clang-compile-cpp-17-programs/

이번 포스트에서는 우분투에서 clang12를 설치하는 방법을 소개합니다.
참고로 우분투 버전은 20.04입니다. 
 
'sudo apt install clang-12 --install-suggests' 명령어를 사용해 clang12를 설치합니다.
 
$ sudo apt install clang-12 --install-suggests
 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  clang-12-doc fonts-font-awesome fonts-mathjax fonts-mathjax-extras fonts-stix libjs-mathjax libjs-mathjax-doc libjs-modernizr
  libjs-sphinxdoc libjs-underscore libomp-12-doc llvm-12-doc sphinx-rtd-theme-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  clang-12-doc fonts-font-awesome fonts-mathjax fonts-mathjax-extras fonts-stix libclang-common-12-dev libclang-cpp12 libclang1-12
  libjs-mathjax libjs-mathjax-doc libjs-modernizr libjs-sphinxdoc libjs-underscore libomp-12-dev libomp-12-doc libomp5-12 llvm-12
  llvm-12-dev llvm-12-doc llvm-12-linker-tools llvm-12-runtime llvm-12-tools sphinx-rtd-theme-common
The following packages will be REMOVED:
...
etting up libjs-mathjax-doc (2.7+20171212-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for fontconfig (2.13.1-2ubuntu3) ...
 
커널을 빌드할 때 'make CC=clang' 구문을 추가하면 Clang으로 커널 빌드가 됩니다.
 
make CC=clang ARCH=arm64 O=$OUTPUT CROSS_COMPILE=aarch64-linux-gnu- allyesconfig  -j16 2>&1
make CC=clang ARCH=arm64 O=$OUTPUT CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs  -j16 2>&1 | tee $BUILD_LOG
라즈비안에서 '7z 파일' 압축을 풀고 싶을 때가 있다.
 
p7zip 유틸리티를 설치
 
먼저 p7zip 유틸리티를 설치하자.
 
$ apt install p7zip
 
root@raspberrypi:/home/pi/work/crash_dump/out# apt install p7zip
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  python-colorzero
Use 'sudo apt autoremove' to remove it.
Suggested packages:
  p7zip-full
The following NEW packages will be installed:
  p7zip
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 350 kB of archives.
After this operation, 1,006 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main arm64 p7zip arm64 16.02+dfsg-6 [350 kB]
Fetched 350 kB in 0s (1,070 kB/s)
Selecting previously unselected package p7zip.
(Reading database ... 92716 files and directories currently installed.)
Preparing to unpack .../p7zip_16.02+dfsg-6_arm64.deb ...
Unpacking p7zip (16.02+dfsg-6) ...
Setting up p7zip (16.02+dfsg-6) ...
Processing triggers for man-db (2.8.5-2) ...
 
설치 완료!
 
p7zip는 어디에 있나?
 
root@raspberrypi:/home/pi/work/crash_dump/rpi_sample# whereis p7zip
p7zip: /usr/bin/p7zip /usr/lib/p7zip /usr/share/man/man1/p7zip.1.gz
 
root@raspberrypi:/home/pi/work/crash_dump/rpi_sample# p7zip
/usr/bin/p7zip: compressed data not written to a terminal.
For help, type: /usr/bin/p7zip -h
 
'/usr/bin/p7zip' 디렉토리에 존재한다.
 
p7zip help 출력 결과 
 
root@raspberrypi:/home/pi/work/crash_dump/rpi_sample# /usr/bin/p7zip -h
Usage: /usr/bin/p7zip [options] [--] [ name ... ]
 
Options:
    -c --stdout --to-stdout      output data to stdout
    -d --decompress --uncompress decompress file
    -f --force                   do not ask questions
    -k --keep                    keep original file
    -h --help                    print this help
    --                           treat subsequent arguments as file
                                 names, even if they start with a dash
 
이제 압축을 풀어볼까?  
 
p7zip -d file.7z
 
root@raspberrypi:/home/pi/work/crash_dump/rpi_sample# p7zip -d user_call_stack_dump_rpi.7z
 
7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs LE)
 
Scanning the drive for archives:
1 file, 110218549 bytes (106 MiB)
 
Extracting archive: user_call_stack_dump_rpi.7z
--
Path = user_call_stack_dump_rpi.7z
Type = 7z
Physical Size = 110218549
Headers Size = 918
Method = LZMA2:24
Solid = +
Blocks = 5
아래 파일을 열고, 다음과 같은 코드를 입력하면 깃 명령어에 대해 단축키를 지정할 수 있습니다.
 
~/.gitconfig
[alias]
    ch = checkout
    co = commit
    fp = format-patch
    s = status
    b = branch
 
아래 링크에 가보면 훌륭한 개발자님께서 깃에 대한 유용한 정보를 올렸으니, 잘 참고했으면 합니다.
 
가끔 Ubuntu 버전을 확인하고 싶을 때가 있습니다.
이 때 'lsb_release -a' 명령어를 입력하면 됩니다.
 
root:~/oss_prj$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.7 LTS
Release:        16.04
Codename:       xenial
 
위 출력 결과로 우분투의 버전은 16.04임을 알 수 있습니다.
어느 훌륭한 개발자 분이 유용한 GIT 커멘드를 정리했습니다.
 
출처:
 
이렇게 유용한 GIT 명령어를 정리해주신 블로그 운영자께 감사의 마음을 전합니다.
가끔 하위 디렉토리에 있는 특정 확장자의 파일을 지우고 싶을 때가 있습니다.
만약 *.png 파일을 지우고 싶으면 아래 명령어를 입력하면 됩니다.
 
$ rm -rf `find . -name *.png`
프로젝트를 진행하다보면 리눅스 서버에 있는 데이터를 바로 복사하고 싶을 때가 있습니다.
이때 scp 유틸리티를 쓰면 되는데요. 사용법은 다음과 같습니다.
 
[1] 먼저, 복사할 데이터가 있는 리눅스 서버에 접속합니다.
 
[2] 이어서 다음 명령어를 입력합니다. 
 
scp bald_candy.data bald.candy@12.345.67.89:~/bald_candy_data
 
여기서, 각 명령어의 내용은 다음과 같습니다.
 
복사할 대상의 리눅스 서버의 IP 주소: 12.345.67.89
복사할 대상의 리눅스 서버의 계정: bald.candy
복사하고 싶은 파일 이름: bald_candy.data
 
[3] 만약 폴더를 복사하려면 다음 명령어를 입력하면 됩니다.
 
scp -r bald_candy_folder bald.candy@12.345.67.89:~/bald_candy_data
 
(where)
복사할 대상의 리눅스 서버의 IP 주소: 12.345.67.89
복사할 대상의 리눅스 서버의 계정: bald.candy
복사하고 싶은 디렉토리 이름: bald_candy_folder
 
이번에 소개하는 scp 명령어를 잘 활용해서 집에 일찍 갑시다.

+ Recent posts