Difference between revisions of "Cmd tools"

From TheBestLinux.com
Jump to navigation Jump to search
Line 1: Line 1:
 
= All of these commands must be run from a command line prompt or window, what used to be called the DOS prompt! =
 
= All of these commands must be run from a command line prompt or window, what used to be called the DOS prompt! =
 +
<br />
 +
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!
 +
<br />
 +
<br />
 +
== 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 ==
 
<br />
 
<br />
 
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.
 
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.
 
<br />
 
<br />
So, to see how long your Windows computer has been turned on for since it was last turned off or reboots, type this from the command prompt:
+
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:
 
<pre style="color:blue">net statistics server</pre>
 
<pre style="color:blue">net statistics server</pre>
 
and hit the "ENTER" key.
 
and hit the "ENTER" key.

Revision as of 02:44, 25 October 2015

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 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:

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 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.

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!