The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Pseudo-terminal will not be allocated because stdin is not a terminal. Shivdatta UNIX for Advanced & Expert Users 1 08-04-2008 07:29 AM
code that reads commands from the standard i/p and executes the commands Phrozen Smoke High Level Programming 4 01-21-2007 11:06 PM
HP UX Terminal Help gpta_varun HP-UX 0 05-11-2005 11:16 AM
like to have fun in terminal collins UNIX for Advanced & Expert Users 4 10-14-2004 02:28 PM
connecting to unix through hyper terminal - as a dumb terminal michelle UNIX for Advanced & Expert Users 2 11-05-2001 12:32 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-15-2003
Registered User
 

Join Date: Dec 2003
Posts: 4
Terminal Commands

Hi there. Linux newbie and I'm trying to find commands to:

Display number of executable files in a directory that i supply and list them in alphabetical order

Back up all the files in the current irectory to a directory i supply, creating that directory if it's not allready there

Cound number of occurances of a file name that i provide in the file system.

Any help would be really appreciated!
Cheers
Forum Sponsor
  #2  
Old 12-15-2003
Registered User
 

Join Date: Dec 2003
Location: India
Posts: 50
Well to find out whether a file is executable under a directory, I cannot think of any command as such present in unix, I doubt whether there is any. You can use this script to find out the executable file
Code:
#!/bin/sh

for i in `ls -1`
do
        if [ -x $i ]
        then
                echo $i
        fi
done
Others I need to try

Cheers
JK

added code tags for readability --oombera

Last edited by oombera; 02-19-2004 at 09:27 AM.
  #3  
Old 12-15-2003
Registered User
 

Join Date: Dec 2003
Location: India
Posts: 50
For second query

cp -R JUNK JUNK1

JUNK is the existing directory
JUNK1 is the non-existing directory, if the directory exists then JUNK will be its sub-directory

For third query

find ./ filename

It will search the whole of the file system and will take lot of time

Cheers
  #4  
Old 12-15-2003
Registered User
 

Join Date: Dec 2003
Posts: 4
That's great thanks very much, but do you know how I would get it to *count* the number of occurances of a filename within the file system, rather than just list the filenames?

Thanks for your help so far, much appreciated.
  #5  
Old 12-15-2003
Registered User
 

Join Date: Dec 2003
Location: India
Posts: 50
find ./ filename | grep -x "filename" | wc -l

It would have been better if you had come with this solution rather than me, just try around and play with unix you can find lot more stuffs and you can also learn more

Cheers
  #6  
Old 12-15-2003
Registered User
 

Join Date: Dec 2003
Location: India
Posts: 50
You can use also this, this is much simpler

find / -name filename | wc -l

Regards
JK
Google The UNIX and Linux Forums
Closed Thread

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:47 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0