博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux/unix rules for naming file and directory
阅读量:4033 次
发布时间:2019-05-24

本文共 1734 字,大约阅读时间需要 5 分钟。

Linux / UNIX: Rules For Naming File And Directory Names

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:

  1. All file names are case sensitive. So filename vivek.txt Vivek.txt VIVEK.txt all are three different files.
  2. You can use upper and lowercase letters, numbers, “.” (dot), and “_” (underscore) symbols.
  3. You can use other special characters such as blank space, but they are hard to use and it is better to avoid them.
  4. 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.
  5. 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
  6. Most modern Linux and UNIX limit filename to 255 characters (255 bytes). However, some older version of UNIX system limits filenames to 14 characters only.
  7. A filename must be unique inside its directory. For example, inside /home/vivek directory you cannot create a demo.txt file and demo.txt directory name. However, other directory may have files with the same names. For example, you can create demo.txt directory in /tmp.

Linux / UNIX: Reserved Characters And Words

Avoid using the following characters from appearing in file names:

  1. /
  2. >
  3. <
  4. |
  5. :
  6. &

Please note that Linux and UNIX allows white spaces, <, >, |, \, :, (, ), &, ;, as well as wildcards such as ? and *, to be quoted or  using \ symbol.

See also:

转载地址:http://cehbi.baihongyu.com/

你可能感兴趣的文章
一些socket的编程经验
查看>>
socket编程中select的使用
查看>>
C++获取文件大小常用技巧分享
查看>>
未来5年大机遇:做贩卖多巴胺的超级玩家
查看>>
关于AIS编码解码的两个小问题
查看>>
GitHub 万星推荐:黑客成长技术清单
查看>>
可以在线C++编译的工具站点
查看>>
关于无人驾驶的过去、现在以及未来,看这篇文章就够了!
查看>>
所谓的进步和提升,就是完成认知升级
查看>>
昨夜今晨最大八卦终于坐实——人类首次直接探测到了引力波
查看>>
如何优雅、机智地和新公司谈薪水?
查看>>
为什么读了很多书,却学不到什么东西?
查看>>
长文干货:如何轻松应对工作中最棘手的13种场景?
查看>>
如何确保自己的Mac数据安全呢?这里有四个“小秘诀”
查看>>
如何用好碎片化时间,让思维更有效率?
查看>>
第一性原理:戳中问题本质的人是怎么思考的?
查看>>
No.147 - LeetCode1108
查看>>
No.148 - LeetCode771
查看>>
No.174 - LeetCode1305 - 合并两个搜索树
查看>>
No.175 - LeetCode1306
查看>>