Difference between revisions of "Cmd tools"

From TheBestLinux.com
Jump to navigation Jump to search
Line 92: Line 92:
 
<br />
 
<br />
 
Windows webserver info, such as network SAN(Subject Alternative Names) alias names for SSL web certificates:  [https://en.wikipedia.org/wiki/Subject_Alternative_Name SAN Webserver Alternate Names]
 
Windows webserver info, such as network SAN(Subject Alternative Names) alias names for SSL web certificates:  [https://en.wikipedia.org/wiki/Subject_Alternative_Name SAN Webserver Alternate Names]
 +
<br /><br />
 +
How to create a CSR(Certificate Signing Request):<br />
 +
<pre style=color:blue>
 +
C:\Program Files\Apache Group\Apache2.2\conf\certificate
 +
 +
open the make_cert.txt file and double check the below. They should contain the same information.
 +
 +
 +
open a command line and run (REPLACE YYYY WITH YEAR):
 +
 +
cd C:\Program Files\Apache Group\Apache2.2\conf\certificate\
 +
mkdir YYYY
 +
cd YYYY
 +
 +
openssl req -new -newkey rsa:2048 -nodes -out wrangler_aerospace_craneae_com.csr -keyout wrangler_aerospace_craneae_com.key -subj "/C=us/ST=Washington/L=Lynnwood/O=Crane Aerospace and Electronics/OU=ET&P/CN=wrangler.aerospace.craneae.com" -config "c:\Program Files\Apache Group\Apache2.2\conf\openssl.cnf"
 +
 +
submit CSR to IT
 +
 +
place cert in the YYYY folder
 +
(make sure the received file is named wrangler_aerospace_craneae_com.cer, otherwise rename it to match assuming if its a cer file) if it's in a different format, you may need to convert the file format, or ask for a new certificate from IT.
 +
 +
edit the httpd.conf file located:
 +
C:\Program Files\Apache Group\Apache2.2\conf\httpd.conf
 +
 +
find SSLCertificate and replace YYYY with the new YYYY folder
 +
restart apache in the services.
 +
</pre>
 
<br /><br />
 
<br /><br />
 
More command line info to come as I have time.  Thanks for checking this and all of my other Wiki tips, tricks, and helpful information about all things computers!
 
More command line info to come as I have time.  Thanks for checking this and all of my other Wiki tips, tricks, and helpful information about all things computers!
 
<br />
 
<br />
 
<br />
 
<br />

Revision as of 19:59, 16 November 2016

All of these commands must be run from a command line prompt or window, what used to be called the DOS prompt!


If you don't know how to open a command prompt in Windows, it's very easy. Just click on the Start button, usually at the very bottom left corner of your computer screen, and then right above where you clicked where it says "Search programs and files", type "cmd" without the quotes and hit the "ENTER" key on your keyboard. It will then open up a command prompt window, where you can type many powerful commands using your keyboard and hitting the "ENTER" key when done to tell the computer you are done typing the command you want it to run, so now do it!

Here are some very useful command line commands you can type to get information you otherwise may not be able to do from a normal Windows program


To find out when the OS(Opertaing System) was installed, which can be a good way to find the age of the computer. This is the command:

C:\>systeminfo | findstr Original



To see how long a Windows computer has been turned on for since the last time it was turned off or rebooted, there is no UNIX/Linux equivalent of the command "uptime", which shows you exactly how long the machine has been "Up" or turned on for. A command to get that same information is a subset of the "net" family of command line commands.
So, to see how long your Windows computer has been turned on for since it was last turned off or rebooted, type this from the command prompt:

C:\>net statistics server

and hit the "ENTER" key. You will get an output similar to this:

Server Statistics for \\COMPUTER_NAME


Statistics since 9/27/2015 4:55:18 PM


Sessions accepted                  1
Sessions timed-out                 0
Sessions errored-out               328

Kilobytes sent                     925
Kilobytes received                 4351

Mean response time (msec)          0

System errors                      0
Permission violations              0
Password violations                4

Files accessed                     0
Communication devices accessed     0
Print jobs spooled                 0

Times buffers exhausted

  Big buffers                      0
  Request buffers                  0

The command completed successfully.



You can shorten the command as well, like this:

net stats srv



Also, you can filter out all of the extra data and information provided by the output of this command by piping the output of the command into the findstr command to only display the one line we are looking for, that starts with "Statistics since...", like this:

net stats srv | findstr "since"


Which produces an output similar to this:

Statistics since 9/27/2015 4:55:18 PM


This gives you exactly what you are looking for, as the date and time indicates when the computer was powered on since it's been currently running.

Another way to get the same information is with the systeminfo command. This is how to use systeminfo to get the time when the computer was powered on:

systeminfo | findstr Boot | findstr Time


The above command produces an output like this:

System Boot Time:          12/16/2015, 3:48:08 PM



To reboot your computer from the command line, which is the only way to do it if you are connected to it remotely instead of directly, such as when using Windows Remote Desktop, which I have to do multiple times at the same time on many multiple Windows servers while I am at work. From a command line window, type this to reboot the computer in 30 seconds:

shutdown /r /t 30

and hit the "ENTER" key to compete the command. If you've typed the command correctly, instead of receiving an error message, a pop-up window should pop up stating that the computer is going down for a reboot in 30 seconds.

Here are more examples: Retrieve RAM from Command Line

Windows webserver info, such as network SAN(Subject Alternative Names) alias names for SSL web certificates: SAN Webserver Alternate Names

How to create a CSR(Certificate Signing Request):

C:\Program Files\Apache Group\Apache2.2\conf\certificate
 
open the make_cert.txt file and double check the below. They should contain the same information.
 
 
open a command line and run (REPLACE YYYY WITH YEAR):
 
cd C:\Program Files\Apache Group\Apache2.2\conf\certificate\
mkdir YYYY
cd YYYY
 
openssl req -new -newkey rsa:2048 -nodes -out wrangler_aerospace_craneae_com.csr -keyout wrangler_aerospace_craneae_com.key -subj "/C=us/ST=Washington/L=Lynnwood/O=Crane Aerospace and Electronics/OU=ET&P/CN=wrangler.aerospace.craneae.com" -config "c:\Program Files\Apache Group\Apache2.2\conf\openssl.cnf"
 
submit CSR to IT
 
place cert in the YYYY folder
(make sure the received file is named wrangler_aerospace_craneae_com.cer, otherwise rename it to match assuming if its a cer file) if it's in a different format, you may need to convert the file format, or ask for a new certificate from IT.
 
edit the httpd.conf file located:
C:\Program Files\Apache Group\Apache2.2\conf\httpd.conf
 
find SSLCertificate and replace YYYY with the new YYYY folder
restart apache in the services.



More command line info to come as I have time. Thanks for checking this and all of my other Wiki tips, tricks, and helpful information about all things computers!