Some operating systems provide native support for TRIM. For example, the BSD "fstrim" utility (complemented by "fstrim -v" and "fstrim /" in most modern Linux distributions) can be used to instruct the operating system to perform TRIM operations on files which do not already have TRIM support, or to reclaim TRIM support from files which already have it. TRIM is available on a file-by-file basis (not a block-by-block basis), and is not available for directories and network shares.
Where the operating system supports TRIM, it first writes commands into a special area of the user's prescribed area of the drive, called the Magic Area, and then writes the required trimming offets to the actual space the user requested. Users may need to make adjustments to their disk partitions and user allocation area to ensure the allocated space is contiguous.
When a file is deleted, the data is written to a new location with all the required properties of a regular block of flash memory (that is, all fakesectors are zeroed out, and the block's offset is updated), but if the deletion occurs while the block is free, then the data will be erased. This causes less wear and tear on the SSD, but requires the operating system to trim that block rather than write a zero-length block to re-use it. The minimum amount of trimming required for a file to be considered deleted or "wiped" in user-space is set by the real-time monitoring process, and is made available to applications via the CONFIG.TRIM_DELETE flag in the filesystem partition.
The following command will delete the file /Users/testTrim. The -u flag forces TRIM to run immediately, no later than the next reboot. The -r flag deletes all blocks once no valid data is found, forcing it to trim the device. But if data is found to still be valid, it will not be written to disk. d2c66b5586