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 (B)

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 (A)</p> Signup and view all the answers

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

<p>False (B)</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 (C)</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 (A)</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 (A)</p> Signup and view all the answers

Linux is not a multi-user operating system.

<p>False (B)</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 (B)</p> Signup and view all the answers

Linux file paths are case insensitive.

<p>False (B)</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 (B)</p> Signup and view all the answers

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

<p>False (B)</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 (B)</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 (A)</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 (D)</p> Signup and view all the answers

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

<p>True (A)</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 (D)</p> Signup and view all the answers

In a Bash script, all variables are strictly typed.

<p>False (B)</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; (A)</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 (A)</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: (C)</p> Signup and view all the answers

Flashcards

Operating System (OS)

System software that manages the entire computer system, providing user-friendly interfaces and efficient resource allocation. Examples include Windows, macOS, Linux, and Android.

Application Software

Software designed for specific tasks and used by end users. Examples include word processors, spreadsheets, and graphics programs.

System Software

Software that provides fundamental services to the computer system, supporting application software to run smoothly. Examples include operating systems, compilers, and debuggers.

Command Line Interface (CLI)

A text-based interface that allows users to interact with the computer using commands. It's typically used by programmers and advanced users.

Signup and view all the flashcards

Graphical User Interface (GUI)

A visual interface that uses icons and menus to allow users to interact with the computer. It is more user-friendly than CLI.

Signup and view all the flashcards

Unix

A family of multitasking, multi-user operating systems originally developed by Bell Labs. It's known for its flexibility, portability, and influence on modern operating systems.

Signup and view all the flashcards

Linux

A free and open-source operating system based on the Unix kernel, known for its flexibility, stability, and wide range of distributions.

Signup and view all the flashcards

Kernel

The heart of any operating system, managing the system's resources like CPU, memory, and storage.

Signup and view all the flashcards

Shell

The user interface of an OS that allows users to interact with the kernel by running commands.

Signup and view all the flashcards

File System

The way files and directories are organized in a hierarchical structure, allowing for easy navigation and management.

Signup and view all the flashcards

Permissions

Control over who can access and modify files, ensuring data security in a multi-user environment.

Signup and view all the flashcards

Command Interpreter

A program that interacts with users to execute commands and manage the operating system.

Signup and view all the flashcards

Hierarchical File Structure

A system where files and directories are organized in a tree-like hierarchy, making it easy to structure and navigate data.

Signup and view all the flashcards

Parent Directory

The directory that contains the current directory. It is one level higher in the hierarchy of directories.

Signup and view all the flashcards

Login (Home) Directory

The directory assigned to a user when they log in. It usually contains their personal files and configuration settings.

Signup and view all the flashcards

mkdir

A command used to create a new directory. Takes a directory name as an argument.

Signup and view all the flashcards

rmdir

A command used to remove a directory. Takes a directory name as an argument.

Signup and view all the flashcards

ls

A command used to list the contents of a directory. It displays files and subdirectories within a specified directory.

Signup and view all the flashcards

Hidden Files

Files whose names start with a period (.). They are not displayed by default when listing directory contents using the 'ls' command.

Signup and view all the flashcards

Absolute Path

A complete and unambiguous path to a file or directory, starting from the root directory (/).

Signup and view all the flashcards

What is a relative path?

A path to a file or directory relative to the current working directory. It doesn't start with / or ~.

Signup and view all the flashcards

File Size

The total number of bytes a file occupies, often displayed in octal format.

Signup and view all the flashcards

more Command

Displays a file's contents one screen at a time, allowing for easier navigation of large files.

Signup and view all the flashcards

head Command

Displays the first 'n' lines of a file, useful for previewing the beginning of a file.

Signup and view all the flashcards

tail Command

Displays the last 'n' lines of a file, helpful for seeing recent changes or examining the end of a file.

Signup and view all the flashcards

cmp Command

Compares two files, highlighting the first difference encountered.

Signup and view all the flashcards

diff Command

Compares two files, showing all discrepancies between them, line by line.

Signup and view all the flashcards

pico Command

A simple text editor for creating and modifying files, allowing for quick and straightforward editing.

Signup and view all the flashcards

cp Command

Copies a file, creating a duplicate with the same content.

Signup and view all the flashcards

Array (Bash)

A data structure that can hold multiple values, similar to a list in other languages. It is dynamic in size and does not require contiguous indexing.

Signup and view all the flashcards

${color[@]}

Refers to the entire array named "color" in a Bash script. It accesses all elements of the array.

Signup and view all the flashcards

Positional Parameters

Variables in Bash that represent arguments passed to a script during execution. They are accessed using $0, $1, $2, etc.

Signup and view all the flashcards

if-then-else

A control structure in Bash that allows for conditional execution of code based on a test expression. It executes different command lists based on whether the expression is true or false.

Signup and view all the flashcards

case statement

A control structure in Bash that allows for multiple branches based on matching a string against a pattern.

Signup and view all the flashcards

Bash Script

A sequence of commands written in the Bash scripting language, used to automate tasks and perform complex operations on a Unix-like system.

Signup and view all the flashcards

Interpreting Code

The process of reading and executing each line of code one by one, without compiling it into machine code.

Signup and view all the flashcards

Executable File

A file that contains instructions the computer can directly run, often created from Bash scripts.

Signup and view all the flashcards

Environment Variables

Special variables that store information about the system and user environment, like the user's home directory or the shell being used.

Signup and view all the flashcards

User-Defined Variables

Variables created by the user to store data in a Bash script, used to hold values like numbers or text.

Signup and view all the flashcards

String Value

A data type used to store text, like a name or a sentence, in Bash scripts.

Signup and view all the flashcards

Test Expression

A statement that evaluates a condition and returns either true or false, allowing you to control the flow of a Bash script.

Signup and view all the flashcards

File Queries

Commands used to check properties of files and directories, like their existence, size, or permissions.

Signup and view all the flashcards

Logical Operators

Operators that combine or modify test expressions, allowing you to build complex conditions in Bash scripts.

Signup and view all the flashcards

Bash Script Basics

Fundamental concepts and features of Bash scripting, including variables, test expressions, and file manipulation.

Signup and view all the flashcards

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
Linux Midterm Review  3
30 questions

Linux Midterm Review 3

LuxuryAbundance avatar
LuxuryAbundance
Introduction to Linux Commands and Concepts
23 questions
Use Quizgecko on...
Browser
Browser