Computing.Net > Forums > Unix > can this be done in Unix?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

can this be done in Unix?

Reply to Message Icon

Name: Danty
Date: February 22, 2002 at 11:45:12 Pacific
Comment:

can this DOS command be done in unix: 'dir/s "wildcards+part/file name"' with the unix ls command?

i.e. dir/s .login <-- searches all dirs for the .login file



Sponsored Link
Ads by Google

Response Number 1
Name: James Boothe
Date: February 22, 2002 at 14:29:05 Pacific
Reply:

find . -name .login

will search current directory, recursively, or you can change the dot to any desired directory. Output is like:

./scripts/.login

Or filename pattern search:

find . -name "*log*"

Do "man find" to read the manual on find. You can search based on many different attributes at one time, such as file ownership, size, age, etc. Also, you can specify a command to execute on each of the qualifying files (such as to remove them).

For ls, R makes it recursive, and the a flag makes it include hidden files, so

ls -Ra

will do a directory listing of your current directory tree, or throw in the l flag to make it the long format:

ls -Rla

If you then filtered that with grep:

ls -Ra | grep .login

you could see if you have any of those filenames in the tree, but you would not be able to tell in which subdirectories they were.


0

Response Number 2
Name: vikram
Date: February 24, 2002 at 13:13:45 Pacific
Reply:

why to do all this ? y don't u use the MC or the FD shell ? Its much better u can do a lot using the 2 shells i mentioned


0

Response Number 3
Name: James Boothe
Date: February 25, 2002 at 07:42:41 Pacific
Reply:

In the first place, "all this" as you refer to it was a single very simple command (find . -name .login) which was the answer to Danty's question. I then went on to mention that the same command has many options (switches) to control a search, and then explained why the ls command that Danty mentioned was not good for tree search.

Secondly, most people want to become proficient in the more common unix shells since those are the ones in use on all the main platforms. The MC and FD shells are certainly not in this category. Have you already mastered sh, ksh and bash? Until you have, how do you know their power?


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


netatalk problems with dd... vfstab



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: can this be done in Unix?

removing CR in middle of eachrecord www.computing.net/answers/unix/removing-cr-in-middle-of-eachrecord/5131.html

getting table names from sqls www.computing.net/answers/unix/getting-table-names-from-sqls/8466.html

Help to delete rows in a file www.computing.net/answers/unix/help-to-delete-rows-in-a-file/3751.html