Operating Systems Quiz
44 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following is an example of an Operating System?

  • Google Chrome
  • Microsoft Word
  • Linux (correct)
  • Adobe Photoshop
  • The main goal of an Operating System is to provide a convenient working environment for programmers only.

    False

    What is the purpose of the 'umask' setting in a shell configuration?

    It controls the default access permissions for new files.

    _________ is a command to clear the terminal screen.

    <p>cls</p> Signup and view all the answers

    Match the common Operating Systems with their characteristics:

    <p>Windows 11 = Graphical User Interface Linux = Open-source software macOS 14 = Developed by Apple Android = Primarily for mobile devices</p> Signup and view all the answers

    Which command is used to create a new directory?

    <p>mkdir</p> Signup and view all the answers

    The relative path of a file starts with a forward slash (/).

    <p>False</p> Signup and view all the answers

    What notation is used to represent the home directory in file paths?

    <p>~</p> Signup and view all the answers

    To remove a directory, the command used is ______.

    <p>rmdir</p> Signup and view all the answers

    Which of the following is an example of an absolute path?

    <p>/home/user/file.txt</p> Signup and view all the answers

    Match the following commands with their functions:

    <p>ls = List directory contents cat = Concatenate files and output od = Octal dump of files mkdir = Make a new directory</p> Signup and view all the answers

    Hidden files in Linux begin with a period (.) in their filename.

    <p>True</p> Signup and view all the answers

    What is the command to display the contents of a file on standard output?

    <p>cat</p> Signup and view all the answers

    Which of the following components is considered the core of the Linux operating system?

    <p>Kernel</p> Signup and view all the answers

    Linux is not a multi-user operating system.

    <p>False</p> Signup and view all the answers

    What command would you use to create a directory named 'projects' in Linux?

    <p>mkdir projects</p> Signup and view all the answers

    The __________ is the command interpreter that provides the user interface in Linux.

    <p>Shell</p> Signup and view all the answers

    Match the Linux commands with their functions:

    <p>date = Print date and time whoami = Display user id logout = Log out pwd = Print working directory</p> Signup and view all the answers

    Which distribution of Linux is known for being a free open-source operating system?

    <p>Ubuntu</p> Signup and view all the answers

    Linux file paths are case insensitive.

    <p>False</p> Signup and view all the answers

    What protocol was significant in the development of UNIX at Berkeley?

    <p>TCP/IP</p> Signup and view all the answers

    What does ${#color[@]} return when the color list has five components?

    <p>5</p> Signup and view all the answers

    In Bash, the first command line argument is accessed using $2.

    <p>False</p> Signup and view all the answers

    What is the index of the first component in a Bash array?

    <p>0</p> Signup and view all the answers

    In a Bash script, the command to check a condition using if structure starts with 'if test-______'.

    <p>expr</p> Signup and view all the answers

    Match the following positional parameters with their corresponding command line arguments:

    <p>$0 = ./addsize $1 = file1 $2 = file2 $3 = file3 $# = 3</p> Signup and view all the answers

    What command is used to display the top 20 lines of a file?

    <p>head -20 file1</p> Signup and view all the answers

    The command 'mv file1 file2' can be used to move and rename a file at the same time.

    <p>True</p> Signup and view all the answers

    What command should you use to remove a directory that is not empty?

    <p>rm -r dir1</p> Signup and view all the answers

    To check the calendar for the year 2001, use the command '____ 2001'.

    <p>cal</p> Signup and view all the answers

    Match the commands with their functions:

    <p>ls -l = List in long format all non-hidden entries cp = Copy a file rm = Remove files cd = Change directory</p> Signup and view all the answers

    Which command will you use to list all entries in a directory, including hidden files?

    <p>ls -a dir1</p> Signup and view all the answers

    The 'rm file1 file2' command can delete two files at once.

    <p>True</p> Signup and view all the answers

    What command would you use to view the current working directory?

    <p>pwd</p> Signup and view all the answers

    What is the first command you use to give a script file executable permissions?

    <p>chmod 700</p> Signup and view all the answers

    In a Bash script, all variables are strictly typed.

    <p>False</p> Signup and view all the answers

    What does the acronym GCD stand for?

    <p>Greatest Common Divisor</p> Signup and view all the answers

    The shell implements a programming language that includes variables, expressions, assignment, and __________ structures.

    <p>control</p> Signup and view all the answers

    Match the following Bash expressions with their meanings:

    <p>[[ var ]] = var is defined and is not null [[ -z str ]] = str is zero length [[ arg1 -eq arg2 ]] = arg1 is equal to arg2 [[ -f entry ]] = Is an ordinary file</p> Signup and view all the answers

    Which operator is used for logical AND in Bash expressions?

    <p>&amp;&amp;</p> Signup and view all the answers

    The GCD of two integers can be calculated using the Euclidean algorithm as shown in the sample code.

    <p>True</p> Signup and view all the answers

    What is the command to display the value of a variable named 'x'?

    <p>echo $x</p> Signup and view all the answers

    When defining a variable, there should be no spaces around the __________ symbol.

    <p>equal to</p> Signup and view all the answers

    What will be the output of the command 'echo -n "Enter the 1st positive integer: "'?

    <p>Enter the 1st positive integer:</p> Signup and view all the answers

    Study Notes

    CSC 209 UNIX Tools - Hierarchical Diagram

    • A hierarchical diagram displays folders and files created in assignment 1
    • The home directory contains the user account jdoel
    • The jdoel folder contains multiple subfolders and files
    • The csc209 folder contains subfolders asgn01 and asgn02
    • The public_html folder is a subfolder under csc209
    • The folder csc209 contains the folder esc209
    • The root directory (/) is the top-level folder

    Login and Bash Initialization

    • Sign on as a new user using Net-ID (user ID) and password
    • Verify password and establish user identity and group id
    • Establish login (home) directory and shell
    • Announce the presence of email (traditional)
    • Customize terminal settings
    • Publish message of the day (motd) (traditional)
    • Initiate command interpreter (shell)
    • Perform user-specified initialization (code)
    • Display prompt and await commands

    Password File

    • The /etc/passwd file historically stores login information
    • Each line within /etc/passwd represents a user
    • Each line contains seven pieces of user data separated by colons
    • Encrypts password in a hash
    • Modern systems use /etc/shadow or similar mechanisms for security

    Shell Initialization Files

    • The C Shell is the default login shell at Brockport
    • Initialization files .cshrc and .login are executed on startup of the C shell
    • In Assignment 1, a .login file is set up to switch to Bash
    • Bash initialization executes /etc/profile and ~/.bash_profile at login

    Sample .bashrc File

    • The ~/.bashrc file contains important configurations
    • Sources global definitions from /etc/bashrc (if applicable)
    • Contains user-specific aliases (e.g., cls, h, lo)
    • Controls history parameters (e.g., HISTSIZE, HISTFILESIZE)
    • Sets default access permissions (using umask)
    • Protects files in redirection
    • Defines shell prompt (PS1)

    What is an Operating System?

    • OS is a computer's system software in charge of the entire computer system
    • Provides a convenient working environment and organization of files
    • Management of computer resources are critical OS functions
    • Examples of OS include MS-DOS, Windows 11, macOS 14, UNIX, Linux, Android, and iOS

    Brief History of UNIX

    • MULTICS project at MIT influenced early UNIX development
    • UNIX originated at Bell Labs (AT&T) in 1969 by Ken Thompson and Dennis Ritchie
    • UNIX System Laboratory (USL)
    • UNIX extensions and communication protocols (TCP/IP) emerged in the 1980s
    • Major flavors such as AT&T System 5 Release 4 (SVR4). USL (AT&T) → Novell → Santa Cruz Operations (SCO) BSD 4.4 and some from vendors

    UNIX/Linux

    • Linux is a multi-user, time-sharing, multi-tasking OS
    • Kernel is the core of the operating system
    • Shell acts as the user interface and command interpreter
    • Features include hierarchical file structure and I/O device support.

    Simple Linux Commands

    • date: Displays date and time
    • who: Lists currently logged-in users
    • whoami: Displays current user ID
    • logout: Logs out of the system
    • pwd: Displays the current working directory
    • mkdir: Creates a new directory
    • rmdir: Removes an empty directory
    • cd: Changes the current working directory
    • ls: Lists directory contents
    • chmod: Changes file permissions

    Permissions in Linux

    • The ls -l command provides detailed security information of files and directories
    • Permissions are specified as three sets of three permissions (read, write, execute)
    • Permissions are tied to the owner, group, and others

    Ordinary File Permissions

    • Displaying files requires read permissions
    • Rewriting files requires write permissions
    • Executing a file requires execute permissions

    Directory File Permissions

    • Moving to directories requires execute permissions
    • List directories requires read and execute permissions
    • Creating new directory entries requires write permission
    • Removing directory entries requires write permissions

    Default Access Permissions

    • Default file permissions are 666 (for files) and 777 (for directories)
    • umask (user mask) controls what permissions are removed
    • Using ~/.bashrc to set umask to 077 changes default permissions

    Superuser (root)

    • Superuser (root) is the administrator account
    • Can access, create, or delete any files or directories irrespective of permissions
    • Superuser bypasses permission restrictions

    Format of Linux Commands

    • Commands typically follow the format command_name [options] [argument]
    • Options are single characters preceded by a hyphen
    • Arguments are often necessary to use the commands effectively

    Handling errors while typing commands

    • ctl-h or Backspace to delete previous character
    • ctl-w to delete the previous word
    • ctl-u to delete the entire command

    On-line help (man command)

    • Use man to display help for commands
    • Example man cat provides documentation for the cat command

    Hierarchical File System

    • Organizes files and directories in a tree-like structure
    • Root directory (/) is the top-level directory
    • cd command navigates between directories
    • pwd displays current working directory

    Absolute and Relative Path Names

    • Absolute paths start with a forward slash (/) or a tilde (~)
    • Relative paths are relative to the current working directory

    File Manipulation Commands

    • cat: Concatenates files and prints to the standard output
    • od: Displays content in octal format
    • more: Displays files one screen at a time

    Other File Commands

    • head: Displays the first part of a file
    • tail: Displays the last part of a file
    • cmp: Compares two files; shows the first difference
    • diff: Compares two files; shows all differences
    • cal: Displays a calendar

    File System Commands

    • piico, nano, emacs: Editors for file manipulation
    • cp: Copies files
    • mv: Moves or renames files
    • rm: Removes files
    • rm -i: prompts before deleting files

    Directory Listing Commands

    • ls: Lists files and directories in the current working directory
    • ls -a: Includes hidden files in listing
    • ls -l: Displays file information in long format
    • ls -ld: Lists directory information in long format

    Directory Manipulation Commands

    • mkdir: Creates a new directory
    • rmdir: Removes an empty directory
    • rm -r: Recursively removes a directory (be cautious)
    • cd: Changes the current working directory
    • pwd: Shows current working directory

    Bash Special Characters

    • Special characters define actions such as input/output redirection, variable substitutions, and more

    Shell Substitutions and Quoting

    • The shell performs input processing of various substitutions
    • Three methods are available to quote
    • Use \ (backslash) to quote a character
    • Use single quotes to disable substitutions entirely
    • Use double quotes to allow certain substitutions but restrict wildcard expansion

    History Substitution

    • Accessing previously entered commands or parts
    • Variables like HISTSIZE and HISTFILESIZE influence command history management

    Aliases Substitution

    • Alias commands to shorten the names for frequently used tasks
    • A list of all aliases can be obtained with the alias command
    • An alias is undone using unalias

    Shell Variable Value Substitution

    • Accessing the values stored in shell variables using the "$" symbol
    • Using set displays all current shell variables
    • Removing particular variables using unset

    Command Output Substitution

    • Performing a command, and using the output as a value
    • Enclosing the command in backticks

    File Name Expansion

    • Wildcards and file name expansion
    • Example: ls -l * will generate a listing of all entries in the current directory
    • Use \ or single quotes to disable wildcards

    Special Characters and Quoting

    • Backslash escapes the effect of special characters inside the quotes
    • Single and double quotes both prevent certain interpretations

    Redirection and Pipe

    • Redirecting input from a file with input_file < or redirecting output to a file with >output_file
    • Using a pipe to chain commands (e.g., command1 | command2)

    Linux Filenames and Shell Substitutions

    • Filename length and character restrictions
    • Standard usage for creating and deleting files
    • Filename wildcards and usage, e.g., "*and?`
    • Information of file and directories that describe the Linux file system
    • Inode number is central to Linux structure to maintain all file attributes
    • Hard and soft links

    Shell Working and Process Control

    • Shell activities and commands (e.g. ps, jobs, fg)

    Process Control Commands

    • Using ps and kill to manage running processes

    Locating Files in File System

    • Using find command to locate files
    • Use criteria for location

    Selection Criterion

    • find command criteria to meet when listing files

    Regular Expressions

    • Method of describing a set of text strings using meta characters

    Stream Editor (sed)

    • sed is used for repetitive editing tasks
    • Editing instructions can be in a separate file or given inline
    • sed performs edits on each line

    Bash Scripts

    • Shell scripts are programs for the shell
    • How to execute code in files

    Bash Script Basics

    • User-defined variables, use of $ symbol for accessing variables, arithmetic operations, string handling

    Test Expressions

    • Logical conditions to check whether a variable is true or false

    File Queries

    • Examine file types, permissions, sizes with find command

    Multivalued Variables (Arrays)

    • Array variables and how to access them

    Command Line Arguments

    • Accessing command line arguments passed to a script (e.g., $1, $2, $@ , $#).

    Bash Control Structures

    • Conditional statements and loops for Bash scripts (like if, elif, else, case, while, and for).

    Examples of Bash Scripts

    • Practical demonstrations of using the discussed concepts

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Unix All Notes PDF

    Description

    Test your knowledge on Operating Systems with this quiz that covers key concepts, commands, and characteristics of different systems. From shell configurations to directory management, assess your understanding of both Linux and general Operating System principles.

    More Like This

    Bash Shell Grundlagen
    10 questions

    Bash Shell Grundlagen

    AdoringClavichord avatar
    AdoringClavichord
    Chapter 8: Working with Directories
    16 questions
    Linux Shell Flashcards
    39 questions

    Linux Shell Flashcards

    MarvelousPascal avatar
    MarvelousPascal
    Use Quizgecko on...
    Browser
    Browser