Easy Tutorial
❮ Linux Shell Include File Linux Comm Modinfo ❯

Linux tmpwatch Command

Linux Command Manual

The Linux tmpwatch command is used to remove temporary files.

Executing the tmpwatch command can delete unnecessary temporary files. You can set the file expiration time in hours.

Syntax

tmpwatch [-afqv][--test][expiration time][directories...]

Parameters:

Example

To remove files in the "/tmp" directory that have not been used for more than one day using the "tmpwatch" command, enter the following command:

$ tmpwatch 24 /tmp/ # Remove files in /tmp directory not used for more than one day

After executing the above command, the result is as follows:

removing directctmp/orbit-tom if not empty

Note: This command requires root privileges. Therefore, you should switch to the root user using the su command before using the tmpwatch command. The switch to root user operation is as follows:

$ su                                # Switch to root user
Password: **********                # Enter user password

Linux Command Manual

❮ Linux Shell Include File Linux Comm Modinfo ❯