DEV Community

Cover image for Basic Windows Commands every one MUST know
Mahith
Mahith

Posted on

Basic Windows Commands every one MUST know

Hey Guys...!

Who will use the command line in the modern world is the common thought many of you may have but using the command line gives you complete control of your computer and let you do things a lot better.

Some people are scared of the Command line. Others consider it arcane and obsolete. Many of us know the truth though. Often, Command line tools are just the right tools for the job.

Command line utilities and applications provide us with many benefits that are unavailable, difficult to achieve, or incomplete with any GUI applications.

Every developer must know at least some basic commands and that's what this post focusses on.
So, A quick intro of some basic windows commands you must know:

1) pwd-
It shows the path of the Present working directory you are in which helps you to change your directory if you need to.

2) cd -
If you want to go to the directory which is in the current working directory you can simply enter cd followed by folder name you want to go to.

Pro Tip: You can directly go to the folder you want to work on using command prompt and then enter cmd in place of path and press enter, your command prompt opens up in the current directory.

3)cd .. -
If you want to come back to the previous folder from the current folder you can simply type cd followed ..

4) cd / -
If you want to come back to your home directory simply type cd followed by a space and then /

5) dir -
If you want to know what are the files/folders present in the current directory you are in, just type dir to see a list of items present.

6) md -
If you want to create a new directory you can type md followed by the name of the folder you want to be created.

You can also use mkdir instead of md.

Type dir to check your newly created folder in the list displayed.

7) notepad filename.extension -
If you want to create a new notepad file, you can enter the command notepad followed by name of the file with .file extension

Then notepad file with a given name will be created, feel free to write down your information and save it.

Note: if you enter notepad abc.txt and abc.txt already exists then saved file will be fetched, if there is no file present with the given name then a new file will be created in the directory.

8) copy con file-name.extension -
This command is no different than that of (5). The only difference is instead of popping up a notepad file and then entering the data you can directly enter the data on the command line and then press Ctrl+Z to save the file.

9) del file-name.extension -
If you want to delete a particular file in a directory simply type del followed by file name with its extension.

10)del folder-name -
If you want to delete all the files in a folder, you should first come out of that folder using (3). Now type del followed by the name of the folder. Now you will be asked to enter confirmation key with y for yes and n for No. Submit your choice and it will be done.

Note: This doesn't remove the folder itself, instead it removes contents of the folder.

11) rd -
If you want to delete the folder itself then type rd followed by name of the folder.

You can also use rmdir instead of rd for this operation.

12) move file-name.extension -
If you want to move a file to another folder type move followed by filename with the extension you want to move followed by the path where you want to move the file to.

13) copy file-name.extension -
If you want to copy a file to another folder type copy followed by filename with the extension you want to copy followed by the path where you want to copy the file to.

14) cls -
If you want to clear your command line screen, just type cls. Everything will be clean and fresh.

I hope this post helps you understand the basic commands you can use to do your basic work done in the command prompt.

Let me know your thoughts in the comments. Also, Let me know if you need to know the advanced commands so that I can make a new post.

Thank you, guys.
Bubye

Top comments (5)

Collapse
 
f1lt3r profile image
F1LT3R • Edited

Best Windows command I ever used was:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Collapse
 
mahithchigurupati profile image
Mahith

That is to install the Windows Subsystem for Linux. Quite useful for Advanced users. Thanks for sharing Alistair

Collapse
 
asyraf profile image
Amirul Asyraf

Thanks for awsome tips🀟

Collapse
 
tokendev18 profile image
Aaron

Great tips man!!

Collapse
 
mahithchigurupati profile image
Mahith

Thanks man..! ❀️