Delete files in /tmp directory in Centos?

Paul Wellner Bou

Well-known member
Registered
Joined
Apr 20, 2016
Messages
95
Points
6
I saw this folder tmp on my Centos when checking with winscp, I think it is containing temporary files on my hosting. Can I delete files in this /tmp directory without any problems? it is possible to tell CentOS to delete /tmp folder automatically at shutdown VPS?
 

LJSHost

Well-known member
Hosting Provider
Registered
Joined
Jul 5, 2016
Messages
1,031
Points
63
They are temp files which you can remove at anytime.

Their are multiple ways of clearing this directory at shutdown, I would suggest creating your own shutdown script which includes removing files from /tmp/

Clear /tmp/* and reboot

Code:
#!/bin/bash
rm -r /tmp/*
shutdown -r now

Clear /tmp/* and shutdown

Code:
#!/bin/bash
rm -r /tmp/*
shutdown -h now
just pick the one you want create the script as root and chmod +x to make it executable. You can call the script whatever you want for example shutdownclear or rebootclear.
 
Newer Threads
Replies
42
Views
35,806
Replies
5
Views
3,962
Replies
9
Views
4,932
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top