Quick Tip: Linux File Management
Share
Below are a few quick commands for managing file in Linux:
- Display a count of the number of files in a directory
ls -f /dir1/subdir1/subdir2 | wc -l
- Delete all files in a directory older than 30 days
find /dir1/subdir1/subdir2 -name "*.*" -type f -mtime +30 -exec rm -f {}
- Find the largest 5 directories on the system
du -hs * | sort -rh | head -5
- Find the 5 largest files on the system
find -type f -exec du -Sh {} + | sort -rh | head -n 5
- Find the 5 largest files in a directory
find /home/tecmint/Downloads/ -type f -exec du -Sh {} + | sort -rh | head -n 5
Author
Stewart Schatz
More Stories
How to Use the rsync Command to Sync Files and Directories on Linux
The rsync command is one of the most powerful tools in the Linux toolkit for syncing files and directories. Whether...
How to Clean Up Empty Directories Using the find Command in Linux
Managing files and directories in Linux often involves dealing with empty directories that can clutter your workspace. Manually finding and...
Quick Tip: Determine Active Directory Account Status From The Windows Commandline
Use the following command to Determine Active Directory Account Status from the Windows Commandline without Powershell or any special software....
Where Is Java Installed?
Below are a few commands that can be run to determine where Java is installed on each Operating System: Windows:...
Windows God Mode… What!?!
Windows God Mode is a hidden feature in the Windows operating system that allows users to access all of the system’s control panel options and settings in a single place.
A Better SMTP Test
Several years ago, I posted about an SMTP Test that I was using. Well, lately, I've needed something with a...
Average Rating