Recommendations for working with a Linux file system and best practices
User documents are located in each user’s personal directory, known as the “home” directory. Each user has an assigned home directory, and this is the default location where personal information is stored, including documents, scripts, and configurations.
Home Directory Location:
Each user’s home directory is located at the following path:
/home/users/nom.usuari
Where “nom.usuari” is the specific user’s username.
All nodes have shared access to your user’s home directory, which simplifies data access during executions.
Store Documents in Home
Users can store their documents, files, and other materials directly in their home directory. For example, to create a new document:
Open a terminal.
Navigate to your home directory:
$ cd ~
File Names
Avoid spaces in file names
Spaces can cause problems when used in file names, especially in scripts and command-line operations. Instead of spaces, use underscores or hyphens in file names.
- Example:
Instead of:
fitxer amb espais.txtUse:fitxer_amb_espais.txtorfitxer-amb-espais.txt
Avoid special characters
Avoid using special characters such as accents, symbols, or non-alphanumeric characters in file names. This ensures better compatibility and avoids possible interpretation issues across different systems.
File and Directory Structure
Organize files hierarchically
Maintaining a hierarchical and logical directory structure makes file system navigation and management easier. Grouping related files in specific directories helps preserve order and clarity.
- Example:
/documents-/treballs-/informes/imatges/scripts
Document and comment
Include documentation and comments inside directories and files, especially if other people need to work with your file system. This makes understanding and future use easier.
Conclusion
Following these best practices will improve consistency and maintainability in your Linux file system, ensuring better organization and avoiding potential issues.