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.
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.
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
Password:
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:
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/com.apple.TimeMachine.plist Destinations.
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.
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.
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.
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.
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 : king.com.CandyCrushSodaSaga
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 --
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
index.html
$ 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
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.
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.
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.
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 "rcm.amazon", since I know that
string
is part of the old ad format, but not the new ad format.
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
underscore.
-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
POSIX.)
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., "rcm.amazon", I can pipe the output of the grep
command into the
wc (word count) utility.
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 "rcm.amazon" --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</
title>
software/database/collectorz/MC-Customization/index.php: <title>Movie Collector
6.4.1 Customization</title>
security/malware/010210/index.php:<title></title>
security/malware/system_defender/033011/index.php:<title>System Defender Infecti
on</title>
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 "rcm.amazon" --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
Customization
security/malware/010210/index.php:
security/malware/system_defender/033011/index.php:System Defender Infection
security/malware/111511/index.php:AV Security 2012v121.exe Rogue Antivirus Progr
am
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 "rcm.amazon" --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 "rcm.amazon" --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
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:
Forbidden
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.
C:\>wmic cpu get name
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
Manufacturer
AuthenticAMD
C:\>
Or wmic cpu get caption.
C:\>wmic cpu get caption
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
CurrentClockSpeed
3600
C:\>wmic cpu get maxclockspeed
MaxClockSpeed
3600
C:\>
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.
If you have a Microsoft account, such as a Hotmail, now
Outlook.com, 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.
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
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.
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.
C:\>wmic os get OSArchitecture
OSArchitecture
64-bit
C:\>
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.
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.today() - D(2013, 12, 31)).days
745
>>> 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) - D.today()).days
1201
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
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"
1096
$
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@127.0.0.1 2>&1 >/dev/null | grep -i 'roaming'
debug1: Roaming not allowed by server
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 jdoe@example.com. 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.
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.
E.g., if I have 3 Firefox windows open, one of which has multiple tabs open,
I might see something like the following:
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.
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
lause>].
USAGE:
STARTUP ASSOC [<format specifier>]
STARTUP CREATE <assign list>
STARTUP DELETE
STARTUP GET [<property list>] [<get switches>]
STARTUP LIST [<list format>] [<list switches>]
C:\>
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.
USAGE:
LIST [<list format>] [<list switches>]
The following LIST formats are available:
BRIEF - Command, User, Caption
FULL - Command, Description, SettingID, User, Location, Cap
tion
INSTANCE - Caption
SYSTEM - __CLASS, __DERIVATION, __DYNASTY, __GENUS, __NAMESPA
CE, __PATH, __PROPERTY_COUNT, __RELPATH, __SERVER, __SUPERCLASS
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
ut.
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.
C:\>
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:
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:
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.
c:\>wmic printer get /?
Property get operations.
USAGE:
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
ut.
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 192.168.0.90
Microsoft XPS Document Writer XPSPort:
HP Photosmart 6510 series (Network) 192.168.0.21
HP Deskjet 6940 series 192.168.0.9
Fax SHRFAX:
Adobe PDF Documents\*.pdf
c:\>
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
PortName
192.168.0.9
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
C:\Users\Admin>
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 'gs371.example.com'.
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.
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.
I clicked on the Start Recovery button and then was informed that the
recovery of the database was successful.
When I clicked on Next I was able to access the database again.
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.
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 MacRumors.com webpage open to
reduce excessive memory consumption and CPU usage by Safari, I immediately
encountered another CPU usage issue caused by SymDaemon.
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/YYdate
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.
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.
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
C:\>wmic os get lastbootuptime
LastBootUpTime
20160102101902.495471-300
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".
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
Manufacturer
Dell Inc.
C:\Users>
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.
C:\>
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
C:\Users>
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
C:\Users\Admin>