24.03.2025

Linux Quick Cheat Sheet: Working with Files and Directories

This guide contains key commands for managing files and directories in Linux, which will be useful for every DevOps specialist.

Working with Files and Directories

Viewing and Editing Files

Managing Permissions and Ownership

Archiving and Compression

Working with Symbolic Links

Disk Usage Monitoring

Useful Tricks

FAQ (Frequently Asked Questions)

Can deleted files be recovered after rm -rf?
Usually, no. The rm -rf command permanently deletes files. However, if the filesystem supports a "trash bin" (e.g., via the trash-cli utility), safe deletion can be configured.

How do I copy a folder along with its contents?
Use cp -r source_dir destination_dir, where the -r flag enables recursive copying.

How can I quickly find a file on the system?
Use find / -name "filename" to search the entire system or locate filename if the locate utility is installed.

Conclusion

This quick reference guide contains essential commands for managing files and directories in Linux. Knowing these commands will streamline system management and make daily tasks easier for DevOps engineers.