System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Find command getting hanged while finding sshd_config files.

 
Reshma Malusare
Trusted Contributor

Find command getting hanged while finding sshd_config files.

Hello Experts,

I have one script and in which find is searching sshd_config files on the system.

find / -local -name sshd_config -exec ls -la {} \;

When i run the command, its getting hanged.

I chekcked files are present on the system /opt/ssh/etc/sshd_config ,/opt/ssh/newconfig/opt/ssh/etc/sshd_config, /opt/ssh/src/ssh/sshd_config.

But still why my command is getting hanged???
4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: Find command getting hanged while finding sshd_config files.

Is it hung or just slow? Does top(1) show it stopped or still trying to find those files?
What happens if you start from /opt/ssh?
If you expect to find a lot of files, you should change your -exec to:
-exec ll -a {} +
john123
Trusted Contributor

Re: Find command getting hanged while finding sshd_config files.

HI,

The command you issued may be making your system busy by checking all the filesystems and directories under root . Restrict the search to the directory or filesystem where the file resides,And -xdev option also very helpful in such situations if u want to restrict the search to the mount points.

regards
John
Highlighted
Reshma Malusare
Trusted Contributor

Re: Find command getting hanged while finding sshd_config files.

Well.. we have to use this command only as its in script...

so we have to find out why system is getting hanged after this command? why command is not showing outputs though files are present.

Dennis Handly
Acclaimed Contributor

Re: Find command getting hanged while finding sshd_config files.

>we have to use this command only as its in script...

Does that mean you can't improve the script?

>so we have to find out why system is getting hung after this command? why command is not showing outputs though files are present.

You need to prove it is hung. Is it trying to scan some NFS directory?
Does it work if you just start at /opt?

You can also use: find / -local
And see if that hangs.