A tool synonymous with computers in the ’80s and ’90s, the command prompt or command line is much less well-known with today’s users. Despite a drop in usage, the command prompt still remains an important tool that Windows and Mac users should be familiar with. Learning how to use the command prompt can help you troubleshoot problems, created automated tasks and files, and more. For instance, if you experience a hardware malfunction that forces you into safe mode with command prompt, familiarity with it may help you troubleshoot the problem and get back to work. To help you get started, we have compiled a list of essential and useful commands as well as a description for each.
Before we begin however, you need to know how to get to the command prompt tool. For Windows users, search for “cmd” with the search and run feature. CMD.exe will likely be the first result; open it to get started. Once launched, you will see this window:
Navigating Files and Folders
Familiarize yourself with the following commands to get started. You can open files using the command prompt simply by typing the filename and its extension. To open a readme.txt file for instance, just type readme.txt as the command and press Enter.
A note on shortcuts: The traditional Ctrl + A/C/V/X keyboard shortcuts will not work in the command prompt. Instead, those commands and shortcuts can only be accessed through the right click menu. If you do need to repeat a command however, you can use the up arrow on your keyboard to scroll through commands you have used previously in the same session.
|dir||Directory||Lists all the files and folders housed in the directory you are currently in.|
|cd||Change directory||Changes the directory from the one you are working with to another one that you specify.|
|cd..||Go up a directory level||Navigate up a directory level. For instance, if you are in C:\Folder\Subfolder, using the command will put you in C:\Folder.|
|cd <folder name>||Open a folder in a directory||If you are at the root C:\ level, typing CD windows|
|<drive letter>: (Example: C:, D:, E:. F:)||Navigate to another drive.||Navigate to another drive. For instance, C: will send to you to the C:\ drive, D: to D:\, E: to E:\, and so on.|
|mkdir <folder name>||Create a directory||Creates a new folder in the folder you are currently in. Example: mkdir hello will create a folder named “Hello”.|
|del <filename>.<extension>||Delete a file or folder||Delete a specified file. For instance, using del readme.txt will delete the Readme.txt file. You can expand the command by using asterisk (*) as a wildcard.Example:del *.txt deletes all .txt files in the directory.del *.* deletes all files in the directory.|
In the following list, we cover useful commands that go beyond navigating and modifying the file structure.
|help||List commands||The help command brings up a list of commands that you can use. Please note that the command is context sensitive. For instance, if you use the help command while using a command prompt program, it will bring up commands specifically for it.|
|Copy <file name> <destination directory / file name>||Copies a file to another location||Unlike the Copy function in Windows, think of this command as Copy and Paste in one function.Example: copy readme.txt c:\hello.txt copies readme.txt into the root c:\ drive with the file name hello.txt.|
|move <file name> <destination directory>||Moves a file to another location||The Cut and Paste actions in Windows merged into one command—just specify the file and new location. The same arguments that you can use for the copy command can generally be used for the move command as well.|
Unlike the navigation and file manipulation commands in the previous sections, the following will open programs.
|Ping <Website or IP address>||Verifies connectivity to the specified location||Pings an address and returns information on its status in relation to you as well as latency. Not all websites can be pinged, as firewalls may block the packets. Useful to check router connectivity, in which case you would use ping 192.168.1.1.|
|ipconfig||View or modify your computer’s IP address||Often used to determine your computer’s IP address, it can also be used to view details such as Ethernet adapters, DHCP status, subnet mask, MAC address, and more.Additional arguments include:ipconfig /all Lists all detailsipconfig /release Releases the computer’s IP address assigned to it by the router.ipconfig /renew Requests a new IP address.|
|driverquery||Lists all drivers installed on the PC||In case of hardware issues, you can use this command to check for missing drivers.|
|Netstat||Lists currently open ports and connected IP addresses||Useful for the security-minded, this command allows you to check if a device is successfully connected or if you have a Trojan or other malware.|
|Tasklist||Lists currently running tasks||Similar to the Task Manager, except in text form. Every task will be listed with a four digit PID along with session information and memory usage.|
|Taskkill <PID>||Stop a specified task||Force stop the specified task, similar to the End Task button in the Task Manager.|
Despite how much we work with GUI-intensive programs, knowing how to use the command prompt can very helpful in emergency situations. What commands do you find useful? Or do you never touch it?