1) Command Line Flashcards
Windows: Dir
Displays contents of current working directory.
Switches:
/p = Pauses after screen full of info
/w = Displays only filenames
/a = Displays files with specified attributes (see below)
D = Directories | H = Hidden files | R = Read-only
S = System files
Windows: Cd
Changes to specified directory (change directory)
Syntax: cd \documents\testfolder
Change Drives: cd D (do not use colon, just drive letter)
.. = Move up a directory
\ = root directory
Windows: Md/Rd
Md = Make Directory
Syntax: md /documents/newfolder
Rd = Remove directory
Syntax: rd /documents/newfolder
Rd Switches
/S = Removes all directories & files in specified directory
/Q = Quiet mode, does not ask if okay to remove
Windows: Ipconfig
Displays IP configuration details
Switches /all = Displays all IP config info /release = releases current IP address from DHCP /renew = re-assigns an IP via DHCP /flushdns = clears DNS cache
Windows: Ping
Used to test if an domain/IP can be reached & how long it takes
Switches
- t = ping specified host until stopped (ctrl-c)
- a = resolve address to host names
- l = specify ping packet size (buffer size)
Windows: Tracert
Shows the route that a packet takes to get to its destination (via domain or IP address)
Switches
- d = do not resolve addresses to hostnames
- 4 = force using IPv4
- 6 = force using IPv6
Windows: Netstat
Shows all TCP/UDP connections on your computer
Switches
- a = displays all connections & listening ports
- q = displays all connections, listening ports, and bound non-listening TCP ports
- r = displays routing table
Dion recommends -ano switch to view details
Windows: Nslookup
Enables you to determine exactly what info the DNS server is giving you about a specific hostname.
Displays host’s IP address (4 & 6)
Takes you to its own terminal
Then type in the web address being queried
Windows: Shutdown
Enables you to shut down a local or remote computer
Switches /r = reboot (full shutdown/restart) /s = shutdown /l = log off /a = abort shutdown /m \\computer = specify target computer /f = force applications to close without warning
Windows: Sfc
System file checker
Looks at system store (backup copies of critical files)
Compares them with current working files
Can choose to repair or verify only
Switches
/scannow = scans integrity of all protected files & repairs if needed
/verifyonly = scans integrity of all protected files
no repairs
Windows: Dism
Deployment Image Servicing/Management Tool
Best to run sfc first, if sfc finds a problem, run dism
Syntax: dism /online /cleanup-image /restorehealth
dism /online /cleanup-image /checkhealth
Enumerates, installs, uninstalls, configures, & updates features/packages in Windows images.
Switches
/online = Targets running OS
/checkhealth = looks for corruptions inside image
/restorehealth = attempts to repair corrupted scanned files automatically
Windows: Chkdsk
Checks a HDD & displays a status report
Switches
/f = fixes errors on the disk
Volume = specify drive to check
Syntax: chkdsk volume:C:
/scan = runs online scan of volume /L:size = specify log file size in Kb
Windows: Diskpart
Type ? for help
Command line partitioning tool equipped with its own commands.
List disk (shows disks & disk numbers)
Select disk 1 (select disk number 1 or whichever)
Create partition primary
List partition
Select partition
Assign (assigns drive letter to selected drive/partition)
Clean (removes all partition/volume formatting)
Create (creates partition on a disk)
Format (formats drive)
Syntax: format fs=ntfs quick label=test
Quick formats to NTFS with name test
Windows: Tasklist/Taskkill
Tasklist
Displays current running programs with PIDs & mem usage
Taskkill
Kills process by PID or name
Switches
/f = force quit
/t = terminates the process & child processes
Windows: Gpupdate
Forces an update to new group policies (AD)
Switches
/force = reapplies policy settings
/target = specify user/computer to target update for
/logoff = logoff after GP updates
/boot = restart after applying GP updates
Windows: Gpresult
Gives a quick overview of all security policies applied to a user/computer
Switches
/s = specifies name/IP of a remote PC (default: local)
/u = uses credentials of specified user to run command
/p = specifies password of user provided by /u
/z = displays all info about GP
Windows: Format
Formats a disk to accept Windows files (admin)
Syntax: format e: /q /fs:exFAT
Switches /q = quick format /c = compress new volume (NTFS) /fs: = specify file system /v: = specify volume name