posted by 귀염둥이채원 2018. 8. 3. 09:28

whois는 인터넷 사용자에게 정보 서비스를 제공하는데 일반적으로 사용되는 TCP 기반 쿼리 및 응답 프로토콜입니다. 

등록된 도메인 이름, IP 주소, 네임 서버 및 훨씬 광범위한 정보 서비스에 대한 정보를 반환합니다.

whois 명령어가  리눅스 배포판에 사전에 설치되어 있지 않은 경우 아래 명령을 실행하여 설치할수 있습니다.

# yum install whois		# RHEL/CentOS
# dnf install whois		# Fedora 22+
$ sudo apt install whois	# Debian/Ubuntu

# IP 주소 정보를 찾는 방법

특정 IP 주소에 대한 정보를 얻으려면 아래 예제와 같이 명령을 실행하십시오.

$ whois 216.58.206.46
#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/whois_tou.html
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/public/whoisinaccuracy/index.xhtml
#
#
# The following results may also be obtained via:
# https://whois.arin.net/rest/nets;q=216.58.206.46?showDetails=true&showARIN=false&showNonArinTopLevelNet=false&ext=netref2
#
NetRange:       216.58.192.0 - 216.58.223.255
CIDR:           216.58.192.0/19
NetName:        GOOGLE
NetHandle:      NET-216-58-192-0-1
Parent:         NET216 (NET-216-0-0-0-0)
NetType:        Direct Allocation
OriginAS:       AS15169
Organization:   Google LLC (GOGL)
RegDate:        2012-01-27
Updated:        2012-01-27
Ref:            https://whois.arin.net/rest/net/NET-216-58-192-0-1
OrgName:        Google LLC
OrgId:          GOGL
Address:        1600 Amphitheatre Parkway
City:           Mountain View
StateProv:      CA
PostalCode:     94043
Country:        US
RegDate:        2000-03-30
Updated:        2017-12-21
Ref:            https://whois.arin.net/rest/org/GOGL
...

# 도메인 정보를 찾는 방법

등록된 도메인에 대한 정보를 얻으려면 도메인 이름과 함께 다음 명령을 실행하면됩니다. 가용성, 소유권, 생성, 만료 세부 사항, 네임 서버 등을 포함한 도메인 데이터를 검색합니다.

$ whois google.com
Domain Name: GOOGLE.COM
Registry Domain ID: 2138514_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.markmonitor.com
Registrar URL: http://www.markmonitor.com
Updated Date: 2011-07-20T16:55:31Z
Creation Date: 1997-09-15T04:00:00Z
Registry Expiry Date: 2020-09-14T04:00:00Z
Registrar: MarkMonitor Inc.
Registrar IANA ID: 292
Registrar Abuse Contact Email: abusecomplaints@markmonitor.com
Registrar Abuse Contact Phone: +1.2083895740
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
Domain Status: serverDeleteProhibited https://icann.org/epp#serverDeleteProhibited
Domain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited
Domain Status: serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited
Name Server: NS1.GOOGLE.COM
Name Server: NS2.GOOGLE.COM
Name Server: NS3.GOOGLE.COM
Name Server: NS4.GOOGLE.COM
....


posted by 귀염둥이채원 2018. 8. 2. 09:06

설정파일 또는 다양한 프로그래밍 언어의 소스코드에서 가독성을 향상시키는 쉬운 방법중 하나는 "구문 강조(syntax highlighting)"을 지원하는 텍스트 에디터를 사용하는 것입니다.

구문 강조(syntax highlighting)는 프로그래밍, 스크립팅 또는 마크 업 언어에 사용되는 대부분의 텍스트 편집기에서 간단하지만 유용한 구성 요소입니다.

소스코드를 다양한 색 또는 다양한 글꼴로 표시할 수 있습니다.

Vi/Vim 텍스트 편집기에서 구문 강조(syntax highlighting)를 일시적으로 또는 영구적으로 사용하는 방법을 설명합니다.

# VIM 설치 방법

리눅스 시스템의 대부분은 VIM 패지키가 포함되어 있습니다.

만약 설치되지 않았으면 yum 명령을 이용하여 설치하면 됩니다.

# yum -y install vim-enhanced

# VI/VIM에서 구문 강조 표시 사용 설정

VI 편집기 에서 구문 강조 표시 기능을 활성화하려면 /etc/ profile 파일을 엽니다.

# vi /etc/profile

/etc/profile 파일에서 alias vi=vim을 추가 하세요. 이 파일은 별칭 기능을 전역적으로 설정하는데 사용됩니다.

alias vi=vim

사용자 별칭 및 기능 을 설정 하려면 사용자 디렉토리 아래에서 .bashrc 파일을 열어야합니다 .

# vi /home/tecmint/.bashrc

alias(별칭) 기능을 추가하십시오. 예를 들어 tecmint 사용자에 대한 별칭을 설정 합니다.

alias vi=vim

파일을 변경한 후 다음 명령(source)을 실행하여 변경 사항을 재설정해야합니다.

# source /etc/profile
OR
# source /home/tecmint/.bashrc

# VI 에디터에서 구문 강조 표시 테스트

vi 편집기를 사용하여 파일의 예제 코드를 엽니다. 기본적으로 구문 강조는 /etc/vimrc 파일 에서 자동으로 켜집니다 .

VI에서 구문 강조 표시의 예

Syntax Highlighting in Vi

Syntax Highlighting in Vi


VI에서 구문 강조 표시 켜기 또는 끄기

여러분은 구문 강조를 키거나 끌수 있습니다.

VI에서 ESC의 버튼 눌러서 :syntax on 을 입력하여 구문 강조를 켤수 있습니다. :syntax off는구문강조를 끌수 있습니다.

아래 그림은 구문 강조를 켜는 방법입니다.

VI에서 구문 강조 표시 켜기

Enable Syntax Highlighting in Vi Editor

Enable Syntax Highlighting in Vi Editor


VI에서 구문 강조 표시 끄기

Disable Syntax Highlighting in Vi Editor

Disable Syntax Highlighting in Vi Edit

참고: https://www.tecmint.com/enable-syntax-highlighting-in-vi-editor/

posted by 귀염둥이채원 2018. 8. 1. 10:00

리눅스 top명령은 시스템 관리자가 시스템 가동 시간  로드 평균, 사용된 메모리, 실행중인 작업, 프로세스 또는 스레드의 요약 및 실행중인 각 프로세스에 대한 자세한 정보를 실시간으로 시스템 통계를 표시하는데 사용됩니다.

그러나 실행중인 시스템을 실시간으로 확인하는 것 외에도 일괄 처리 모드에서 작동 하도록 하는 플래그(-b 플래그) 명령이 출력해야하는 반복 횟수를 지정하는 플래그(-n 플래그)를 사용하여 TOP 명령 출력을 파일에 저장할 수 있습니다.

아래의 예시는 현재 작업 디렉토리에서 top 명령의 결과를 top.txt 파일에 리디렉션 하는 것입니다.

-n 인수는 top 명령을 n번 실행하여 스냅샵 정보를 출력합니다.

$ top -b -n 1 > top.txt

생성된 파일을 읽기 위해 파일을 읽는 명령어인 cat, less, more 같은 명령어를 사용하면 됩니다.

$ less top.txt
View Output of Top Command

View Output of Top Command


top 명령의 결과를 5번 반복해서 가져오려면 아래 명령어를 참고하면 됩니다.

$ top -b -n 5 > top-5iterations.txt

결과 파일에서 실행중인 task들의 개수를 표시하기 위해 아래와 같이 grep filter를 사용하면 됩니다.

$ cat top-5iterations.txt | grep Tasks
Show Top 5 Running Tasks

Show Top 5 Running Tasks

top 명령에서 구체적인 프로세스의 스냅샵 정보를 확인하려면 PID (-p) 플래그와 함께 명령을 실행하면 됩니다.

실행중인 프로세스의 PID를 얻기위해서는 pidof 명령을 사용할수 있습니다.

아래의 예제는 pidof 명령어로 crond 프로세의 PID를 알아오고, top 명령으로 crond 프로세스를 결과를 3번 스냅샵으로 찍어서 cron.txt 파일로 저장합니다.

$ pidof crond
$ top -p 678 -b -n3 > cron.txt
$ cat cron.txt
Watch Process Usage in Top Command

Watch Process Usage in Top Command

반복 루프를 이용해서 2초마다 해당 PID에 대한 프로세스 통계 정보를 출력할 수 있습니다. 반복 루프의 결과를 파일로 리디렉션 할수도 있습니다.

$ for i in {1..4}; do sleep 2 && top -b -p 678 -n1 | tail -1 ; done

반복 루프의 결과를 리디렉션 합니다.

$ for i in {1..4}; do sleep 2 && top -b -p 678 -n1 | tail -1 ; done >> cron.txt
$ cat cron.txt
Find Linux Process Statistics

Find Linux Process Statistics


참고: https://www.tecmint.com/save-top-command-output-to-a-file/