Document Details

Uploaded by Deleted User

Tags

operating systems DOS commands Linux commands practical exercises

Summary

This document includes an index of practical exercises related to operating systems, covering various commands and concepts, such as demonstrating directory structures using DOS, creating and renaming files, and using Linux commands for file and directory manipulation. The document contains practical examples and outlines procedures for performing these tasks.

Full Transcript

INDEX S.NO Questions Page Date Sign no. 1 Demonstrate different directory 4-6 namming listing structure with all options 2 Create one file and rename...

INDEX S.NO Questions Page Date Sign no. 1 Demonstrate different directory 4-6 namming listing structure with all options 2 Create one file and rename file using 7 dos commands 3 Demonstrate all internal dos commands 8-11 with output 4 Demonstrate all external dos 12-16 commands with output 5 Introduction to windows and familiarity 17-18 with its control 6 Use the various window application 19-20 calculator notepad and ms paint 7 Explaining control panel option 21-23 8 Create a file using linux command 24-25 9 Write a linux command which lists all 26 files and directories 10 Create directory using linux commands 27-28 crete a 3 different files in this directory 2|Page 11 Delete above created files and directory 29 using linux commands 12 Explaining various flavers of linux 30-34 3|Page Experiment 1 Objective:- Demonstrate different directory namming listing structure with all options Procedure:- Flat Structure  All files and folders are placed at the root level.  Best for small projects with a few files. project/ │ ├── index.html ├── style.css ├── script.js ├── README.md Hierarchical (Nested) Structure  Organizes files into categories and subcategories.  Ideal for larger projects with multiple modules. project/ │ ├── assets/ │ ├── css/ │ │ └── style.css │ ├── js/ │ │ └── script.js 4|Page │ ├── images/ │ └── logo.png │ ├── src/ │ ├── components/ │ └── services/ │ └── api.js │ ├── index.html └── README.md Date-Based Naming  Organizes files by creation or modification date.  Common in logs or backup systems. backups/ │ ├── 2024-12-01/ │ └── backup.sql ├── 2024-12-02/ │ └── backup.sql ├── 2024-12-03/ └── backup.sql 5|Page Sequential Numbering  Uses numbers to distinguish between versions or stages.  Useful for drafts, prototypes, or progressive files. drafts/ │ ├── draft1.txt ├── draft2.txt ├── draft3.txt └── final_draft.txt Camel Case  Combines words without spaces, capitalizing the first letter of each subsequent word.  Preferred in codebase naming conventions. project/ │ ├── myStyles.css ├── userProfile.js └── readMe.md Snake Case  Uses underscores (_) to separate words.  Common in Python projects and UNIX systems. project/ │ ├── my_styles.css ├── user_profile.js└── read_me.md 6|Page Experiment 2 Objective:- Create one file and rename file using dos commands Procedure:- Open Command Prompt Press Win + R, type cmd, and press Enter cd C:\Users\YourUsername\Documents Create a File Use the echo command to create a text file. echo This is a sample file. > sample.txt This command creates a file named sample.txt in the current directory with the text "This is a sample file." Verify the File Use the dir command to confirm the file has been created. Dir Rename the File Use the rename (or ren) command to rename the file. rename sample.txt new_sample.txt Confirm the Rename Use the dir command again to check the renamed file. Dir You should now see new_sample.txt in the directory listing. 7|Page Experiment 3 Objective:-Demonstrate all internal dos commands with output Procedure:- CD - Change Directory Command:cd C:\Windows Output:C:\Windows> Use: Navigates to the C:\Windows directory. DIR - List Directory Contents Command:dir Output:Volume in drive C is Windows Volume Serial Number is XXXX-XXXX Directory of C:\Users\UserName 12/05/2024 09:30 AM Documents 12/05/2024 09:30 AM Downloads 12/05/2024 09:30 AM 500 example.txt 3 File(s) 500 bytes Use: Lists files and directories in the current directory. CLS - Clear Screen Command:cls Output: (Clears the screen) 8|Page ECHO - Display Messages or Create Files Command:echo Hello, World! Output:Hello, World! Create a File: Command:echo This is a sample file. > file.txt COPY - Copy Files Command:copy file.txt newfile.txt Output: 1 file(s) copied. RENAME - Rename Files Command:rename newfile.txt renamedfile.txt Output: (No output on success) DEL - Delete Files Command:del renamedfile.txt Output: Are you sure (Y/N)? Y Use: Deletes the file renamedfile.txt. TYPE - Display File Contents Command: type file.txt Output: This is a sample file. VER - Display Version of DOS/Windows Command :ver Microsoft Windows [Version 10.0.19045.3086] DATE - Display or Change Date Command:date Output:The current date is: Thu 12/05/2024 9|Page TIME - Display or Change Time Command: time Output: The current time is: 09:45:30.45 PATH - Display or Set Search Path Command: path Output: PATH=C:\Windows\System32;C:\Windows; EXIT - Exit Command Prompt Command: exit Output: (Closes the Command Prompt window) MD (or MKDIR) - Create a New Directory Command: md new folder Output: (No output on success) RD (or RMDIR) - Remove a Directory Command: rd new folder Output: (No output on success) SET - Display or Set Environment Variables Command: set Output: ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\UserName\AppData\Roaming 10 | P a g e PROMPT - Change Command Prompt Display Command: prompt $P$G Output: C:\Users\UserName> TITLE - Change Command Prompt Window Title Command: title My Custom Title Effect: The Command Prompt window's title changes to "My Custom Title." COPY CON - Create a File Command: copy con newfile.txt This is a test file. Press CTRL+Z Output: 1 file(s) copied. HELP - Display Help for Commands Command: help Output: For more information on a specific command, type HELP command-name ASSOC Displays or modifies file extension associations. ATTRIB Displays or changes file attributes. 11 | P a g e Experiment 4 Objective:- Demonstrate all external dos commands with output Procedure:- CD - Change Directory Command : cd C:\Windows Output: C:\Windows> Use: Navigates to the C:\Windows directory. CHKDSK - Check Disk for Errors Command: chkdsk C: Output: The type of the file system is NTFS. Volume label is Windows. Stage 1: Examining basic file system structure... Stage 2: Examining file name linkage... Stage 3: Examining security descriptors... Windows has scanned the file system and found no problems. Use: Checks and displays the status of the disk. DISKCOPY - Copy Contents of a Disk Command: diskcopy A: B: Output: Insert source diskette in drive A: Insert target diskette in drive B: Press any key when ready... Use: Copies data from one disk to another (used for floppy disks). 12 | P a g e FORMAT - Format a Disk Command: format D: Output: Insert new disk for drive D: Press ENTER when ready... WARNING: All data on the drive will be lost! Proceed with Format (Y/N)? Y Formatting... Use: Formats a disk for use. XCOPY - Extended Copy Command: xcopy C:\source D:\destination /E /I Output: C:\source\file1.txt C:\source\folder\file2.txt Total Files Copied: 2 Use: Copies files and directories, including subdirectories. TREE - Display Directory Structure Command: tree C:\Projects Output: C:\PROJECTS ├───Project1 │ └───Docs ├───Project2 │ └───Code └───Project3 └───Images Use: Shows the directory structure of a path. 13 | P a g e DISKPART - Manage Disks and Partitions Command: diskpart Output: DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 500 GB 0 B Disk 1 Online 100 GB 50 GB Use: Manages partitions, volumes, and disks. ATTRIB - Modify File Attributes Command: attrib +r file.txt Output: (No output on success) Check Attributes: attrib file.txt Output: R C:\path\file.txt Use: Adds or removes attributes (e.g., read-only, hidden) from files. PING - Test Network Connectivity Command: ping google.com Output: Pinging google.com [142.250.182.46] with 32 bytes of data: Reply from 142.250.182.46: bytes=32 time=15ms TTL=118 Use: Checks the connection between the computer and a remote host. 14 | P a g e IPCONFIG - Display Network Configuration Command: ipconfig Output: Windows IP Configuration Ethernet adapter Ethernet: IPv4 Address........... : 192.168.1.2 Subnet Mask........... : 255.255.255.0 Default Gateway......... : 192.168.1.1 FC - File Compare Command: fc file1.txt file2.txt Output: Comparing files FILE1.TXT and FILE2.TXT ***** FILE1.TXT This is a test file. ***** FILE2.TXT This is a different file. Use: Compares two files and displays differences. FIND - Search for Text in Files Command: find "search_text" file.txt Output: ---------- FILE.TXT This is a line with search_text. TASKLIST - List Running Processes Command: tasklist 15 | P a g e Output: Image Name PID Session Name Mem Usage ========================= ======== ================ ============ cmd.exe 1234 Console 4,000 K explorer.exe 5678 Console 12,000 K TASKKILL - Kill a Process Command: taskkill /IM notepad.exe /F Output: SUCCESS: The process "notepad.exe" with PID 5678 has been terminated. ROBOCOPY - Robust File Copy Command: robocopy C:\source D:\destination /E Output: -------------------------------------------------------------------------- ----- ROBOCOPY :: Robust File Copy for Windows -------------------------------------------------------------------------- ----- Total Copied Skipped Mismatch FAILED Extras Files : 5 5 0 0 0 0 DEFRAG - Defragment Disk Command: defrag C: Output: Performing pass 1: 0% fragmented Performing pass 2: 0% fragmented 16 | P a g e Experiment 5 Objective:- Introduction to windows and familiarity with its control Procedure:- Graphical User Interface (GUI): Allows users to interact with icons, windows, and menus instead of command-line inputs. 1. Multi-tasking: Users can run multiple applications simultaneously. 2. File Management System: Organizes and manages data in files and folders. 3. Networking: Provides robust networking capabilities for file sharing, internet access, and remote desktop connections. 4. Security Features: Includes user accounts, firewalls, encryption, and regular updates. 5. Customization: Allows users to personalize the desktop, taskbar, and system settings. 6. Compatibility: Supports a wide range of hardware and software. Familiarity with Windows Controls Below is a guide to familiarize yourself with the basic controls and components of the Windows environment. Desktop  Icons: Represent files, folders, and applications. Double-click to open.  Taskbar: Located at the bottom of the screen, it contains: o Start Menu: Access programs, settings, and power options. o Search Bar: Quickly search files, applications, and web content. o Pinned Apps: Frequently used apps can be pinned for easy access. o System Tray: Displays notifications, time, and quick access to system settings. Start Menu  Click the Windows icon (or press the Windows key) to open.  Sections: o Pinned Apps: Quickly access your favorite programs. o All Apps: List of all installed applications. o Power Options: Shut down, restart, or put the computer to sleep. o Settings: Open the Windows Settings application. 17 | P a g e File Explorer  Use to navigate, manage, and organize files and folders.  Key Components: o Quick Access: Displays frequently used folders and recent files. o Drives: Lists all connected drives (e.g., C: for system drive). o Search Bar: Locate files or folders within a specific directory.  Shortcut: Windows + E to open File Explorer. Control Panel  Provides access to system settings such as hardware, software, and user accounts.  Categories: o System and Security: Manage system health and security. o Network and Internet: Configure network connections. o Hardware and Sound: Adjust device and sound settings. o Programs: Install or uninstall software. o User Accounts: Manage user profiles and passwords. Windows Settings  A modern alternative to the Control Panel, accessed via the Start Menu or Windows + I.  Sections include: o System: Adjust display, notifications, and power settings. o Devices: Manage printers, Bluetooth devices, and peripherals. o Network & Internet: Configure Wi-Fi, Ethernet, and VPN. o Personalization: Change desktop background, themes, and fonts. o Task Manager  Monitors system performance, running applications, and processes.  Shortcut: Ctrl + Shift + Esc or Ctrl + Alt + Del → Select Task Manager. Shortcut Keys  Windows + D: Show desktop.  Alt + Tab: Switch between open applications.  Windows + L: Lock the computer.  Ctrl + C / Ctrl + V: Copy and paste. 18 | P a g e Experiment 6 Objective:- Use the various window application calculator notepad and ms paint Procedure:- Calculator The Windows Calculator is useful for basic arithmetic, scientific calculations, programmer modes, and more. Steps to Open: 1. Search: o Press Windows + S, type Calculator, and press Enter. 2. Run Command: o Press Windows + R, type calc, and hit Enter. Features:  Standard Mode: Basic arithmetic (Add, Subtract, Multiply, Divide).  Scientific Mode: For trigonometry, logarithms, and other advanced functions.  Programmer Mode: Useful for binary, hexadecimal, and octal calculations.  Date Calculation: Calculate the difference between two dates.  Unit Conversions: Convert between units (e.g., temperature, weight, length). Notepad Notepad is a simple text editor for creating and editing plain text files. Steps to Open: 1. Search: o Press Windows + S, type Notepad, and press Enter. 2. Run Command: o Press Windows + R, type notepad, and hit Enter. Basic Usage:  Create New File: File -> New or Ctrl + N.  Open File: File -> Open or Ctrl + O.  Save File: File -> Save or Ctrl + S. 19 | P a g e  Word Wrap: Enable Format -> Word Wrap to prevent horizontal scrolling.  Find/Replace: Use Ctrl + F for Find and Ctrl + H for Replace. 3. MS Paint MS Paint is a simple graphics editor for creating and editing images. Steps to Open: 1. Search: o Press Windows + S, type Paint, and press Enter. 2. Run Command: o Press Windows + R, type mspaint, and hit Enter. Basic Features:  Drawing: Use brushes, pencil, and shapes to draw or paint.  Text: Add text by selecting the A icon in the toolbar.  Image Editing: Crop, resize, and rotate images.  File Formats: Save files in formats like.bmp,.jpeg,.png, etc. Shortcut Keys:  New: Ctrl + N  Open: Ctrl + O  Save: Ctrl + S  Undo: Ctrl + Z  Redo: Ctrl + Y Quick Access Tips  Pin to Start Menu or Taskbar: Right-click the app in the search results and choose Pin to Start or Pin to Taskbar.  Desktop Shortcuts: o Right-click on the desktop, select New -> Shortcut, and type:  Calculator: calc  Notepad: notepad  MS Paint: mspaint 20 | P a g e Experiment 7 Objective:- explaining control panel option Procedure:- System and Security This section handles settings related to system performance, security, and backups.  System: View system information (e.g., Windows version, RAM, processor) and configure advanced system settings.  Security and Maintenance: Check for updates, troubleshoot problems, and monitor system health.  Windows Firewall: Manage network firewall settings.  Power Options: Customize power plans to optimize battery usage or performance.  Backup and Restore: Create backups of your data or restore from previous backups. Network and Internet Manage internet and networking settings.  Network and Sharing Center: Set up new connections, troubleshoot networks, or manage network settings.  Internet Options: Adjust browser settings like homepage, privacy, and security (primarily for Internet Explorer).  Change Adapter Settings: Manage and troubleshoot network adapters. Hardware and Sound Control settings for connected hardware and audio devices.  Devices and Printers: Add, remove, or manage printers and other hardware.  Sound: Configure audio devices, set up default playback and recording devices, and troubleshoot sound issues.  Power Options: Manage power settings, including sleep and display timeout. 21 | P a g e  AutoPlay: Choose default actions for CDs, DVDs, USB drives, and media. Programs Install, uninstall, or manage software applications.  Programs and Features: Uninstall or change programs, view installed updates, and turn Windows features on or off.  Default Programs: Set default applications for specific file types (e.g., default web browser or music player). User Accounts Manage user profiles and access settings.  User Accounts: Change account types, passwords, and profile pictures.  Credential Manager: Manage saved login credentials for websites and networks.  Family Safety: Configure parental controls and manage child accounts. Appearance and Personalization Customize the look and feel of your desktop.  Personalization: Change desktop background, themes, and screen savers.  Display: Adjust screen resolution, brightness, and text size.  Taskbar and Navigation: Customize the taskbar and start menu behavior. Clock and Region Set time, date, and regional settings.  Date and Time: Set or change the system clock and time zone.  Region: Configure regional formats for numbers, dates, and currencies.  Language: Add or remove input languages and keyboard layouts. 22 | P a g e Ease of Access Improve accessibility for users with disabilities.  Ease of Access Center: Access tools like Narrator, Magnifier, and On-Screen Keyboard.  Speech Recognition: Set up voice commands and dictation.  Make the Computer Easier to See: Adjust contrast and font sizes. Hardware-Specific Settings Certain hardware components or drivers may add additional settings to the Control Panel, such as:  NVIDIA/AMD Control Panel: Manage graphics settings.  Touchpad/Mouse Settings: Configure gestures and sensitivity. Accessing Control Panel  Search: Press Windows + S, type "Control Panel," and press Enter.  Run Command: Press Windows + R, type control, and press Enter.  File Explorer: Navigate to C:\Windows\System32\control.exe. 23 | P a g e Experiment 8 Objective:- Create a file using linux command Procedure:- Using touch Command The touch command creates an empty file or updates the timestamp of an existing file. touch myfile.txt Using echo Command The echo command creates a file with specific content. echo "Your text here" > filename.txt Using cat Command The cat command allows you to create a file and add content interactively. cat > filename.txt cat > myfile.txt Type your content, press Enter, and then use Ctrl + D to save and exit. Using nano or Other Editors You can use a text editor like nano, vi, or vim to create and edit a file. nano myfile.txt This opens the nano editor, where you can type your content. Press Ctrl + O to save and Ctrl + X to exit. 24 | P a g e Using > (Redirect Operator) You can create an empty file using the redirection operator. > filename.txt > myfile.txt This creates an empty file named myfile.txt. Using printf Command The printf command is similar to echo but more flexible for formatting. printf "Your text here" > filename.txt printf "Hello, World!\n" > myfile.txt This creates myfile.txt with the text "Hello, World!". Using dd Command The dd command creates a file with specific content or size.  Example to create an empty file: dd if=/dev/null of=myfile.txt  Example to create a file of a specific size: dd if=/dev/zero of=myfile.txt bs=1M count=1 This creates a 1MB file named myfile.txt. 25 | P a g e Experiment- 9 Objective:- write a linux command which lists all files and directories Procedure: Basic Command Ls Lists the files and directories in the current directory. Include Hidden Files ls –a Displays all files, including hidden files (those starting with.). Detailed Listing ls –l Shows a detailed list with permissions, owner, size, and modification time. Combine Options ls –la Lists all files, including hidden ones, in a detailed format. Recursive Listing ls –R Lists all files and directories recursively, including their contents. Sort by Modification Time ls –lt Lists files in detailed format sorted by modification time. 26 | P a g e Experiment- 10 Objective: create directory using linux commands crete a 3 different files in this directory Procedure :Create a Directory Use the mkdir command to create a new directory. mkdir my_directory This creates a directory named my_directory in the current location. Navigate to the Directory Change into the newly created directory using the cd command. cd my_directory Create Three Files You can create three files using any of these methods: Method 1: Using touch touch file1.txt file2.txt file3.txt This creates three empty files named file1.txt, file2.txt, and file3.txt. Method 2: Using echo echo "Content for file 1" > file1.txt echo "Content for file 2" > file2.txt echo "Content for file 3" > file3.txt This creates three files with specific content. Method 3: Using cat cat > file1.txt

Use Quizgecko on...
Browser
Browser