Issues I'm having with the Find Command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Issues I'm having with the Find Command
# 1  
Old 05-06-2009
Question Issues I'm having with the Find Command

Smilie

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 :P

Last edited by curtner; 05-06-2009 at 04:03 PM..
# 2  
Old 05-06-2009
Hammer & Screwdriver You asked a lot of questions

Here are a couple answers to get you started:

to find files that a shell scripts (names ending with .sh)
Code:
> find . -name "*.sh"       
./file8.sh
./fid_test/fmr_comb.sh
./proc13.sh

finding files, and then doing a long listing
Code:
> 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.
# 3  
Old 05-06-2009
========================================================================
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

Last edited by curtner; 05-06-2009 at 06:30 PM..
# 4  
Old 05-06-2009
Data Homework?

Looks a lot like a school or homework assignment.
Not allowed, per site rules
The UNIX and Linux Forums - Forum Rules
# 5  
Old 05-06-2009
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. Smilie


+ 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 :P

Last edited by curtner; 05-06-2009 at 04:32 PM..
# 6  
Old 05-06-2009
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:
    1. -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'
    2. -type tells find what type of entry you want: d for directories, f for files, l for symbolic links, ...
    3. -size [+-]size to find entries larger/smaller/equal to given size
    4. -user username belonging to user (-uid if you only have the ID, eg if the user no loger is in /etc/passwd)
    5. same for -group and -gid
  4. actions specify what you want to do with what you found:
    1. -print just prints the path to stdout (default action)
    2. -print0 as above, only as zero-terminated strings (if you've got spaces bugging you)
    3. -exec runs a command, with {} as the placeholder. Needs ; (escaped) to tell it when the command line ends
    4. -ls list, like ls -l

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.
# 7  
Old 05-06-2009
Well you shouldn't fly to oklahoma I think you get lost in our database Smilie

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 Smilie
==================================================================================================== =======
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
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find command with Ignore Access issues

Hi, I am using following command to find a specific file. find . -name "find*.txt" -type f -print I am issuing that command at root directory since I don't know in which sub folder that file is getting created from some other process. As I am not having access to all directories, my... (3 Replies)
Discussion started by: RameshCh
3 Replies

2. UNIX for Dummies Questions & Answers

Db2 command issues with cron

Hi, I have a very simple script that queries from a DB2 table. The script has 3 parts - (i) Sets the db2profile (ii) connects to db2 using credentials (iii) executes the query.This script works fine if i run it manually from the command prompt. However when scheduled in crontab, it proceeds... (2 Replies)
Discussion started by: VeePee
2 Replies

3. Shell Programming and Scripting

Issues in sed command

I use SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux We have a user-defined command called "submit" which will open a vi terminal in which we need to enter the description at 24th line and save it. In order to simplify this, i decided to create another command in which the... (3 Replies)
Discussion started by: pandeesh
3 Replies

4. Shell Programming and Scripting

Issues in grep command in Linux

Hi All I have a file containing following records: $HEW_TGT_DB2_USER=hbme_bi2 $prmAttunityUser=ais $DS_USER=hbme_bi2 $prmStgUser=hbme_bi2 $prmuser=hbme_bi2 $prmStgPass=hbme_bi2 $prmpwd=hbme_bi2 $prmAttunityUser=ais Say suppose the name of the file is test4.txt When i fire this... (5 Replies)
Discussion started by: vee_789
5 Replies

5. Shell Programming and Scripting

Issues with automating SFTP command

Hi All, I am currently looking at automating the steps that I follow to download log files from putty to desktop. I connect to a client's machine through citrix desktop. I am required to download quite a number of application logs to identfiy the issues in production. Steps that is being... (3 Replies)
Discussion started by: krackjack84
3 Replies

6. UNIX for Dummies Questions & Answers

Issues with Makefile (cannot find )

Hello guys ! Need a bit of help is compiling a code, the makefile for which was originally designed to work on a 32-bit Linux platform, for a 64-bit Linux platform. My platform is Ubuntu 10.04 LTS 64-bit. I am trying to compile a code called csim, file name csim-1.1.tar.gz. To compile this... (0 Replies)
Discussion started by: pbhat
0 Replies

7. UNIX for Dummies Questions & Answers

mget command issues

Hi I am trying to get 3 files sitting on a FTP server to an application server. All 3 files are .csv files. I am using mget *.csv and it transfers only 2 files. the 3 files contain a common word in their file names "Report". I tried mget *Report*.csv and that gets me 2 files as well. ... (3 Replies)
Discussion started by: bobsn
3 Replies

8. UNIX for Dummies Questions & Answers

having issues in using Cut Command

Hi, I would like to ask for your help with my problem, im writing a unix script to remove characters before the symbol "/", but the one being removed are characters after the symbol. Ive searched over the internet and found no answer.. hope you can help me with this. sample: text... (2 Replies)
Discussion started by: paoie
2 Replies

9. Shell Programming and Scripting

kill command issues

xxxxxx (8 Replies)
Discussion started by: kitty123
8 Replies

10. UNIX for Dummies Questions & Answers

cal command display issues

I am using AIX version 5.3 I like the cal function because I can print a nice concise view of the calendar for the whole year. I want the calendar to display with 3 months across instead of 2, which is what is happening. My terminal display is set with 67 rows and 140 columns so that should... (0 Replies)
Discussion started by: ruddydaggerwing
0 Replies
Login or Register to Ask a Question