Q. Can you specify rules for naming a file name under Linux?
A. When you save a data, you nee to select a file name, you need to follow certain rules and regulation regarding the length of the name and the types of characters you include.
Rules for naming file names
The rules for naming a file names under Linux (and UNIX like oses) are as follows:
[a] The file names can be up to 255 characters (or bytes) long [b] You cannot use all special characters, try to use:=> Uppercase or lowercase letters
=> Digits
=> Special characters, such as: +, -, _, . [c] File names are case-sensitive. Thus, the following file names all are different:
vivek Vivek VIVEK VIVek[d] Try to avoid non printable and following characters in filenames:
/, >, <, ?, “, ‘, blank space
How do I show hidden files?
Use ls -a or ls -la command:
$ ls -la
$ ls -a
Use -a to see invisible file names.
How do I access filenames with spaces?
To access a filename with spaces, enclose the filename in quotes:
$ cat "my bio data.txt"
$ cd "a long dir nane"
Please note that above rules almost apply to other UNIX like operating system such as HP-UX, Solaris, FreeBSD etc.
🐧 2 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
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 |
file name in linux ends with ~.
plz clarufy
But where the file name is stored? I mean, in the inode, repertory?