How to use the command trashy (with examples)

How to use the command trashy (with examples)

Trashy is an alternative to rm and trash-cli written in Rust. It provides a convenient way to move files to the trash and manage the trash in a more user-friendly manner.

Use case 1: Move a specific file to the trash

Code:

trash path/to/file

Motivation: When you want to remove a file from your system, but still want the option to recover it later, you can use the trash command to move the file to the trash instead of permanently deleting it.

Explanation:

  • trash: The command to move a file to the trash.
  • path/to/file: The path to the specific file you want to move to the trash.

Example output: The file “path/to/file” is moved to the trash.

Use case 2: Move specific files to the trash

Code:

trash path/to/file1 path/to/file2 ...

Motivation: Sometimes you want to delete multiple files at once. With the trash command, you can specify multiple file paths and move all of them to the trash in a single command.

Explanation:

  • trash: The command to move files to the trash.
  • path/to/file1 path/to/file2 ...: The paths to the specific files you want to move to the trash. Separate each file path with a space.

Example output: The files “path/to/file1” and “path/to/file2” are moved to the trash.

Use case 3: List items in the trash

Code:

trash list

Motivation: When you have multiple files in the trash and want to see a list of all the items, you can use the trash list command to view them.

Explanation:

  • trash: The command to list items in the trash.
  • list: An argument that specifies the action to list items in the trash.

Example output:

  • File 1
  • File 2
  • File 3

Use case 4: Restore a specific file from the trash

Code:

trash restore file

Motivation: If you accidentally moved a file to the trash and want to restore it back to its original location, you can use the trash restore command followed by the file name to recover the file.

Explanation:

  • trash: The command to restore a file from the trash.
  • restore: An argument that specifies the action to restore a file from the trash.
  • file: The name of the specific file you want to restore.

Example output: The file “file” is restored from the trash.

Use case 5: Remove a specific file from the trash

Code:

trash empty file

Motivation: When you no longer need a file in the trash and want to permanently delete it, you can use the trash empty command followed by the file name to remove the file from the trash.

Explanation:

  • trash: The command to remove a file from the trash.
  • empty: An argument that specifies the action to remove a file from the trash.
  • file: The name of the specific file you want to remove.

Example output: The file “file” is permanently deleted from the trash.

Use case 6: Restore all files from the trash

Code:

trash restore --all

Motivation: If you want to restore all files from the trash at once, you can use the trash restore --all command to recover all files back to their original locations.

Explanation:

  • trash: The command to restore files from the trash.
  • restore: An argument that specifies the action to restore files from the trash.
  • --all: A flag that specifies to restore all files in the trash.

Example output: All files in the trash are restored.

Use case 7: Remove all files from the trash

Code:

trash empty --all

Motivation: When you want to permanently delete all files in the trash, you can use the trash empty --all command to empty the trash.

Explanation:

  • trash: The command to remove files from the trash.
  • empty: An argument that specifies the action to remove files from the trash.
  • --all: A flag that specifies to empty all files in the trash.

Example output: All files in the trash are permanently deleted.

Related Posts

Managing GitLab CLI Command Aliases (with examples)

Managing GitLab CLI Command Aliases (with examples)

GitLab CLI (glab) provides a command called alias that allows you to manage command aliases.

Read More
How to use the command 'vboxmanage-startvm' (with examples)

How to use the command 'vboxmanage-startvm' (with examples)

The vboxmanage-startvm command is used to start a virtual machine in Oracle VM VirtualBox.

Read More
How to use the command 'networkQuality' (with examples)

How to use the command 'networkQuality' (with examples)

This article provides a detailed guide on how to use the ’networkQuality’ command in various use cases.

Read More