0% found this document useful (0 votes)
16 views

Lab Session 1 Command Line Basics

Command Line Basics

Uploaded by

gracious pezoh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Lab Session 1 Command Line Basics

Command Line Basics

Uploaded by

gracious pezoh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Session 1: Command Line Basics

Objective

• Become familiar with the Windows Command Prompt (CMD) and essential commands
to navigate and manage files, directories, and basic system tasks.

Tasks

1. Navigation Commands
o cd: Change directory. Used to navigate between folders.
 Example: cd Documents
o dir: Display list of files and directories in the current directory.
 Example: dir
o cls: Clear the screen to remove previous command outputs.
 Example: cls
o tree: Display directory structure of a drive or path.
 Example: tree C:\
2. File Manipulation
o copy: Copy files from one location to another.
 Example: copy file.txt D:\Backup
o move: Move files from one location to another.
 Example: move file.txt D:\Projects
o del: Delete one or more files.
 Example: del old_file.txt
o ren: Rename a file or directory.
 Example: ren file.txt new_file.txt
3. Directory Management
o mkdir: Make a new directory.
 Example: mkdir NewFolder
o rmdir: Remove a directory (use /s to delete non-empty directories).
 Example: rmdir /s OldFolder
4. System Information
o echo: Display messages or environment variables.
 Example: echo Hello, World!
o systeminfo: Display detailed system information.
 Example: systeminfo
o ipconfig: Display network configuration details.
 Example: ipconfig
o ping: Check network connection to another computer or server.
 Example: ping google.com
5. Task Management

Tar Joel [email protected] 679303247


otasklist: Display a list of currently running processes.
 Example: tasklist
o taskkill: Terminate a process.
 Example: taskkill /IM notepad.exe /F
6. Basic Networking Commands
o ping: Test connectivity to a network host.
 Example: ping 8.8.8.8
o netstat: Show network statistics, including active connections.
 Example: netstat -an
o tracert: Trace the route to a network host.
 Example: tracert google.com
7. Environment Variables
o set: Display, set, or remove environment variables.
 Example: set PATH=C:\NewPath
o echo %PATH%: Display the current value of the PATH variable.
 Example: echo %PATH%

Exercise 1: Directory Navigation and Structure Creation

1. Open CMD and navigate to the C:\Users\Tarjoel.


2. Create a folder named CMD_Practice in the C:\ Users\Tarjoel.
3. Inside CMD_Practice, create three subfolders: Documents, Media, and
Projects.
4. Navigate into the Documents folder and create another subfolder named Reports.
5. Use the tree command to display the directory structure you just created and verify that
it matches the expected layout.

Exercise 2: File Creation, Copying, and Moving

1. In the Documents folder within CMD_Practice, create a text file named


notes.txt using the following command:

echo This is a sample text file. > notes.txt

2. Copy notes.txt from Documents to the Projects folder.


3. Rename notes.txt in the Projects folder to project_notes.txt.
4. Move project_notes.txt back to the Documents folder and verify it appears
there.

Tar Joel [email protected] 679303247


Exercise 3: System Information and Basic Network Testing

1. In CMD, run the systeminfo command and take note of your computer's information,
such as OS version and system memory.
2. Check your network configuration by running ipconfig and identifying your IP
address.
3. Test connectivity to a popular website (e.g., Google) using the ping command:

ping google.com

4. Run the tracert command to trace the route to google.com and observe the
network path taken.
5. Use the netstat -an command to view active network connections.

Exercise 4: Environment Variables and Path Verification

1. Use the echo %PATH% command to view your current PATH environment variable and
note the directories listed.
2. Create a new environment variable named MY_VAR with the value HelloCMD:

set MY_VAR=HelloCMD

3. Verify that MY_VAR has been set by echoing its value:

echo %MY_VAR%

4. Delete the environment variable MY_VAR by setting it to an empty value:

set MY_VAR=

5. Verify it has been removed by attempting to echo %MY_VAR% again.

Exercise 5: Task Management and Directory Cleanup

1. Run the tasklist command to display a list of currently running tasks.


2. Identify a common process, such as notepad.exe (open Notepad if necessary), and
terminate it using the taskkill command:

taskkill /IM notepad.exe /F

Tar Joel [email protected] 679303247


3. Return to the CMD_Practice folder. Inside Media, create two files (image1.jpg
and video1.mp4) using the following commands:

echo Placeholder for image > image1.jpg


echo Placeholder for video > video1.mp4

4. Delete the image1.jpg file using the del command and then delete the Media
directory (including any remaining contents) using the rmdir command.
5. Verify that Media and its contents have been removed by listing the contents of
CMD_Practice with dir.

Project 1: Personal File Management System

Objective:
Create a structured and organized file management system within CMD, complete with
directories for personal documents, media, and work files. This project will also include backup
automation and system information logging.

Project Outline

1. Setup Folder Structure:


o Create a main directory named MyFiles in the C:\ drive.
o Inside MyFiles, create the following subdirectories:
 PersonalDocs for personal documents.
 Media for photos, videos, and audio.
 WorkFiles for work-related files.
 Backup for copies of important files.
2. Document Management and Logging:
o In the PersonalDocs folder, create text files for each personal document (e.g.,
passport_info.txt, tax_records.txt) using echo commands.
o In WorkFiles, create subfolders Projects and Reports.
 In Projects, create sample project files using echo to simulate
contents.
 In Reports, create monthly report files (Jan_Report.txt,
Feb_Report.txt, etc.).
o Use the dir command to list all files in each directory and log the results into a
file named file_inventory.txt inside MyFiles.
3. Automate Backup Process:
o Write a batch script (e.g., backup_script.bat) that:
 Copies all files from PersonalDocs and WorkFiles to the Backup
folder.

Tar Joel [email protected] 679303247


 Renames each copied file to include the current date (e.g.,
passport_info_2024-11-06.txt) using the ren command.
o Schedule the backup script to run every Sunday using Windows Task Scheduler
(or manually run the script periodically).
4. System and Network Information Logging:
o Create a system information file named system_status.txt in MyFiles.
o Use systeminfo and ipconfig to capture system and network details and
log these into system_status.txt.
o Every week, update system_status.txt by appending new entries with the
current date.
5. Network Connectivity Check:
o Use the ping command to test the connection to multiple sites (e.g.,
google.com, microsoft.com) and log the response times into a file named
network_log.txt.
o Run tracert to one of these sites and append the output to
network_log.txt for route tracking.

Deliverables:

• A well-organized file structure within C:\MyFiles.


• A working batch script (backup_script.bat) for backups.
• Log files (file_inventory.txt, system_status.txt, network_log.txt)
that contain detailed file, system, and network information.

Project 2: IT System Maintenance and Troubleshooting Kit

Objective:
Create a CMD-based system maintenance and troubleshooting toolkit for an office environment,
focusing on routine maintenance tasks, network diagnostics, and system health checks.

Project Outline

1. Folder Structure and Initial Setup:


o Create a main directory named SystemMaintenance in C:\.
o Inside SystemMaintenance, create subdirectories:
 Logs for storing diagnostic logs.
 Utilities for storing custom CMD scripts.
 Reports for weekly system and network reports.
2. System Health Monitoring:
o Write a script named health_check.bat to:
 Check CPU and memory usage using systeminfo and log the output.

Tar Joel [email protected] 679303247


 Use tasklist to list all running tasks and save it to
Logs\active_tasks.txt.
 Identify any unresponsive applications and log them to
Logs\unresponsive_tasks.txt.
 Check disk usage in the C: drive and log the results into
Logs\disk_usage.txt.
3. Network Troubleshooting Tools:
o Write a script named network_diagnostics.bat to:
 Run ping tests to essential websites (e.g., google.com,
company_server).
 Log response times and error rates to Logs\network_status.txt.
 Run netstat -an to list all active network connections and save to
Logs\network_connections.txt.
 Trace routes to a specified server using tracert and append results to
Logs\network_trace.txt.
4. Automated Weekly Report Generation:
o Create a batch script named weekly_report.bat to:
 Compile the latest logs from Logs into a summary report saved in
Reports (e.g., system_report_2024-11-06.txt).
 Include key metrics, such as average ping times, disk space usage, and a
summary of unresponsive applications.
o Set up Windows Task Scheduler to run weekly_report.bat every Friday.
5. Environment Variable Setup:
o In the Utilities folder, create a batch script setup_env.bat to set custom
environment variables specific to the office, such as:
 COMPANY_NAME=OfficeSuite.
 NETWORK_STATUS_CHECK=Enabled.
o Use echo %COMPANY_NAME% and echo %NETWORK_STATUS_CHECK% to
confirm that these variables are accessible.
6. User Documentation and Instructions:
o Write a text file, user_instructions.txt, in the SystemMaintenance
folder explaining how to use each script and interpret the logs.
o Include troubleshooting tips for common network and system issues, such as slow
network speeds or high memory usage.

Deliverables:

• A fully functional SystemMaintenance directory with organized Logs,


Utilities, and Reports.
• Three working CMD scripts: health_check.bat, network_diagnostics.bat,
and weekly_report.bat.
• Comprehensive user_instructions.txt with step-by-step guides for using the
system maintenance toolkit and interpreting output logs.

Tar Joel [email protected] 679303247

You might also like