How to Access Tmp Folder in Linux
The easiest way to access tmp folder in linux is to open a terminal and run cd /tmp, or to open your file manager and enter /tmp in the location bar. The /tmp directory is the standard place for temporary files on most Linux systems, and it is usually readable and writable by regular users, though some files inside it may still require elevated permissions.
What is the /tmp folder in Linux?
/tmp is a system directory used for temporary files. Applications and users may store short-lived data there, such as install files, caches, lock files, or working files that are only needed briefly. Many Linux systems clean up /tmp automatically, either at reboot or after files have not been used for a while, depending on the distribution and system settings.
Because /tmp is part of the root filesystem, it is not a special hidden folder. It sits at the top level of the directory tree, so its full path is simply /tmp.
How to open /tmp in the terminal
If you use the command line, access is straightforward. These commands are usually all you need:
- Open your terminal.
- Type cd /tmp and press Enter.
- Confirm your location with pwd.
- List the contents with ls or ls -la if you want more detail.
Example:
cd /tmp
pwd
ls -lacd /tmp changes your current directory to /tmp. pwd prints the path you are currently in. ls shows the files and folders inside /tmp.
Useful terminal variations
- cd /tmp/, works the same as cd /tmp.
- ls /tmp, lists the directory without changing into it.
- ls -ld /tmp, shows the directory’s permissions and ownership.
How to access /tmp in a file manager
If you prefer a graphical interface, most Linux file managers can open /tmp directly.
- Open your file manager, such as Files, Dolphin, Thunar, or Nemo.
- Use the location bar or address field.
- Type /tmp and press Enter.
Some file managers hide the location bar by default. In that case, look for a menu option such as Go to Location, Open Location, or use a keyboard shortcut provided by your desktop environment.
You can also browse there manually by opening the root filesystem, then selecting tmp.
Why some /tmp files need sudo
Even though /tmp is typically accessible to all users, not every file in it is. A file in /tmp may be owned by another user or by root, and it may have restrictive permissions. In that case, you can see the directory but not open or modify every file inside it.
For example, a root-owned temporary file may require:
sudo ls -l /tmpUse sudo only when needed. For ordinary browsing, you usually do not need it. If a specific file is inaccessible, check its ownership and permissions first with ls -l or stat.
Common permission cases
- World-writable temporary files, common for shared temporary use.
- User-owned files, accessible to the user who created them.
- Root-owned files, which may require administrative access to inspect or remove.
If /tmp is missing or inaccessible
If /tmp appears missing, empty, or inaccessible, the cause is usually one of a few common issues:
- You typed the path incorrectly, for example tmp instead of /tmp.
- You are in a restricted environment, such as a container, rescue shell, or limited recovery session.
- The directory exists but has unusual permissions or mount settings.
- The system is using a different temporary directory setup for a specific application.
Try these checks:
ls -ld /tmp
mount | grep ' /tmp '
echo $TMPDIRIf /tmp is truly unavailable, the issue may be system-level rather than a normal access problem. On most standard Linux installs, however, it should exist and be accessible.
Is it safe to delete files in /tmp?
Sometimes, but not blindly. The /tmp folder is meant for temporary data, yet that does not mean every file inside it is safe to remove. Some files may still be in active use by running programs. Deleting the wrong file can cause an application to crash, lose unsaved work, or behave unexpectedly.
A safer approach is:
- Remove only files you own and understand.
- Avoid deleting files that are currently in use.
- Check file age and purpose before cleaning shared systems.
- Prefer the system’s normal cleanup process when possible.
If you want to clean up your own temporary files, confirm what is there first:
ls -lah /tmp/tmp vs /var/tmp
People often confuse /tmp with /var/tmp. Both are temporary storage locations, but they are not always treated the same way.
| Directory | Typical purpose | Cleanup behavior |
|---|---|---|
| /tmp | Short-term temporary files | Often cleaned on reboot or by age-based rules |
| /var/tmp | Temporary files meant to last longer | Usually retained longer than /tmp |
If you are looking for a file and it is not in /tmp, it may have been created in /var/tmp instead, depending on the application.
Quick troubleshooting checklist
If you still cannot access the directory, use this checklist:
- Verify the path includes the leading slash: /tmp.
- Check that your user account is working normally.
- Run ls -ld /tmp to inspect permissions.
- Use sudo only if you need to inspect a protected file.
- Look for app-specific temporary paths, such as $TMPDIR.
- Make sure you are not inside a container or limited shell with restricted filesystem access.
Practical examples
Here are a few common ways to work with /tmp:
# Enter /tmp
cd /tmp
# See what is inside
ls
# Show detailed permissions
ls -la
# Search for a file by name
find /tmp -name "example*"These commands are usually enough to inspect the temporary directory, find a file, or confirm whether a program has created something there.
Frequently Asked Questions About how to access tmp folder in linux
Where is the tmp folder in Linux?
The standard temporary directory is /tmp at the root of the filesystem. You can open it with cd /tmp in a terminal or by entering /tmp in your file manager.
How do I open /tmp in the terminal?
Use cd /tmp, then run ls or pwd to confirm you are there. If you want a detailed listing, use ls -la.
Why can I see /tmp but not open some files inside it?
Some files in /tmp are owned by other users or by root and may have restrictive permissions. In that case, you can access the directory itself but not every file inside it.
Is it safe to delete files from /tmp?
It can be safe to remove files you own and understand, but do not delete files blindly. Some may still be in use by programs, and removing them can cause problems.
Why does /tmp look empty?
That can happen if the system cleaned it recently, if no programs are currently using it, or if your distribution clears temporary files at reboot or after a time limit.
What is the difference between /tmp and /var/tmp?
/tmp is usually for short-lived temporary files, while /var/tmp is generally used for temporary files that should survive longer, often across reboots depending on the system.
Do I need sudo to access /tmp?
Usually no. Most users can open /tmp without sudo. You may only need sudo if you are inspecting or modifying a root-owned file inside it.
Conclusion
To access tmp folder in linux, use cd /tmp in the terminal or open /tmp in your file manager. In most cases, that is all you need. If a file inside /tmp is protected, check its ownership and permissions before using sudo, and avoid deleting temporary files unless you know they are no longer needed.
