본문 바로가기
Etc2025년 10월 20일6분 읽기

개발자를 위한 리눅스 명령어 50선

YS
김영삼
조회 187

개발자 필수 리눅스 명령어

리눅스 CLI는 개발자의 핵심 도구입니다. 서버 관리, 디버깅, 자동화에 필수적인 명령어들을 카테고리별로 정리합니다.

파일/디렉터리 조작

# 1. find — 파일 검색
find /var/log -name "*.log" -mtime -7 -size +10M
find . -type f -name "*.js" -not -path "*/node_modules/*"

# 2. fd — find의 현대적 대안 (빠르고 직관적)
fd "\.tsx$" src/

# 3. tree — 디렉터리 구조 시각화
tree -L 3 -I "node_modules|.git"

# 4. du — 디스크 사용량
du -sh */ | sort -rh | head -20

# 5. ncdu — 인터랙티브 디스크 사용량 분석
ncdu /var

# 6. ln — 심볼릭/하드 링크
ln -sf /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled/

# 7. stat — 파일 상세 정보
stat package.json

텍스트 처리

# 8. grep/rg — 텍스트 검색
grep -rn "TODO" --include="*.ts" src/
rg "console\.log" --type ts

# 9. sed — 텍스트 치환
sed -i 's/localhost:3000/api.example.com/g' .env

# 10. awk — 필드 기반 처리
docker ps | awk '{print $1, $NF}'

# 11. jq — JSON 처리
curl -s https://api.github.com/users/octocat | jq '.name, .public_repos'
cat package.json | jq '.dependencies | keys[]'

# 12. sort + uniq — 정렬과 중복 제거
cat access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head

# 13. wc — 줄/단어/바이트 수
find src -name "*.ts" | xargs wc -l | tail -1

# 14. cut — 필드 추출
echo "2025-10-20T12:30:00" | cut -dT -f1

프로세스 관리

# 15. ps — 프로세스 목록
ps aux | grep node
ps -eo pid,ppid,%cpu,%mem,cmd --sort=-%mem | head

# 16. top/htop — 실시간 모니터링
htop -p $(pgrep -d, node)

# 17. kill/pkill — 프로세스 종료
pkill -f "node server.js"
kill -9 $(lsof -ti:3000)

# 18. lsof — 열린 파일/포트 확인
lsof -i :8080
lsof -p 1234

# 19. nohup/tmux — 백그라운드 실행
nohup node server.js > app.log 2>&1 &
tmux new -s dev

네트워크

# 20. curl — HTTP 요청
curl -X POST http://localhost:3000/api/data \
  -H "Content-Type: application/json" \
  -d '{"name": "test"}' | jq

# 21. ss/netstat — 네트워크 연결
ss -tlnp

# 22. dig/nslookup — DNS 조회
dig example.com +short
dig @8.8.8.8 example.com MX

# 23. nc — 네트워크 디버깅
nc -zv example.com 80 443

# 24. wget — 파일 다운로드
wget -r -np -R "index.html*" https://example.com/files/

# 25. ssh — 원격 접속 + 터널링
ssh -L 5432:localhost:5432 user@dbserver

시스템 관리

# 26. systemctl — 서비스 관리
systemctl status nginx
journalctl -u nginx -f --since "1 hour ago"

# 27. crontab — 스케줄링
crontab -e

# 28. df — 디스크 공간
df -h --type=ext4

# 29. free — 메모리 상태
free -h

# 30. uname — 시스템 정보
uname -a

유용한 조합 패턴

# 대용량 로그에서 에러 분석
zcat /var/log/nginx/access.log.*.gz | \
  awk '$9 >= 500 {print $7}' | sort | uniq -c | sort -rn | head -20

# 변경된 파일만 배포
rsync -avz --files-from=<(git diff --name-only HEAD~1) ./ server:/deploy/

# 프로세스 메모리 사용량 상위 10
ps aux --sort=-%mem | head -11 | awk '{printf "%-8s %-6s %s\n", $1, $4"%", $11}'
  • 전통 도구의 현대적 대안: fd(find), rg(grep), bat(cat), exa(ls)
  • 파이프(|)로 명령어를 연결하여 복잡한 데이터 처리 파이프라인 구성
  • xargs로 명령어 출력을 다른 명령의 인자로 전달
  • 자주 사용하는 패턴은 셸 alias나 함수로 등록하여 생산성 향상

리눅스 명령어 숙달은 개발자의 효율성을 비약적으로 높입니다. 매일 사용하는 명령어부터 하나씩 깊이 파보면 CLI의 강력함을 체감할 수 있습니다.

댓글 0

아직 댓글이 없습니다.
Ctrl+Enter로 등록