server

[CentOS] 종합

명품_체인지업 2021. 6. 30. 09:47

1. 용량확인

    현재 디렉토리 : df -h   또는  df . -h 

    서브 디렉토리 포함 :  du -h

2. 버전확인

    cat /etc/*release*

    cat /proc/version

3. 날짜바꾸기

    date  :  2021. 03. 25. (금) 17:54:47 KST
    KST 가 아닌경우 :  tzselect      => 5.Asia  >  23. Korea(South)  >  1.Yes

[root@zetawiki ~]# ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
[root@zetawiki ~]# rdate -s time.nist.gov
[root@zetawiki ~]# hwclock --systohc
[root@zetawiki ~]# date
[root@zetawiki ~]# hwclock

4. 자주사용하는 명령어

man : 명령어의 메뉴얼을 볼 수있는 명령어
pwd : 현재 경로 출력
ls : 현재 위치의 파일 표시
mkdir : 폴더 생성   mkdir stuff
touch : 파일 생성   touch the_stuff.txt
cp [src] [dst]: 파일 복사  cp the_stuff.txt other_stuff.txt
rm : 파일삭제 또는 폴더삭제   rm other_stuff.txt  ※ -r : 폴더내부의 모든파일을 삭제하고 폴더까지 삭제
     폴더 강제삭제 : rm 최상위폴더 -rf 

find : 파일 검색  find . -name eagle.txt / find . -empty
cat [filename]: 파일내용 전체출력
grep [needle] [filename] : 파일내용 검색   grep "carlos" workers.csv -i

5. ip   

ip addr show

5. 포트확인(port)

netstat -tnlp
lsof -i -nP | grep LISTEN | awk '{print $(NF-1)" "$1}' | sort -u
nmap localhost

포트는 아래와 같이 열면 된다.
firewall-cmd --permanent --zone=public --add-port=8080/tcp

firewall-cmd --reload

열린 포트는 아래 명령어로 확인 할 수 있다.
firewall-cmd --zone=public --list-all