Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to make find command show size of files also

Status
Not open for further replies.

Brittany Snow

Member level 3
Joined
Aug 30, 2011
Messages
58
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,306
Activity points
1,672
I am learning Linux on evaluation board, there is a question, how can I make find command to show size of files also? Do I need to use -exec ls -l or xargs etc?
 

vinodstanur

Advanced Member level 3
Joined
Oct 31, 2009
Messages
752
Helped
114
Reputation
234
Reaction score
114
Trophy points
1,333
Location
Kerala (INDIA)
Activity points
7,065
for every command there will be a help option....

try
find --help
and read the usage

there you can see all options related to the find command
 

srizbf

Advanced Member level 5
Joined
Apr 3, 2010
Messages
1,995
Helped
417
Reputation
840
Reaction score
328
Trophy points
1,363
Activity points
10,985
you have to use the -exec ls option.
but to apply to the found file only.

for example if you want to find *.txt

give

find . -name "*.txt" -exec ls -l {} \;

the . operator should be changed to your reqd directory.
 

Brittany Snow

Member level 3
Joined
Aug 30, 2011
Messages
58
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,306
Activity points
1,672
for every command there will be a help option....

try
find --help
and read the usage

there you can see all options related to the find command
Help is too large for me to read.

---------- Post added at 14:39 ---------- Previous post was at 14:37 ----------

you have to use the -exec ls option.
but to apply to the found file only.

for example if you want to find *.txt

give

find . -name "*.txt" -exec ls -l {} \;

the . operator should be changed to your reqd directory.

Sorry but I can't find the size of the files. Do you have other command about it? Thanks.
 

bjuric

Advanced Member level 4
Joined
May 4, 2011
Messages
115
Helped
32
Reputation
64
Reaction score
30
Trophy points
1,308
Location
Serbia
Activity points
1,980
find . -name "*.txt" -exec ls -l {} \;

the . operator should be changed to your reqd directory.
Sorry but I can't find the size of the files. Do you have other command about it? Thanks.


The size is displayed in bytes. Use -h switch in ls to show human readable format. Like ls -lh

find . -name "*.txt" -exec ls -lh {} \;


About -exec and xargs... look at it this way...
-exec will perform given command on every found object separately
xargs gets all results as one big chunk (like a txt file, only from RAM)
 

Brittany Snow

Member level 3
Joined
Aug 30, 2011
Messages
58
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,306
Activity points
1,672
Try: "find --help | less" (or use Shift+PgUp/PgDn to page back & forth through text in a terminal). Other options:

man find
info find

Yes , thank you very much.

---------- Post added at 15:13 ---------- Previous post was at 15:12 ----------

The size is displayed in bytes. Use -h switch in ls to show human readable format. Like ls -lh

find . -name "*.txt" -exec ls -lh {} \;


About -exec and xargs... look at it this way...
-exec will perform given command on every found object separately
xargs gets all results as one big chunk (like a txt file, only from RAM)

This is the quick fix and it help very much. Thanks very much
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top