0

I was trying to search a file which is 1033 bytes size. After half hour googling I find a command which show all file name and size inside the current directory.

find -printf 'Name: %16f Size: %6s\n' 

How %16f and %6s show the name and file size?

2

1 Answer 1

1

I was trying to search a file which is 1033 bytes size.

You can say:

find . -type f -size 1033c 

%f and %s are directives for the printf option:

 %f File's name with any leading directories removed (only the last element). %s File's size in bytes. 

Saying %16f would pad the filename; be warned that the output might be truncated if the filename exceeds 16 characters.

Sign up to request clarification or add additional context in comments.

4 Comments

oh! this is unlike C. I thought I was to pass those data. thanks
Is there a type directive exists??
-type is referred to as a predicate.
Maybe try reading the manual page? @ShinTakezou's answer has a good link.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.