• 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

Free AI Courses With Certificate For Beginners In India

Best AI Plugins For WordPress To Use In 2026

3 Commands To Check USB Connection In Linux Terminal

Linux Terminal Commands for Beginners With Examples

How To Password Protect A Folder In Linux Command Line

Best Download Managers for Ubuntu Linux (2026 Edition)

5 Best Free Keyword Research Tools for Bloggers in 2026

How To Check Linux 32 or 64-Bit Command Line

How To Delete And Remove Repository In Ubuntu Terminal

Fix Unexpected Inconsistency By Running Fsck Manually From Initramfs

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

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