20 CMD Commands All Windows Users Should Know

Aakansha Jain
8 min readJul 3, 2020

--

The traditional Unix environment is a CLI (command line interface), where you type commands to tell the computer what to do. That is faster and more powerful, but requires finding out what the commands are.

The basic commands that you will be using more frequently are

1. sudo

This SuperUserDo is the most important command Linux newbies will use. Every single command that needs root’s permission, need this sudo command. You can use sudo before each command that requires root permissions –

$ sudo

2. ls (list)

Just like the other, you often want to see anything in your directory. With list command, the terminal will show you all the files and folders of the directory that you’re working in. Let’s say

I’m in the /home folder and I want to see the directories & files in /home.

/home$ ls

3. cd

Changing directory (cd) is the main command that always be in use in terminal. It’s one of the most Linux basic commands. Using this is easy. Just type the name of the folder you want to go in from your current directory. If you want to go up just do it by giving double dots (..) as the parameter.

Let’s say I’m in /home directory and I want to move in usr directory which is always in the

/home. Here is how I can use cd commands -

/home $ cd usr/home/usr $

4. mkdir

Just changing directory is still incomplete. Sometimes you want to create a new folder or subfolder. You can use mkdir command to do that. Just give your folder name after mkdir command in your terminal.

~$ mkdir folderName

5. rm

rm is a command to remove your file or even your directory. You can use -f if the file need root permission to be removed. And also you can use -r to do recursive removal to remove your folder.

$ rm myfile.txt

6. cat

As a user, you often need to view some of text or code from your script. Again, one of the Linux basic commands is cat command. It will show you the text inside your file.

$ cat CMakeLists.txt

7. Make your Command Prompt colorful

You can change the color of the Windows Command Prompt to make it look colorful. You can perform this easy change by right-clicking in the top corners of the Command Prompt and select Properties. There, find the Colors tab and look for the options to change the background and text color.

8. Abort a command

This handy Windows CMD trick comes to rescue when you have pressed the enter key, and you need to stop the command in its tracks? To do it, you need to do a Ctrl+C. However, it isn’t a magic trick that can undo an undoable thing.

9. Send output to clipboard

Very often, you might have felt the need to save the output of a command? Usually, people use copy and paste. However, using a simple command, you can send the command’s output to the Windows clipboard. Here’s how to send the ipconfig information:

ipconfig | clip

10. Command History

Using this command, you can track down your command history. This will turn out to be useful when you are trying to look for some command that you’ve used in the past, but can’t remember.

doskey /history

11. Run multiple commands

If you are feeling the need to run two commands one after the other, you can do so easily. Add this to your collection of CMD hacks. You just need to put “&&” between each command and save some time. For example, here’s how to run ipconfig and paint.

ipconfig && mspaint

12. Become a Command Prompt Power User With Function Keys

One out of the very useful CMD tricks is to use function keys. There is a lot these keys can do to improve your CMD experience.

Here’s the list:

· F1: Pastes the last executed command (character by character)

· F2: Pastes the last executed command (up to the entered character)

· F3: Pastes the last executed command

· F4: Deletes current prompt text up to the entered character

· F5: Pastes recently executed commands (does not cycle)

· F6: Pastes ^Z to the prompt

· F7: Displays a selectable list of previously executed commands

· F8: Pastes recently executed commands (cycles)

· F9: Asks for the number of the command from the F7 list to paste

13. See PC driver list

Using a simple command, you can see all the drivers installed on your computer. All you need to do is run the driverquery command, and you’ll be seeing a list of all the drivers along with their name, type, and other information.

driverquery

14. SYSTEMINFO: System Information

If you need to know what brand of network card you have, processor details, or the exact version of your Windows OS, the SYSTEMINFO command can help.

This command polls your system and pulls the most important information about your system. It lists the information in a clean format that’s easy to read.

15. View a Drive’s Entire Directory Structure

· One of the neatest little commands is the tree command. With tree, you can create a kind of map of the directories on any of your computer’s drives.

· Execute tree from any directory to see the folder structure under that directory.

· With so much information created with this command, it’s probably a good idea to export the results of tree to a file so you can actually look through it.

16. Open the Command Prompt From Any Location

· If you’ve ever worked in the Command Prompt for very long, you know that it can be really frustrating executing the cd/chdir command over and over again to get to the right directory.

· In Windows, open the folder you’d like to start working from, within Command Prompt. When you’re there, hold down Shift while you right-click anywhere in the folder.

· After the menu pops up, you’ll notice an entry that’s not usually there: Open command window here. Click that and you’ll start a new instance of the Command Prompt, ready and waiting at the right location.

· If you’re a Command Prompt power user, you’ll immediately recognize the value in this little trick.

17. Access Previously Used Commands With the Arrow Keys

· Another great Command Prompt trick uses the keyboard arrow keys to cycle through previously executed commands.

· The up and down arrow keys cycle through the commands you’ve entered and the right arrow automatically enters, character by character, the last command you executed.

· This might not sound that interesting, but there are several situations where the arrow keys become huge time savers.

· Consider this example: You’ve typed out 75 characters of a command and then try to execute it, only to find that you forgot to add an option at the very end. No problem, just press the up arrow and the entire command is automatically entered in the Command Prompt window, ready for you to edit to make it work.

18. Find a Website’s IP Address

· Like to know the IP address of a website? Use the nslookup command or the ping command, but the former is probably faster.

· First, let’s use the nslookup command to find the IP address of lifewire.com.

· Just execute nslookup lifewire.com and view the result. Don’t confuse any private IP addresses that also show up in the nslookup results alongside the public IP address of lifewire.com, which is what IP address we’re after.

· Now let’s try using the ping command to find it.

· Execute ping lifewire.com and then look at the IP address between the brackets in the first line shown. Don’t worry if the ping command “times out” during execution; all we needed here was the IP address.

· You can use the same procedure with any website or any hostname on your local network.

19. Copy and Paste Easier With QuickEdit Mode

· A number of these Command Prompt tricks have dealt with making copying and pasting easier. So, how about an even easier way to copy from the Command Prompt (and a secret way to easily paste)?

· Just right-click on the Command Prompt title bar and select Properties. On the Options tab, in the Edit Options section, check the QuickEdit Mode box and then select OK.

· Enabling QuickEdit Mode is like having Mark enabled all the time, so selecting text to copy is really easy.

· As a bonus, this also enables a simple way to paste into the Command Prompt: just right click once and whatever you have in the clipboard is pasted in the Command Prompt window. Normally, pasting involves right-clicking and selecting Paste, so this is still a bit different than you’re used to.

20. Watch Star Wars Episode IV

· Yes, you read that correctly, you can watch an ASCII version of the full Star Wars Episode IV movie right in the Command Prompt window!

· Just open Command Prompt and execute this:

telnet towel.blinkenlights.nl

· The movie will start immediately. Check out the tip below if this doesn’t work.

· True, this isn’t a terribly productive use of the Command Prompt, nor is it really a trick of the Command Prompt or any command, but it sure is fun! We can’t imagine the work that went into this homage to the sci-fi masterpiece.

· The telnet command isn’t normally enabled in Windows but can be turned on by enabling Telnet Client from Control Panel. If you’d rather not enable Telnet but would like to see the movie, you can also watch it in your browser at Star Wars ASCIIMation.

--

--

Aakansha Jain

Upcoming Developer. Love to code and learn new technologies.