레이블이 cmd인 게시물을 표시합니다. 모든 게시물 표시
레이블이 cmd인 게시물을 표시합니다. 모든 게시물 표시

CMD - free 명령어를 이용한 메모리 사용률 확인 방법

메모리 사용률 확인

사용 환경에서 필요한 내용만 정리.

시스템 환경

OS : CentOS 7 3.10.0-957.el7.x86_64

실행 명령어

centos 6.x 버전 밑 버전에서 메모리 읽는 방식이 7에서 부터는 변경이 되었다.
(-/+ buffers/cache 부분이 사라졌다.)

메모리 사용량 (%) = 메모리used/(메모리used+메모리free)*100

  • 사용 예시
[root@localhost sw]# free -m
              total        used        free      shared  buff/cache   available
Mem:           7803         892        4686         263        2224        6277
Swap:          8064           0        8064

메모리 사용률 계산
$$Memusage=\frac{used}{total}*100
$$

sar -r 1 명령어를 통해서도 사용률 확인 가능 (%memused) 확인

  • 초 단위로 버퍼 캐쉬 영역 분리 해서 메모리 확인
[root@localhost sw]# free -mw -s 1
              total        used        free      shared     buffers       cache   available
Mem:           7803         900        4627         308           2        2273        6224
Swap:          8064           0        8064

              total        used        free      shared     buffers       cache   available
Mem:           7803         900        4627         308           2        2273        6224
Swap:          8064           0        8064

Parameters

Parameters
total 총 메모리 크기
used 사용중인 메모리 (free-buff/cache)
free 여유 메모리 (used-buff/cache)
shared tmpfs, ramfs등에 사용되는 공유 메모리
buffer/cache 커널 버퍼 / 페이지 캐시 slab 메모리
available swapping 없이 new ps에 할당 가능한 메모리 예상 크기

CMD - which, readlink 명령어를 활용법

리눅스에 설치 된 JAVA 경로 확인 방법

사용 환경에서 필요한 내용만 정리.

시스템 환경

OS : CentOS 7 3.10.0-957.el7.x86_64

실행 명령어

사용 명령어 which, readlink

  • which : 명령어의 경로를 확인하는 명령어
  • readlink : 심볼릭 링크의 원본 위치를 찾는 명령어 (-f : 최종 파일의 절대경로)

ll 명령어를 통해 찾아도 되지만, 심볼릭 링크가 여러번 사용되어 있는 경우 readlink 명령어로 찾는게 편함.

#which 
[wasadm@localhost sw]$ which java
/usr/bin/java

#readlink
[wasadm@localhost sw]$ readlink -f /usr/bin/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/jre/bin/java

#ll
[wasadm@localhost sw]$ ll /usr/bin/java
lrwxrwxrwx. 1 root root 22 Feb  5 01:36 /usr/bin/java -> /etc/alternatives/java
[wasadm@localhost sw]$ ll /etc/alternatives/java
lrwxrwxrwx. 1 root root 71 Feb  5 01:36 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/jre/bin/java

CMD - chmod 명령어로 파일 및 경로 권한 부여 방법

파일 및 경로 권한 부여 방법

사용 환경에서 필요한 내용만 정리.

시스템 환경

OS : CentOS 7 3.10.0-957.el7.x86_64

사용 방법

Change the mode of each FILE to MODE.

주의 할 점으로 chmod 의 경우 현재 상태의 권한을 변경.

  • Permission Change
    • 주로 사용 하는 예시
[wasadm@localhost sw]$ chmod -R 700 ./was
[wasadm@localhost sw]$ chmod -R 700 ./web
[wasadm@localhost sw]$ chmod -R 755 ./bin
[wasadm@localhost sw]$ chmod -R 777 ./img

하위 디렉토리 속성 까지 변경

-R, --recursive change files and directories recursively

Permission

Permission

Options

Permission

There are two ways to modify permissions, with numbers or with letters.

  1. 문자열 모드
Parameters
u User (the owner of the file) 소유자
g group (any member of the file's defined group) 그룹
o Other (anyone else) 기타 사용자
a All (equivalent to ugo) ugo 전체 사용자
+ add permission
- remove permission
= set permission
  1. 숫자 모드 (많이 사용하는 모드)
Parameters symbol Permission
1 --- No Permission
2 --x Execute
3 -w- Write
4 -wx Write and Execute
5 r-- Read
6 rw- Read and Exceute
7 rwx all

이 블로그 검색

Popular Posts

WEB&&WAS

OS

Reviews