Certopolis

CompTIA A+ Core 2

Windows commands for A+ Core 2: ipconfig, netstat, nslookup, dir

ipconfig shows and refreshes the PC's IP and DNS settings, ping tests reachability, tracert lists the routers on the path, netstat lists connections and listening ports, and nslookup queries DNS. net use maps a drive letter to a share, cd changes folder, and dir lists files. Most questions turn on one switch, such as ipconfig /displaydns, netstat -o or dir /s.

ipconfig and the DNS cache

Without parameters, ipconfig shows the IPv4 and IPv6 addresses, subnet mask and default gateway for each adapter. ipconfig /all shows the full TCP/IP configuration.

ipconfig /release and ipconfig /renew give up and renew a DHCP address. They work only on adapters set to obtain an address automatically.

ipconfig /displaydns shows the DNS client resolver cache: entries preloaded from the local Hosts file plus recently resolved names. Windows checks this cache before asking its DNS servers, so it shows the address the PC is actually using. ipconfig /flushdns empties the cache so the next lookup goes to the DNS server again. Look before you flush if you need the evidence.

ping, tracert and nslookup

ping sends ICMP echo Requests and shows each reply with its round-trip time. It sends 4 by default; /n changes the count and /t keeps going until stopped.

tracert sends echo Requests with a TTL that starts at 1 and rises by one, so each router on the path answers in turn, up to 30 hops by default. A router that does not answer within the timeout shows as an asterisk.

nslookup displays information used to diagnose DNS. If a server works by IP address but not by name, nslookup is the tool for checking how DNS resolves that name.

netstat: who is connected

netstat -a lists all active TCP connections and the TCP and UDP ports the computer is listening on. -n shows addresses and ports as numbers without name lookups.

netstat -o adds the process ID (PID) that owns each connection. Match that PID on the Processes tab in Task Manager to find the application. netstat -b shows the executable directly.

net use, cd and dir

net use M: \\server\share maps a drive letter (D: through Z:) to a shared folder. /persistent:yes restores the mapping at next sign-in, and /delete removes it.

cd .. moves up to the parent folder. cd on its own shows the current drive and folder.

dir lists the files and subfolders in a folder. dir name /s lists every occurrence of that file name in the folder and all its subfolders, which is how you find a file when you do not know where it was saved. /p pauses after each screen, and /a includes files with given attributes such as hidden.

Where the exam catches people

  • Believing ipconfig /flushdns shows which address is cached: it empties the cache; ipconfig /displaydns shows it.
  • Believing ipconfig /renew fixes a stale name lookup: it renews the DHCP address, while a wrong cached DNS entry needs /flushdns.
  • Believing netstat names the program behind a PID: -o gives the PID, and Task Manager's Processes tab (or netstat -b) maps it to the program.
  • Believing dir searches subfolders by default: it lists one folder unless you add /s.
  • Believing an asterisk in tracert means the destination is down: it means that hop did not reply before the timeout.

Written from CompTIA's documentation

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. A technician runs netstat -o on a Windows workstation and finds an unfamiliar connection. The output shows the process ID (PID) that owns it. Which of the following tools should the technician use to find the application with that PID?

    Right. In the game that’s Renown for your Operating Systems building.

    Not that one: C is right. In the game your Operating Systems building would lose a little Renown, and this question would come back later.

  2. A user reports that a Windows laptop reached an intranet site at the wrong address earlier today. Before clearing anything, the technician wants to see which address the laptop itself still holds for that name in its local cache. Which of the following commands should the technician run?

    Right. In the game that’s Renown for your Operating Systems building.

    Not that one: D is right. In the game your Operating Systems building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    The DNS Client service uses it before querying its configured DNS servers, so it shows the address the laptop is actually using for the name.

    Written from learn.microsoft.com/en-us/windows-server/administration/windows-commands/ipconfig

  3. A user saved a file named budget.xlsx somewhere inside C:\Users\Ana but cannot remember which folder. A technician at a Command Prompt in C:\Users\Ana wants every location of that file listed. Which of the following should the technician run?

    Right. In the game that’s Renown for your Operating Systems building.

    Not that one: D is right. In the game your Operating Systems building would lose a little Renown, and this question would come back later.