To clear the /tmp directory manually, you can use the following commands in the terminal. Make sure you have the necessary permissions to delete files in this directory.
-
Open a terminal.
-
Use the
rmcommand to remove files and directories. Here are a few examples:-
To remove all files in
/tmp:sudo rm -rf /tmp/* -
To remove files older than a certain number of days (e.g., 7 days):
sudo find /tmp -type f -mtime +7 -exec rm {} \; -
To remove empty directories in
/tmp:sudo find /tmp -type d -empty -exec rmdir {} \;
-
-
Verify the contents of
/tmpafter clearing:ls -la /tmp
Note: Be cautious when using the rm -rf command, as it will permanently delete files without confirmation. Always double-check the command before executing it.
