LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-21-2006, 09:02 AM   #1
simber
LQ Newbie
 
Registered: Nov 2005
Location: Ankara
Distribution: SuSE 9.2
Posts: 24

Rep: Reputation: 15
Question A regularly executing "find" command without my intention freaks me


Hello everyone,
There is a find command running on some regular intervals without my intention, and I want to understand what it does. It has may regex in it and I am a bit alien to those regex stuff, so can someone please translate it to me (especially this \(^/mnt$\)\|\(^/cdrom$\).... part)? and how come there is some parenthesis after directory to be searched? Anyway, here's the output of the command via
Code:
 ps -aux | grep 'find'
: Thanks in advance!

Code:
/usr/bin/find / ( -fstype nfs -o -fstype NFS -o -fstype proc -o -fstype afs -o -fstype proc -o -fstype smbfs -o -fstype autofs -o -fstype iso9660 -o -fstype ncpfs -o -fstype coda -o -fstype devpts -o -fstype ftpfs -o -fstype devfs -o -fstype mfs -o -fstype sysfs -o -fstype shfs -o -type d -regex \(^/mnt$\)\|\(^/cdrom$\)\|\(^/tmp$\)\|\(^/usr/tmp$\)\|\(^/var/tmp$\)\|\(^/var/spool$\)\|\(^/proc$\)\|\(^/media$\) ) -prune -o -print0
 
Old 05-21-2006, 11:04 AM   #2
rjwilmsi
Member
 
Registered: Mar 2005
Location: UK
Distribution: opensuse 12.2 x86_64
Posts: 563

Rep: Reputation: 38
^ means 'not'
$ means at the end of end of a line
| means or
Brackets make an expression rather than a list of separate characters, so here brakcets makes /tmp an expression and not / and t and m and p.
The backslashes \ seem to be the syntax for this particular command (?)

It looks like this regex is excluding a list of directories from being searched.
 
Old 05-21-2006, 11:29 AM   #3
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Quote:
Originally Posted by rjwilmsi
^ means 'not'
To my knowledge it represents the beginning of a line unless contained in square brackets. So the regular expression tells find which directories to examine.

The parentheses are just logical grouping. I guess that this command is issued by one of the scripts in /etc/cron.daily, but I couldn't find it in SUSE 10.1. If that's the case, moving the script to /etc/cron.weekly probably won't do much harm, so that it won't be executed that often at least.
 
  


Reply

Tags
regex


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 08:42 AM
executing a loaded module returns "command not found" error neelay1 Linux - Software 1 05-08-2006 03:25 PM
Not able to Run/find "configure" command aaryan72 Linux - Newbie 4 09-10-2005 12:16 PM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 03:32 PM
Help,I can't find my USB mouse when I run "kudzu" command in RH9. aeolus Red Hat 0 03-27-2004 10:14 PM


All times are GMT -5. The time now is 11:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration