Anyone who has used Linux even sporadically will have notions of what a terminal is and its usefulness . But there are many who only use Microsoft’s Windows 10 system and its windows environment par excellence. For this reason, the article will be mainly dedicated to them, in case they ever need to use the Command Prompt and do not even know its existence. Of course, we will see how to use it and the most important or useful commands from it.
Index of contents
- What is a command terminal
- How a terminal and its shell works
- Command terminal startups in Windows and current version
- How to use the Windows 10 terminal
- User permissions for the Promt command
- Access from the system
- Access from installation / recovery drive
- Customize appearance of Windows terminal
- Basic use of the terminal and help
- Execute Conditional or Concurrent Commands in Windows Terminal
- More useful commands in the Windows terminal
- Windows Power Shell on W10
- Conclusions about the terminal in Windows 10
What is a command terminal
In the Microsoft windows system we know it as Command Prompt or CMD , but its more accurate name will always be command terminal or Command Promt . It consists of a command interpreter available in almost all operating systems, as one more control element for it, but at a low level.
It is a tool integrated into the system, and as such it is capable of performing the same tasks that we do in Windows 10 at the click of our mouse, at least part of them . When we do not have a graphical interface or windows, the command terminal will be the only option to manage an operating system. It is not only in Windows, but also in Linux with great weight for system administrators, in MacOS, and even in other systems as it is a basic tool.
How a terminal and its shell works
A command interpreter is nothing more than a program with the ability to translate commands written by the user through a set of instructions that allow direct control of aspects of the system, as well as the set of tools that are part of it.
For example, in Windows 10 we can access a folder by clicking on it and later view its content, or double-click to start the calculator from the beginning. In the Command Prompt we could do the same using commands :
PROMT> ls C: \ folder path \ to show if content
PROMT> calc to start the graphing calculator
We must introduce these commands following some syntax rules within the terminal emulator, through a promt that waits for them to be entered. These commands are related to functions of the system and all of them can express different ways of operation by means of arguments .
The arguments are nothing more than additional options placed after the main command that qualify the operation. In this syntax, many times it will be essential to place the path of the folder or file involved.
Command terminal startups in Windows and current version
The appearance of the command terminal dates back to the first operating systems that appeared, being the only possible way to carry out instructions in them. IBM’s UNIX would be one of the benchmarks in the 70s, and although it was not the first, it did have the closest capabilities to what we understand today by operating system.
But this system still required quite complex code for its control, so it would not be until 1981 with the appearance of MS-DOS when the command terminal became known as such. The use of medium and high-level programming languages such as C or C ++ greatly facilitated the implementation of systems with a layer between machine and user controllable more easily from commands and scripts.
COMMAND.COM would be the tool in charge of controlling the system as an integral part of the system itself, and in fact part of the commands used in Windows today come from it.As there was no graphical interface as such, everything was done on a black or blue screen and plain text. This tool was also in charge of loading the system configuration during its startup.
Architecture was developed and showed the ability to process graphics, giving way to Windows NT, the first system based on Microsoft windows . In this, the command interface was replaced by mouse clicks to icons and high-level graphics, evolving enormously until today and Windows 10.
Unlike COMMAND.COM, the current terminal commands Windows is just one more application in the system, making the function emulator command . This means that it is not an integral part of the system, and as such it does not load its configuration or dlls that control its operation. However, there are still functions carried out from the graphical interface that are sent to CMD to execute them, many others are based on scripts (script read by the interpreter) that are opened in the terminal.
How to use the Windows 10 terminal
We already know what a terminal is, so now we have to put this into practice to know how to use it, and above all, know how to cope with it to investigate it on our own.
As already mentioned, the terminal is nothing more than a command interpreter, and as such it needs a string of characters that it can understand. The only element that we find when starting the terminal will be its PROMT, a line that informs the user of the path of the user ‘s home directory . It will be by default where we are located to execute the commands, although later we will see that this may change.
When we enter the order with or without additional parameters, its execution will not be carried out until pressing the Enter key . The sequence is immediately analyzed by cmd or directly by the program it represents, since within the terminal we can execute other programs with their own commands , such as DISKPART, for example. The terminal’s response will depend on the order, and it may be information in the form of text in the terminal, the execution of an application in the foreground or background, or an error message when the command is not “understood”.
But not only will we be able to enter commands in the terminal , other features are also included such as redirection of input / output, reading and editing of files, process control, protection and security or editing and execution of batch programs (batch scripts)
User permissions for the Promt command
Another aspect to take into account when using the terminal in any system will be the user permissions . As we know, current OSs are multi-user and are based on sessions opened by each of them. Not all will have the same weight in terms of ability to interact with applications and others, there are administrators and invited or limited users.
Promt user vs administrator
Linux is where the user permission system is most marked, but Windows also has its own. Although in your case, whenever we create a user, it will be automatically administrator , but the figure of root or super user that Linux does have is not presented more explicitly.
This can be seen more easily graphically when we install an application, because at that moment, a window appears telling us to give administrator permissions to continue. Well, something like this will happen with the command terminal, because we must start it as a normal user or administrator.
We will immediately notice the type of user in the PROMT information, because instead of showing the path of our user’s folder, the path of the System32 directory will be shown as the path.
Access from the system
The simplest and most common way to access the Windows command terminal will be from the start menu.
- The long path will be Start> Windows System> Command Prompt, valid for all versions of Windows.
- The abbreviated route will be taking advantage of the search engine integrated in Windowsfrom Vista, writing on the CMD start, terminal or Command Prompt . Any of them will work, showing the tool as a result.
- A third option would be to open the Runtool with the Windows + R key combination and type CMD. Pressing Enter will execute
But wait, because before opening the tool we are going to see how to run it in normal or administrator mode . In the first and second method seen above, we will simply have to right-click on the tool icon and choose Run as Administrator .
In the third method, it is possible to run as Administrator if, when pressing Enter, we also execute the combination Shift + Ctrl .
Access from installation / recovery drive
But the Windows command terminal will acquire greater importance in situations in which it is not possible to access the graphical interface of the operating system . This scenario can occur due to a problem in the login due to system errors, or due to continuous reboots that do not allow us to work on it. CMD will be the only way to try to access the system if safe mode fails and we don’t want to format .
Luckily, Windows recovery drives have access to Command Prompt among their options. Exactly the same happens if we use the recovery menu of the system itself after three failed startups.
Using the example of a bootable USB , first of all, we will need to boot it correctly until the installation menu of the operating system appears. We can do this by following this tutorial .
Next, we must choose the Repair the computer option to access the drive’s recovery menu. In the list of options we will choose Troubleshoot , and then the Command Prompt option . We will be inside the terminal directly with administrator permissions.
If we carry out the process from the system recovery menu , the path would be Troubleshoot> Advanced Options> Command Prompt . To access this menu we must produce three failed system starts, for example, forcing the shutdown with the button, or press Shift while choosing Restart in the Start menu options.
Customize appearance of Windows terminal
A fundamental section (it is really optional) before starting to use the command terminal will be to customize the interface to our liking. The tool allows us to make certain modifications that will make the situation more enjoyable.
After executing the tool, we must right-click on the status bar – yes, you have to do it with the mouse – and we will choose Properties . Now a window will open with many options in which we can modify the interface.
In the Options section we have parameters on the basic operation of the terminal, among which the following stand out:
- Cursor size: it simply affects the cursor we see while typing. We recommend using the small size so as not to get confused with Insert mode activated.
- Command history: this is a buffer where the last commands executed in the session are stored.
- Editing options: affect the way of writing the commands and the copying of information in the terminal.
The Font section will obviously affect the font size of the text represented in cmd, being able to modify the size and font.
With the following, we simply modify the size of the window and screen buffer when starting the tool.
In the Colors section we can customize the color of the content of the terminal window, its text and even the pop-up windows. All this separately to give us different scenarios that we can differentiate well. It is even possible to modify the opacity of the entire terminal window, something very typical in Linux.
Finally, the Terminal section will also allow you to modify the color of the text, the cursor and its shape as more remarkable options.
Basic use of the terminal and help
A very basic procedure for know how to handle the command terminal minimally will be to know how to navigate through the system directories, display their content and access the help of the commands. It should be said that the terminal is not case sensitive , so it does not matter if we use lowercase or uppercase.
Take out the aid
The first thing we could do in cmd would be to get the full list of available commands . It certainly will not be very long and we will obtain basic information on its operation. For this we will use, either as a normal user or administrator, the command:
HELP
In this way, the following questions and sections that we are going to mention will almost answer themselves.
Help will have the command function as such , but will not be used to get help for a particular command. Indeed, all the commands that appear in the previous list have their own help section , even the CMD itself, which will open another instance of the terminal. To use the help in a command we will write the command followed by “ /? ” thus:
CMD /?
DIR /?
If the information is more extensive, then it is shown that we press a key to go to the next information screen. Another way to do it will be:
HELP DIR
Clean screen
When the information on the screen bothers us when executing a command and we want to erase everything that is being displayed, we will execute the command:
CLS
Break or terminate the execution of a command
If when executing a recursive or continuous command in the terminal we want to terminate it forcibly , the quickest way to do it is to press the combination Ctrl + C and it will conclude.
View command history and use them again
To speed up the task, we have seen before that the terminal has a buffer where it stores the last commands executed , whether they are correct or incorrect. These commands can be reused if we press the Up or Down arrow keys on the Promt , or it will write the last command by pressing Right .
If we want a complete list of them, then on the active cmd window we will press F7 , and this list will appear.
Directory navigation
To show the content in the directory in which we are currently located we will write:
DIR
If we expand the help we can add arguments to show more or less detailed information.
We can show the content of any directory even if it is not inside it by typing its full or relative path, being with the separator ” \ ” on the keyboard (Shift + º):
DIR <Directory path>
The directories in the operating system have a tree shape, so we will go up as we go into folders and subfolders, and we will go down if we leave them.
CD <Directory path>
CD ..
Create directories
Another command related to directory browsing will be the command that will allow you to create folders, with or without additional properties. The command will be the following:
MKDIR <path where \ new directory will be created>
Delete
The same as if we create, we can also delete folders and files with the DEL command for files and RD for directories as follows:
DEL <file path>
RD <directory path>
Copy and paste
The copy and paste command from Windows could not be missing, but in this case from CMD. Its name and syntax will be the following:
XCOPY <path of the file or directory to copy> <path of the location where to paste>
As simple as selecting the origin and adding the destination after a space. Obviously it will have arguments to recursively copy all the contents of a directory, to overwrite the existing content in the destination and others. It even works with drives shared over the network as if we do it graphically.
Complete path or view files on the go
To speed up navigation, not only these commands, but all those that have paths or file names as arguments allow autocomplete the name of the same. To do this we will begin to write the name of the folder or file and press TAB , then the name will be completed.
We will verify that the path is enclosed in quotes to allow spaces, accents, and other characters.
Execute Conditional or Concurrent Commands in Windows Terminal
As also happens in the Linux terminal, the Windows terminal can execute multiple successive commands or under certain conditions. It will be especially interesting for scripts that run line by line and small programs that we create. These will be the characters that we must add to make conditions:
[…] & […] (AND)
With the symbol & we will be telling the terminal to execute the second command when it finishes executing the first one . Regardless of what the result of the first is. For instance:
ipconfig / release & ipconfig / renew
We will first execute the status check of the network connections to later renew the IP and configuration of all of them.
[…] && […] (YES)
In this case it will be a lifelong conditional if , since the second command will only be executed if the first one has shown a successful result or has concluded correctly. In case the first one does not work, the second one will not run either. For instance:
cd Documents \ folder && mkdir Documents \ folder \ photos
We will only create the photos directory if we have been able to access Documents first
[…] || […] (OTHERWISE)
In this case, the second command will only be executed if the first one has not been executed successfully , that is, just the opposite of the above.
cd Documents \ folder || mkdir Documents \ folder
For this condition, we will only create the folder directory if we have not been able to access it because it did not previously exist.
They are somewhat simple examples, but at the moment of truth they can be quite important to make scripts that run automatically line by line like a small automatic program.
More useful commands in the Windows terminal
We have seen the essential commands to start using the Windows terminal, but we can still make a list of the essential ones in case we need them to operate in Windows in command mode or to try to correct system errors.
They will be the following:
- ASSOC: this command will show us file extensions associations and which programs they are associated with. You can also modify this association to a different program.
- CHKDSK– important for troubleshooting a hard drive. It is responsible for checking the status of a drive, partition or volume and tries to correct possible errors.
- CONTROL PANEL: to directly open the control panel in the graphical interface
- DISKPART: it is not a command, but a complete program for managing storage units, just like the disk manager in the graphical interface, but even more powerful.
- DRIVERQUERY: we will use it to list all the drivers installed on the computer, their location, and the type, in order to be able to manage them in case of malfunctions.
- FORMAT: to format a drive or partition
- IPCONFIG: indispensable network command that shows the configuration of the network interfaces and is also capable of updating said configuration
- MOVE: move files from one directory to another, same as cut and paste
- NETSTAT: shows statistics of our network and makes a very detailed diagnosis of active connections.
- NETSH– This command is more powerful than netstat not only for displaying network telemetry, but also for modifying and managing settings.
- PATHPING: combination between tracert and ping
- ping: another classic, the command that checks the connection status by sending ICMP packets
- POWERCFG: another of the most prominent, as it is in charge of everything related to the energy management of the equipment. You can create or activate power profiles, consumption reports, and even battery status reports if the battery is lithium.
- RENAME: command to rename files
- SFC– Typically used in conjunction with chkdsk to examine the integrity of all files on the system. In addition, it replaces the damaged ones with the correct versions using cached copies of the system.
- SHUTDOWN: command to shut down, restart or hibernate the computer.
- SYSTEMINFO: a very useful command to display system information, updates, version and hardware of the computer.
- TRACERT: another command related to networks that allows us to know the route that packets make from a host.
- TREE: shows the directory tree of a specific folder
- VIEW: shows the version of Windows installed
Well, these will be the most useful and used commands from the Windows terminal, although we have already seen that with help we can see the entire list in case we look for a function that does not appear here.
Windows Power Shell on W10
Power Shell is another command terminal installed natively in Windows , but more powerful than CMD. This one appeared with Windows Vista , and since then it is available in all later versions. We will find it in the tools menu by right-clicking on Start.
For usability, you can do the same as cmd with the same commands, but this interpreter adds even more power . It gives us the possibility of writing and joining commands through scripts, being designed for use by system administrators. The syntax in this terminal is a bit more complicated , or at least it differs a lot from what cmd supports, with in language we would say that it is of a higher level and intuitive when you know its guidelines for use based on the Perl language of UNIX .
Power Shell is also capable of interacting with Microsoft programs such as IIS or SQL Server , it supports variable declaration, mathematical operations, complex conditional structures, output redirection and many more as it is object-oriented. In fact, from this terminal we can modify system registers, stop services and monitor certain system counters.
Conclusions about the terminal in Windows 10
This is the end of this post dedicated to knowing what a command terminal is, focusing on Windows 10 as it is the most widely used system. As already mentioned, a Linux user should already know of its existence as it is quite important for these systems. It is not very different from Windows, but it is more useful and powerful.