Nayem Mahmud logo

Command Line Troubleshooting Tools Reference Guide

Table of Contents

Command Line Tools Grow with Google: IT Support Certificate 

Sections 

Software and hardware troubleshooting tools 

File management 

Disk management 

Other tools 

Networking troubleshooting tools 

Network information 

Information and diagnostics 

Group management 

Software and hardware troubleshooting tools 

File management 

The following commands allow you to copy files from the command line. 

 

Copy 

Linux: cp 

copy files by moving them from one location to another, such as from one drive to another 

Example: A company decides to upgrade its computers, but it’s still using the same operating system and wants to keep its data and files intact. The IT administrator can use copy to move the files and directories from the older computers to the newer computers. The newer computers will now have duplicates of the files.

Xcopy 

copy files with options and control over how to copy files and directories 

xcopy /s 

includes subdirectories that contain content when copying files 

xcopy /j 

protects larger files while copying 

Example: The hard drive on a computer is beginning to fail. The drive has tested clean for viruses and other malware, so issue is purely mechanical. The IT administrator decides to copy all the files on the drive to another drive. Some of these files are very large and contain important data. The IT administrator decides to use xcopy and copy all the files without buffering. They add the switch /j to protect the larger files. 

Robocopy 

copy files with more commands than xcopy, including commands for moving secure files 

robocopy /sec 

copies files with security 

Example: An IT administrator needs to move files from one place to another with the security intact. The administrator decides to use robocopy to move the files with the switch /sec which copies files with security. 

Disk management 

These commands are used to troubleshoot and perform tasks on a computer’s disk, file system, and drives.

Chkdsk 

Linux: fsck 

check both the file system and its metadata for physical and logical errors 

chkdsk /f 

check the drive and repair any issues 

Example: A user goes to an IT professional about a computer that has problems opening files, and is not bringing up apps and programs the user needs. The IT professional uses the chkdsk tool to scan the drive and display the status of the disk. Chkdsk finds problem sectors in the disk. The IT professional uses chkdsk and the /f switch to repair the drive. 

Sfc 

Check the system for corrupted files and look for cached copies of the files to try to repair them 

Example: A computer is having problems running. It is constantly displaying error warnings and periodically shuts down. The IT administrator first runs sfc to look for and fix corrupted files before taking any further steps. 

displays the first 10 lines of the patches.txt file 

Format 

Reset the drive and erase all the data, only putting in data needed to operate the disk 

Example: A user has been trying to start a computer, but it won’t consistently start. When it does go on, it doesn’t stay on long enough to perform any tasks. There may be a virus on the drive, bad sectors, or a number of other problems. After explaining to the user all the data on the drive will be erased and getting permission from the user, an IT professional formats the computer’s drives, reinstalls the operating system, and checks if it starts up again with a newly formatted disk.

Diskpart 

Linux: fdisk 

divide a hard drive into separate partitions that act like disks 

Example: A user wants to have Windows running to be compatible with work computers, but also to have the ability to run Linux. The user creates one partition for each, and the computer can now start as a Windows computer or a Linux computer depending on what the user needs at the time. 

Other tools 

These two commands are helpful tools for an IT administrator to troubleshoot and gather information about a computer system. 

Shutdown 

Linux: shutdown 

shut down the local computer or other computers on the network 

shutdown /fw 

reboots the computer into the firmware interface after shutdown 

Example: A company has decided to shut down all the computers on the internal network for routine maintenance. The IT administrator uses the shutdown tool to shut down all the computers in the network. 

Winver 

display the current version of Windows.

Example: A new administrator needs information on which version of Windows is being used on company computers. The administrator runs winver to get this information. 

Networking troubleshooting tools 

Network information 

This group of commands helps you gather information about the network that you might need to troubleshoot and solve issues. 

Ipconfig 

Linux (later version): ip 

Linux (older versions): ipconfig 

display the current network configuration information 

ipconfig /all 

display full configuration information for all adapters 

Example: A user’s computer can’t connect to the Internet. The IT professional goes to the command line and uses ipconfig to check the status of the connection. They see the ip address as 0.0.0.0 and knows the computer is not communicating with the DHCP server. This gives the IT professional important information on how to start fixing the problem. 

Ping 

Linux: ping 

check the status of a connection to an address or the server speed of the connection to determine if a website or router is running slow

Example: A user is successfully connected to a website, but it’s very slow. The user asks an IT administrator to find out why it is slow. The IT administrator uses ping to check the router and finds no problem with the speed. Then they use ping to check the website and they find the website is running slow, not the user’s computer or the local router. 

Pathping 

send out a request to each of the routers on the path to the destination, check the packets from each router for loss and latency, and use the information to determine where the packet loss is happening 

Example: An administrator notices problems with a network and runs pathping to check each of the routers on the path and discovers a specific router is losing more packets than any of the others. This router needs repair or replacement. 

Tracert 

Linux: traceroute 

Mac: traceroute 

trace the route of a packet of data from the user’s source computer to the destination system 

Example: An IT administrator notices packets of information are not arriving at their destinations. The IT administrator uses the tracert (or traceroute) command to find out where in their routes the packets were lost. 

Hostname 

Linux: hostname 

display the name of one device on a network

Example: The IT manager needs to find the names of multiple computers on a local network. The IT manager uses the hostname tool to find the systems’ names. 

Information and diagnostics 

This group of commands gives the IT administrator information about network activity and user statistics. It also contains commands that help diagnose network issues. 

Netstat 

Linux: netstat 

display statistics about network activity and configuration, such as user information about passive and active sockets 

Example: An IT administrator needs to know which sockets are active and how many there are. The administrator uses netstat to get the information. 

Nslookup 

Linux: nslookup 

obtain DNS record information by sending queries to the domain name server 

Example: An IT administrator needs to find information from DNS properties, so the administrator uses the nslookup tool with the set all parameters and is able to find the current configuration settings for the computer’s DNS properties. 

Net user 

add or modifies user accounts, or display user account information 

Example: A computer in the company which allows external users access from other computers is having problems. Huge amounts of files start appearing on the computer including large photo files and other odd files. The IT

Administrator uses the net user tool and finds there is still an account active for a recently terminated employee. The IT administrator then uses the net user command and the /delete switch to delete the user account. 

Net use 

Disconnect a computer from a shared resource and display a list of network connections 

Example: An IT administrator needs to remove a shared resource from a computer. The administrator uses the net use tool to check all the computers connected to the resource, find the one that needs to be removed, and uses the /delete switch to remove the connection from the computer. 

Group management 

Both of the follwing commands are used to display and update group policies. 

Gpupdate 

update group policy settings 

Example: A company hires an IT professional after having done everything on their own. The IT professional looks at the group policy in the system and finds that everyone in the organization has free access to a delicate part of the system. To prevent problems in the future, the IT professional updates the group policy to restrict access to that part of the system. 

Gpresult 

display the Resultant Set of Policy (RSoP) for a system

Example: An IT professional uses gpresult to examine the RSoP policy already in place. The IT professional then finds the access weakness described and updates the group policy using gpupdate to protect the system.

Facebook
Twitter
LinkedIn

Over 1,320,000+ Readers Get fresh content from WPBeginner

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.