Issues I'm having with the Find Command

:confused:

I've been trying to display all my files in my /tmp directory when I'm in it. I just can't get the darn find command working...
And I've been trying to look at my /tmp directory on my home directory and I know I'm messing something up there..
Another issue I had while back but never seemed to post it is trying to list all the files in /usr/bin/ looking for a names with Y or like any letter really..
Also wanted to find the right way of looking at files in the /etc directory that begins with a letter I keep messing up by using find /etc -name 'wa*'
and I wanna give their long listings. as well. And wanting to do a interactive confirmation to the long list of the files in the /etc i wanted to search for.
Some thing I want double check for you guru's out there~!
I'm needing to learn how to create a file that holds all the names of files /lib/ directory that begin with any letter. I got something like tar -cczf files.tar.gz w* but that can't be right for the lib directory....
Want to double check on this one as well in my /lib/ directory i got a files that start with Unerical larger than 40 blocks I keep need help i got this find /lib -name 'u*' -size +40 trying to see if that correct by your guys eye's

and I got another one I don't I listed this one to be looked over wanted to list all of the directories under my /etc directory
by my guess its (find /etc -type d) if thats correct just tell me i'm not sure when Im doing it.

Thanks! If this looks weird its how I type :stuck_out_tongue:

Here are a couple answers to get you started:

to find files that a shell scripts (names ending with .sh)

> find . -name "*.sh"       
./file8.sh
./fid_test/fmr_comb.sh
./proc13.sh

finding files, and then doing a long listing

> find . -name "*.sh" -exec ls -l {} \;
-rwxrwx--- 1 abc dp 40 Mar 31 10:31 ./file8.sh
-rwxrwx--- 1 abc dp 7485 Apr 30 12:55 ./fid_test/fmr_comb.sh
-rwxrwx--- 1 abc dp 104 Apr 22 13:40 ./proc13.sh

Try to build off of these two.

========================================================================
I wanna display a list of all files in the /tmp directory. Make /tmp making /tmp my current directory

=================================================================
From My home directory, display a list of all of the files in the /tmp directory as well

=====================================================================
I need to display a list of all of the files under the /etc directory that begin with the letters �ls�
find /etc -name "ls" alright I'm geting the find command more *NOTE This works

I need to display a list of all of the files in the /etc directory that begin with the letters �ls� this time giving their long listings
find /etc -name "ls" -exec ls -l {} \; I Think I know how to do that one now joey Thanks buddy *NOTE This works

Below this I need help on just

redo 5 but I need it to be this time requiring interactive confirmation to long list each file which has been killing me

===========================================================================================================
needing to make a file containing the names of all the files in the /lib/ directory that have names that begin with �u� there should be a simple command

===========================================================
Find all files under the /usr directory that are owned by the userid �uucp�

find / -type f -user uucp this isn't working I need help on this command

Looks a lot like a school or homework assignment.
Not allowed, per site rules
The UNIX and Linux Forums - Forum Rules

no its not i've read the rules I'm just trying to learn them and find my way around using my putty with my unix program + Helps me at my job! work for a IT Speicalist at the Int Airport in oklahoma and we do use unix and green screens and etc. :smiley:

+ this system is hard to learn even if I'm only been using it for like 6 months a work and I'm the Team Lead that has to know every thing :stuck_out_tongue:

Remind me not to fly to Oklahoma (or even anywhere near the airspace) in the foreseeable future.

Quick overview of find:

  1. General syntax: find [path] [command [parameter]]+ [action [parameter]]
  2. path can be anything from . (current dir) to a list of directories to search
  3. command specifies what you want to find:
    [list=1]
  4. -name is used most often, it specifies the name (Duh) of the object you're looking for. y* will look for entries starting with y (yes, yep.txt, yargh.bin, ...), desaster*.doc will look for 'desaster_plan.doc', 'desaster-will-happen.doc', ..., but not 'omgwereallgoingtodie.doc'
  5. -type tells find what type of entry you want: d for directories, f for files, l for symbolic links, ...
  6. -size [+-]size to find entries larger/smaller/equal to given size
  7. -user username belonging to user (-uid if you only have the ID, eg if the user no loger is in /etc/passwd)
  8. same for -group and -gid
    [/list]
  9. actions specify what you want to do with what you found:
    [list=1]
  10. -print just prints the path to stdout (default action)
  11. -print0 as above, only as zero-terminated strings (if you've got spaces bugging you)
  12. -exec runs a command, with {} as the placeholder. Needs ; (escaped) to tell it when the command line ends
  13. -ls list, like ls -l
    [/list]

There's a lot more (boolean expressions, ...), look those up in the man page.

If you want to learn UNIX a bit quicker (and with less lives on the line), install Linux || OpenSolaris || *BSD at home.

Well you shouldn't fly to oklahoma I think you get lost in our database :smiley:

This is what I'm still having problems with

========================================================================
I wanna display a list of all files in the /tmp directory. Make /tmp making /tmp my current directory

=================================================================
From My home directory, display a list of all of the files in the /tmp directory as well

=====================================================================
I need to display a list of all of the files under the /etc directory that begin with the letters �ls�
find /etc -name "ls" alright I'm geting the find command more *NOTE This works

I need to display a list of all of the files in the /etc directory that begin with the letters �ls� this time giving their long listings
find /etc -name "ls" -exec ls -l {} \; I Think I know how to do that one now joey Thanks buddy *NOTE This works

Below this I need help on just

redo 5 but I need it to be this time requiring interactive confirmation to long list each file which has been killing me

there is a switch like the exec switch from the one above that asks for confirmation before it does whatever it does. which I don't know :smiley:

needing to make a file containing the names of all the files in the /lib/ directory that have names that begin with �u� there should be a simple command

===========================================================
Find all files under the /usr directory that are owned by the userid �uucp�

find / -type f -user uucp this isn't working I need help on this command

What have you tried so far?

Only that you're searching for files ending in ls, not starting with as you said.

Again, what have you tried? What's the error message, if any? What do you get instead of the desired output?

Mind though, I'm not trying to be mean. But from your postings up to now it seems like you're expecting us to do your work. So I'd suggest you reading the man page of find (on the command-line, enter "man find"), and then lets take a look at any questions that still remain.

Update down below

=====================================================================
I need to display a list of all of the files under the /etc directory that begin with the letters �ls�
find /etc -name "ls" alright I'm geting the find command more *NOTE This works

I need to display a list of all of the files in the /etc directory that begin with the letters �ls� this time giving their long listings
find /etc -name "ls" -exec ls -l {} \; I Think I know how to do that one now joey Thanks buddy *NOTE This works

Below this I need help on just

redo it and I need it to be this time requiring interactive confirmation to long list each file

==================================================================================================== =======
needing to make a file containing the names of all the files in the /lib/ directory that have names that begin with �u� there should be a simple command

===========================================================

Note this is all I have left to learn!

I'm out of ideas on these's too I'm Burned out.

From the man page of find:

Just like your search for files in /etc starting with ls, you only have to add a redirection '>' at the end.

Can you post the version of unix "uname -a". It it very old?

Assuming the files exist, this command should work in most versions of unix. The trailing "/" in "/usr/" is deliberate in case you have an old SCO unix.

find /usr/ -follow -type f -user uucp -print

Afterthought: If you are not a root user, you will get error messages searching "/usr".

Well Thanks I I figured it out late last night!:b: