Linux Tmp System Directory – Ls (List Directory) Command Examples – Quick Tips


The Linux tmp directory

The tmp directory, below the / directory, is used to hold "temporary files", such as those created by Linux application software programs and other programs.

Many programs automatically create temporary files when they are run and these files are commonly created in / tmp.

These files are intended to exist only temporarily, for as long as the application is running. They are used by programs for their own internal purposes.

When you exit out of a program that has created "temporary" files, these files should automatically be deleted by the application (software program) that created them.

However, if an application is running and it creates temporary files in / tmp and the power goes off, or the system hangs, then it does not have the opportunity to "properly" exit and delete these files.

Linux Commands Training Tips: By default, users can create files in / tmp. You may find that users start keeping files in this directory if they are restricted in the disk space that is available to them.

It is recommended that you notify users that they should not create files in this directory and any files that are created in there will not be "backed up" (to some kind of external storage) and that they will be deleted.

With many Linux distributions, the files created in / tmp are automatically deleted after a period of time (if they have not been accessed or updated).

Now view the directories and files in the tmp directory.

$ ls / tmp

The output may show many files and directories or very few. The contents will vary broadly depending on your Linux distribution and the software programs that are being run.

The Linux tmp directory and command examples shown here apply to ALL Linux distributions, including Ubuntu, Kubuntu, Debian, SUSE, openSUSE, Fedora, Red Hat and Slackware Linux.


Leave a Reply