본문 바로가기

Program

CentOS 기본명령어

반응형

CentOS 7 자주 사용되는 명령어 모음

 그룹

기능

명령어 

 

계정관련

 계정 리스트 확인

 cat /etc/passwd


 계정 추가

 useradd newUser

 passwd newUser

 (비밀번호 입력)


 계정 제거

 userdel -f newUser

 -f를 입력해야 계정으로 인한 home디렉토리 및에 계정명 디렉토리와 var/mail 의 계정파일이 같이 제거된다.


 그룹 정보 확인

 groups userName

 계정 그룹 변경

 usermod -g groupName userName

 파일권한 관리

 권한 변경
 읽기(4)|쓰기(2)|실행(1)

 chmod 755 fileName

 

파일 관리

 파일 삭제

 rm fileName

 rm -f fileName  (최종확인 경고없이 삭제)


 디렉토리 삭제

 rm -r dirName

 rm -r -f dirName (최종확인 경고없이 삭제)


 디렉토리 생성

 mkdir newDirName

 디렉토리 이름변경

 mv oldDirName newDirName

 

서비스 관리

 새로운 서비스 리로드

 systemctl daemon-reload

 서비스들 실행상태 확인

 systemctl list-unit-files

 서비스 자동시작

 systemctl enable 서비스명

 서비스 자동시작 취소

 systemctl disable 서비스명

 서비스 시작

 systemctl start 서비스명

 서비스 중지

 systemctl stop 서비스명

 서비스 재시작

 systemctl restart 서비스명

 서비스 상태

 systemctl status 서비스명

 

디스크 관리

 남은 용량 확인

 df

 남은용량을 KB 단위로 확인

 df -k

 남은용량을 MB 단위로 확인

 df -m

 남은용량을 보기좋게 표시

 df -h

 시스템 관리

 시스템 종료

 shutdown


 재부팅

 reboot

 시간 관리

현재 시간 확인

 timedatectl


 수동 시간 설정

 timedatectl set-time '2017-10-23 32:11:43'

시간 동기화 사용

 timedatectl set-ntp true

 네트워크 관리

 IP 정보 확인

 hostname -I


 기타

  OS 설치 후 yum 명령어 실행시 에러가 발생 할 경우


/etc/resolv.conf 파일을 열어 nameserver 정보가 입력되어 있는지 확인한다.

# Generated by NetworkManager

nameserver 168.126.63.1











반응형

'Program' 카테고리의 다른 글

ElasticSearch 쿼리  (0) 2018.06.18
CentOS7에 ElasticSearch 설치하기  (0) 2018.06.05
CentOS7 Service 만들기  (0) 2018.05.11
CentOS7 실행중인 프로세스 확인/종료  (0) 2018.05.07
Python logging 사용하기  (1) 2018.05.07