Find hangs when ran under superuser.

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find hangs when ran under superuser.
# 1  
Old 01-07-2011
Find hangs when ran under superuser.

When I ran the following find command under a "regular" user is completes but it limited because of perms.

find / -name "*.*" | xargs grep something > ok

But when I try to run it under su, it hangs and never completes.

Any suggestion?
# 2  
Old 01-07-2011
Another way:
find / -type f | xargs grep "something" > ok

Also pls check the content of "ok" file if it is getting new data all the time when find command is running.
tail -f ok

Last edited by anurag.singh; 01-07-2011 at 03:14 PM..
# 3  
Old 01-08-2011
Try something like
find / -type f |tee /tmp/output| xargs grep "something" > ok
and on other shell tail -f /tmp/output
to see what is happening.
It might be that it runs into network directory unaccesible for a normal.
That find might be run as
find / -type f -exec grep "something" {} \;
# 4  
Old 01-09-2011
But when I try to run it under su, it hangs and never completes.

Please post the exact lines you typed both with and without the "su" and state clearly which computer should receive the file called "ok".

Btw. Unix is not MSDOS. There is no significance in a period (.) in a filename except perhaps when transferring files to/from MSDOS. However if your "find" is only looking for filenames containing period then your script is nearly right.
# 5  
Old 01-09-2011
Originally Posted by shorty
find / -name "*.*" | xargs grep something > ok

If you run this it will process /dev and /proc which have system devices, and
there is a good chance it will never finish.
As other people here have suggested I would use "-type f" instead of "-name *.*". This will limit the find to files only, which although may take some time, it will eventually finish.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

How do you make a superuser?

I have just installed Solaris 11. When I turn the computer on I don't want to see a login in screen. I want to automatically be logged in as "SUPERUSER". My research tells me someone is going to tell me that's not wise or safe. I'm not interested in security advice. If someone I know is... (10 Replies)
Discussion started by: kkeevv
10 Replies

2. UNIX for Dummies Questions & Answers


Hello! I found this on net: This is the ``prompt''. If you entered you username, or your password incorrectly, you will be greeted by: Login incorrect localhost login: Don't panic, try again. Likely you either mis-typed either your login name, or your password. Try again. You're not... (2 Replies)
Discussion started by: pinklemon
2 Replies

3. AIX

[Solved] Find command hangs my terminal session

Hello every one. I know little to nothing about AIX. Recently I have been assigned to an AIX project. For some reason or another the find command is hanging the server. Well it does not hand server per say, it just freezes my terminal session. after running find, I waited up to 40 min and... (3 Replies)
Discussion started by: busi386
3 Replies

4. UNIX for Dummies Questions & Answers

find the no of processes that ran 2 hours before or earlier

Is there a way to find out the total no of processes that were running ? - 2 or 3 hours before - list those no of processes (3 Replies)
Discussion started by: jansat
3 Replies

5. Shell Programming and Scripting

how to find whether a script ran or not

Hi, I have written a script and placed in an application and the script can be executed manually only. But somehow one of the method in the script is being called and bringing the application down. But we are not able to find any instance of script running. Is there a way to findout whether the... (1 Reply)
Discussion started by: Satyak
1 Replies

6. Shell Programming and Scripting

Find hangs with automountd daemon running

Hi, I am trying to find files with specific name using find / -name core -print.. this command is hanging and never completes as it is searching for all the automount filesystems ..i cant eliminate using "! -fstype nfs" as this is not a nfs filesystem pls let me know if anyone know how to... (2 Replies)
Discussion started by: to_bsr
2 Replies

7. Shell Programming and Scripting

to run sql as superuser

hi All, In my script I want to run some drop and select statements in the same host as a different user.I am inputting password for the superuser from the user who will be executing the script. ie , I would be greatfull to you experts if you could suggest me how to proceed. (4 Replies)
Discussion started by: Sreejith_VK
4 Replies

8. UNIX for Dummies Questions & Answers


Can I create a superuser account in scoadmin? If not how do I do it via command line (0 Replies)
Discussion started by: maconte
0 Replies

9. UNIX for Dummies Questions & Answers

superuser password change

how can i change the superuser password? the admin left the company, and we want to change the password. to gain su access, i use: # su - password:***** (old password) then, using passwd command it changes my own login password, not the root?? (this is not trying to block anybody's... (4 Replies)
Discussion started by: apalex
4 Replies
Login or Register to Ask a Question

Featured Tech Videos