linux/unix rules for naming file and directory
2016-05-23 17:54
573 查看
Linux / UNIX: Rules For Naming File And Directory Names
by VIVEK GITE on FEBRUARY17, 2006 last updated DECEMBER 29, 2009
in FEDORA
LINUX, FILE
SYSTEM, FREEBSD, LINUX, UNIX
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
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.
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:/
>
<
|
:
&
Please note that Linux and UNIX allows white spaces, <, >, |, \, :, (, ), &, ;, as well as wildcards such as ? and *, to be quoted or escaped using
\ symbol.
See also:
Understanding UNIX/Linuxfile system
相关文章推荐
- 史上最简单的上传文件到linux系统方法
- Linux堆内存管理深入分析(下)
- Linux中的搜索命令
- linux部署java web项目
- 每天一个linux命令-rm
- Linux中Varnish基础应用
- xz compression install on centos
- linux基础(27)--内核编译、内核模块操作--RHEL6.5
- Linux-正则表达式
- linux 发送 post请求
- LInux常用命令
- Linux配置VNC远程桌面
- Linux-grep命令
- linux命令 wc
- (十六)洞悉linux下的Netfilter&iptables:开发自己的hook函数【实战】(下)
- 系统管理员-Linux基础学习-第一部分内容。
- snmp4j获取数据实例(一,Linux SNMP OID’s for CPU,Memory a)
- centos7 安装Zabbix3.0
- linux - grep | cut
- windows下读取Linux分区软件