Hi,

I the following two command give the names of the folder of files on the desktop which have their size in MB or GB, am I right?

[root@localhost Desktop]# du -h |grep M

[root@localhost Desktop]# du -h |grep G

What do I need to use as a command to get the name of the files/folders within a particular range in terms of size ie MB or GB? If I want to know the names of the files/folders on the desktop that are larger than 5 MB but less then 10 MB in size? Thanks..

Recommended Answers

All 3 Replies

I the following two command give the names of the folder of files on the desktop which have their size in MB or GB, am I right?

[root@localhost Desktop]# du -h |grep M

[root@localhost Desktop]# du -h |grep G

Well, yes and no, you get ALL lines displaying a 'M' or a 'G'. That is, files like 'superMarket.sh' or
'GreyFloor.jpg' would also be printed. It will also do the check recursive, so if you just want the size of the things actually "on" the Desktop to be printed, you'll have to ad the option '-s' to du (for more info check #man du).

Unfortunately I can't come up with any good solutions, but hopefully someone else will help you with the rest of the cake.

/jansson

You could use a program called "ncdu", that computes recursively the size of all files and folders somewhere on your disk... And you can browse the list and then delete the big unnecessary files :)

man find

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.