MoonPoint Support Logo


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals

Advanced Search
Sun Mon Tue Wed Thu Fri Sat

Sun, Jan 31, 2016 11:32 pm

Checking the battery charge from the command line on OS X

On a laptop running Apple's OS X oerating system, it is usually easy to check the state of the battery by just glancing at the top of the screen, but if you connect remotely to a system by Secure Shell (SSH) or just spend a lot of time at a command line interface (CLI), aka shell prompt, which you can obtain using the Terminal app, you may want a way to check the battery charge level by issuing a command from a command line. If so, you can use pmset -g batt (note: use "batt" not "battery").
$ pmset -g batt
Currently drawing from 'AC Power'
 -InternalBattery-0	100%; charged; 0:00 remaining
$ pmset -g batt
Currently drawing from 'Battery Power'
 -InternalBattery-0	86%; discharging; (no estimate)

In the first instance of the command being issued above on a MacBook Pro laptop, the power cable was plugged into the laptop and it was charging. In the second instance, the power cable was disconnected and the internal battery is discharging.

[/os/os-x] permanent link

Sat, Jan 30, 2016 10:08 pm

Locating a MySQL password in the Bash history file

If you need to recover a forgotten MySQL or MariaDB password, if the password was entered at a shell prompt while starting either program with the mysql command and the user's account uses the Bash shell, you may be able to find the password in the Bash history file for the user's acount, which is .bash_history in the user's home directory. E.g., if the user entered the command below:
$ mysql --user=users_acct --password=users_password

If you viewed the contents of the Bash history file for that user's account you would see the command with the password just as you would see other commands entered from the user's account. E.g., if the user's account was jdoe:

# grep mysql ~jdoe/.bash_history
mysql --user=users_account --password=users_password

But, if the user entered the command mysql -u users_acct -p and didn't follow the `-p` or `--password` with the password, but, instead, just entered one of those parameters without putting the password immediately after it, that leads to the system prompting the user for the password and the password won't be in the Bash history file.

Note: if the user is still logged in to the account for which you are checking the .bash_history file, you won't see the commands entered during that login session until after the user logs out of the session.

If you are logged into the relevant account or use the su command, which is also referred to as the "substitute user", "switch user", or "super user" command, you can use the history command to view the commands entered at the command line. E.g., you could use history | grep mysql.

[/software/database/mysql] permanent link

Fri, Jan 29, 2016 10:22 pm

Checking the time of the last Time Machine backup

I wanted to check the time a MacBook Pro laptop was last backed up using Apple's OS X Time Machine backup utility without the external USB-attached backup disk drive being connected to the system. The tmutil command can be run from a command line interface (CLI), aka a shell prompt by running the Terminal application which is found in Applications/Utilities. But whenever I issued any tmutil command, even when I prefaced it with sudo, I received the same message: "Unable to locate machine directory for host."

$ tmutil latestbackup
Unable to locate machine directory for host.
$ tmutil listbackups
No machine directory found for host.
$ tmutil compare -s
Unable to locate machine directory for host.

Added:         0B
Removed:       0B
Changed:       0B
$ sudo tmutil latestbackup
Unable to locate machine directory for host.
$ tmutil machinedirectory
No machine directory found for host.
$ sudo tmutil machinedirectory
No machine directory found for host.

If I ran the Time Machine program itself, I saw the message "Your Time Macine backup disk can't be found."

But I was able to get the last backup time even with the backup drive disconnected from the system using the command below:

$ defaults read /Library/Preferences/ Destinations | grep "BACKUP_COMPLETED_DATE"
        "BACKUP_COMPLETED_DATE" = "2015-12-09 13:18:20 +0000";

You can obtain additional information such as the number of snapshots stored on the drive and the date of the oldest complete snapshot of the system's hard drive stored on the backup device using defaults read /Library/Preferences/ Destinations.

$ defaults read /Library/Preferences/ Destinations 
        "BACKUP_COMPLETED_DATE" = "2015-12-09 13:18:20 +0000";
        BackupAlias = <00000000 01760002 0001134d 6163426f 6f6b2050 726f2042 61636b7
5 70730000 00000000 0000d1c1 ef55482b 00000000 0001134d 6163426f 6f6b2050 726f2042 6
1636b75 70730000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000
0000 00000000 00000000 00000000 0002d1c1 ef550000 00000000 0000ffff ffff0000 0900000
0 00000000 00000000 00000000 00134d61 63426f6f 6b205072 6f204261 636b7570 73000010 0
0080000 d1c22795 00000011 00080000 d1c22795 00000001 00000002 00274d61 63426f6f 6b20
5072 6f204261 636b7570 733a4d61 63426f6f 6b205072 6f204261 636b7570 7300000e 0028001
3 004d0061 00630042 006f006f 006b0020 00500072 006f0020 00420061 0063006b 00750070 0
073000f 00280013 004d0061 00630042 006f006f 006b0020 00500072 006f0020 00420061 0063
006b 00750070 00730012 00000013 001c2f56 6f6c756d 65732f4d 6163426f 6f6b2050 726f204
2 61636b75 7073ffff 0000>;
        BytesAvailable = 126685134848;
        BytesUsed = 373078753280;
        DateOfLatestWarning = "2016-01-29 23:42:56 +0000";
        DestinationID = "41935539-CE2A-4F1E-96DC-B67FBC14BCA3";
        DestinationUUIDs =         (
        RESULT = 19;
        SnapshotCount = 30;
        kCSBackupdOldestCompleteSnapshotDate = "2015-07-08 05:04:05 +0000";

If you just want one of those pieces of information, e.g., the oldest complete snapshot date, you can filter the result with grep and, if you don't want to see the text you are searching for with grep, pipe its output into the cut command. E.g. for the oldest complete snapshot date on the drive being used for Time Machine backups you can use the cut command to just display columns 49 to 59.

$ defaults read /Library/Preferences/ Destinations | grep "BackupdOldestCompleteSnapshotDate"
        kCSBackupdOldestCompleteSnapshotDate = "2015-07-08 05:04:05 +0000";
$ defaults read /Library/Preferences/ Destinations | grep "BackupdOldestCompleteSnapshotDate" | cut -c 49-59

[/os/os-x] permanent link

Thu, Jan 28, 2016 10:53 pm

Viewing date and time information under Windows with WMIC

If you want to obtain the current date and time on a Windows system from a command prompt, you can use date /t and time /t - if you omit the /t you will be prompted to change the values.

C:\>date /t
Thu 01/28/2016

C:\>time /t
10:38 PM

You can also obtain the information using a Windows Management Instrumentation Command-line command, wmic path win32_localtime get *. Times will be shown in 24-hour clock format, aka "military time", so 10 PM is hour 22.

C:\>wmic   path win32_localtime get *
Day  DayOfWeek  Hour  Milliseconds  Minute  Month  Quarter  Second  WeekInMonth  Year
28   4          22                  47      1      1        42      5            2016


You can format the display of the information using the /format option, e.g., you can put it in a list format.

C:\>wmic   path win32_localtime get * /format:list



[/os/windows/commands/wmic] permanent link

Wed, Jan 27, 2016 11:33 pm

PowerShell Command to List the Event Logs on a Remote computer

If you want to see what event logs are available on a remote system, you can use the PowerShell command get-eventlog -List -ComputerName system_name where system_name is the name of the remote computer.

PS C:\WINDOWS\system32> Get-EventLog -List -ComputerName Saturn

  Max(K) Retain OverflowAction        Entries Log
  ------ ------ --------------        ------- ---
     512      7 OverwriteOlder            117 Active Directory Web Services
  20,480      0 OverwriteAsNeeded      27,672 Application
  15,168      0 OverwriteAsNeeded       3,563 DFS Replication
     512      0 OverwriteAsNeeded       2,298 Directory Service
  16,384      0 OverwriteAsNeeded          61 DNS Server
  20,480      0 OverwriteAsNeeded           0 HardwareEvents
     512      7 OverwriteOlder              0 Internet Explorer
  20,480      0 OverwriteAsNeeded           0 Key Management Service
     128      0 OverwriteAsNeeded         103 OAlerts
  16,384      0 OverwriteAsNeeded           0 ODiag
  16,384      0 OverwriteAsNeeded           0 OSession
   5,056      7 OverwriteOlder              0 PRTG Network Monitor
 131,072      0 OverwriteAsNeeded     219,040 Security
  20,480      0 OverwriteAsNeeded      64,223 System
  15,360      0 OverwriteAsNeeded      18,604 Windows PowerShell

PS C:\WINDOWS\system32>

[/os/windows/PowerShell] permanent link

Tue, Jan 26, 2016 9:54 pm

Viewing the "Modern" aka "Metro" apps on a Microsoft Windows system

If you want to see a list of only the "Modern", aka "Metro" apps installed on a Microsoft Windows system, get a Windows PowerShell prompt, which you can do on Windows 10 by clicking on the Start button, or hitting Ctrl-Esc, then typing PowerShell then right-click on Windows PowerShell and choose "Run as administrator". Then type Get-AppxPackage and hit Enter.

Windows PowerShell
Copyright (C) 2015 Microsoft Corporation. All rights reserved.

PS C:\WINDOWS\system32> Get-AppxPackage | more

Name              : Microsoft.Getstarted
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           :
PackageFullName   : Microsoft.Getstarted_2.6.12.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.Getstarted_2.6.12.0_x64__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.Getstarted_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False

Name              : Microsoft.MicrosoftOfficeHub
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 17.6605.23751.0
PackageFullName   : Microsoft.MicrosoftOfficeHub_17.6605.23751.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.MicrosoftOfficeHub_17.6605.23751.0_x64__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False

Name              : Microsoft.CommsPhone
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 2.12.14001.0
PackageFullName   : Microsoft.CommsPhone_2.12.14001.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.CommsPhone_2.12.14001.0_x64__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.CommsPhone_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False

Name              : Microsoft.XboxApp
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 11.13.6008.0
-- More  --

If you don't want to see all of the details for the installed packages, just the name, use Get-AppxPackage | findstr "^Name" - put the ^ before "Name" so that you get lines beginning with "Name" and not those beginning with "PackageFullName" and "PackageFamilyName".

PS C:\> Get-AppxPackage | findstr "^Name" | more
Name              : Microsoft.Getstarted
Name              : Microsoft.MicrosoftOfficeHub
Name              : Microsoft.CommsPhone
Name              : Microsoft.XboxApp
Name              : Microsoft.MicrosoftSolitaireCollection
Name              : Microsoft.WindowsCamera
Name              : Microsoft.Office.Sway
Name              : Microsoft.WindowsMaps
Name              : Microsoft.Messaging
Name              : Microsoft.BingFinance
Name              : Microsoft.BingWeather
Name              : Microsoft.BingSports
Name              : Microsoft.BingNews
Name              :
Name              : Microsoft.Windows.Photos
Name              : Microsoft.VCLibs.140.00
Name              : Microsoft.VCLibs.140.00
Name              : Microsoft.NET.Native.Framework.1.1
Name              : Microsoft.NET.Native.Framework.1.1
Name              : Microsoft.NET.Native.Framework.1.2
Name              : Microsoft.NET.Native.Runtime.1.1
Name              : Microsoft.NET.Native.Framework.1.0
Name              : Microsoft.NET.Native.Framework.1.0
Name              : Microsoft.NET.Native.Runtime.1.0
Name              : Microsoft.NET.Native.Runtime.1.0
Name              : Microsoft.AAD.BrokerPlugin
Name              : Microsoft.BioEnrollment
Name              : Microsoft.Windows.CloudExperienceHost
Name              : Microsoft.Windows.ShellExperienceHost
Name              : windows.immersivecontrolpanel
Name              : Microsoft.Windows.Cortana
Name              : Microsoft.AccountsControl
Name              : Microsoft.LockApp
Name              : Microsoft.MicrosoftEdge
Name              : Microsoft.Windows.AssignedAccessLockApp
Name              : Microsoft.Windows.ContentDeliveryManager
Name              : Microsoft.Windows.ParentalControls
Name              : Microsoft.Windows.SecondaryTileExperience
Name              : Microsoft.WindowsFeedback
Name              : Microsoft.XboxGameCallableUI
Name              : Microsoft.XboxIdentityProvider
Name              : Windows.ContactSupport
Name              : Windows.MiracastView
Name              : Windows.PrintDialog
Name              : Windows.PurchaseDialog
Name              : Microsoft.NET.Native.Runtime.1.1
Name              : Microsoft.NET.Native.Framework.1.2
Name              : 9E2F88E3.Twitter
Name              : windows.devicesflow
-- More  --

[/os/windows/PowerShell] permanent link

Mon, Jan 25, 2016 10:47 pm

Updating a file's time stamp and creating multiple files with touch

The touch command is a standard command available on Unix/Linux systems. It can be used to create new, empty files or change the timestamp on existing files. If there is an existing file named test.txt created on January 22, 2016 at 10:13 PM, i.e. 22:13 in the 24-hour time format, aka "military time", I can change the date to Decembe 25, 2015 and the time to 5:13 PM by using the command shown below.
$ touch -t 201512251713 test.txt
$ ls -l test.txt
-rw-rw-r-- 1 joe joe 0 Dec 25 17:13 test.txt

The -t option indicates that I wish to change the time stamp. It is followed by the date and time in the format YYYYMMDDHHMM where YYYY represents the year, MM the month, DD the day, HH the hour and MM represents minutes.

Using the --date argument to the command, you can even specify a time as YYYY-MM-DD HH:MM. Note: use the --time-style=long-iso or --time-style=full-iso options for the ls -l command to show the full timestamp.

$ touch --date="2013-01-25 09:00" example.txt
$ ls -l --time-style=long-iso example.txt
-rw-rw-r-- 1 joe joe 0 2013-01-25 09:00 example.txt

With the --date option, you can even specify a date in a format such as "next Friday" or "last Friday". A date string may contain items indicating calendar date, time of day, time zone, day of week, relative time, relative date, and numbers. An empty string indicates the beginning of the day.

E.g., suppose, today is Saturday January 23, but I want to create two new files, one with a date of the prior Friday and one with a date of next Friday. I could use the commands shown below.

$ touch --date="last Friday" oldsample.txt
$ touch --date="next Friday" newsample.txt
$ ls -l *sample.txt
-rw-rw-r-- 1 joe joe 0 Jan 29  2016 newsample.txt
-rw-rw-r-- 1 joe joe 0 Jan 22 00:00 oldsample.txt

You can also specify the hours, minutes, and seconds using such a format, e.g., suppose I already have the file newsample.txt, but want to change the date and time for the existing file to be this coming Sunday at 11:00 PM. I could use the touch command below.

$ touch --date="Sunday 23:11:05" newsample.txt
$ ls -l --time-style="long-iso" newsample.txt
-rw-rw-r-- 1 joe joe 0 2016-01-24 23:11 newsample.txt
$ ls -l --time-style="full-iso" newsample.txt
-rw-rw-r-- 1 joe joe 0 2016-01-24 23:11:05.000000000 +0000 newsample.txt

You can even specify the time down to fractions of a section by putting a period after the seconds value, which appears as HH:MM:SS. E.g.:

$ touch --date="Sunday 23:11:05.01234" newsample.txt
$ ls -l --time-style="full-iso" newsample.txt
-rw-rw-r-- 1 joe joe 0 2016-01-24 23:11:05.012340000 +0000 newsample.txt
If you wish to create multiple empty files at once e.g., for test purposes, you can use a command such as touch file{n1..n2} where file is the first part of the file name, n1 is the starting number you wish to add to the end of the file name, and n2 is the ending number to be appended to the file name. The touch command will then create ten files starting with file1 through file10.
$ ls
$ touch file{1..10}.html
$ ls
file10.html  file2.html  file4.html  file6.html  file8.html  index.html
file1.html   file3.html  file5.html  file7.html  file9.html

[/os/unix/commands] permanent link

Sun, Jan 24, 2016 9:45 pm

Using reg query to determine the last registry key accessed

You can determine the last Windows Registry key accessed in regedit by issuing a reg query command from a command prompt. E.g., suppose I ran regedit and viewed HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run and then exited from regedit.

Regedit - Accessed HKCU Run

From a command line interface (CLI), i.e., a command prompt, I can issue the command reg query HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit /v LastKey, which will show me the last key that was accessed while in regedit. If I reopen regedit, it will start with that key selected, i.e., it will open from the key selected when I exited from the program.

C:\>reg query HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit /v LastKey

    LastKey    REG_SZ    Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run


Note: the command is querying a key in HKEY Current User (HKCU), so the results apply to the account from which the command is run. If you run the command from a different account on the system, you will get the LastKey value for that account.

[/os/windows/registry] permanent link

Sat, Jan 23, 2016 10:56 pm

Find files containing a string and then extract another string from the files

Amazon changed the format they use for Ads months ago and ads using the old format no longer work, but I've never gotten around to fixing all of the links I have in PHP files on a Linux system, some going back many years, so a lot of pages show a "not found" block on pages where ads for Amazon books related to an article I wrote appear. I've corrected a few when I needed to reference a page again to recall how I resolved a problem in the past when I encountered it again, but I have done that for only a small number of the many pages. So I decided to determine how many such pages exist and make a list of the file locations and the titles that appear in the HTML code for the pages, i.e., the text that appears between <title> and </title>.

To find all the PHP files containing the old ads, I can search for "", since I know that string is part of the old ad format, but not the new ad format.

$ grep -rwl "" --include="*.php"

The -rwl parameters to the grep command have the following meanings:

-r, --recursive
       Read  all  files  under  each  directory, recursively, following
       symbolic links only if they are on the command  line.   This  is
       equivalent to the -d recurse option.

-w, --word-regexp
       Select  only  those  lines  containing  matches  that form whole
       words.  The test is that the matching substring must  either  be
       at  the  beginning  of  the  line,  or  preceded  by  a non-word
       constituent character.  Similarly, it must be either at the  end
       of  the  line  or  followed by a non-word constituent character.
       Word-constituent  characters  are  letters,  digits,   and   the

-l, --files-with-matches
       Suppress  normal  output;  instead  print the name of each input
       file from which output would normally have  been  printed.   The
       scanning  will  stop  on  the  first match.  (-l is specified by

The -r parameter performs a recursive search from the directory where I ran the command down through all subdirectories within it. In this case, I could have omitted the -w, but I normally use it when performing such searches. I used -l because I just want to see the file names; I don't want anything else from the grep command.

I used the --include="*.php" because I know that the text I'm searching for will be in files that have a file name ending with .php; I don't want the command to waste time searching in other files. That option will ensure that the grep command searches only for any files that have a file name ending with .php.

If I wanted a count of the number of files that have the text for which I'm searching, i.e., "", I can pipe the output of the grep command into the wc (word count) utility.

$ grep -rwl "" --include="*.php" | wc -l

The -l parameter to the wc command tells the utility that I only want to see a count of the number of lines.

The PHP files are webpages and I'd like to know the title for each page. The title will appear within the HTML code between the <title> and </title> tags, so I want to feed the output of the grep command into another grep command to show the titles. One way to do that is to put the first grep command within $() and use that in place of the file argument to the outer grep command, which will run the command and substitute its output for the file parameter for the outer grep command - see the answer provided by Gilles at How do I pass a list of files to grep.

$ grep '<title>' $(grep -rwl "" --include="*.php")
software/database/mysql/field-types.php:<title>MySQL Field Types</title>
software/database/mysql/creating-mysql-db.php:<title>Creating a MySQL Database</
software/database/collectorz/MC-Customization/index.php:  <title>Movie Collector
 6.4.1 Customization</title>
security/malware/system_defender/033011/index.php:<title>System Defender Infecti
security/malware/111511/index.php:<title>AV Security 2012v121.exe Rogue Antiviru
s Program</title>
security/firewalls/netscreen/smtp-vip.php:<title>Configuring a NetScreen Firewal
l for an Internal SMTP Server</title>
security/firewalls/netscreen/syslog.php:<title>Configuring a Netscreen Firewall
for Syslog Server Support</title>

Note: the above command will fail if there are any files with a space in the file name in the search path, i.e. test me.php, but in my case I know no such files exist.

But I just want the title, not the <title> and </title>, so to eliminate those strings, I can feed the output into the sed command.

$ grep '<title>' $(grep -rwl "" --include="*.php") | sed -e 's/<title>//' | sed -e 's/<\/title>//'
software/database/mysql/field-types.php:MySQL Field Types
software/database/mysql/creating-mysql-db.php:Creating a MySQL Database
software/database/collectorz/MC-Customization/index.php:  Movie Collector 6.4.1
security/malware/system_defender/033011/index.php:System Defender Infection
security/malware/111511/index.php:AV Security 2012v121.exe Rogue Antivirus Progr
security/firewalls/netscreen/smtp-vip.php:Configuring a NetScreen Firewall for a
n Internal SMTP Server
security/firewalls/netscreen/syslog.php:Configuring a Netscreen Firewall for Sys
log Server Support

The s in 's/<title>// tells sed that I want to search for whatever appears between the next two / (forward slash) characters and subsitute whatever appears after the second foward slash and the following one in its place - the "s" stands for substitute. In this case since nothing appears between the second and third forward slashes, then "<title>" is eliminated from the line with nothing substituted in its place. I then pipe the output into a second sed command to eliminate the "</title >". Since there is a forward slash withing the string I want to search for, I don't want sed to interpret the line to mean I want it to search just for "<", so I need to "escape" the special meaning the forward slash has for sed in this instance. I can do that by preceding that forward slash with an "escape character". The backslash character, i.e., \, is the escape character that takes away the special meaning for the forward slash before "title", so that it is included in the text for which sed will search.

The above string of commands will provide the file name followed by a colon and then the title for the web page. If I just want the title, I can pipe the output from the above commands into the cut utility.

$ grep '<title>' $(grep -rwl "" --include="*.php") | sed -e 's/<title>//' | sed -e 's/<\/title>//' | cut -d":" -f2
MySQL Field Types
Creating a MySQL Database
  Movie Collector 6.4.1 Customization

System Defender Infection
AV Security 2012v121.exe Rogue Antivirus Program
Configuring a NetScreen Firewall for an Internal SMTP Server
Configuring a Netscreen Firewall for Syslog Server Support

That command makes it clear that I have some unnecessary spaces or a tab character at the beginning of the title line for the Movie Collector page and a missing title for security/malware/010210/index.php.

The -d":" option to cut specifies that I want to use a colon as the delimiter between fields. The -f2 option instructs cut to just show me the second field, i.e., the one after the colon.

After inserting the missing title line in the file for which no title was shown, I modified the first sed command to ignore any spaces or tabs that occur on the line with the title tags by using \s which represents spaces or tabs. I followed the \s with an asterisk, *, which, for regular expressions undestood by many Unix/Linux commands, means zero or more of the preceding character, so in this case sed will remove "<title>" or " <title>", i.e., it will remove the beginning title tag or, if there are any spaces or tabs before the tag, it will remove those and the title tag.

$ grep '<title>' $(grep -rwl "" --include="*.php") | sed -e 's/\s*<title>//' | sed -e 's/<\/title>//' | cut -d":" -f2 | more
MySQL Field Types
Creating a MySQL Database
Movie Collector 6.4.1 Customization
Malware Scanning on Dell Inspiron 1526
System Defender Infection
AV Security 2012v121.exe Rogue Antivirus Program
Configuring a NetScreen Firewall for an Internal SMTP Server
Configuring a Netscreen Firewall for Syslog Server Support

Note: for POSIX-compliant systems and Mac OS X, you may need to use [[:space:]] instead of \s - see How to match whitespace in sed?.

[/os/unix/commands] permanent link

Fri, Jan 22, 2016 5:12 pm

New site - You don't have permission to access / on this server

After adding a VirtualHost section to /etc/httpd/conf/httpd.conf on an Apache web server, when I tried accessing the site I saw the message below:


You don't have permission to access / on this server.

I'd encountered the problem in the past when there was a problem with permissions on the user's home directory. I didn't see any log files for the site in the directory under the user account, either, where the ErrorLog and CustomLog directives in the VirtualHost section for the website should have placed them. I checked the access for the user's home directory and found that the only access to that directory was read, write, and execute access for the user's account.

# ls -ld /home/jim
drwx------ 5 jim jim 4096 Jan 22 21:44 /home/jim

When I added "search" access for the group and all users to the user's home directory from the root account, I was able to access the website from a browser.

# chmod ga+x /home/joe

I.e., the cause of the problem had been the same as the last time I encountered the error message.

[/network/web/server/apache] permanent link

Thu, Jan 21, 2016 10:44 pm

WMIC cpu get commands

On Microsoft Windows systems since Windows XP, you can use the Windows Management Instrumentation Command-line (WMIC) to obtain information on a system's Central Processing Unit (CPU). E.g., you can issue the command wmic cpu get name to determine if the processor is an AMD or Intel processor.
C:\>wmic cpu get name
AMD FX(tm)-4100 Quad-Core Processor

You can also specify, manufacturer as an option to the command, instead.

C:\>wmic cpu get manufacturer


Or wmic cpu get caption.

C:\>wmic cpu get caption
AMD64 Family 21 Model 1 Stepping 2

If you want to know the CPU's clock speed, you can use currentclockspeed. There is also a maxclockspeed parameter.

C:\>wmic cpu get currentclockspeed

C:\>wmic cpu get maxclockspeed


If you want to obtain a figure for the current CPU utilization from a command line interface (CLI), i.e., a command prompt, rather than checking it through a GUI, such as through the Task Manager, you can use wmic cpu get loadpercentage.

C:\>wmic cpu get loadpercentage

[/os/windows/commands/wmic] permanent link

Wed, Jan 20, 2016 9:01 pm

Microsoft Reducing the Free Storage Amount for OneDrive

If you have a Microsoft account, such as a Hotmail, now, account you were eligible for 15 GB of free storage for files with OneDrive, which provides cloud-based storage. Microsoft is reducing the amount allocated to accounts from 15 GB to 5 GB. Howerver, if you visit this OneDrive page, you can click on the button there to retain the 15 GB limit to ensure "your account will not be affected when the amount of free storage changes from 15 GB to 5 GB and the +15 GB camera roll bonus is discontinued." But you will need to do so by January 31, 2016. If you do so you can have a total of 30 GB in free online storage that will allow you to share files between devices and backup your files offsite in the cloud.

[/network/web/services/microsoft] permanent link

Mon, Jan 18, 2016 10:12 pm

BitDefender Threat Scanner File Containing Error Information

A user of a Windows 7 Professional system (64-bit version) sent me a screen shot she had taken of a BitDefender Threat Scanner window that had popped up on her system Friday morning. She had been seeing the message periodically in the past.

BitDefender Threat Scanner

White X in a red circle A problem has occured in BitDefender Threat Scanner. A file containing error information has been created at C:\Windows\TEMP\c44f5eb-94e1-4222-b781-15e2ddadac3b\BitDefender Threat Scanner.dmp. You are strongly encouraged to send the file to the developers of the application for further investigation of the error.

After using the Sysinternals autoruns utility, I found that a BitDefender driver Trufos.sys was being loaded. I disabled it with autoruns.

[ More Info ]

[/security/antivirus/bitdefender] permanent link

Sun, Jan 17, 2016 4:34 pm

Reducing Firefox Memory Usage

If you are seeing high memory consumption by Firefox, put about:memory in the address bar of a tab and try the "Reduce memory usage" option, which triggers a global garbage collection followed by a cycle collection, and can reduce memory usage in other ways, e.g., by flushing various caches. If that doesn't sufficiently reduce memory, try the "Measure" option to view memory usage by Firefox, which will allow you to see usage information associated with URLs that can allow you to determine which tab or tabs you could close to significantly reduce Firefox's memory usage.

[ More Info ]

[/network/web/browser/firefox] permanent link

Sat, Jan 16, 2016 10:09 pm

Determining if your version of Windows is a 32-bit or 64-bit version

You can determine if your version of Microsoft Windows is a 32-bit or 64-bit version of the operating system from a command line interface (CLI), i.e., a command prompt, using the Windows Management Instrumentation Command-line (WMIC) command wmic os get OSArchitecture:
C:\>wmic os get OSArchitecture


You can also pipe the output of the syteminfo command into either findstr or find to make the determination whether you have a 32-bit or 64-bit version of the OS:

C:\>systeminfo | findstr /C:"System Type"
System Type:               x64-based PC

C:\>systeminfo | find "System Type"
System Type:               x64-based PC

Note: the above commands were run on a Windows 10 system, but will work on earlier versions as well.

Also, if you have just a C:\Program Files directory, but no C:\Program Files (x86) directory, then you likely have a 32-bit version whereas if you have both directories, then you likely have a 64-bit version of Windows.

You can run either 32-bit or 64-bit applications on a 64-bit version of Windows, but you can only run 32-bit versions of applications on a 32-bit version of Windows. You can determine if an application is 32-bit or 64-bit using the steps noted at 32 or 64-bit Application.

[/os/windows] permanent link

Fri, Jan 15, 2016 10:44 pm

Determining the number of days from or to a given date with Python

If you wish to know how many days have passed since a given date, you can do so in Python using the datetime module. If I wanted to know the number of days from December 31, 2013 until today, I could use the code below, which shows 745 days have elapsed since that date:
$ python
Python 2.7.5 (default, Jun 24 2015, 00:41:19)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import date as D
>>> print ( - D(2013, 12, 31)).days
>>> exit()

If, instead, I want to know the number of days that remain until a given date, a command such as the one below, which calculates the number of days from today until April 31, 2019, could be used.

>>> print (D(2019, 4, 30) -

Of course, the calculations don't have to be from or to today, any arbitrary day can be selected as shown in the example below, which provides the number of days between January 1, 2016 and January 1, 2019

>>> print ( D(2019, 1, 31) - D(2016, 1, 31) ).days

If you would prefer to get the result from the command line, aka shell prompt, with just one command line rather than through the Python interpreter's interactive mode, a command such as the following one could be used:

$ python -c "from datetime import date as D; print ( D(2019,1,31) - D(2016,1,31) ).days"

[/languages/python] permanent link

Thu, Jan 14, 2016 11:09 pm

OpenSSH Roaming Vulnerability

Ars Technica published an article today titled Bug that can leak crypto keys just fixed in widely used OpenSSH which explained how a compromise of a SSH server running OpenSSH software could lead to the server being used to capture data from the memory of systems that have connected to the server via SSH including private keys for users connecting to the server.

The vulnerability resides only in the version end users use to connect to servers and not in versions used by servers. A maliciously configured server could exploit it to obtain the contents of the connecting computer's memory, including the private encryption key used for SSH connections. The bug is the result of code that enables an experimental roaming feature in OpenSSH versions 5.4 to 7.1

"The matching server code has never been shipped, but the client code was enabled by default and could be tricked by a malicious server into leaking client memory to the server, including private client user keys," OpenSSH officials wrote in an advisory published Thursday. "The authentication of the server host key prevents exploitation by a man-in-the-middle, so this information leak is restricted to connections to malicious or compromised servers."

The roaming feature was intended to allow users to resume broken SSH connections, even though the feature was disabled in OpenSSH server software years ago. E.g., when I connected to a server I have running OpenSSH server software, I saw the folowing:

$ ssh -v jdoe@ 2>&1 >/dev/null | grep -i 'roaming'
debug1: Roaming not allowed by server

The Red Hat article on the vulnerability OpenSSH: Information-leak vulnerability (CVE-2016-0777) notes:

Since version 5.4, the OpenSSH client supports an undocumented feature called roaming. If a connection to an SSH server breaks unexpectedly, and if the SSH server supports roaming as well, the client is able to reconnect to the server and resume the interrupted SSH session. The roaming feature is enabled by default in OpenSSH clients, even though no OpenSSH server version implements the roaming feature.

For affected products, the article also notes:

Red Hat Enterprise Linux 7 since version 7.1 has provided OpenSSH 6.6 for which the default configuration is not affected by this flaw. OpenSSH 6.6 is only vulnerable to this issue when used with certain non-default ProxyCommand settings. Security update RHSA-2016-0043 corrects this issue.

So CentOS 7 systems using a default OpenSSH configuration should be unaffected, since CentOS is derived from Red Hat Enterprise Linux.

On a Linux system, you can check the version of SSH installed with ssh -V.

$ ssh -V
OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013

On a CentOS Linux system using the RPM Package Manager you can also use rpm -qi openssh | grep Version.

$ rpm -qi openssh | grep Version
Version     : 6.6.1p1

On a CentOS system, you can update the software from the command line, aka a shell prompt, using the command yum update openssh.

If you are using a vulnerable OpenSSH client, you can also specify the -oUseRoaming=no parameter on the command line to ensure that a malicious server can't take advantage of the vulnerability. E.g. ssh -oUseRoaming=no Or the feature can be disabled for all users on a system by putting UseRoaming no in /etc/ssh/ssh_config or by an individual user for his account by adding the line to ~/.ssh/config.

echo 'UseRoaming no' >> /etc/ssh/ssh_config


  1. Bug that can leak crypto keys just fixed in widely used OpenSSH
    Date: January 14, 2016
    Ars Technica
  2. Fixing The New OpenSSH Roaming Bug
    By: ScriptRock
    ScriptRock Blog
  3. OpenSSH: Information-leak vulnerability (CVE-2016-0777)
    Updated: January 14, 2016
    Red Hat Customer Portal
  4. Security OpenSSH Security Bug CVE-2016-0777 & CVE-2016-0778
    Date: January 4, 2016

[/network/ssh] permanent link

Wed, Jan 13, 2016 11:24 pm

Returning to a prior directory with Bash

If you use the Bash shell on a Unix/Linux system, you can return to the prior directory you were in using cd $OLDPWD or simply cd -. If you wish to be able to easily return to a prior directory further back, you can use the pushd and popd commands. The pushd command pushes the current directory onto a directory stack,i.e., each time you issue the command the current directory is added to the "top" of the stack. When you issue the popd command, you are returned to the directory that is currently at the top of that stack. So if you were in the directory /home/jdoe/test then issued the command pushd, later changed the working directory to /home/jdoe/abc and issued the command pushd again then the command cd /home/jdoe/def followed later by cd /home/jdoe/ghi, if you then issued the command popd, your current working directory would become /home/jdoe/abc. If you entered the popd command a second time without any intervening pushd command, you would be returned to directory /home/jdoe/test, the first directory pushed onto the stack.

[/os/unix/bash] permanent link

Tue, Jan 12, 2016 11:28 pm

Displaying Firefox Windows Titles With AppleScript

On an Apple, OS X system, the following AppleScript script will display the titles for the currently open windows in Firefox.

tell application "Firefox"
	set windowTitles to ""
	repeat with w in (every window whose visible is true)
		set windowTitles to windowTitles & "
" & "
" & name of w
	end repeat
	display dialog windowTitles
end tell

E.g., if I have 3 Firefox windows open, one of which has multiple tabs open, I might see something like the following:

Firefox Windows

The first window title displayed is for a Firefox window with 9 tabs open, but only the title for the currently selected tab "After sticking a land-based return, SpaceX will try the ocan again | Ars Technica" is displayed.

Note: putting an ending double quote on the line below the opening one results in a new line.

[/os/os-x/applescript] permanent link

Mon, Jan 11, 2016 10:54 pm

WMIC startup

The WMIC startup command can be used to check the programs that will be run when a user logs into a Microsoft Windows system.

C:\>wmic startup /?

STARTUP - Management of commands that run automatically when users log onto the
computer system.

HINT: BNF for Alias usage.
(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb c


STARTUP ASSOC [<format specifier>]
STARTUP CREATE <assign list>
STARTUP GET [<property list>] [<get switches>]
STARTUP LIST [<list format>] [<list switches>]


The list parameter can be specified to obtain a list of programs that will be run upon logon.

C:\>wmic startup list /?

Property list operations.

LIST [<list format>] [<list switches>]

The following LIST formats are available:

BRIEF                     - Command, User, Caption
FULL                      - Command, Description, SettingID, User, Location, Cap
INSTANCE                  - Caption
SYSTEM                    - __CLASS, __DERIVATION, __DYNASTY, __GENUS, __NAMESPA

The following LIST switches are available:

/TRANSLATE:<table name>      - Translate output via values from <table name>.
/EVERY:<interval> [/REPEAT:<repeat count>] - Returns value every (X interval) se
conds, If /REPEAT specified the command is executed <repeat count> times.
/FORMAT:<format specifier>   - Keyword/XSL filename to process the XML results.

NOTE: Order of /TRANSLATE and /FORMAT switches influences the appearance of outp
Case1: If /TRANSLATE precedes /FORMAT, then translation of results will be follo
wed by formatting.
Case2: If /TRANSLATE succeeds /FORMAT, then translation of the formatted results
 will be done.


E.g., if I only want a brief listing, i.e, just the Command, User, and Caption values, I can use wmic startup list brief. If I just want the "caption", I can use wmic startup list instance as shown below:

C:\>wmic startup list instance
Akamai NetSession Interface
Intuit Data Protect
QuickBooks Update Agent



If I don't want to use any of the predefined list formats like brief, full, instance, etc., I can use wmic startup get followed by the values I'm interested in. E.g., if I wanted the caption and command values, I could use the command shown below:

C:\>wmic startup get caption, command
Caption                              Command
Akamai NetSession Interface          "C:\Users\Pamela\AppData\Local\Akamai\netsession_win.exe"
SpybotPostWindows10UpgradeReInstall  "C:\Program Files\Common Files\AV\Spybot - Search and Destroy\Test.exe"
Intuit Data Protect                  C:\PROGRA~2\COMMON~1\Intuit\DATAPR~1\INTUIT~1.EXE /Startup
QuickBooks Update Agent              C:\PROGRA~2\COMMON~1\Intuit\QUICKB~1\QBUpdate\qbupdate.exe
QuickBooks_Standard_21               C:\PROGRA~2\Intuit\QUICKB~1\QBW32.EXE -silent
IgfxTray                             C:\Windows\system32\igfxtray.exe
HotKeysCmds                          C:\Windows\system32\hkcmd.exe
Persistence                          C:\Windows\system32\igfxpers.exe

AdAwareTray                          "C:\Program Files\Security\Ad-Aware\Ad-Aware Antivirus\11.8.586.8535\AdAwareTray.exe"

[/os/windows/commands/wmic] permanent link

Sun, Jan 10, 2016 11:40 pm

WMIC share get

If you need to obtain a list of shared resources on a Microsoft Windows system, such as shared folders, you can use a Windows Management Instrumentation Command-line (WMIC) command, wmic share get. E.g., wmic share get caption,name,path, which will show the share names on the system on which the command is issued and the full directory path for shared folders associated with those sharenames.

[ More Info ]

[/os/windows/commands/wmic] permanent link

Sat, Jan 09, 2016 11:05 pm

WMIC printer get

The Windows Management Instrumentation Command-line (WMIC) can be used to query the available printers for a system using wmic printer get. Parameters the command accepts are shown below:

c:\>wmic printer get /?

Property get operations.

GET [<property list>] [<get switches>]
NOTE: <property list> ::= <property name> | <property name>,  <property list>

The following properties are available:
Property                                Type                    Operation
========                                ====                    =========
Attributes                              N/A                     N/A
Availability                            N/A                     N/A
AvailableJobSheets                      N/A                     N/A
AveragePagesPerMinute                   N/A                     N/A
Capabilities                            N/A                     N/A
CapabilityDescriptions                  N/A                     N/A
Caption                                 N/A                     N/A
CharSetsSupported                       N/A                     N/A
Comment                                 N/A                     N/A
ConfigManagerErrorCode                  N/A                     N/A
ConfigManagerUserConfig                 N/A                     N/A
CurrentCapabilities                     N/A                     N/A
CurrentCharSet                          N/A                     N/A
CurrentLanguage                         N/A                     N/A
CurrentMimeType                         N/A                     N/A
CurrentNaturalLanguage                  N/A                     N/A
CurrentPaperType                        N/A                     N/A
Default                                 N/A                     N/A
DefaultCapabilities                     N/A                     N/A
DefaultCopies                           N/A                     N/A
DefaultLanguage                         N/A                     N/A
DefaultMimeType                         N/A                     N/A
DefaultNumberUp                         N/A                     N/A
DefaultPaperType                        N/A                     N/A
DefaultPriority                         N/A                     N/A
Description                             N/A                     N/A
DetectedErrorState                      N/A                     N/A
DeviceID                                N/A                     N/A
Direct                                  N/A                     N/A
DoCompleteFirst                         N/A                     N/A
DriverName                              N/A                     N/A
EnableBIDI                              N/A                     N/A
EnableDevQueryPrint                     N/A                     N/A
ErrorCleared                            N/A                     N/A
ErrorDescription                        N/A                     N/A
ErrorInformation                        N/A                     N/A
ExtendedDetectedErrorState              N/A                     N/A
ExtendedPrinterStatus                   N/A                     N/A
Hidden                                  N/A                     N/A
HorizontalResolution                    N/A                     N/A
InstallDate                             N/A                     N/A
JobCountSinceLastReset                  N/A                     N/A
KeepPrintedJobs                         N/A                     N/A
LanguagesSupported                      N/A                     N/A
LastErrorCode                           N/A                     N/A
Local                                   N/A                     N/A
Location                                N/A                     N/A
MarkingTechnology                       N/A                     N/A
MaxCopies                               N/A                     N/A
MaxNumberUp                             N/A                     N/A
MaxSizeSupported                        N/A                     N/A
MimeTypesSupported                      N/A                     N/A
Name                                    N/A                     N/A
PNPDeviceID                             N/A                     N/A
PaperSizesSupported                     N/A                     N/A
PortName                                N/A                     N/A
PowerManagementCapabilities             N/A                     N/A
PowerManagementSupported                N/A                     N/A
PrintJobDataType                        N/A                     N/A
PrintProcessor                          N/A                     N/A
PrinterPaperNames                       N/A                     N/A
PrinterState                            N/A                     N/A
PrinterStatus                           N/A                     N/A
SeparatorFile                           N/A                     N/A
ServerName                              N/A                     N/A
ShareName                               N/A                     N/A
SpoolEnabled                            N/A                     N/A
StartTime                               N/A                     N/A
Status                                  N/A                     N/A
StatusInfo                              N/A                     N/A
SystemName                              N/A                     N/A
TimeOfLastReset                         N/A                     N/A
UntilTime                               N/A                     N/A
VerticalResolution                      N/A                     N/A

The following GET switches are available:

/VALUE                       - Return value.
/ALL(default)                - Return the data and metadata for the attribute.
/TRANSLATE:<table name>      - Translate output via values from <table name>.
/EVERY:<interval> [/REPEAT:<repeat count>] - Returns value every (X interval) se
conds, If /REPEAT specified the command is executed <repeat count> times.
/FORMAT:<format specifier>   - Keyword/XSL filename to process the XML results.

NOTE: Order of /TRANSLATE and /FORMAT switches influences the appearance of outp
Case1: If /TRANSLATE precedes /FORMAT, then translation of results will be follo
wed by formatting.
Case2: If /TRANSLATE succeeds /FORMAT, then translation of the formatted results
 will be done.

Some parameters may yield similar results, e.g., the results of a query for DeviceID, DriverName, and Name on one system are shown below:

c:\>wmic printer get DeviceID, Name
DeviceID                             Name
Send To OneNote 2010                 Send To OneNote 2010
Ricoh Aficio MP C2500 PCL5c          Ricoh Aficio MP C2500 PCL5c
Microsoft XPS Document Writer        Microsoft XPS Document Writer
HP Photosmart 6510 series (Network)  HP Photosmart 6510 series (Network)
HP Deskjet 6940 series               HP Deskjet 6940 series
Fax                                  Fax
Adobe PDF                            Adobe PDF

c:\>wmic printer get DeviceID, DriverName
DeviceID                             DriverName
Send To OneNote 2010                 Send To Microsoft OneNote 2010 Driver
Ricoh Aficio MP C2500 PCL5c          Ricoh Aficio MP C2500 PCL5c
Microsoft XPS Document Writer        Microsoft XPS Document Writer
HP Photosmart 6510 series (Network)  HP Photosmart 6510 series
HP Deskjet 6940 series               HP Deskjet 6940 series
Fax                                  Microsoft Shared Fax Driver
Adobe PDF                            Adobe PDF Converter

If I want to check the IP address for a printer, I can use PortName.

c:\>wmic printer get DeviceID, PortName
DeviceID                             PortName
Send To OneNote 2010                 nul:
Ricoh Aficio MP C2500 PCL5c
Microsoft XPS Document Writer        XPSPort:
HP Photosmart 6510 series (Network)
HP Deskjet 6940 series     
Fax                                  SHRFAX:
Adobe PDF                            Documents\*.pdf


If I just want the IP address for a particular printer I can specify it with where DeviceId="printer_deviceid PortName where printer_deviceid is that printer's device ID. I could also query based on Name, DriverName, etc.

c:\>wmic printer where DeviceID="HP Deskjet 6940 series" get PortName

To check the horizontal and vertical resolution, I can use HorizontalResolution and VerticalResolution:

c:\>wmic printer get DeviceID, HorizontalResolution, VerticalResolution
DeviceID                             HorizontalResolution  VerticalResolution
Send To OneNote 2010                 600                   600
Ricoh Aficio MP C2500 PCL5c          600                   600
Microsoft XPS Document Writer        600                   600
HP Photosmart 6510 series (Network)  600                   600
HP Deskjet 6940 series               600                   600
Fax                                  200                   200
Adobe PDF                            1200                  1200

If I want to see a sharename for a printer, i.e., the name used for a printer that is a shared resource for other computers on the network, I can use the ShareName parameter. E.g., the results for such a command issued on a Windows Server 2012 system showing a printer shared from another system in the Windows domain for which it is the domain controller:

C:\Users\Admin>wmic printer where portname="LPT3:" get deviceid, sharename
DeviceID                                                       ShareName
\\MERGENTHALER.IMAGINATION.local\HP LaserJet 5100 Series PCL6  CSR_HP_5100


[/os/windows/commands/wmic] permanent link

Fri, Jan 08, 2016 10:19 pm

OpenOffice personal settings are locked

After I attempted to close a table in an Apache OpenOffice Base database, the database application stopped responding. The table remained open, but I couldn't do anything in it, open any other table, etc. So I forced the program to quit using the Activity Monitor. When I tried to reopen OpenOffice after its abnormal termination, I saw the message below:

OpenOffice 4.1.1

Either another instance of OpenOffice is accessing your personal settings or your personal settings are locked.
Simultaneous access can lead to inconsistencies in your personal settings. Before continuing, you should make sure user 'jasmith1' closes OpenOffice on host ''.

Do you really want to continue?


I selected "No" and looked in the OpenOffice user profile for my account for a .lock file - you need to use the -a option for the ls command to see "dot something" files that would otherwise be hidden.

$ ls -al ~/Library/Application\ Support/OpenOffice/4
total 8
drwxr-xr-x   4 jasmith1  NDC\Domain Users  136 Jan  8 16:28 .
drwxr-xr-x   3 jasmith1  NDC\Domain Users  102 May 18  2015 ..
-rw-r--r--   1 jasmith1  NDC\Domain Users  143 Jan  8 16:28 .lock
drwxr-xr-x  18 jasmith1  NDC\Domain Users  612 Jan  8 20:42 user

Since OpenOffice wasn't closed normally, the .lock file remained. After I deleted the .lock file, I was able to open OpenOffice without the message reappearing.

$ rm ~/Library/Application\ Support/OpenOffice/4/.lock

When the program reopened I saw an OpenOffice Document Recovery window allowing me to recover the database I had been working on before I had to terminate the Base application.

OpenOffice Document Recovery

I clicked on the Start Recovery button and then was informed that the recovery of the database was successful.

OpenOffice Document Recovery Successful

When I clicked on Next I was able to access the database again.

[/software/openoffice] permanent link

Thu, Jan 07, 2016 11:58 pm

VBScript - List Installed Programs

I had been using InstalledPrograms.vbs, a VBScript script written by Bill James, to query systems for a list of installed programs. I ran the script today while logged into a user's account on a Microsoft Windows 7 system, I received an error message because the script was in a sudirectory beneath C:\Program Files and the script's output file is stored by default in the directory from which the script is run, but the user's account did not have permission to write to that directory. To fix the problem, rather than move the script to another directory or run the script from an administrator account, I added VBScript code from Rob van der Woude's Browse Folder Dialog function so that a user can select the directory to be used for the output file.

[ More Info ]

[/languages/vbs] permanent link

Wed, Jan 06, 2016 11:32 pm

Web Page Consuming Excessive Memory in Safari and SymDaemon CPU Usage

When I run into excessive memory usage by an application on a MacBook Pro laptop I use, the culprit is usually Safari. It is often a culprit in high CPU utilization problems as well. Another common cause for high CPU usage making the system unresponsive is the Symantec Endpoint Protection daemon. Today, after closing a tab with a webpage open to reduce excessive memory consumption and CPU usage by Safari, I immediately encountered another CPU usage issue caused by SymDaemon.

[ More Info ]

[/os/os-x] permanent link

Tue, Jan 05, 2016 9:56 pm

Calculating an end date given the number of weeks from a start date

In spreadsheet programs such as Microsoft Excel, OpenOffice Calc, and Google Sheets, you can determine an end date given a start date and the number of weeks that some entry, such as a class, will last by using the formula =startdate + numweeks * 7. E.g., if the start date is January 11, 2016, which is stored in cell C2 as 1/11/16 (assuming you are using the U.S. MM/DD/YY date format) and the end date is to be stored in D2 and the duration is 10 weeks, you could put the formula =C2 + 10 * 7 in the D2 cell. The result should be 3/21/16. If you wanted to know the date 10 weeks from today and if today is January 5, 2016, you could use =TODAY() + 10 * 7 . In mathematics and normally in computer operations the order of precedence results in multiplication and division having precedence over addition and substraction, so ten will be multiplied by seven and that result added to the current date to determine the last day of the event.

[/os/windows/office/excel] permanent link

Mon, Jan 04, 2016 10:08 pm

Remote Logon to a Windows 10 System in a Domain

When I attempted to log in remotely to a Windows 10 system that is a member of a Server 2012 Windows domain using a domain account, I saw the message "The connection was denied because the user account is not authorized for remote login." The problem can be resolved by logging into the system remotely using a domain administrator account and adding the accounts for which you wish to grant remote logon access to the Remote Desktop Users group through the Control Panel by selecting System and Security, Administrative Tools, and Computer Management.

[ More Info ]

[/os/windows/domain] permanent link

Sun, Jan 03, 2016 11:01 pm

Finding the time a Windows system was last rebooted

If you want to find the time a Microsoft Windows system, e.g., XP, Vista, Small Business Server 2003, Windows 7, 8, and 10, was last rebooted, you can run the systeminfo command from a command prompt and filter the output using the find command so that you see just the line containing "Boot Time":
C:\>systeminfo | find "Boot Time"
System Boot Time:          1/2/2016, 10:19:02 AM

Or you can use the Windows Management Instrumentation command line tool, wmic, by issuing the command wmic os get lastbootuptime.

C:\>wmic os get lastbootuptime

The output of the command in the above example is in the format YYYYMMDDHHSS where YYYY is the year, MM is the month, DD is the day of the month, HH is the hour in 12-hour clock format, aka "military time".

[/os/windows/commands] permanent link

Sat, Jan 02, 2016 10:48 pm

Using wmic to obtain model and serial numbers for Dell systems

If you wish to get the model number for a Dell system from a command line interface (CLI), i.e., a command prompt, you can use the wmic command wmic csproduct get vendor, name as shown below:

C:\Users>wmic csproduct get vendor,name
Name          Vendor
Inspiron 570  Dell Inc.

If you just wanted the model, you could use wmic csproduct get name .

Besides "vendor", you can also use "manufacturer" in a BIOS query with WMIC to see the system was manufactured by Dell.

C:\Users>wmic bios get manufacturer
Dell Inc.


For some Dell models, e.g., an Inspiron 620s, you can also get the service tag, which is the equivalent of a serial number for Dell systems, by issuing the command wmic bios get serialnumber.

C:\>wmic csproduct get vendor,name
Name           Vendor
Inspiron 620s  Dell Inc.

C:\>wmic bios get manufacturer, name, serialnumber
Manufacturer  Name                                        SerialNumber
Dell Inc.     BIOS Date: 11/21/11 10:52:35 Ver: 04.06.04  FP1QVR1

You will see in the above example that if you use "name" as a parameter for the wmic bios get command that, unlike with the wmic csproduct get name command, you see information for the BIOS, in this case the BIOS date and version number, rather than the model number for the system. But the serial number corresponds to the Dell service tag.

For some systems, you will see the manufacturer of the BIOS, such as Award Software listed when you issue a wmic bios get manufacturer command. E.g., the example below is for a custom-built system rather than one from Dell. For this system, there is no manufacturer assigning a serial number to the system. I can get the BIOS version by appending version to the wmic query.

C:\Users\Lee>wmic bios get manufacturer, version, serialnumber
Manufacturer                        SerialNumber  Version
Award Software International, Inc.                GBT    - 42302e31

For the Dell Inspiron 620s, I can use either the wmic bios get serialnumber or the wmic csproduct get identifyingnumber to get the Dell service tag.

C:\>wmic csproduct get vendor,name
Name           Vendor
Inspiron 620s  Dell Inc.

C:\>wmic bios get manufacturer, name, serialnumber
Manufacturer  Name                                        SerialNumber
Dell Inc.     BIOS Date: 11/21/11 10:52:35 Ver: 04.06.04  FP1QVR1

C:\>wmic csproduct get vendor,name,identifyingnumber
IdentifyingNumber  Name           Vendor
FP1QVR1            Inspiron 620s  Dell Inc.


I found the commands also show the service tag on a Dell Latitude E6530 laptop, however, you won't be able to use those for all Dell computer models to get the service tag. E.g., a Dell Inspiron 570:

C:\Users>wmic csproduct get vendor,name,identifyingnumber
IdentifyingNumber  Name          Vendor
                   Inspiron 570  Dell Inc.

C:\Users>wmic bios get manufacturer, name, serialnumber
Manufacturer  Name                                        SerialNumber
Dell Inc.     BIOS Date: 09/02/10 15:02:26 Ver: 08.00.15


You can use the same commands with computers from other manufacturers. E.g., the output from the same commands run on a Gateway system running Windows Small Business Server (SBS) 2003 is shown below (the Dell systems in the above examples were running Windows 7 Professional):

C:\Documents and Settings>wmic bios get manufacturer,name,serialnumber
Manufacturer              Name                                                        SerialNumber
American Megatrends Inc.  AMIBIOS (C)2001 American Megatrends Inc., Version 07.00.00  0032880113

C:\Documents and Settings>wmic csproduct get vendor,name,identifyingnumber
IdentifyingNumber  Name        Vendor
0032880113         920 Series  Gateway

And the output from an HP system running Windows Server 2012:

C:\Users\Admin>wmic bios get manufacturer, name, serialnumber
Manufacturer  Name                       SerialNumber
AMI           Ver: RED_807.ROM vRED8.07  MXU24202NE

C:\Users\Admin>wmic csproduct get vendor,name,identifyingnumber
IdentifyingNumber  Name     Vendor
MXU24202NE         p2-1310  Hewlett-Packard



  1. View DELL Service Tag and Express Service Code From Linux and Windows
    By: Ramesh Natarajan
    Date: October 24, 2008
    The Geek Stuff

[/os/windows/commands/wmic] permanent link

Fri, Jan 01, 2016 7:20 pm

Moving a Windows system from one domain to another

I needed to move a Microsoft Windows 7 Ultimate system from a home Windows domain with a Windows Small Business Server (SBS) 2003 domain controller (DC) to one with a Windows Server 2012 Essentials domain controller. I migrated the system using these steps, but then realized I should have first copied the profile information for accounts used on the system, which I could have done using Windows Easy Transfer. I was still able to easily migrate the existing profiles to accounts in the new domain using the free version of User Profile Wizard from ForensiT, though.

[/os/windows/win7] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo