In computer science, a Command-line interpreter (CLI) refers to a program that allows users to enter a command, it then reads and interprets the input and executes the input in the operating system. CLI accepts commands from a keyboard in the form of a text line.
Here we will be sharing with you, 7 Command Prompt tricks that you should definitely know in 2021.
Also Read: What is the Purpose of the Command Interpreter?
Command Prompt Tricks that You Should Know
In this section, we will discuss 7 command prompt tricks that you should know.
1. Listing Files and Directories
If you want to list all your files and directories, you can do it with few command prompt commands.
To view all the files and folders in a particular directory use dir command. This dir command will list all the directories available on your Windows 10 computer.

Even you can list all the hidden files and directories if somebody had hidden some files and directories in your computer you can view it with a command prompt. For that use dir /a command
Note: There’s a reason why system files and folders are hidden, so don’t mess with these hidden files and folders this can affect your computer.
2. Opening Files using Command Prompt

Do you know you can open any files using the command prompt? Yes, you can open any images, audio, and video files using command prompts.
To view all the files and folders available in a particular directory use dir command.
Now say for example If want to view all the png file available in that directory then I will use
dir *.png
To open a file, use the following command
file_name_with_extension
Also Read: How to Run a Java Program Without IDE?
3. Creating and Removing Directories

Creating and removing directories or folders in a windows 10 computer is very easy using the command prompt. You don’t need to select multiple options for that, just write one Command Prompt command.
To Create Directories, use this command mkdir (make directory)
mkdir New
This command will create a directory called New.
To Remove Directories, use this command rmdir (remove directory)
rmdir New
This command will delete the New directory. Now if you have other directories inside this directory then you have to use
rmdir /s New
This command will delete all the directories which are available inside this directory along with the New directory.
Also Read: How to Shut Down a Windows 10 PC using the Command Prompt?
4. Change Drives and Directories

By default C:\Windows\System32 or C:\Users\<user name> is your default command prompt Directory. Now if you want to work on different drives and directories. For that, you have to use the change directory command.
Before that let us learn how to check the drives available on our computer. For that use this command:
wmic logicaldisk get name
To change drive use the drive name with a colon (E:) this will change the directory to E drive.
To change the directory use this command cd folder_name. For example:
cd desktop
Note: To come back to the default directory or previous directory use this command cd ..
5. Changing Colors of Command Prompt

If you want a matrix look in your command prompt then you can change the colors of it. Here we will learn how to change the text color and background color of the command prompt.
To change text and background color, use a color command
color 08
Here 0 is for background and 8 is for text color. Need more help with the color command, use this command “color /?” or “help color“.
Note:- 0-7 are background color and 8,9 and A-F are text color. To come back to normal just use the “color” command.
Also Read: How to Hide/Unhide Files and Folders Using Command Prompt on Windows 10
6. Opening and Deleting Files

Here, we are going to discuss Deleting and Appending to Files. Here we will learn how to open and delete files using the command prompt.
Let’s see how we can open the file:
Use this command to open files with the default software. Say for example your text editor is notepad then when you open the file using the command prompt it will open in notepad.
Here the command:
Navigate to the directory and type the file_name_with_extension (note.txt)
Now to open the note.txt on the command prompt itself then use the command
type note.txt
Now to delet the file usin the following command
del note.txt
7. File Attributes in Command Prompt

If you want to change the file attributes then use the following command.
Note:- If you want some help with the file attribute then use this command “attrib /?“
To hide files use “attrib +h file_name_with_extension“. For example, I want to hide note.txt file then I’ll use
attrib +h note.txt
To add read-only attribute use
attrib +r note.txt
Now to unhide the file use this command
attrib -h note.txt