dimanche 22 septembre 2024

How to use Windows Terminal and what it’s useful for

How to use Windows Terminal and what it’s useful for
Laptop with Windows logo against background of small drawn icons.
Illustration by Samar Haddad / The Verge

Scratch the surface of Windows (and macOS), and you’ll find a command line console underneath, a lingering remnant of how these operating systems started out: as user-friendly graphical wrappers built on top of text-based, monochrome interfaces.

If you’re as old as I am, you might remember having to launch apps and games on a computer by typing out text commands, rather than pointing and clicking. The modern-day methods are much easier, of course, but the old ways are still available — and they’re actually still useful for multiple tasks, as the list below shows.

To begin with, Windows kept the Command Prompt utility as a reminder of its MS-DOS roots. That was later joined by PowerShell (Command Prompt with extras), and in the latest versions of Windows 11, Command Prompt and PowerShell are now both wrapped up in a tool called Windows Terminal.

Windows Terminal supports all the original Command Prompt instructions, and you can launch it from the Start menu. It’s simple:

  • Search for Terminal.
  • Right-click on the program icon and choose Run as administrator to make sure all of the features are available to you.

Now that you’ve got the Windows Terminal open, here are some of the commands that might make it worth your while. To make use of them, type the text shown and then hit Enter.

Windows Terminal window with shut-down instructions. Screenshot: Microsoft
There are more ways to shut down your computer than you might have realized.

1. Shut down your computer after a certain time

shutdown /s /t 600

Shutting down your computer via the Start menu isn’t difficult, of course, but Terminal gives you a few more options, like timed shutdowns. The command above orders a shutdown (“/s”) rather than a restart, after a time (“/t”) of 600 seconds. Simply adjust the timing as needed.

Another handy option is “shutdown -r -o” (without the quotes), which restarts (“-r”) your computer and launches the Advanced Start Option menu — very useful for troubleshooting. Just type “shutdown” by itself to see other flags you can use.

2. See a visualization of your folders

tree

Type “tree” and hit Enter to see a visual representation of the folders and subfolders on your system — very useful for seeing how your Windows drive is organized. You can include a drive and folder path (such as. “C:\Programs\”) to focus the listing on a specific area of the drive and use the “/f” flag to see files listed as well as folders.

3. Troubleshoot network problems

ipconfig /flushdns

The “ipconfig” command is often used to troubleshoot networking problems. Use it on its own, and you’ll see your router’s current IP address, but add the “/flushdns” flag, and connections between your computer and the websites you visit get reset (via the DNS server), which can help if websites aren’t loading up as they should.

You can also use “ipconfig /release” and then “ipconfig /renew” to get a fresh IP address for your computer — potentially solving connection problems between your Windows device and your router or your device and the internet.

Windows Terminal window with systeminfo. Screenshot: Microsoft
You can get a plethora of information about your system.

4. Get more information about your system

systeminfo

The classic “systeminfo” command will tell you just about everything you could possibly want to know about your system and then some: it returns your Windows 11 version and CPU model, the amount of RAM and storage installed, all the active network connections currently detected, and even how long your PC took to boot up last time around.

5. Check your Windows 11 drive for errors

chkdsk

The “chkdsk” command has long been a favorite of IT technicians, and you’ll see it appear in many a troubleshooting guide. It essentially checks your system disk for errors and can fix some of the most fundamental ones. For example, if you’re having trouble accessing files and folders, or booting up your PC, chkdsk might be able to help.

There are lots of flags you can use with it, too. The command on its own just looks for errors, but add a space and “/r” at the end, and the utility will try and fix those errors while recovering all the data it can. Use “chkdsk /?” to see other options.

6. See running tasks

tasklist

The “tasklist” command gives you more or less the same information as the Task Manager, showing you which applications are putting the most strain on your system. Using the process ID numbers (or PIDS) that it shows, you can then forcefully kill apps using “taskkill /pid <PID number> /f” — which can be handy for troublesome software.

Windows Terminal window showing tasklist.
You can use these PID numbers to force-kill troublesome apps.

7. Analyze the energy states of your computer

powercfg /a

This is another classic command line prompt, which, with the “/a” flag, will return all the sleep states your computer supports (such as hibernate and fast startup). You can also get a detailed battery report via “powercfg /batteryreport” — which is saved in the default folder for the current user account.

Dig deeper and there’s more: “powercfg /devicequery s1_supported” lists all the devices connected to your system that can wake it out of standby, for example. Change that “s1” if you need to analyze a different standby state — the codes will be listed when you run the original “powercfg /a” command.

8. Check Windows 11 system integrity

sfc /scannow

Like many other command line prompts, this one is really useful when it comes to troubleshooting. It checks the integrity of key operating system files and applies fixes where necessary. If you’re noticing bugs and crashes all across Windows 11, this is one of the first steps that a lot of troubleshooting guides will recommend.

9. Get advanced networking information

netstat

Another simple word that conceals a host of useful diagnostic utilities: Use “netstat” on its own and it’ll tell you about all the devices your computer is connected to, from printers to smart speakers (use Ctrl+C when you want it to stop).

Like many other commands, you can tweak the command in a myriad of ways (use “netstat /?” for a full list). You can, for example, use “netstat -b” to see which apps are currently communicating with the web, which can help spot programs that are being more active online than perhaps they should be.

Aucun commentaire:

Enregistrer un commentaire

Tesla’s first 500kW V4 Superchargers are coming next year

Tesla’s first 500kW V4 Superchargers are coming next year New V4 cabinet and Supercharger stalls. | Image: Tesla Tesla will launch fully...