Rules for naming a file in Linux or naming conventions:
There are some rules for naming file in Linux OS. Here are they:
1. Filename must not have blanks. You can not create filename Manoj Pal but you can create ManojPal.
2. Filenames in Linux are case sensitive that means Apple, apple and APPLE are different filenames. You cannot access Apple by typing apple.
3. Filename could be 255 characters long and this file name may be combinations of upper and lower case letters.
4. You can use . dot Underscore _ hyphen – in file names at any place in the filename.
5. Filename also may have extensions.
6. You can use more than one dot in filename and at any place.
Creating More than one directory using single mkdir command:
It is possible too to create more than one directory at a time by using single mkdir command. To do so type mkdir command at Linux command prompt followed by directory names which are to be created.
mkdir product product/computer product/computer/floppy
the above command will create a directory called product in current working directory and directory named computer under product directory and floppy under computer direcotory.
What should I do when I will not be able to create a directory:
There are certain rules to create a directory under Linux OS. If tries to create directory under Linux/Unix OS and fails then it may be due to following reasons.
1. The directory you are trying to create, a file with same name exists in the same directory.
2. You don’t have enough permission to create a directory.
3. Directory already present with the same name as you desire to create.
Changing a directory:
If you wish to change your current working directory. cd command is used. Just suppose if you want to change your current working directory to product directory. Type the following command to do so.
Removing a directory: To remove any directory under Linux OS. rmdir command is used. suppose you want to remove directory called product. command will be as follows.
Removing more than one directory using single rmdir command:
It is possible too to remove more than one directory at a time by using single rmdir command. To do so type rmdir command at Linux command prompt followed by directory names which are to be deleted.
rmdir product/computer/floppy product/computer product
the above command will delete three directories at a time. But one thing always you should keep in your mind, while removing directories, you should remove lower level directory first then upper level in the tree as shown in the above example.
What should I do when I will not be able to remove any directory:
There are certain rules to remove a directory under Linux OS. If tries to remove directory under Linux/Unix OS and fails then it may be due to following reasons.
1. The directory you are trying to remove is not empty means the directory have subdirectories first remove then and try again.
2. You don’t have enough permission to remove a directory.
3. you must be get out of that directory which is to be deleted you must not be in anyone of its subdirectories in order to delete the directory.