1820782 Members
3810 Online
109627 Solutions
New Discussion юеВ

Re: find problem

 
SOLVED
Go to solution
j773303
Super Advisor

find problem

Is it possible to search file belong to "c" or "p" or "s" in the system ?

For ex:
crw------- 1 root root 15 0x000089 Sep 30 tunip9

prw------- 1 root root .... test1
srw------- 1 root ......... test2..
Hero
5 REPLIES 5
Bharat Katkar
Honored Contributor
Solution

Re: find problem

Hi,
You can do it this way:

# find ./ -name "*xyz*" -print | xargs ls -al | grep ^c
# find ./ -name "*xyz*" -print | xargs ls -al | grep ^p
# find ./ -name "*xyz*" -print | xargs ls -al | grep ^s

Hope that helps
Regards,

You need to know a lot to actually know how little you know
bhavin asokan
Honored Contributor

Re: find problem

hi,

use the following command for finding character (c) files in /dev.

# find /dev -type c -exec ll {} \;


if you want to check for all the system use '/' instead of '/dev' and use the following instead of 'c' for finding other types of files. see man page of find for more details.


f Regular file
d Directory
b Block special file
c Character special file
p FIFO (named pipe)
l Symbolic link
s Socket
n Network special file
M Mount point




regds,

Muthukumar_5
Honored Contributor

Re: find problem

WE can find the files based file types with -type option on find command.

IF you want to get character files then,

find -type c -name "*" -exec ll {} \;

IT will give every file there,

Else,

you can try with ll | grep '^ as,

find -name "*" -exec ls -l {} \; | grep -E '^c'

It will give character files there,

You can get file type on find man page there.

Easy to suggest when don't know about the problem!
Franky_1
Respected Contributor

Re: find problem

Hi,

you can do

ls -lR | grep "^c" (or grep "^p" or whatever you want to search for)

or all in one

ls -lR|egrep "^c|^p"

Regards

Franky
Don't worry be happy
Muthukumar_5
Honored Contributor

Re: find problem

We can get all character, fifo, socket files as,


find / -type c -type p -type s -name "*" -exec ls -al {} \;

It will give every files full informations there.

We can do in another as,

find / -name "*" -exec ls -al {} \; | grep -E "^c|^p|^s"


HTH.
Easy to suggest when don't know about the problem!