What are alternatives to rm?

0369

Here are some alternatives to the rm command for safely deleting files and directories:

  1. trash-cli: This command-line utility moves files to the trash instead of permanently deleting them. You can install it using:

    sudo apt install trash-cli
    

    To delete a file, use:

    trash filename
    
  2. gvfs-trash: Similar to trash-cli, this command is available on systems using GNOME. You can use it like this:

    gvfs-trash filename
    
  3. rm -i: As mentioned earlier, using the -i option with rm prompts for confirmation before deletion:

    rm -i filename
    
  4. find with -delete: This can be used to delete files found by specific criteria, but be cautious as it can also be permanent:

    find . -name "*.tmp" -delete
    

Using these alternatives can help prevent accidental data loss. If you need more information or examples, let me know!

0 Comments

no data
Be the first to share your comment!