#TIL #unix 파일 크기가 알고 싶을 때

$ du -h ~/.emacs.d/init.el
8.0K    /Users/ohyecloudy/.emacs.d/init.el

$ du -h ~/.emacs.d/init.el | cut -f1
8.0K

du(disk usage) 명령어를 사용하면 된다. 파일 크기와 path를 같이 보여주는데, cut 명령어로 파일 크기만 볼 수도 있다.

참고 - How can I get the size of a file in a bash script? - unix.stackexchange.com

Feedback plz <3 @ohyecloudy, ohyecloudy@gmail.com

A Random Post