The Windows Command Prompt, also known as CMD or Command Line Interface (CLI), The command prompt allows you to control your computer using text-based commands rather than the graphical user interface (GUI). This makes it an essential tool for programmers and developers. This article will introduce some of the most useful CMD commands. These commands cover critical scenarios, including network administration, device management, and file and data manipulation.
What is Command Prompt?
A Command Prompt is basically a Command Line Interface. We usually call it as CMD. It is an application in which the user enters commands, and the operations are executed accordingly. The Command Prompt is an integral part of the Windows Operating System. Also known as the Windows Command Processor, it is a file with the extension .exe.
How to Access Command Prompt?
To access the command prompt there are two ways:
First way
· Click on the Start Menu or press the Windows logo button from the keyboard.
· Type ‘cmd’ or ‘Command Prompt’ in the search bar.
· Click on the command prompt from the search results.
Second way
· Press Windows + R from the keyword.
· Type ‘cmd’ in the Run dialog box.
· Click on OK.
Commonly Used Commands in Command Prompt
Basic CMD Commands
cd (change directory)
changes the current working directory (path)
Example: cd\documents\test will change the location to a directory
Dir (Directory)
This display directory of files and directories stored on disk.
Example: C:User\Syeda>dir will allows you to see the directory of the given path.
cls (Clear the screen)
Erases all characters and graphics from the command prompt screen
Example: C:\Users\Syeda>cls This command is used to clear or wipe out everything written on screen.
echo (‘Print’ or ‘show’)
The echo command in Windows is used to print text to the console
Example: C:\Users\Syeda>echo Here echo is on now you can write a text.
C:\Users\Syeda>echo “Hello world” Here text will be printed in the Terminal.
File and Directory Operations
These Commands help you to view directories and move directories around, essentially allowing them to manage data stored on your computer through terminal window.
copy: - this command is to copy one or multiple files and folders in windows
move: - This command is used to move one or more files from one location to another
del: - This command deletes specific files from a disk
mkdir:- This command is used to create a new folder in your directory
rmdir:- To delete folders we need to use rmdir command
System Information Commands
System Information Commands is to display detailed configuration information about a computer and its operating system, including security information, product ID, and hardware properties (such as RAM, disk space)
Examples:
To view system configuration information for your computer use ‘systeminfo’ command.
To print the domain name in systems, use ‘hostname’ command
--------------------------------------------------------------------------------------------------------------------
Git Functionality in Command Prompt
Git commands can be executed directly from the command prompt with the terminal and Git are among the basic techniques with advanced git commands for users. Here are some basic git commands can be used to navigate to the directory and run the command below using it for IntelliJ IDE.
1. Git New Directory:
Using ‘git init’ through command prompt to create a new local directory in your IDE.
2.Clone the repository:
To clone the new repository from the remote location using ‘git clone’ command in Command Prompt.
3. Git Status check:
These states are like to check your change state like untracked files, commit, etc. To check this state of the change using in Terminal ‘git status’ command.
4. Switch from one branch to another:
To checkout from current branch to the newly created branch or different existing branch you can always use the checkout option using this command ‘git checkout’ & branch name in Command Prompt.
5.Git Pull Option:
To pull the latest code from the remote location of the same branch use ‘git pull’ command in command prompt.
6. Merge a branch into current one:
After code is complete and ready to be merged into your master branch use ‘git merge’ & branch name in Command Prompt.
FAQs- Questions on Command Prompt:
How to clear the command prompt shell?
To clear the command shell. We use the command cls. Cls is the command which is used when we want to clear our command prompt
Can we run command prompt as an administrator?
Yes, we can use Command Prompt to run as an administrator. The steps are as follows:
· Click on Start Menu
· Type cmd in the search bar.
· Command Prompt appears. Now right click and from the list of options click on ‘Run as Administrator’.
Can we change the default console background?
YES, we can change the default console background and text colors using the command color [background] [front] then it will display list of color attribute of console output select the color then it will change to selected color.