LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-23-2019, 07:53 AM   #1
risingflight
LQ Newbie
 
Registered: Dec 2019
Posts: 6

Rep: Reputation: Disabled
fize size


Hi Experts
I am new to linux, i have disk space issue on one server,
when i use the syntax du -sch *
i can see application folder is occupying 30GB

[root@server01 home]# du -sch *
30G myapp01
[root@server01 home]# cd myapp01/

There are lot of files in myapp01 i want to pull the files with large size please help me with the syntax
 
Old 12-23-2019, 08:00 AM   #2
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 884Reputation: 884Reputation: 884Reputation: 884Reputation: 884Reputation: 884Reputation: 884
Quote:
Originally Posted by risingflight View Post
There are lot of files in myapp01 i want to pull the files with large size please help me with the syntax
This code will probably work
Code:
 ls -l myapp01 | sort +4n
If your version of sort doesn't accept +4 (it is an older option), use
-k 5 -n
instead (keyfield is 5, the size, sort as numbers, not text).
 
Old 12-23-2019, 08:04 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 5,235
Blog Entries: 3

Rep: Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587
You can sort the output of ls

Code:
ls -r -S ./myapp01/
ls -r -S ./myapp01/ | head -n 2
See "man ls" for the full details.
 
Old 12-23-2019, 08:05 AM   #4
risingflight
LQ Newbie
 
Registered: Dec 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
It did not work
 
Old 12-23-2019, 08:32 AM   #5
berndbausch
LQ Guru
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 5,636

Rep: Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689Reputation: 1689
Quote:
Originally Posted by risingflight View Post
It did not work
That's sad, but if we knew the problems you encounter, we might be able to help.

You could try du -h myapp01/* | sort -n for files in the myapp01 directory. Another command that reports the file size is stat, e.g. stat -c "%s %n" myapp01/*.

You could also use find, e.g. find myapp01 -size +100M lists files larger than 100MB.

Last edited by berndbausch; 12-23-2019 at 08:38 AM. Reason: added info about stat and find
 
Old 12-23-2019, 08:40 AM   #6
risingflight
LQ Newbie
 
Registered: Dec 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
i have used the below syntax i can get the files but how can i get their size
ls -r -S ./myapp01/ | head -n 10
 
Old 12-23-2019, 08:42 AM   #7
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 5,235
Blog Entries: 3

Rep: Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587Reputation: 2587
Check the manual page, it is the authoritative reference, and scroll down to -l and -h there. They may be of use.

Code:
man ls
 
Old 12-23-2019, 09:47 AM   #8
risingflight
LQ Newbie
 
Registered: Dec 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
whts wrong with the below syntax

[root@server01 data]# find /home/app/data -type -f size +100M
find: Arguments to -type should contain only one letter
 
Old 12-23-2019, 10:00 AM   #9
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,120

Rep: Reputation: 1327Reputation: 1327Reputation: 1327Reputation: 1327Reputation: 1327Reputation: 1327Reputation: 1327Reputation: 1327Reputation: 1327Reputation: 1327
Quote:
Originally Posted by risingflight View Post
whts wrong with the below syntax
The error message tells you!

Use:
Code:
find /home/app/data -type f -size +100M
 
Old 12-23-2019, 10:51 AM   #10
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 15,600

Rep: Reputation: 5116Reputation: 5116Reputation: 5116Reputation: 5116Reputation: 5116Reputation: 5116Reputation: 5116Reputation: 5116Reputation: 5116Reputation: 5116Reputation: 5116
you might want to check/install/try ncdu
 
Old 12-23-2019, 01:38 PM   #11
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Older: Coherent, MacOS, Red Hat, Big Iron IXs: AIX, Solaris, Tru64
Posts: 2,163

Rep: Reputation: 362Reputation: 362Reputation: 362Reputation: 362
Quote:
Originally Posted by risingflight View Post
whts wrong with the below syntax

[root@server01 data]# find /home/app/data -type -f size +100M
find: Arguments to -type should contain only one letter
And there needs to be an argument to the "-type" switch. (Do you see the cause of the error message now? We've all botched a command line like that before. :^) )
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems setting ulimit fize size for user. File size exceeded LD-50 Slackware 15 09-11-2019 06:26 PM
Linux Virtual Memory size; Page size; Resident Data Size; DB2Database; Explanation ANanalanalyzer Linux - Newbie 1 09-28-2018 05:50 PM
Total partition size - User partition size is not equals to Free partition size navaneethanj Linux - General 5 06-14-2004 01:55 PM
fdisk partition size differs from mounted partition size jimieee Linux - General 3 10-15-2003 04:10 AM
increase point size size when printing PDF files newlin Red Hat 0 09-27-2003 08:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration