Useful asset management tool and system commands

1.  Belarc Advisor, an extremely useful “asset management” application that everyone including the individual user can benefit from. When the Advisor is run it generates the ultimate page listing everything about a computer: its serial number, all software installed, its product license keys, etc. If you ever need to re-install the operating system you will be extremely grateful to have all this info, especially the Windows product key if you use Windows. As a rule I run Advisor on every machine I have and save the file in a safe location on an external drive for future reference.

2. If you’re dealing with backups or disk space issues the following shell commands are highly useful. They require Cygwin to be installed on a Windows system. Cygwin is so important to Windows I won’t even say much about it other than it should always be installed without question.

Find out how large a directory is:

du -sh

or if you want a more detailed output on the size, use k instead of h and the output will be in kilobytes

Find out how many files are in a directory:

ls -R somedir |wc -l

Make a backup:

(under Windows, requires the optional package rsync to be installed in Cygwin:)
rsync -rRv --size-only sourcedir backupdir

For example one would run the following in a Cygwin shell on a typical Windows system. This assumes you have an external backup drive which is set to drive letter M. The backup is for a machine named x60:

mkdir -p /cygdrive/m/Backups/x60-2013.10.22-backup/

cd /cygdrive/c

rsync -rRv --size-only Users/me/ /cygdrive/m/Backups/x60-2013.10.22-backup/

What is so awesome about this is that when it backs up to the M: drive you will see a folder structure like this:

-Backups
     |
     –x60-2013.10.22-backup
             |
              –Users
                  |
                   –me

it will be an exact mirror of what is actually under Users/me on the C: drive and all the data will be accessible just as it normally is through Windows Explorer.