Cmd tools

From TheBestLinux.com
Jump to navigation Jump to search

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 open up the main control panel, just type "control" without the quotes and hit the ENTER key.

To open up the System Control panel, where you can then rename your computer, enable remote desktop access, and change many more system setting, type "control system" without the quotes, and hit ENTER, to bring up the System Control Panel.

C:\Users\jamie>control system

C:\Users\jamie>



This should bring up the System control panel, showing information about your computer, such as RAM memory and other system specifications:

Error creating thumbnail: File missing



To find out when the OS(Operating 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 SERVER 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.

The above commands were for Windows SERVER versions. The exact same process can be performed on a Windows 10 or prior computer, substituting the word "server" (OR "srv", if abbreviated), without the quotes, for "workstation". Specific abbreviations can be substituted as seen in the case of "server" usage, being abbreviated with "srv", whereas "workstation" can be abbreviated in using these commands with "work", again without the quotes.

For instance, here is an example of me performing the same type of command to see how long a Windows 10 end-user computer has been booted up(turned on) for:

C:\Users\jamie.DAWGLAND>net stats work | findstr since
Statistics since 8/4/2021 6:59:03 PM

C:\Users\jamie.DAWGLAND>


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 Windows CSR(Certificate Signing Request) for use with the Apache webserver running on Windows:

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!