Site TIPS PAGE🔎 SEARCH  Ξ INDEX  MAIN MENU  UP ONE LEVEL
 OJB's Web Site. Version 2.1. Mac Tip.You are here: tip tips mac owen2 
Tip

Up to OJB's Mac Tips List

Terminal Tips: Deleting Files

There are some situations when deleting files using the command line is preferable to deleting them in the Finder. For example, the command line can delete files which are protected because of their ownership and it can also delete files securely, so they cannot be recovered.

CAUTION: Do I need to mention that using the delete command can lead to files being deleted?

The command to delete files in Unix is "rm" (remove). To use it, just navigate to the directory (folder) containing the file(s) to delete and type "rm filename", where filename is the name of the file to delete. You can delete multiple files using a "wildcard" in the filename, for example rm file* will remove all files starting with "file". Use rm * to remove everything in the current folder (be careful, OK?).

Theoretically, files which have been deleted can be recovered using the correct software (file recovery or "undelete" programs). If you have sensitive data you really want to delete, use the "rm -P filename" command. Remember, the idea of this is to make the file unrecoverable so don't use it on useful files!

If the files you want to delete are not owned by you they can still be deleted using the "sudo" command with "rm", like this: "sudo rm filename", then supply the admin password.



I usually write a blog post about once a week. The latest post can be viewed here: But is it Science?: Ask yourself this: is it really science? (posted 2024-10-04 at 12:30:35).
Warning: mysqli_connect(): MySQL server has gone away in /Library/WebServer/Documents/Owen2/Inc/Footer.inc.php on line 59

Warning: mysqli_connect(): Error while reading greeting packet. PID=27702 in /Library/WebServer/Documents/Owen2/Inc/Footer.inc.php on line 59

Warning: mysqli_connect(): (HY000/2006): MySQL server has gone away in /Library/WebServer/Documents/Owen2/Inc/Footer.inc.php on line 59

Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /Library/WebServer/Documents/Owen2/Inc/Footer.inc.php on line 60
Could not connect to MySQL: