Home > Operation and Maintenance > Linux Operation and Maintenance > How to restore linux tmp files?

How to restore linux tmp files?

藏色散人
Release: 2019-04-25 13:53:50
Original
7602 people have browsed it

The

/tmp directory mainly contains temporarily needed 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 your system to crash.

How to restore linux tmp files?

On all Linux systems, the contents of the /tmp directory are deleted (cleared) at boot time or when the local system is shut down. This is a standard procedure in system administration to reduce the storage space used (usually on a disk drive).

Important Tip: Do not delete files from the /tmp directory unless you know exactly what you are doing! In a multi-user system, this may delete active files, thus interrupting the user activities (through the programs they are using).

What if you accidentally delete the /tmp directory?

In this article, we will introduce how to restore (re-create) the /tmp directory after deleting it.

There are a few things to note before running the command below.

1./tmp must belong to the root user.

2. Set appropriate permissions to allow all users to use this directory (make it public).

$ sudo mkdir /tmp 
$ sudo chmod 1777 /tmp
Copy after login

Alternatively, run this command.

$ sudo mkdir -m 1777 /tmp
Copy after login

Now run the following command to check the permissions of the directory.

$ ls -ld /tmp
Copy after login

How to restore linux tmp files?

Recover deleted /tmp directory in Linux

The permission set here means that everyone (owner, group and others) Files in the directory can be read, written, and accessed, and the t (sticky bit) indicates that the file can only be deleted by the owner.

Note: Once the /tmp directory shown above is restored, it is recommended to restart the system to ensure that all programs can run normally.

The above is the detailed content of How to restore linux tmp files?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template