Home > System Tutorial > LINUX > File Management on Linux: 7 Tips and 4 Tools

File Management on Linux: 7 Tips and 4 Tools

PHPz
Release: 2024-02-09 16:00:25
forward
635 people have browsed it

Linux is an excellent operating system that provides a powerful command line and flexible file system. However, if you don't pay attention to file organization and cleanup, your computer may become cluttered, affecting your efficiency and experience. This article will share some tips and tools for organizing files and cleaning up your computer on Linux to help you maintain a clean and orderly work environment.

1. Give the file a meaningful name

Give your files and directories descriptive and meaningful names that reflect their contents or purpose. This makes it easier to guess the contents of future folders or files.
Keep in mind that Linux is case sensitive, so the directories linuxmi and Linuxmi are different, even if they have the same name.

Linux 上的文件管理:7 个技巧和 4 个工具

Avoid using spaces and special characters. Using spaces in folder or file names can cause problems in scripts or when using the command line. You can use hyphens (-) or underscores (_) to separate words in the name.

Linux 上的文件管理:7 个技巧和 4 个工具

The most important thing is to be consistent when naming your files. For example, I use snake_case for all filenames. It uses lowercase letters and words separated by underscores. For example, a job application letter would be named job_application_letter.doc.

For directories, I use Pascal_Snake_Case. Capitalize the first letter of each word and separate words with underscores. For example, my repository for all Python projects will be named Python_Projects.

Find or create a naming convention that suits your needs and use it consistently across your systems.

2. Always use file extension

Related to naming, use file extensions whenever possible and maintain consistency. For example, you can save all your Word documents with the Open Document Format extension, which means that all Word documents will have the ".odt" extension.

Linux 上的文件管理:7 个技巧和 4 个工具

If you're consistent, it's easy to associate certain file types with default programs. This saves you time in the long run.

File extensions make searching for files easier. Additionally, you can easily run automated scripts or commands targeting specific file extensions.

3. Organize your directory structure

We all know those people who put all directories on their desktop or in a specific folder. What a mess! Be sure to avoid doing this and always keep your desktop clean.
Putting too many directories in one place can be confusing and make it difficult to locate files, thus affecting productivity.

By default, Linux has specific directories used to store specific types of files, such as the Pictures directory, Videos directory or Music directory. This demonstrates the importance of grouping related items, so follow the same principles when creating a table of contents.

Linux 上的文件管理:7 个技巧和 4 个工具

Organize your directory structure so that it does not contain too many files and subdirectories. Place related items in specific directories and create more categories if necessary. Just make sure your directories aren't nested too deeply.

4. Location is crucial

In addition to organizing your directory structure correctly, it is also very important to place all files in the correct location.

Learn best practices from Linux itself. It follows a directory structure to organize files. Therefore, you should follow the same principles. For example, the /etc/ directory is for configuration files, while the /bin/ directory is for user binaries or programs.

Linux 上的文件管理:7 个技巧和 4 个工具

File location is critical for quickly navigating and finding files. It also plays an important role when performing backups or synchronizing data. For example, if all your photos are in the Pictures directory, you can just back up the Pictures directory to make sure all your important memories are there.

5. Sort files

To further improve work efficiency, you should sort directories and files according to your needs. You can sort files by date, name, type or date modified, and file size. This will make it easier for you to find and locate the file later.

Linux 上的文件管理:7 个技巧和 4 个工具Linux 上的文件管理:7 个技巧和 4 个工具

Sorting files by modification date can help you identify frequently used files. Conversely, files that have not been modified for a long time may need to be deleted.

Overall, sorting files by certain parameters will give you a lot of benefits. It will increase your productivity and simplify file management.

6. Custom directory preferences

Linux provides many file and directory customization options that can improve your workflow. For example, you can change the catalog icon so items can be found at a glance.
You can also create symbolic links for frequently accessed projects. But make sure all symbolic links are working properly. Regularly take the time to repair broken symbolic links.

Linux 上的文件管理:7 个技巧和 4 个工具

Use the directory preference menu to customize how you interact with your files. For example, you can customize whether a file opens with a double-click or a single click. You can also customize whether certain context menus appear when you right-click a file or directory.

Additionally, you can customize your search preferences and specify the depth of your search.

Related:

  • Find all symbolic links in Linux https://www.linuxmi.com/linux-find-soft-links.html
  • How to create symbolic links in Linux [Complete Guide] https://www.linuxmi.com/creating-symbolic-links-in-linux.html

7. Clean up unnecessary files

Use the disk management tools that come with Linux to understand how much disk space you are using and find out which files are taking up a lot of disk space.
Disk Usage Analyzer is a graphical tool that interactively displays an overview of disk usage. The red area shows the directories taking up the most space.

You can also use the du command and the df command to find the directory size and disk usage. The df -h command displays disk usage in human-readable format.

To identify large files or directories, you can run the sudo du /-h | sort -h command. It will show all directories under the root (/) directory and the disk space used by them. The -h flag indicates that the output is displayed in human-readable format. Then, import the output into the sort command to sort the directories by disk usage size.

Linux 上的文件管理:7 个技巧和 4 个工具

Browse the output to identify files taking up too much space and determine whether they are still relevant. Otherwise, you can clear them.

Clean your computer cache regularly and delete temporary files that are no longer needed using the following command:

linuxmi@linuxmi:~/www.linuxmi.com$ sudo rm -rf /tmp/*
Copy after login
Linux 上的文件管理:7 个技巧和 4 个工具

View the log files and determine the log files that are no longer needed. Most log files are located in the /var/log directory.

All deleted files will be placed in the Recycle Bin by default. However, they still take up disk space. Consider emptying your Recycle Bin to get rid of cluttered files.

Be careful when using the rm command. It permanently deletes files and can cause chaos if used incorrectly.

Organize your files and be more productive on Linux

These tips will help you get the most out of your Linux system. Use meaningful names, structure your directories, purge old files, and be consistent throughout.

If you use the GNOME desktop environment, you can also increase your productivity by installing some of the best GNOME Shell extensions.

Through this article, we learned some tips and tools for organizing files and cleaning up the computer on Linux. These include giving files meaningful names, using file extensions, structuring directories appropriately, choosing appropriate storage locations, sorting files according to different criteria, customizing directory preferences, and regularly cleaning out unnecessary files. We've also covered some useful tools like BleachBit, FSlint, Stacer, and Baobab that can help you manage files and free up space more easily. Hopefully these tips and tools will help you work and play more efficiently on Linux.

The above is the detailed content of File Management on Linux: 7 Tips and 4 Tools. For more information, please follow other related articles on the PHP Chinese website!

source:lxlinux.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template