Can you specify rules for naming file and directory names under Linux and UNIX operating systems?
Following are general rules for both Linux, and Unix (including *BSD) like systems:
- All file names are case sensitive. So filename vivek.txt Vivek.txt VIVEK.txt all are three different files.
- You can use upper and lowercase letters, numbers, “.” (dot), and “_” (underscore) symbols.
- You can use other special characters such as blank space, but they are hard to use and it is better to avoid them.
- In short, filenames may contain any character except / (root directory), which is reserved as the separator between files and directories in a pathname. You cannot use the null character.
- No need to use . (dot) in a filename. Some time dot improves readability of filenames. And you can use dot based filename extension to identify file. For example:
- .sh = Shell file
- .tar.gz = Compressed archive
Linux / UNIX: Reserved Characters And Words
Avoid using the following characters from appearing in file names:
Please note that Linux and UNIX allows white spaces, , |, \, :, (, ), &, ;, as well as wildcards such as ? and *, to be quoted or escaped using \ symbol.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
|Category||List of Unix and Linux commands|
|Firewall||Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|