[Linux] Useful Linux Commands
Published:
In this post, useful linux commands are introduced.
Useful Commands
process
특정 포트에서 실행 중인 프로스세를 보고 싶을 때
sudo lsof -i :80 # 80번 포트에서 실행중인 프로세스 보여줌lsof는 LiSt Open Files의 약자로 macOS / Linux에서 열린 파일을 모두 보여주는 명령어이다.
여기서
-i는 Internet/network sockets 정보만 보여달라는 의미이다.특정 PID의 프로세스가 무엇인지 확인하고 싶을 때
ps aux | grep 5667 #ps aux 는 현재 실행 중인 모든 프로세스의 정보를 자세히 보여주는 명령어이다.
여기서
a는 “all users”로 현재 사용자 외에 모든 사용자의 프로세스를 보여준다.여기서
u는 “user-oriented format”으로 USER, CPU 사용률, 메모리 사용률 등을 포함한 자세한 정보를 출력한다.여기서
x는 “processes without controlling terminal”로, 터미널에 붙어 있지 않은 프로세스(서비스, 백그라운드 데몬 등)도 출력한다.
nginx
nginx 실행-재시작/종료
sudo nginx -c /opt/homebrew/etc/nginx/nginx.conf # 실행 sudo nginx -s quit

Leave a Comment