Archive for November, 2008

If you want to extract just the audio track from video and still maintain the quality of the audio track, then you need to use Video MP3 Extractor from GeoVid.

This tiny program will install in seconds and will allow you to tracks from any video encoded in AVI, ASF, WMV formats and output the file in MP3 format and it is released as freeware.

Read the rest of this entry »

There are many reasons that you want to know your public IP address and getting that is easy by visiting some of the sites that allow you to view that information, but what if you wanted to do it from the command line? What if you wanted to script that? To upload the result to a web page? Or to email it?

There is a quick and easy way of doing it from the command line.

In Linux or any other UNIX based system, open terminal window or ssh to your server and type the following at the command prompt.

wget -qO - http://www.whatismyip.org

In Windows, if you haven’t done already, download and wget from this location, extract it to your c:Windows or C:Windowssystem32 folder and then open a command line box and type the same command in the above in the command box.

On Linux/UNIX systems, curl http://www.whatismyip.org has the same result for the wget command above.

While it is not new that Youtube videos can be downloaded to a local drive, now you can convert the format to a Windows or Mac friendly formats even before downloading the videos to your local drive.

This has been done using expensive software in the past, but now it is done online, and for free.

To do this, you can visit http://www.vixy.net/ provide the link to the Youtube video that you want to download, choose the format that you want to download that video in, which currently supports AVI for Windows (Divx+MP3), MOV Windows and Mac (MPEG4+MP3), MP4 for iPod (MPEG4+AAC), 3GP for mobile devices (MPEG4+AAC), or MP3 (Audio only), which means that you can even rip sounds, sound effects, and songs from the posted youtube videos.

Please note that on Windows, in order to play the AVI files you must have a DIVX or XVID codec installed.

I recommend installing XVID codec package for Windows from this location.

This is “find” command tutorial.

The command find will search location you specify for files that match the supplied search criteria.

The search is recursive which means that find will search the location that you specify and all the subdirectories that it find in there.

If you type

# find –help

You’ll see the help text which starts by listing:

Usage: find [path...] [expression]

Default path is the current directory; default expression is -print
expression may consist of: operators, options, tests, and actions.

To simplify it, look at it like this.

find path criteria action

Examples:

# find / -name httpd

Will located any file or folder named httpd searching recursivley from the root path and downwards.

Depending on your configuration, that might take a while since you are searching the whole OS installation.

On my Cent OS server the output looks like.

/var/log/httpd
/var/lock/subsys/httpd
/usr/include/httpd
/usr/lib/httpd
/usr/sbin/httpd
/etc/logrotate.d/httpd
/etc/rc.d/init.d/httpd
/etc/sysconfig/httpd
/etc/httpd

Please note that if find doesn’t locate any matching files, there will be no output.
You also will see an error message on each directory that you don’t have access permissions to.

You can specify as many places as you want to search in, for example:

# find /var $HOME /bin -name history

This will search /var, your home directory and /bin for files name history.

You can use wildcards in the file name argument.

# find / -name mail*log

This will search the whole system for any file with a name that begins with mail and ends with log.

Another way of specifying wildcards in your search is

# find / -name ‘*.log’

This will find all the files in your system that have the .log extension.

If you want to find more than one type of files, use the following:

# find / -name ‘*.log’ -o -name ‘*.pid’

This will find all the log and pid files on your system.

To find a list of the directories, use the -type specifier. Here’s an example:

# find . -type d

This is a basic tutorial, as find is very customizable and powerful command.

Please refer to the full usage of find by typing.

# man find

In your shell.

PSkill is part of Microsoft’s Sysinternals collection of free tools.

You can get PSKill as a part of PsTools collection from here.

To use pskill you either have to be in DOS command (cmd) window or download and install PowerShell.

Usage: pskill [-t] [\computer [-u username [-p password]]] <process ID | name>
-t      Kill the process and its descendants.
-u     Specifies optional user name for login to remote computer.
-p     Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password.

process ID | name    The process or processes to be killed.

-Help   Displays the supported options.

For example

>pskill \home-computer firefox

You can also use pslist (with the same syntax) to list processes on the remote or local computer and then use the resulting name and ID of the processes in pskill.

I have one server hosted by a third party which runs Red Hat Enterprise Linux 4 and it doesn’t have yum installed.

To install yum on Red Hat Enterprise Linux 4 you need to install the dependencies first.

Here is a quick and dirty way of doing it.

First download all the required packages.

Download the main yum rpm.

# wget http://dag.wieers.com/rpm/packages/yum/yum-2.4.2-0.4.el4.rf.noarch.rpm

Now download the dependencies…

# wget ftp://fr2.rpmfind.net/linux/PLD/dists/ac/ready/i386/libsqlite-2.8.15-1.i386.rpm

# wget ftp://rpmfind.net/linux/dag/redhat/el4/en/i386/dag/RPMS/python-elementtree-1.2.6-7.el4.rf.i386.rpm

# wget ftp://rpmfind.net/linux/dag/redhat/el4/en/i386/dag/RPMS/python-sqlite-0.5.0-1.2.el4.rf.i386.rpm

# wget ftp://rpmfind.net/linux/dag/redhat/el4/en/x86_64/dag/RPMS/python-urlgrabber-2.9.7-1.2.el4.rf.noarch.rpm

Note: Each one of the above should be on ONE line.

Now we need to install the packages.

First we install the dependencies.

# rpm -ivh libsqlite-2.8.15-1.i386.rpm

# rpm -ivh python-elementtree-1.2.6-7.el4.rf.i386.rpm

# rpm -ivh python-sqlite-0.5.0-1.2.el4.rf.i386.rpm

# rpm -ivh python-urlgrabber-2.9.7-1.2.el4.rf.noarch.rpm

Now we are ready to install yum.

# rpm -ivh yum-2.4.2-0.4.el4.rf.noarch.rpm

Add a repository to the current ones that are installed by default.

# wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm

# rpm -ivh rpmforge-release-0.3.6-1.el4.rf.i386.rpm

Now run the following commands to update and upgrade all packages.

# yum update

# yum upgrade

If you would like to add more repositories to your Yum installation, please look here for instructions.

Some 3rd part repositories have their own rpm that you can use.

Here is how to do it manually in Cent OS.

For example if you have a repository that exists at subdomain.domain.com.
Note: Replace subdomain, domain, and com with your link.

# cd /etc/yum.repos.d

Add a file that points to the repository name and location.

# nano subdomain

Now type the following in the new file (or copy/paste the following changing the names and locations to the correct repository):

[subdomain]
name=Subdomain for RHEL/ CentOS $releasever – $basearch
baseurl=http://subdomain.domain.com/centos/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://subdomain.domain.com/RPM-GPG-KEY.txt

Save the changes and then exit out of nano.

Now import the PGP keys for the repository.

# rpm –import http://subdomain.domain.com/RPM-GPG-KEY.txt

Now run your update and upgrade processes.

# yum update

# yum upgrade

And you are now ready to install packages from the new repository.

Netsh.exe is fantastic tool from Microsoft that allows administrators and users to monitor and change networking for Windows from the command prompt.

For the full options and switches that can be used with the command, type

netsh /?

Followed by Enter to view the list.

Here are some examples that you can use.

To view your TCP/IP settings type.

netsh interface ip show config

To set your network interface named Local area connection IP address to static and supply the values

netsh interface ip set address name=”Local Area Connection” static <IP> <Subnet mask> <Gateway>

For example

netsh interface ip set address name=”Local Area Connection” static 192.168.1.15 255.255.255.0 192.168.1.1 1

Note the above should be on one line.

To configure “Local Area Connection” to obtain IP address and others through DHCP.

netsh interface ip set address “Local Area Connection” dhcp

To specify DNS server for an interface.

netsh interface ip set dns “Local Area Connection” static 192.168.1.17

To specify WINS server for an interface.

netsh interface ip set WINS “Local Area Connection” static 192.168.1.17

To export your current network settings including IP address and others, type the following.

netsh -c interface dump > <path to network settings file>

For example.

netsh -c interface dump > c:networksettings.txt

To import settings from a file previously dumped.

netsh -f <path to network settings file>

For example.

netsh -f c:networksettings.txt

To reset the TCP/IP stack to default,

netsh interface ip reset C:resettcpiplog.txt

To turn the Windows firewall off

netsh firewall set opmode disable

To turn it back on

netsh firewall set opmode enable

To disable firewall on computer in a domain environment.

netsh firewall set opmode mode=DISABLE profile=DOMAIN

Gathering firewall status and configuration information

Netsh firewall show state
Netsh firewall show config

To allow a port through firewall.

netsh firewall add portopening <protocol> <port> <descriptiveName> [mode] [scope [addresses]] [profile]

The above should be on one line.

Please note that

*  protocol is TCP, UDP or ALL;
* port is a port in the 1-65535 range;
* descriptiveName is a descriptive name, surrounded in quotes if it contains spaces;
* mode is ENABLE or DISABLE;
* scope is ALL, SUBNET or CUSTOM. If you use CUSTOM then you must specify the addresses;
* addresses if the scope field is set to CUSTOM, this field is a comma-separated list of allowed addresses;
* profile is CURRENT, DOMAIN, STANDARD or ALL.

To delete the firewall exception.

netsh firewall delete portopening <protocol> <port>

Here is the reference page directly from Microsoft.

If you notice that you are not getting security updates after installing Windows XP Service Pack 3, then you are one of the unfortunate people that got hit by that mysterious bug/behavior of SP3.

Follow these steps to correct this issue.

1. Log on as an administrator, or as a user that has administrator access.

2. Click start, Run, and then type CMD, and then click OK.

3. From the DOS command box, issue the following commands, hitting the enter key after each one.

net stop wuauserv

cd windowssystem32

regsvr32 wups2.dll

net start wuauserv

4. Windows should start receiving Windows updates from now on.

Microsoft decided to have this approach that other opertaing systems have (hide the administrator account access from the average user) to prevent security problems.

The account is added during initial setup but is set to be inactive, that is why the user doesn’t see it.

If you want to enable that account, please follow these steps:

1. Open a command box as an administrator.

Click Start, Programs, Accessories, and then right-click the Command Prompt icon, and then choose “Run as administrator” to open it.

2. Now type the following command:

net user administrator /active:yes

3. Hit the Enter key.

4. You should see a message that the command completed successfully.

5. Log out, and you’ll now see the Administrator account as a choice.

Note: You can reverse the changes by issuing this command.

net user administrator /active:no