Skip to main content

πŸ—‚οΈ File & Directory Management

Explore categorized shell commands with real scenarios and outputs for file and directory tasks. πŸš€


πŸ“ Directory Navigation​

1. List current directory​

Command​

sh snippet

Output​


2. List all including hidden​

Command​

sh snippet

Output​


3. Print current path​

Command​

sh snippet

Output​


4. Change to subdirectory​

Command​

sh snippet

Output​


5. Go to parent directory​

Command​

sh snippet

Output​


6. Go to home directory​

Command​

sh snippet

Output​


7. List contents with details​

Command​

sh snippet

Output​


8. List sorted by modified time​

Command​

sh snippet

Output​


9. List in reverse order​

Command​

sh snippet

Output​


10. List directories only​

Command​

sh snippet

Output​


πŸ“„ File Creation & Deletion​

11. Create an empty file​

Command​

sh snippet

Output​


12. Create multiple files​

Command​

sh snippet

Output​


13. Remove a file​

Command​

sh snippet

Output​


14. Remove multiple files​

Command​

sh snippet

Output​


15. Remove without prompt​

Command​

sh snippet

Output​


16. Prompt before removing​

Command​

sh snippet

Output​


17. Empty file contents​

Command​

sh snippet

Output​


18. Delete empty directory​

Command​

sh snippet

Output​


19. Delete directory with contents​

Command​

sh snippet

Output​


20. Force delete a directory​

Command​

sh snippet

Output​


πŸ“¦ File & Folder Copy/Move​

21. Copy a file​

Command​

sh snippet

Output​


22. Copy and rename file​

Command​

sh snippet

Output​


23. Copy folder recursively​

Command​

sh snippet

Output​


24. Move a file​

Command​

sh snippet

Output​


25. Rename a file​

Command​

sh snippet

Output​


26. Move and overwrite without prompt​

Command​

sh snippet

Output​


27. Interactive move​

Command​

sh snippet

Output​


28. Copy with prompt​

Command​

sh snippet

Output​


29. Backup before overwrite​

Command​

sh snippet

Output​


30. Preserve timestamps while copying​

Command​

sh snippet

Output​


πŸ” File Info & Permissions​

31. Show file type​

Command​

sh snippet

Output​


32. Display file info​

Command​

sh snippet

Output​


33. Check disk usage​

Command​

sh snippet

Output​


34. Check available disk space​

Command​

sh snippet

Output​


35. Change file permissions​

Command​

sh snippet

Output​


36. Make file executable​

Command​

sh snippet

Output​


37. Change file owner​

Command​

sh snippet

Output​


38. Change group ownership​

Command​

sh snippet

Output​


39. Check umask value​

Command​

sh snippet

Output​


40. Set umask value​

Command​

sh snippet

Output​


πŸ—‚οΈ Directory Management​

41. Create a directory​

Command​

sh snippet

Output​


42. Create nested directories​

Command​

sh snippet

Output​


43. List directories only​

Command​

sh snippet

Output​


44. List files only​

Command​

sh snippet

Output​


45. Count files​

Command​

sh snippet

Output​


46. Sort files by size​

Command​

sh snippet

Output​


47. Open directory in GUI (Linux)​

Command​

sh snippet

Output​


48. Open directory (macOS)​

Command​

sh snippet

Output​


49. Navigate back to previous dir​

Command​

sh snippet

Output​


50. Create directory with space​

Command​

sh snippet

Output​


πŸ§ͺ Advanced Operations​

51. Search file by name​

Command​

sh snippet

Output​


52. Find files modified today​

Command​

sh snippet

Output​


53. Search text in files​

Command​

sh snippet

Output​


Command​

sh snippet

Output​


55. Count lines in a file​

Command​

sh snippet

Output​


56. Monitor file changes​

Command​

sh snippet

Output​


57. Compare two files​

Command​

sh snippet

Output​


58. Archive files​

Command​

sh snippet

Output​


59. Extract archive​

Command​

sh snippet

Output​


60. Compress file​

Command​

sh snippet

Output​


🌐 File Transfer & Download​

61. Download a file​

Command​

sh snippet

Output​


62. Download with curl​

Command​

sh snippet

Output​


63. Secure copy to remote​

Command​

sh snippet

Output​


64. Secure copy from remote​

Command​

sh snippet

Output​


65. Sync directories​

Command​

sh snippet

Output​


66. Upload via FTP​

Command​

sh snippet

Output​


67. Mount remote folder​

Command​

sh snippet

Output​


68. List remote files​

Command​

sh snippet

Output​


69. Download from S3​

Command​

sh snippet

Output​


70. Upload to S3​

Command​

sh snippet

Output​


βŒ›οΈFile contents operation​

71. Concatenate and display the content of one or more files.​

Command​

shell snippet

Output​


72. Combine Multiple Files​

Command​

Combine Multiple Files

Output​


73. Redirect to Another File​

Command​

shell snippet

Output​


74. Append the output to an existing file:​

Command​

shell snippet

Output​


75. Quickly create a file and input content manually​

Command​

shell snippet

Type your content, then press Ctrl+D to save.

Output​

76. Helpful when you want line numbers for all lines (including blank ones).​

Command​

shell snippet

Output​

77. Good for skipping blank lines in numbering.​

Command​

shell snippet

Output​

78. Squeeze blank lines (collapse multiple empty lines into one) Useful when files have lots of extra spacing.​

Command​

shell snippet

Output​

79. Show all special characters (like tabs ^I, line endings $) Great for debugging file formatting.​

Command​

shell snippet

Output​

80. View file content interactively with scrolling and search support.​

Command​

shell snippet

Output​

81. Display the first 10 lines of a file by default.​

Command​

shell snippet

Output​

82. Show first N lines​

Command​

shell snippet

Output​

83. Display the last 10 lines of a file by default.​

Command​

shell snippet

Output​

84. Show last N lines​

Command​

shell snippet

Output​

85. Follow file as it grows​

Command​

shell snippet

Output​