1 방법[ | ]
1.1 명령어[ | ]
Bash
Copy
top -n 1 | grep -i cpu\(s\)| awk '{print $5}'
1.2 실행 예시[ | ]
Console
Copy
[root@localhost ~]# top -n 1 | grep -i cpu\(s\)| awk '{print $5}'
98.7%id,
→ CPU 유휴율은 98.7%이다.
2 변수에 담기[ | ]
2.1 명령어[ | ]
Console
Copy
PIDLE=`top -n 1 | grep -i cpu\(s\)| awk '{print $5}' | tr -d "%id,"`
2.2 실행 예시[ | ]
Console
Copy
[root@localhost ~]# PIDLE=`top -n 1 | grep -i cpu\(s\)| awk '{print $5}' | tr -d "%id,"`
[root@localhost ~]# echo $PIDLE
98.7
3 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.