• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / Ubuntu / Restore Deleted tmp Folder in Linux Ubuntu

Restore Deleted tmp Folder in Linux Ubuntu

By Sourabh / July 25, 2017 Category: How To, Ubuntu

How to restore deleted tmp folder in Linux Ubuntu. On Linux, recover tmp files using the following method.

/tmp directory contains mostly files that are required temporarily. Many programs use this to create lock files and for temporary storage of data. Do not remove files from this directory unless you know exactly what you are doing! Many of these files are important for currently running programs and deleting them may result in a system crash. Usually it won’t contain more than a few KB anyway. On most systems, this directory is cleared out at boot or at shutdown by the local system. The basis for this was historical precedent and common practice. However, it was not made a requirement because system administration is not within the scope of the FSSTND. For this reason people and programs must not assume that any files or directories in /tmp are preserved between invocations of the program.

Please note that the /var/tmp folder is different from the /tmp directory. The /var/tmp contains the temporary files preserved between system reboots. It is made available for programs and applications which require temporary files or directories preserved between system reboots.

Restore /tmp Directory

All the contains of the /tmp directory, files and directories must not be deleted. /tmp can be recreated. All you have to do is to give it to root (chown root:root /tmp) and permissions set to 1777. This will allow everyone to use the directory. The permission 1777 is eual to rwxrwxrwt. Which means anyone can read, write and access files in the said directory. Also note the letter t which ensures that the contenet can only be deleted by the owner.

To restore the deleted /tmp directory, run the following command:

$ sudo mkdir /tmp
$ sudo chmod 1777 /tmp

or

$ sudo mkdir /tmp && sudo chmod 1777 /tmp

Make a note that while performing the said operation, /tmp must have root privileges. I would also recommend to reboot the system.

Tags: /Tmp Directory Mac, Centos Recover Deleted Files, Centos Tmp Directory, Deleted Tmp Folder Linux, How To Clean Tmp Directory In Linux, Linux /Tmp Full, Linux Recover Deleted Files, Linux Tmp Directory Cleanup, Linux Tmp Directory Environment Variable, Linux Tmp Directory Permissions, Linux Tmp Directory Size, Tmp Directory Windows, Tmp Folder Linux Server, Tmp Folder Windows 10, Tmptime, Ubuntu Temp Directory

Primary Sidebar

Latest Posts

Delete Directory And Contents Recursively Without Prompt On Linux

Check User Login History In Ubuntu Linux Command Line

Use Locate Command To Find File In Linux Terminal By Name

How To Change Terminal Color In Ubuntu Command Line

How To Run Fsck Manually In Linux To Fix Unexpected Inconsistency

How To Fix Broken Packages On Ubuntu From Terminal

Re Execute The Previous Command In Linux Ubuntu Command Line

How Much RAM Is Needed For Ubuntu PC

How To Find Large Files And Directories In Linux Command Line

How To Use Clear Command History In Linux Terminal

© 2026 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap