Forrest logo
back to the fstrim tool

fstrim:tldr:0503f

fstrim: Display statistics after trimming.
$ sudo fstrim --verbose ${-}
try on your machine

The command sudo fstrim --verbose ${-} is used to perform the "discard" operation on the file system, which tells the underlying storage device that specified blocks of data are no longer in use and can be reclaimed.

Here's a breakdown of each component of the command:

  • sudo: This is a command to execute the subsequent command with administrative privileges. It allows you to run commands as a superuser or another system user.
  • fstrim: This is the main command. It is used to trim file systems, which means reclaiming unused data blocks. The fstrim command is typically used with solid-state drives (SSDs) and other storage devices that support the "discard" operation.
  • --verbose: This flag is used to provide more detailed information about the trimming operation. It displays the progress and status of the command during execution.
  • ${-}: This is a special variable in shell scripting that represents the list of options or flags that were passed to the script itself. In this case, it is used to provide those options to the fstrim command.

In summary, the command sudo fstrim --verbose ${-} is used to run the fstrim command with administrative privileges, enabling the "discard" operation on a file system while providing detailed progress information. The ${-} ensures that any command-line options or flags passed to the script are also sent to the fstrim command.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the fstrim tool