# rm-safely - 안전하게 ‘rm’ 하세요

> Clean Markdown view of GeekNews topic #23635. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=23635](https://news.hada.io/topic?id=23635)
- GeekNews Markdown: [https://news.hada.io/topic/23635.md](https://news.hada.io/topic/23635.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2025-10-14T09:31:02+09:00
- Updated: 2025-10-14T09:31:02+09:00
- Original source: [github.com/zdk](https://github.com/zdk/rm-safely)
- Points: 15
- Comments: 2

## Summary

macOS 환경에서 **중요 파일 삭제 사고**를 방지할 수 있도록, 기존 `rm` 명령어를 **휴지통(Trash)으로 이동하는 셸 스크립트**로 안전하게 대체합니다. 별도의 의존성 없이 **순수 셸 스크립트**로 구현되어 간편하게 적용할 수 있으며, 완전 삭제나 휴지통 관리 기능도 함께 제공합니다.

## Topic Body

- macOS의 기본 `rm` 명령어를 **안전하게 감싸는 셸 별칭(alias)** 으로, 실수로 중요한 파일을 삭제하는 상황을 방지  
- 기본 `rm` 대신 파일을 **휴지통(Trash)** 으로 이동시키는 방식으로 별도 의존성 없이 **순수 셸 스크립트로 작성**됨  
- 완전 삭제를 원할 경우 `rm --rm` 또는 `/bin/rm`을 직접 호출하면 됨  
- **추가 명령어** 제공  
  - `rm --list-trash`: 휴지통 내용 목록 확인  
  - `rm --empty-trash`: 휴지통 비우기  
  - `rm --show-trash-path`: 휴지통 경로 표시  
- 삭제 된 파일은 **`~/.local/share/Trash` 또는 `/.Trash-$(id -u)`** 에 보관되며, 재부팅 후에도 안전하게 복원 가능함  
- **curl로 간단히 설치가능**  
  ```bash  
  curl -fsSL https://raw.githubusercontent.com/zdk/rm-safely/main/rm-safely | bash -s install  
  ```

## Comments



### Comment 44971

- Author: shakespeares
- Created: 2025-10-14T18:56:57+09:00
- Points: 1

윈도우에서는 안되는 것 같네요. ㅠㅠ

### Comment 44940

- Author: wicksome
- Created: 2025-10-14T09:44:48+09:00
- Points: 2

누구나 비슷한 생각을 하는 것 같네요.  
https://github.com/wicksome/trash-cli
