Skip to content

What is sdel Linux command?

The sdel command in Linux is used to securely delete files and directories by overwriting them multiple times to prevent data recovery. It helps protect sensitive information from being accessed by unauthorized users.

sdel Syntax:

Terminal window
sdel [options] [file/directory]

sdel Options:

OptionDescription
-rRecursively delete
-fForce delete (no prompts)
-vVerbose mode (show details)
-hHelp (display usage information)

Parameters:

ParameterDescription
file/directoryThe file or directory to be deleted.

sdel Command Usage Examples:

Delete a Single File

Terminal window
sdel file.txt

Deletes the file named “file.txt”.

Purge a Directory Recursively

Terminal window
sdel -r directory

Removes all files and subdirectories in the specified directory recursively.

Delete Multiple Files

Terminal window
sdel file1.txt file2.txt file3.txt

Deletes multiple files named “file1.txt”, “file2.txt”, and “file3.txt”.

Securely Delete a File

Terminal window
sdel -s confidential.txt

Overwrites the content of the file “confidential.txt” before deleting it, making it unrecoverable.

Empty Trash Can

Terminal window
sdel -t

Permanently deletes all files in the trash can, instead of moving them to the trash directory.

How do I use sdel in Linux?

To use the sdel command in bash, execute the following command:

Terminal window
sdel --option <value>

What are the available options with the sdel command?

The sdel command in Linux offers various options for secure file deletion. You can explore these options by typing:

Terminal window
sdel --help

How can I securely delete a specific file using sdel?

To securely delete a specific file with sdel, use the following command format:

Terminal window
sdel --file <filename>

Can I use sdel to delete multiple files at once?

Yes, you can delete multiple files at once using sdel in Linux by providing a list of filenames as arguments. Here is an example:

Terminal window
sdel --file file1.txt file2.txt file3.txt

How can I securely delete a directory with sdel?

To securely delete a directory and its contents with sdel, use the following command format:

Terminal window
sdel --dir <directory_path>

Is there a way to verify the secure deletion process with sdel?

You can enable the verification option to confirm the secure deletion process with sdel. Include the --verify flag in your command like this:

Terminal window
sdel --file <filename> --verify

How do I change the number of overwrites for secure deletion in sdel?

To set a specific number of overwrites for secure deletion in sdel, you can use the --repeats option followed by the desired number. Here is an example:

Terminal window
sdel --file <filename> --repeats 10

Can I force the deletion of files without any confirmation using sdel?

If you want to force the deletion of files without any confirmation prompts, you can use the --force option in your sdel command. For example:

Terminal window
sdel --file <filename> --force

Applications of the sdel command

  • Securely delete files or directories
  • Shred sensitive information before disk disposal or sharing
  • Ensure that deleted data cannot be recovered through file recovery tools