Skip to content

srm MacOS command

The MacOS srm command is a powerful tool that allows users to securely delete files from their system. This command is designed to completely erase the contents of a file, making it unrecoverable by traditional means. By overwriting the file multiple times with random data, srm ensures that the original data cannot be recovered, even with advanced data recovery tools. This makes srm an ideal solution for securely deleting sensitive information, such as personal documents, financial records, or other confidential data. With the srm command, users can have peace of mind knowing that their data has been safely and permanently removed from their system.

Terminal window
srm [options] [files/directories]
OptionDescription
-sRecursively delete files/directories in the specified location.
-zOverwrite before deletion with zeros.
-fForce deletion without prompting for confirmation.
-llToggle low-level format.
-vVerbose mode, show progress.
ParameterDescription
files/directoriesSpecify the files or directories to delete.
Terminal window
srm important_file.txt

Permanently removes the file “important_file.txt” from the system securely.

Terminal window
srm -s -z 3 sensitive_data.xls

Overwrites the contents of “sensitive_data.xls” three times with zeros before securely removing it from the system.

Terminal window
srm -r confidential_folder

Securely removes the directory “confidential_folder” along with all its contents.

Terminal window
srm file1.txt file2.doc file3.pdf

Securely removes multiple files - “file1.txt”, “file2.doc”, and “file3.pdf” from the system.

Terminal window
srm -d /custom/path/secret_file.txt

Securely removes the file “secret_file.txt” from the specified custom path “/custom/path/”.

Terminal window
srm -v important_doc.pdf

Displays detailed progress information while securely removing the file “important_doc.pdf”.

To use the srm command in MacOS, execute the following command:

Terminal window
srm --option <value>

What is the purpose of the srm command in MacOS?

Section titled “What is the purpose of the srm command in MacOS?”

The srm command in MacOS securely deletes files and directories by overwriting the data multiple times to prevent any chance of recovery.

Terminal window
srm -r /path/to/directory

How can I permanently delete a file using the srm command in MacOS?

Section titled “How can I permanently delete a file using the srm command in MacOS?”

To permanently delete a file with the srm command in MacOS, use the following command:

Terminal window
srm file.txt

How do I force the deletion of files with the srm command in MacOS?

Section titled “How do I force the deletion of files with the srm command in MacOS?”

To force the deletion of files with the srm command in MacOS, add the -f flag to the command.

Terminal window
srm -f file.txt

How can I delete a directory and its contents with the srm command in MacOS?

Section titled “How can I delete a directory and its contents with the srm command in MacOS?”

To delete a directory and all its contents securely using the srm command in MacOS, use the -r flag.

Terminal window
srm -r /path/to/directory

Can I use wildcards with the srm command in MacOS to delete multiple files?

Section titled “Can I use wildcards with the srm command in MacOS to delete multiple files?”

Yes, you can use wildcards with the srm command in MacOS to delete multiple files at once.

Terminal window
srm *.txt

How do I securely delete a file and display verbose output with the srm command in MacOS?

Section titled “How do I securely delete a file and display verbose output with the srm command in MacOS?”

To securely delete a file with verbose output using the srm command in MacOS, use the -v flag.

Terminal window
srm -v file.txt
  • Securely delete files and directories
  • Overwrite the content of files before deletion
  • Remove sensitive information from storage devices
  • Erase data securely before selling or disposing of storage devices