How to restore tmp files in linux
This article mainly introduces how to restore tmp files in linux, which has certain reference value, and friends who need it can refer to it. I hope you all have a lot of success after reading this article. Let's take a look at it together.
The/tmp directory contains mostly temporary files, which are used by different programs to create lock files and temporarily store data. Many of these files are important to currently running programs, and deleting them may cause the system to crash.
On all Linux systems, the contents of the/tmp directory are deleted (purged) at boot time or when the local system shuts down. This is a standard process of system management to reduce the storage space used (usually on disk drives).
IMPORTANT: Don't delete files from/tmp unless you know exactly what you're doing! In a multi-user system, this may delete active files, thereby interrupting the user's activity (through the programs they are using).
What if you accidentally delete the/tmp directory?
In this article, we show you how to restore (recreate) the/tmp directory after deleting it.
Before running the following command, there are a few things to note.
1./ tmp must belong to root user.
2. Set appropriate permissions to allow all users to use this directory (make it public).
$ sudo mkdir /tmp $ sudo chmod 1777 /tmp
Or, run this command.
$ sudo mkdir -m 1777 /tmp
Now run the following command to check permissions on the directory.
$ ls -ld /tmp
Restore deleted/tmp directory in Linux
The permission set here means that everyone (owner, group, and others) can read, write, and access files in the directory, and the t(paste bit) indicates that files can only be deleted by the owner.
Note: Once the/tmp directory shown above has been restored, it is recommended to reboot the system to ensure that all programs are functioning properly.
Thank you for reading this article carefully, hope Xiaobian share linux tmp file how to restore content to help everyone, but also hope that everyone more support, pay attention to industry information channels, encounter problems to find, detailed solutions waiting for you to learn!