Home » Questions » Computers [ Ask a new question ]

How do I delete a file using the Terminal from my Trash in Mac OS X?

How do I delete a file using the Terminal from my Trash in Mac OS X?

From a previous question I have applied following command to my file.

Asked by: Guest | Views: 65
Total answers/comments: 2
Guest [Entry]

"sudo executes a command as another user. By default (as in this case) the user is the superuser root, which can do almost anything. The trash is located in ~/.Trash. You can delete the entire trash by running:

rm -rf ~/.Trash/*"
Guest [Entry]

"You can force the removal by holding down the Option key while emptying the trash.

sudo allows you to run commands as another user. If no user is specified, root is used.

chflags changes file or folder ""flags"". The -R switch makes the command recursive, i.e. it will apply to all files in all subfolders. uchg makes the file immutable, nouchg clears the immutable flag.

chmod changes a file or folder's permissions. 444 is the octal permissions bitmask of a file that is read-only by everybody, including the owner. See this question for an explanation of octal masks and chmod.

Typing man 'command name' in a terminal will give you a complete description of all these commands."