The FHS provides no “standard” empty directory.
It is common for Linux systems to provide a directory /var/empty
, but this directory is not defined in FHS and may not actually be empty. Instead, certain daemons will create their own empty directories in here. For instance, openssh uses the empty directory /var/empty/sshd
for privilege separation.
If your need for an empty directory is transient, you can create an empty directory yourself, as a subdirectory of /run
or /tmp
. If you’re doing this outside the program, you can use mktemp -d
for this, or use the mkdtemp(3)
C function inside your program. Though if you always need the empty directory to be present, consider creating one under /var/empty
as openssh does.
For this use case, creating a directory under /tmp
is probably the best fit, though in practice it doesn’t matter very much where you put it.
Related Posts:
- Confused about stdin, stdout and stderr?
- How to set the environmental variable LD_LIBRARY_PATH in linux
- What’s a .sh file?
- How to fix ‘sudo: no tty present and no askpass program specified’ error?
- How do I grep recursively?
- What does pss mean in /proc/pid/smaps
- apt-get error: Sub-process /usr/bin/dpkg returned an error code (1)
- error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’ — Missing /var/run/mysqld/mysqld.sock
- How do I grep recursively?
- how to find libstdc++.so.6: that contain GLIBCXX_3.4.19 for RHEL 6?
- How to extract C source code from .so file?
- subprocess.Popen(): OSError: [Errno 8] Exec format error in python?
- How to substitute shell variables in complex text files
- How can I recursively find all files in current and subfolders based on wildcard matching?
- Curl command for https ( SSL )
- How can I exclude directories from grep -R?
- How to exclude a directory in find . command
- “sed” command in bash
- How to exclude a directory in find . command
- How can I find all *.js file in directory recursively in Linux?
- Argument list too long error for rm, cp, mv commands
- Difference between using “chmod a+x” and “chmod 755”
- ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known
- WSL – GEDIT Unable to init server: Could not connect: Connection refused
- Python subprocess.Popen “OSError: [Errno 12] Cannot allocate memory”
- Install tkinter for Python
- Creating a new directory in C
- How to open some ports on Ubuntu?
- Given two directory trees, how can I find out which files differ by content?
- mv: cannot stat error : No such file or directory error
- Uncompress tar.gz file
- What does it mean to mount a file system in linux?
- curl: (6) Could not resolve host: google.com; Name or service not known
- How to pass password to scp?
- scp gives “not a regular file”
- -bash: fork: Cannot allocate memory
- Explanation of polkitd Unregistered Authentication Agent
- CentOS error – sudo: effective uid is not 0, is sudo installed setuid root?
- Merge / convert multiple PDF files into one PDF
- scp from Linux to Windows
- Bash script: bad interpreter
- What is the difference between /etc/rc.local and ~/.bashrc?
- Snort Message – WARNING: No preprocessors configured for policy 0
- How do I find the MySQL my.cnf location
- PHP and mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
- How to grep and replace
- node.js: cannot find module ‘request’
- Getting stty: standard input: Inappropriate ioctl for device when using scp through an ssh tunnel
- What is the reason and how to avoid the [FIN, ACK] , [RST] and [RST, ACK]
- What does “&” at the end of a linux command mean?
- wget returns “Unable to establish SSL connection”
- How to recursively download a folder via FTP on Linux
- Apache server keeps crashing, “caught SIGTERM, shutting down”
- error : storage class specified for parameter
- httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
- How do I write stderr to a file while using “tee” with a pipe?
- How to include file in a bash shell script
- python-dev installation error: ImportError: No module named apt_pkg
- Does Mac OS X use Linux?
- How to enable Bash in Windows 10 developer preview?
- bash sh – command not found
- Hosting multiple WordPress sites on single server – best practices?
- WordPress Update – This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php
- Anyone else experiencing high rates of Linux server crashes during a leap second day?
- Can I nohup/screen an already-started process?
- df in linux not showing correct free space after file removal
- In my /etc/hosts/ file on Linux/OSX, how do I do a wildcard subdomain?
- Setting the hostname: FQDN or short name?
- Shell command to monitor changes in a file
- When does /tmp get cleared?
- Difference in sites-available vs sites-enabled vs conf.d directories (Nginx)?
- How do I sleep for a millisecond in bash or ksh
- Disk full, du tells different. How to further investigate?
- What does ‘set -e’ do, and why might it be considered dangerous?
- Filename length limits on linux?
- What useful things can one add to one’s .bashrc? [closed]
- How to add a timestamp to bash script log?
- best way to clear all iptables rules
- How to remove empty/blank lines from a file in Unix (including spaces)?
- How can I kill all stopped jobs?
- How to copy file preserving directory path in Linux?
- Postfix – how to retry delivery of mail in queue?
- How can I rename a Unix user?
- How to re-order windows, change the scroll shortcut, and modify the status bar contents in GNU Screen?
- Is it possible to alias a hostname in Linux?
- How do I list loaded Linux module parameter values?
- Does getting disconnected from an SSH session kill your programs?
- Tips for Securing a LAMP Server
- What Linux distribution is the Amazon Linux AMI based on?
- How to prevent a user from login in, but allow “su – user” in Linux?
- What is this IP address: 169.254.169.254?
- I have a keypair. How do I determine the key length?
- How to do the port forwarding from one ip to another ip in same network?
- Why drop caches in Linux?
- Linux – Is there a way to prevent/protect a file from being deleted even by root?
- swap partition vs file for performance?
- Best way to disable swap in Linux
- How to remove invalid characters from filenames?
- How can I zip/compress a symlink?
- How to find the physical volume(s) that hold a logical volume in LVM