Archive for the 'Windows' Category

Windows: Grep for windows

Monday, May 2nd, 2011

If you don’t have access to a Unix environment on your windows box, you can still search files with findstr. The findstr command will allow you to search files close to the same way as grep.

findstr /S "search string"

will recursively find your string in the current directory and subdirectories.

There are more options that you can find if you run the following command:

findstr /?

will show you the help message.

Tags: ,

Edit the hosts file

Monday, November 1st, 2010

If you have every wanted to set certain IP addresses in your network without depending on a nameserver, you can edit the ‘hosts’ file in your operating system.  This can be done to stop access to any inappropriate sites as well.

The hosts file in Windows is:

%systemroot%System32driversetchosts

This is typically  in:

c:windowsSystem32driversetchosts

On linux this file is:

/etc/hosts

The common layout of the file is

<IP address> hostname [hostname]

So if would look something like this:

127.0.0.1  localhost
192.168.2.222 homeserver homeserver.mydomain.net
127.0.0.1 badlocation

Remember that these lookups happen before looking to a nameserver. So this will override any name lookup. So if you happen to do this on a laptop that you regularly use outside of your home network, make sure that you do not override an address that might be needed when you are not at home.

You will need appropriate privileges to access the file. So you may have to be root or use sudo on Linux and you may have to open an editor as administrator before opening the file on Windows.

Tags: ,