rm deletes files:
text
learner@tidepool:~/shop$ rm draft.txt
learner@tidepool:~/shop$ rm monday.txt tuesday.txtThere is no trash
On a desktop, a deleted file goes to the trash. In the shell, it does not. When rm deletes a file, the file is gone.
Errors
| Error | Meaning |
|---|---|
rm: cannot remove 'draft.txt': No such file or directory | There is no file with that name |
rm: cannot remove 'orders': Is a directory | The item is a directory. Plain rm deletes only files |
rmdir: delete an empty directory
rmdir deletes a directory, but only when it is empty:
text
learner@tidepool:~/shop$ rmdir empty-box
learner@tidepool:~/shop$ rmdir orders
rmdir: failed to remove 'orders': Directory not emptyThe error protects you. You cannot delete files by mistake with rmdir.