4 C
Texas

How to use the Windows 10 terminal

Hello! We have recently talked about what the terminal is. Well, it’s time to dig a little deeper. Today, we will learn how to use the terminal in Windows 10. A basic use allows you to navigate through the system directories, display their contents and access command help. Therefore, read on to learn how to use the Windows 10 terminal.

How to use Windows 10 terminal help.

In particular, the help allows you to obtain the complete list of available commands. Don’t worry, there are actually not many. This is something we can do from the command prompt. Additionally, there is no distinction between a normal user and an administrator. Please note that the terminal is not case-sensitive, so it makes no difference whether we use lower case or upper case. With this in mind, we will use the following command:

HELP
List of commands available for the windows terminal
List of commands available for the windows terminal

Consequently, we will be able to develop the help of each particular command. Specifically, help shows the function of the command as such. However, it does not display the complete help for a command. I mean, all the commands we saw in the previous list have their help section. This applies even to the command prompt itself. In effect, the help opens another instance of the terminal. l. To use the help in a command, type the command followed by /? Using this syntax:

- Advertisement -
BREAK /?
CD /?
Displaying CD command help

The information may be more extensive than what is shown in the window. Consequently, it is offered to press some keys to move to the next information screen. Another way to do this is to use the command:

HELP DIR

How to clean the terminal screen.

After executing and executing commands, the screen will logically fill up with characters. Consequently, it is likely that at some point we will want to clean them up. With this in mind, we will use the following command:

CLS

How to force the termination of a command.

Occasionally, we run a command, and it is taking a long time to finish. Or we simply run it accidentally. Consequently, if you want to finish it in a forced way, then you must press the combination Ctrl + C, and it will finish:

Forcing the termination of a command in the Windows terminal
Forcing the termination of a command in the Windows terminal

How to view the command history and use them again.

The Windows terminal has a buffer where it stores the last executed commands, whether correct or erroneous. This serves to speed up the tasks we do. Consequently, we will be able to reuse them if we press the Up or Down arrow keys on the Prompt. Additionally, we can write the last command by pressing the Right directional key. We can also display the complete list of commands. To accomplish this, just press F7.

Viewing the list of all commands used in Windows Terminal
Viewing the list of all commands used in Windows Terminal

Using directory navigation.

One of the most used functions of the CMD is to be able to navigate through the file directories. To display the directory where you are currently located, please use the following command:

DIR

Note that you can expand the information by using the help command shown above.

DIR command, displaying the user's current directory
DIR command, displaying the user’s current directory

On the other hand, we can show the content of any directory even if we are not inside it. To achieve this, just type DIR and then the full or relative path:

DIR <directory path>

Directories in the operating system have a tree-like composition. Consequently, we will go up as we go deeper into folders and subfolders. On the contrary, we will go down if we go out of them.

CD <directory path>
CD..
Navigating directories from the Windows terminal.
Navigating directories from the Windows terminal.

How to create directories with the Windows terminal.

Next we will see another command related to directory navigation. Specifically, we will see how to create folders, with or without additional properties. The command will be as follows:

MKDIR <path where the new directory will be created>
Creating a new folder in the command prompt
Creating a new folder in the command prompt

Let’s learn to erase as well

We have seen how to create directories and files. Well, we can also delete them via commands. Specifically, we will use the DEL command to delete files and the RD command to delete directories.

DEL <file path>
RD <directory path>

It is also possible to copy and paste.

This Windows classic could not be missed. Yes, the Windows terminal also allows copy and paste. Let’s see the syntax:

XCOPY <path of file or directory to copy> <path of the location where to paste>

You only have to select the origin and after a space to add the destination. In addition, there are arguments to recursively copy the entire contents of a directory, to overwrite the contents already existing in the destination and others. It even works with shared drives over the network, as if we do it graphically.

Complete files and view files on the go.

This option is intended to speed up navigation. All commands that take paths or filenames as arguments allow auto-completion of the filename. For this purpose, just start typing the name of the folder or file. Then press TAB and the name will be completed. Note that the path is enclosed in quotes to allow for spaces, accents and other characters.

Autocompleting a command in the Windows Terminal
Autocompleting a command in the Windows Terminal

Running simultaneous or conditional commands in Windows terminal

In some cases, the Windows terminal behaves like the GNU/Linux terminal. Indeed, it can execute multiple commands succeeding or under certain conditions. This option becomes relevant for scripts that are executed line by line and small programs created by the user. Check the characters to be added:

[…] & […] 

Let’s see how they are used. With the symbol & we will be indicating to the terminal to run the second command when it finishes running the first one. Independently of the result of the first command. To clarify, it is an AND function. For example:

ipconfig /release & ipconfig /renew

In this case, the status of the network connections will be checked first. Then the IP address and the configuration of all of them will be renewed.

Let’s look at another use:

[…] && […]

We are talking about a classic if conditional. In effect, the second command will only be executed if the first one has shown a successful result or has concluded correctly. If the first command fails, the second command will not be executed either. Let’s see:

cd Documents\folder && mkdir Documents\folder\docs

We will only create the docs directory if we have been able to access Documents first. Let’s look at another use:

[…] || […]

In this case, the second command will only be executed if the first one has not been executed successfully. In fact, it is just the opposite of the previous command. Specifically, it is an if-but-no command:

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. These are certainly simple examples, but they can be very useful when executing more complex tasks.

Conclusion

Very well, in last instance we have seen how to use the terminal of Windows 10. I hope to have clarified your doubts, if you want some topic in particular, let us know in the comments. Bye!

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article