Tag: name resolution

Today I was working with Solaris and after I had set up the NIS+, DNS server, IP Address and completing the basic setting. I was using the pkg-get util from the freesunware.com

The utility was using wget and it was failing constantly. From the looks of it, it was very clear that the wget utility was unable to find the IP address from the name. Name resolution was not happening, while dig and nslookup was able to do the DNS lookup.

After searching for quite sometime all that I could see was, in one of the forums, \”Did you have NIS enabled?\”

That seemed interesting and thus I got the direction to look for where I can find the solution. And finally I found that in \”nsswitch.conf\” there were settings to find how the various lookups should happen.

For the host entry, I saw that after looking at the nis the lookup would end so I changed the sequence to look at \”files dns\” also and then quit. And it worked. Hope it helps you too 🙂

There are also lots of blogs, tutorials and other articles on find command on the web, so why write another one. Because it\’s worth every word spent on it 🙂
find is a very powerful command, let\’s see how (options for find command from man page and usage):

–depth — Process each directory\’s contents before the directory itself.
–maxdepth — Descend at most levels (a non-negative integer) levels of directories below the command line arguments.
–xdev — Don\’t descend directories on other filesystems.
–executable — Matches files which are executable and directories which are searchable (in a file name resolution sense).
This takes into account access control lists and other permissions artefacts which the -perm test ignores.
–iname — Like -name, but the match is case insensitive.
–nogroup — No group corresponds to file\’s numeric group ID.
–nouser — No user corresponds to file\’s numeric user ID.
–flsfile — True; like -ls but write to file like -fprint.
–okcommand — Like -exec but ask the user first (on the standard input);
–print0 — True; print the full file name on the standard output, followed by a null character
(instead of the newline character that -print uses).
–printfformat — True; print format on the standard output, interpreting \’\’ escapes and \’%\’ directives.

There are lot of other options but these are worth mention not used on regular basis. The printf option requires
special mention as the number of options that it supports is quite large and can reallyl help you in the formatting
the data that you get, as well as help you get the data that you want.

Example:
1) Get names of files bigger than 5M

find . +5M -printf \”Name : %20f Size : %s\\n\”

2) delete files (filenames contain spaces or quotes and so on)

find . -name \”name*\” -print0 |xargs -0 rm -f

Updated 28th May: Realinged for issues with post going into the sidebar 🙁