Computer CMD, PowerShell & Linux Commands: Step-by-Step Practical Guide

Terminal & Shell Cheatsheet

Command Line Mastery: Windows CMD, PowerShell & Linux Shell

From repairing corrupted operating system partitions and flushing DNS caches to configuring cloud servers and automating file deployments, the command line terminal is the foundational weapon of IT technicians, software developers, and system administrators. Here is your definitive, comparative, step-by-step terminal manual.

Section 1: Windows Command Prompt (CMD) Master Reference

Windows Command Prompt (cmd.exe) has been the bedrock administrative utility in Windows for over 30 years. Here are the indispensable daily commands:

1. Networking & Internet Diagnostics

  • ipconfig /all — Displays comprehensive network adapter configuration: IPv4, IPv6, Subnet Mask, Default Gateway, DHCP Server, and physical MAC address.
  • ipconfig /flushdns — Clears local DNS resolver cache to resolve domain resolution errors and stale website IP mappings.
  • ipconfig /release && ipconfig /renew — Drops current IP assignment and requests a fresh lease from the local router/DHCP server.
  • ping -t 8.8.8.8 — Sends continuous ICMP echo packets to Google Public DNS to verify packet loss and latency stability. Press Ctrl + C to stop.
  • tracert google.com — Traces the exact hop-by-hop router path packets take to reach destination server.
  • netstat -ano — Displays all active TCP/UDP connections, listening ports, and corresponding process IDs (PID).
  • netsh wlan show profile name="SSID_NAME" key=clear — Recovers the cleartext saved Wi-Fi password for any network connected to on this laptop.

2. System Health, Disk & OS Repair

  • sfc /scannow — System File Checker: scans all protected system files and repairs corrupted OS binaries using local cached copies.
  • dism /online /cleanup-image /restorehealth — Deployment Image Servicing and Management: repairs corrupted Windows Component Store files by downloading fresh copies directly from Windows Update.
  • chkdsk C: /f /r — Check Disk: locates bad sectors on hard drive, recovers readable information, and fixes file system errors on reboot.
  • systeminfo — Prints detailed hardware, OS build, BIOS version, memory, and hotfix patch history.
  • tasklist / taskkill /F /PID 1234 / taskkill /F /IM chrome.exe — Lists and forcefully terminates misbehaving tasks.

Section 2: Windows PowerShell Modern Cmdlet Architecture

Unlike CMD which passes raw unstructured text, PowerShell passes rich .NET objects through its pipeline. It uses an intuitive Verb-Noun naming convention (e.g. Get-Process, Start-Service):

Essential PowerShell Cmdlets for System Admins

# 1. Inspect running processes using more than 200MB RAM
Get-Process | Where-Object WorkingSet64 -gt 200MB | Sort-Object WorkingSet64 -Descending

# 2. Search recursively for all files containing text "password" or "api_key"
Get-ChildItem -Path C:\Project -Recurse -File | Select-String -Pattern "api_key"

# 3. Test TCP port connectivity (like Telnet)
Test-NetConnection -ComputerName google.com -Port 443

# 4. Export all installed Windows Services to CSV
Get-Service | Select-Object Name, DisplayName, Status | Export-Csv -Path C:\services.csv -NoTypeInformation

# 5. Install software via Windows Package Manager
winget install --id Google.Chrome -e
winget install --id Git.Git -e
winget install --id Microsoft.VisualStudioCode -e

Section 3: Linux Terminal (Bash / Zsh) Workflows

Over 90% of cloud servers, web applications, and supercomputers run on Linux. Mastering Bash is non-negotiable for developers and DevOps engineers:

1. File System Navigation & Manipulation

  • ls -lah — Lists all files (including hidden dotfiles) in human-readable sizes (KB, MB, GB) with permissions and timestamps.
  • pwd — Print Working Directory: shows current absolute directory path.
  • mkdir -p /var/www/html/app — Creates nested parent directories without throwing errors.
  • cp -rv /source /dest — Copies directory recursively with verbose progress.
  • rm -rf /folder — Recursively and forcefully deletes directory (exercise extreme caution).
  • tar -czvf archive.tar.gz /folder — Compresses folder into gzip archive.
  • tar -xzvf archive.tar.gz — Extracts compressed tarball.

2. Permissions & Ownership Decoded

In Linux, every file has 3 permission scopes: User (Owner), Group, and Others (World), with 3 permission types: Read (4), Write (2), Execute (1):

# Standard web server file permissions:
chmod 755 /var/www/html       # Owner: rwx (4+2+1=7), Group: r-x (4+1=5), Others: r-x (4+1=5)
chmod 644 /var/www/html/index.php  # Owner: rw- (4+2=6), Group: r-- (4), Others: r-- (4)
chmod +x deploy.sh            # Makes script executable

# Change ownership to web server user (www-data or nginx):
chown -R www-data:www-data /var/www/html

3. Search, Text Processing & Log Auditing

  • grep -rnw '/var/log' -e 'ERROR' — Recursively searches all files in /var/log for the exact word 'ERROR' with line numbers.
  • tail -f /var/log/nginx/error.log — Streams incoming live log entries in real-time as they occur.
  • find / -type f -size +500M — Scans the entire file system for files larger than 500 megabytes (indispensable for finding runaway logs).
  • df -h — Displays disk space usage by partition in gigabytes.
  • top / htop — Interactive task manager showing real-time CPU, RAM, and thread consumption.

Section 4: Step-by-Step Practical Troubleshooting Walkthroughs

Scenario 1: Resolving a "Port Already in Use" Error (e.g. Port 3000 / 8080)

On Windows:

netstat -ano | findstr :3000
# Output shows PID in last column, e.g. 14280
taskkill /PID 14280 /F

On Linux / macOS:

lsof -i :3000
# Or using ss: ss -tulpn | grep :3000
kill -9 <PID>
🎁 Free Career Guidance & Demo Session

Get Free Syllabus PDF & 2-Day Live Demo Class

Connect with our certified academic counselors today. Understand module details, installment fee plans, and how students from your area are building successful careers.

Frequently Asked Questions

What is the difference between Command Prompt (CMD) and PowerShell?
CMD is a legacy command-line interpreter that outputs raw text strings. PowerShell is an object-oriented automation engine built on Microsoft .NET that passes structured objects, integrates with system APIs, and supports advanced scripting.
How do I run CMD or PowerShell as Administrator?
Press Win + S, type 'cmd' or 'powershell', right-click the application, and select 'Run as administrator', or simply press Ctrl + Shift + Enter after typing the name.
What does 'sfc /scannow' do?
It runs Windows System File Checker to scan all critical operating system files for corruption, missing files, or bad hashes, and automatically replaces damaged files with clean cached copies.
What does 'chmod 777' mean and why is it dangerous?
chmod 777 gives Read, Write, and Execute permissions to everyone (Owner, Group, and Public). On a public server, this allows anyone or any malicious script to overwrite, delete, or execute arbitrary files.

Student Reviews

"Pragati Skill Academy-তে DCA course করে আমি সরকারি চাকরির পরীক্ষায় ভালো ফল করেছি। Teachers অনেক helpful এবং practical training চমৎকার।"

Sourav Maity

"Tally Prime course আমার career completely change করে দিয়েছে। এখন আমি একটি private firm-এ Accountant হিসেবে কাজ করছি। Thank you Pragati Skill Academy!"

Priya Das

"Computer basic course থেকে শুরু করে এখন আমি Graphic Design শিখছি। সবকিছু step by step শেখানো হয়। Very good institute!"

Rahul Mondal

"ADCA course-এর syllabus অনেক comprehensive। MS Office, Tally, Web Design সব একসাথে শেখা যায়। Best computer center in this area."

Ananya Samanta

Check Batch Availability & Certificate Delivery by PIN Code

Instant lookup for all 19,000+ Indian PIN Codes, Blocks, and Villages

Speed Post Delivery Timeline 24 - 48 Hours via Speed Post
Available Training Mode Classroom Lab & Online Hybrid
Govt Recognized Certificate ISO 9001:2015 & E-Max India
Admissions open for immediate batch starting this week. Inquire on WhatsApp for PIN 721433