본문 바로가기

Infra Architecture

(34)
[ Centos ] IP 변경 방법 https://sysinfo.tistory.com/22 Centos7 IP 변경하기 안녕하세요. 이번 글은 Centos 7 의 IP 변경 방법을 소개합니다. 1. 네트워크 인터페이스 name 확인 [ex@localhost ~]$ ifconfig ( 보통 인터페이스 name이 ens33으로 되어 있을 거예요 ) 2. IP가 설정된 파일 위치 sysinfo.tistory.com
[ Linux ] 사설 및 공인 IP 확인 사설 IP 확인 ' hostname -I' 나 'ip addr' 로 사설 IP를 확인한다. duru@ykd2:/sbin$ hostname -I 192.168.219.114 duru@ykd2:/sbin$ ip addr 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: mtu 1500..
[ Linux ] ifconfig ifconfig 명령어 ifconfig명령어를 통해 ip, netmask, broadcast등을 확인할 수 있다. net-tools가 설치되어있어야 명령어를 실행할 수 있으며 net-tools가 설치되지 않은 상태에서 ifconfig명령어를 실행하면 command not found 에러메세지가 출력된다. duru@ykd2:/sbin$ ifconfig Command 'ifconfig' not found, but can be installed with: sudo apt install net-tools duru@ykd2:/sbin$ sudo apt install net-tools Reading package lists... Done Building dependency tree... Done Reading st..
[ Linux ] DNS 확인 리눅스 DNS 확인 /etc/resolv.conf 파일을 확인하면 설정되어있는 nameserver로 지정되어있는 IP를 확인할 수 있다. 복수개로 지정할 수 있으며 첫번째 검색에서 실패할 경우 다음으로 지정되어있는 IP로 검색을 한다. duru@ykd2:/sbin$ cat /etc/resolv.conf # This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8). # Do not edit. # # This file might be symlinked as /etc/resolv.conf. If you're looking at # /etc/resolv.conf and seeing this text, you have foll..
[ Linux ] sudo 권한 주기 sudo 권한주기 'usermod -a -G sudo userid' 를 통해 sudo권한을 줄 수 있다. 아래 duru계정이 sudo그룹에 속해있지 않아 sudo명령 처리가 안되었다가 sudo그룹에 속한 이후 sudo명령이 정상처리됨을 확인할 수 있다. duru@ykd2:/etc/security$ id uid=1001(duru) gid=1001(duru) groups=1001(duru) duru@ykd2:/etc/security$ sudo cat /etc/security/access.conf [sudo] password for duru: duru is not in the sudoers file. This incident will be reported. duru@ykd2:/etc/security$ su t..
[ Linux ] 유저 생성 useradd 명령어 user add명령어를 통해 유저를 생성한다. -m옵션은 홈디렉토리까지 같이 생성해주는 옵션이고, -s는 기본쉘을 설정해주는 옵션이다. 기본쉘을 설정해 주지 않으면 sh가 기본쉘이된다. 유저가 생성되면 password를 지정해줘야 해당계정으로 로그인이 가능하다. test@ykd2:/home/duru$ sudo useradd -m -s /usr/bin/bash happy test@ykd2:/home/duru$ sudo passwd happy New password: Retype new password: passwd: password updated successfully test@ykd2:/home/duru$ su happy Password: happy@ykd2:/home/duru$ i..
[ Linux ] Shell Script 산술연산/조건문 Shell Script 산술연산 / 조건문 (velog.io) Shell Script 산술연산 / 조건문 Shell script if, case 등의 분기문에 대해 알아보자. velog.io
[ Shell Script ] awk 명령어 BEGIN END문 패턴 awk ' BEGIN { actions } /pattern/ { actions } /pattern/ { actions } ………. END { actions } ' filenames Shell변수 awk로 전달 SHELL변수를 awk내부에서 사용하기 위해서는 -v 옵션을 사용하고 -v var=$var로 치환 후 사용한다. pattern을 shell변수를 전달받아 사용시에는 shell변수에도 / /가 필요 없고 pattern사용시에도 / /없이 사용한다. / 앞에 \도 사용하면 안된다. 아래 예의 경우 {2}다음에 /에 대해서 \가 필요하지만 Shell변수 전달시에는 없이 사용한다. # Shell변수 AWK 적용 전 cat tmp_getpost_dynamic.txt |head -n ..