-a : 표시할 수 없는 문자가 있거나 매우 긴 경우에도 모든 Log 내용을 출력 -b : 마지막 부팅 후의 Log만 출력 -r : 최신항목이 먼저 표시되도록 역순으로 출력 -c : 커서가 지정한 저널의 위치부터 Log 표시를 시작 -f : 가장 최근 Log만 표시하고 새롭게 추가되는 Log는 계속 출력 -k : 커널 메시지만 출력 (dmesg랑 같음) -q : 일반 사용자로 실행될 때 접근할 수 없는 시스템 저널에 관한 경고메시지를 표시하지 않음 -u : unit으로 systemctl list-units에서 출력되는 첫번째 항목 -p : 메시지의 우선순위로 log level을 의미 emerg=0, alert=1, crit=2, err=3, warning=4, notice=5, info=6, debug=7 -o : Log 출력 형식을 설정 short : 기본값으로 syslog파일의 형식과 동일하다. 한 행에 하나의 Log만 출력 short-iso : short와 비슷하지만 ISO 8601의 시간 형식으로 출력 short-precise : short와 비슷하지만 마이크로 초 단위로 시간 출력 short-monotonic : short와 비슷하지만 단조로운 시간 형식으로 출력 verbose : 전체 Log를 모두 자세하게 출력 export : Log내용을 내보낸다. (백업 및 전송에 적합한 바이너리 스트림으로 직렬화) json : 한줄에 하나씩 JSON 데이터 구조로 형식화 json-pretty : JSON 데이터 구조로 형식화 하지만 여러줄로 형식을 지정하여 사람이 읽을 수 있게 한다. json-see : JSON 데이터 구조로 형식화 하지만 Server-Sent Events에 적합한 형식으로 한다. cat : 매우 간결한 출력을 생성하며 메타 데이터가 없고 Log만 표시하며 시간은 표시하지 않음 -l : 출력되는 Log의 필드를 줄일때 사용, 기본값은 전체 필드를 표시하여 사용자가 해당 필드를 붙이거나 자를 수 있도록 한다. _UID= 33 : 33번 UID를 가진 프로세스에 대한 Log를 출력 --disk-usage : 저널 파일의 디스크 사용량을 표시 (압춘된 모든 더널 파일과 사용중인 저널 파일의 합계를 표시)
sudo mount -o remount,exec /dev sudo vbetool dpms off sudo mount -o remount,noexec /dev
다시 디스플레이를 켜려면
1 2 3
sudo mount -o remount,exec /dev sudo vbetool dpms on sudo mount -o remount,noexec /dev
Network 상태 확인
ss 명령
ss 명령은 Socket Statistics 를 출력해 준다. open 된 소켓에 대한 정보를 표시한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
ss [-a -t -u -l -p -n] [filter]
-a: -t: TCP -u: UDP -l: LISTEN 상태 포트 -n: 호스트/포트/사용자 이름을 숫자로 표시 -p: 프로세스 이름 -r, --resolve: resolve host names -w, --raw : display only RAW sockets -x, --unix : display only Unix domain sockets -4, --ipv4 : display only IP version 4 sockets -6, --ipv6 : display only IP version 6 sockets -m, --memory : show socket memory usage
LISTEN Port 확이
netstat 같이 LISTEN 상태 프로세스를 확인할 수 있다. 다음은 t: tcp 포트, l: LISTEN 상태의 소켓 정보를 출력한다.
$ ss -tl4 State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 511 0.0.0.0:http 0.0.0.0:* LISTEN 0 511 0.0.0.0:https 0.0.0.0:* $ $ ss -tl6 State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 [::]:2020 [::]:* q
lsof
Linux에서 open file을 확인하는데 사용되는 lsof 명령입니다. Unix/Linux의 모든 것은 파일로 이루어져있기때문에 스트림이나 네트워크 파일도 lsof 로 확인할 수 있습니다.
-d, --detach : 명령을 detach mode, 백그라운드로 실행 -e, --env : 환경변수 설정하고 실행 -it [SHELL]: iteractive tty 옵션. 사용할 shell을 지시한다, 보통 bash -u, --user: User ID, UID -w, --workdir: 작업 디렉토리 지정
Device Start End Sectors Size Type /dev/sdb1 2048 8390655 8388608 4G Linux swap /dev/sdb2 8390656 125042654 116651999 55.6G Linux LVM
fdisk 결과의 Sector size는 전체 용량과 섹터 크기를 계산하면 논릭적인 섹터의 크기를 확인할 수 있다.
1 2
echo $((64021856256/125042688)) 512
Sector size (logical/physical): 512 bytes / 512 bytes 에서 물리 크기를 확인할 수 있다.
성능
dd 를 사용해서 1024 바이트를 1000000 블록에 걸쳐 쓰기를 수행한다 - 1GB
1
$ time sudo dd bs=1024 count=1000000 if=/dev/zero of=1GB_file
dd 를 사용해서 1GB 크기 파일을 1024 바이트씩 읽기를 한다.
1
$ time sudo dd bs=1024 if=1GB_file of=/dev/null
Verbose output
Sending an INFO signal to a running dd process makes it print I/O statistics to standard error and then resume copying. In the example below, dd is run in the background to copy 10 million blocks. The kill command makes it output intermediate I/O statistics, and when dd completes normally or is killed by the SIGINT signal, it outputs the final statistics.
1 2 3 4 5 6 7 8
$ dd if=/dev/zero of=/dev/null count=10MB & pid=$! $ kill -s INFO $pid; wait $pid 3385223+0 records in 3385223+0 records out 1733234176 bytes (1.7 GB) copied, 6.42173 seconds, 270 MB/s 10000000+0 records in 10000000+0 records out 5120000000 bytes (5.1 GB) copied, 18.913 seconds, 271 MB/s
On systems lacking the INFO signal dd responds to the USR1 signal instead, unless the POSIXLY_CORRECT environment variable is set.
You can also try the status=progress option:
1 2 3 4 5 6
[~]$ dd if=/dev/zero of=/dev/null count=10MB status=progress 4708234752 bytes (4.7 GB, 4.4 GiB) copied, 4 s, 1.2 GB/s 10000000+0 records in 10000000+0 records out 5120000000 bytes (5.1 GB, 4.8 GiB) copied, 4.3516 s, 1.2 GB/s [~]$
$ file /bin/ls ELF 32-bit LSB executable, ARM, EABI5 version 1 .. ARM arm 7 is 32 bit. ARMv8-A, October 2011, 64-bit address space and 64-bit arithmetic 지원