Lab Assignment: Windows and Linux Command-Line Mastery
This lab assignment covers practical tasks using commands in both Windows Command Prompt and
Linux Terminal, focusing on system navigation, file management, process handling, and networking. Each
task includes commands and expected outputs.
Windows Lab Assignment
1. Navigation and Directory Management
• Task: Navigate to the Documents folder and list all files.
• Command:
• cd %USERPROFILE%\Documents
• dir
• Expected Output: A list of files and subdirectories in the Documents folder.
2. File Operations
• Task: Create a file named example.txt with the text "Hello, Windows!" and display its contents.
• Command:
• echo Hello, Windows! > example.txt
• type example.txt
• Expected Output:
• Hello, Windows!
3. Copying and Moving Files
• Task: Copy example.txt to C:\Temp and rename it to example_copy.txt.
• Command:
• copy example.txt C:\Temp\example_copy.txt
• Expected Output:
• 1 file(s) copied.
4. Viewing System Information
• Task: Display your computer's hostname and IP configuration.
• Command:
• hostname
• ipconfig
• Expected Output:
o Hostname: Displays your computer’s name.
o IP Configuration: Shows the IP address, subnet mask, and gateway.
5. Process and System Management
• Task: List all running processes and terminate notepad.exe.
• Command:
• tasklist
• taskkill /im notepad.exe /f
• Expected Output:
o Tasklist: Shows a list of running processes.
o Taskkill:
o SUCCESS: The process "notepad.exe" with PID XXXX has been terminated.
TECHINTONS PREPARED BY – K.DR 1
6. Networking
• Task: Check connectivity to www.google.com and trace the route.
• Command:
• ping www.google.com
• tracert www.google.com
• Expected Output:
o Ping: Displays latency and packet loss.
o Tracert: Shows the route through which packets travel to Google.
7. Redirection and Logging
• Task: Save the output of dir to a file named dir_output.txt.
• Command:
• dir > dir_output.txt
• Expected Output: A file dir_output.txt containing the directory listing.
Linux Lab Assignment
1. Navigation and Directory Management
• Task: Navigate to the /home directory and list all contents.
• Command:
• cd /home
• ls -la
• Expected Output: A detailed list of all files and directories in /home.
2. File Operations
• Task: Create a file named example.txt with the text "Hello, Linux!" and display its contents.
• Command:
• echo "Hello, Linux!" > example.txt
• cat example.txt
• Expected Output:
• Hello, Linux!
3. Copying and Moving Files
• Task: Copy example.txt to /tmp and rename it to example_copy.txt.
• Command:
• cp example.txt /tmp/example_copy.txt
• Expected Output: No output on success. Use ls /tmp to verify.
4. Viewing System Information
• Task: Display system information and the kernel version.
• Command:
• uname -a
• lsb_release -a
• Expected Output:
o uname: Displays kernel and architecture info.
o lsb_release: Displays distribution-specific info.
5. Process and System Management
TECHINTONS PREPARED BY – K.DR 2
• Task: List all running processes and terminate a process by its name (gedit).
• Command:
• ps aux
• pkill gedit
• Expected Output:
o ps aux: Shows detailed info of all processes.
o pkill: Terminates gedit without output on success.
6. Networking
• Task: Display network interfaces and check connectivity to www.google.com.
• Command:
• ifconfig
• ping www.google.com -c 4
• Expected Output:
o Ifconfig: Shows active network interfaces.
o Ping: Displays packet loss and round-trip times.
7. Archiving and Compressing Files
• Task: Archive and compress the /tmp directory into a file backup.tar.gz.
• Command:
• tar -czvf backup.tar.gz /tmp
• Expected Output:
• backup.tar.gz
Lists files being archived.
8. Permissions and Ownership
• Task: Change the permissions of example.txt to be readable, writable, and executable by the
owner.
• Command:
• chmod 700 example.txt
• ls -l example.txt
• Expected Output:
• -rwx------ 1 user group size date example.txt
9. Scripting and Automation
• Task: Create a script hello.sh that prints "Hello, World!" and execute it.
• Command:
• echo -e '#!/bin/bash\necho "Hello, World!"' > hello.sh
• chmod +x hello.sh
• ./hello.sh
• Expected Output:
• Hello, World!
10. System Maintenance
• Task: Check disk usage and free memory.
• Command:
• df -h
TECHINTONS PREPARED BY – K.DR 3
• free -m
• Expected Output:
o Disk Usage: Shows free and used disk space.
o Memory Usage: Displays free and used memory.
Assignment Submission
1. Execute all commands on your system.
2. Capture screenshots of command execution and outputs.
3. Write a short summary of each task's purpose and output.
4. Submit a consolidated PDF report.
TECHINTONS PREPARED BY – K.DR 4