Web Development: Introduction, Tools & Terms

 



Command Line

Windows Terminal Commands: CMD vs. PowerShell

1. How Many Commands Exist?

There's no exact count, but roughly:

  • Command Prompt (CMD): 100+ built-in commands
  • PowerShell: 1,000+ cmdlets
  • External Tools: Additional executables (ping, netstat, etc.)

2. Language Names

CMD: Batch Scripting (.bat/.cmd files)

PowerShell: PowerShell Scripting (.ps1 files)

3. Common CMD Commands

Command Description
DIR Lists files/folders
XCOPY Advanced file copy
SC Manages Windows services
TREE Shows folder structure

4. PowerShell Equivalents

CMD Command PowerShell Equivalent
DIR Get-ChildItem
XCOPY Copy-Item -Recurse
SC Get-Service

Pro Tip: For modern scripting, use PowerShell instead of CMD for better automation capabilities.

Commands





Basic Commands

dir - lists all files & folders in a directory

help - lists commands

help + <command> - lists the instructions for using a command

cd - traverse directories

mkdir - create a directory

copy - copy files

del - remove files

move - move files

cmd - starts a new instance of terminal

type - displays the contents of a text file


Writing Scripts / Bash / Powershell


Bash vs CMD vs PowerShell: Scripting Languages Compared

1. What is Bash?

Language: Bash scripting (.sh files)

Platform: Linux/macOS (primary shell)

Usage: System administration, automation, development

#!/bin/bash
echo "Hello, World!"
ls -l

2. CMD: Batch Scripting (Windows)

Language: Batch scripting (.bat/.cmd files)

Characteristics:

  • Simple, linear execution
  • Limited programming features
  • Weak error handling
@echo off
echo Hello, World!
dir C:\

3. PowerShell (Windows)

Language: PowerShell + .NET (.ps1 files)

Characteristics:

  • Object-oriented
  • Powerful cmdlets (e.g., Get-ChildItem)
  • Advanced error handling
Write-Host "Hello, World!"
Get-ChildItem C:\

Key Differences

Feature Bash CMD PowerShell
File Extension .sh .bat/.cmd .ps1
Object-Oriented No No Yes
Cross-Platform Yes (Linux/macOS) No (Windows-only) Yes (PowerShell Core)

Recommendation

For modern scripting:

  • Windows: Use PowerShell (more powerful)
  • Linux/macOS: Use Bash
  • Cross-platform: Consider PowerShell Core or Python


Source Control with Git and Github

Github creates repositories. Solves problem of two developers working on different parts of code. Multiple users and version are handled. FTP does not do this. 

Git handles Development, Staging and Production environments. 






When two developers are working on the same file. Dev 1 will push changes. The Dev 2 might try to push changes, git will detect that the file is out of date, and force the user to Pull the file first, Merge the files and then Push the new merged file. This assumes they are working on different parts of a file. 



Github


Git & GitHub Commands Explained

4. Introduction to Source Control (17min)

Source control (or version control) tracks changes to files over time. Git is a distributed version control system that helps developers collaborate and manage code history.

5. GitHub (1min)

GitHub is a cloud-based platform that hosts Git repositories. It provides a web interface for managing repositories, collaboration tools, and additional features like pull requests and issues.

6. Your First Repository (1min)

To create a repository (repo) on GitHub:

  • Click the "+" icon in the top-right and select "New repository"
  • Name your repository
  • Choose public/private visibility
  • Initialize with a README if desired

7. Pushing your files (5min)

To upload local files to GitHub:


git init                  # Initialize local Git repository
git add .                 # Stage all files for commit
git commit -m "Message"   # Commit changes
git remote add origin [repository-url]  # Connect to remote repo
git push -u origin main   # Push to GitHub

    

8. Cloning a Repository (1min)

To download a repository from GitHub to your local machine:


git clone [repository-url]

    

9. Updating Files (5min)

To update files in an existing repository:


git pull origin main      # Get latest changes from GitHub
# Make your changes to files
git add .                 # Stage changed files
git commit -m "Message"   # Commit changes
git push origin main      # Push changes to GitHub

    

Note: Replace "main" with your branch name if different (older repos may use "master").


Working with Github

1. Create a New Repository on GitHub

  • ✓ Go to github.com
  • ✓ Name matches project folder
  • Do not initialize with README
  • ✓ Repository will be empty

2. Initialize Local Repository


touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/URLTOREPOSITORY.git
git push -u origin master

3. Push Existing Repository


git remote add origin https://github.com/URLTOREPOSITORY.git
git push -u origin master

4. Clone a Repository

Copy repository URL from GitHub, then run:


git clone https://github.com/THEREPO.git

Creates folder named after repository.

5. Update Files Workflow


git remote -v  # Verify remote URLs
# Edit files...
git add -A      # Stage all changes
git status     # Check changes
git commit -m "Your commit message"
git push       # Upload changes

6. Syncing Changes (git pull)

Always pull before working if others might have made changes:


git pull

Essential for multi-user projects or multi-device workflows.

7. Project Organization

  • ✓ Create a /projects folder in root directory
  • ✓ Match local folder names to GitHub repo names



Chrome Dev Tools

See this post for more information on the Dev Tools in Chrome Browser for Debugging. 


Comments