DEV Community

shun
shun

Posted on

Standard Windows Commands and Their Outputs

File Operations

  • dir: List directory contents
  C:\> dir
  2023-08-11  10:00 AM    <DIR>          dir1
  2023-08-11  09:58 AM                20 file1.txt
  2023-08-11  09:59 AM                30 file2.txt
Enter fullscreen mode Exit fullscreen mode
  • cd: Print working directory
  C:\> cd
  C:\Users\user
Enter fullscreen mode Exit fullscreen mode

Text Operations

  • type: Display file content
  C:\> type file1.txt
  This is the content of file1.
Enter fullscreen mode Exit fullscreen mode
  • more: Display the beginning of a file (Windows doesn't have an exact equivalent to head, but more can be used to view the contents)
  C:\> more file1.txt
  First line of the file.
Enter fullscreen mode Exit fullscreen mode
  • more: Display the end of a file (Again, Windows doesn't have an exact tail equivalent, but you can scroll through with more)
  C:\> more file1.txt
  Last line of the file.
Enter fullscreen mode Exit fullscreen mode

System Information

  • systeminfo: Display system information (This provides a lot of information, more than uname -a in Linux)
  C:\> systeminfo
Enter fullscreen mode Exit fullscreen mode
  • wmic OS get FreePhysicalMemory,TotalVisibleMemorySize /Value: Display memory usage (This is a bit more complex in Windows compared to Linux's free)
  C:\> wmic OS get FreePhysicalMemory,TotalVisibleMemorySize /Value
Enter fullscreen mode Exit fullscreen mode

Networking

  • ping: Test network connection
  C:\> ping google.com
Enter fullscreen mode Exit fullscreen mode

Miscellaneous

  • echo: Display a line of text
  C:\> echo Hello, World!
  Hello, World!
Enter fullscreen mode Exit fullscreen mode
  • doskey /history: Display command history (This might not capture all history like Linux's history command, but it's the closest built-in command)
  C:\> doskey /history
Enter fullscreen mode Exit fullscreen mode

Top comments (0)