Podcast
Questions and Answers
Which of the following is an example of an Operating System?
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.
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?
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.
_________ is a command to clear the terminal screen.
Match the common Operating Systems with their characteristics:
Match the common Operating Systems with their characteristics:
Which command is used to create a new directory?
Which command is used to create a new directory?
The relative path of a file starts with a forward slash (/).
The relative path of a file starts with a forward slash (/).
What notation is used to represent the home directory in file paths?
What notation is used to represent the home directory in file paths?
To remove a directory, the command used is ______.
To remove a directory, the command used is ______.
Which of the following is an example of an absolute path?
Which of the following is an example of an absolute path?
Match the following commands with their functions:
Match the following commands with their functions:
Hidden files in Linux begin with a period (.) in their filename.
Hidden files in Linux begin with a period (.) in their filename.
What is the command to display the contents of a file on standard output?
What is the command to display the contents of a file on standard output?
Which of the following components is considered the core of the Linux operating system?
Which of the following components is considered the core of the Linux operating system?
Linux is not a multi-user operating system.
Linux is not a multi-user operating system.
What command would you use to create a directory named 'projects' in Linux?
What command would you use to create a directory named 'projects' in Linux?
The __________ is the command interpreter that provides the user interface in Linux.
The __________ is the command interpreter that provides the user interface in Linux.
Match the Linux commands with their functions:
Match the Linux commands with their functions:
Which distribution of Linux is known for being a free open-source operating system?
Which distribution of Linux is known for being a free open-source operating system?
Linux file paths are case insensitive.
Linux file paths are case insensitive.
What protocol was significant in the development of UNIX at Berkeley?
What protocol was significant in the development of UNIX at Berkeley?
What does ${#color[@]}
return when the color list has five components?
What does ${#color[@]}
return when the color list has five components?
In Bash, the first command line argument is accessed using $2.
In Bash, the first command line argument is accessed using $2.
What is the index of the first component in a Bash array?
What is the index of the first component in a Bash array?
In a Bash script, the command to check a condition using if structure starts with 'if test-______'.
In a Bash script, the command to check a condition using if structure starts with 'if test-______'.
Match the following positional parameters with their corresponding command line arguments:
Match the following positional parameters with their corresponding command line arguments:
What command is used to display the top 20 lines of a file?
What command is used to display the top 20 lines of a file?
The command 'mv file1 file2' can be used to move and rename a file at the same time.
The command 'mv file1 file2' can be used to move and rename a file at the same time.
What command should you use to remove a directory that is not empty?
What command should you use to remove a directory that is not empty?
To check the calendar for the year 2001, use the command '____ 2001'.
To check the calendar for the year 2001, use the command '____ 2001'.
Match the commands with their functions:
Match the commands with their functions:
Which command will you use to list all entries in a directory, including hidden files?
Which command will you use to list all entries in a directory, including hidden files?
The 'rm file1 file2' command can delete two files at once.
The 'rm file1 file2' command can delete two files at once.
What command would you use to view the current working directory?
What command would you use to view the current working directory?
What is the first command you use to give a script file executable permissions?
What is the first command you use to give a script file executable permissions?
In a Bash script, all variables are strictly typed.
In a Bash script, all variables are strictly typed.
What does the acronym GCD stand for?
What does the acronym GCD stand for?
The shell implements a programming language that includes variables, expressions, assignment, and __________ structures.
The shell implements a programming language that includes variables, expressions, assignment, and __________ structures.
Match the following Bash expressions with their meanings:
Match the following Bash expressions with their meanings:
Which operator is used for logical AND in Bash expressions?
Which operator is used for logical AND in Bash expressions?
The GCD of two integers can be calculated using the Euclidean algorithm as shown in the sample code.
The GCD of two integers can be calculated using the Euclidean algorithm as shown in the sample code.
What is the command to display the value of a variable named 'x'?
What is the command to display the value of a variable named 'x'?
When defining a variable, there should be no spaces around the __________ symbol.
When defining a variable, there should be no spaces around the __________ symbol.
What will be the output of the command 'echo -n "Enter the 1st positive integer: "'?
What will be the output of the command 'echo -n "Enter the 1st positive integer: "'?
Flashcards
Operating System (OS)
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
Application Software
Software designed for specific tasks and used by end users. Examples include word processors, spreadsheets, and graphics programs.
System Software
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)
Command Line Interface (CLI)
Signup and view all the flashcards
Graphical User Interface (GUI)
Graphical User Interface (GUI)
Signup and view all the flashcards
Unix
Unix
Signup and view all the flashcards
Linux
Linux
Signup and view all the flashcards
Kernel
Kernel
Signup and view all the flashcards
Shell
Shell
Signup and view all the flashcards
File System
File System
Signup and view all the flashcards
Permissions
Permissions
Signup and view all the flashcards
Command Interpreter
Command Interpreter
Signup and view all the flashcards
Hierarchical File Structure
Hierarchical File Structure
Signup and view all the flashcards
Parent Directory
Parent Directory
Signup and view all the flashcards
Login (Home) Directory
Login (Home) Directory
Signup and view all the flashcards
mkdir
mkdir
Signup and view all the flashcards
rmdir
rmdir
Signup and view all the flashcards
ls
ls
Signup and view all the flashcards
Hidden Files
Hidden Files
Signup and view all the flashcards
Absolute Path
Absolute Path
Signup and view all the flashcards
What is a relative path?
What is a relative path?
Signup and view all the flashcards
File Size
File Size
Signup and view all the flashcards
more Command
more Command
Signup and view all the flashcards
head Command
head Command
Signup and view all the flashcards
tail Command
tail Command
Signup and view all the flashcards
cmp Command
cmp Command
Signup and view all the flashcards
diff Command
diff Command
Signup and view all the flashcards
pico Command
pico Command
Signup and view all the flashcards
cp Command
cp Command
Signup and view all the flashcards
Array (Bash)
Array (Bash)
Signup and view all the flashcards
${color[@]}
${color[@]}
Signup and view all the flashcards
Positional Parameters
Positional Parameters
Signup and view all the flashcards
if-then-else
if-then-else
Signup and view all the flashcards
case statement
case statement
Signup and view all the flashcards
Bash Script
Bash Script
Signup and view all the flashcards
Interpreting Code
Interpreting Code
Signup and view all the flashcards
Executable File
Executable File
Signup and view all the flashcards
Environment Variables
Environment Variables
Signup and view all the flashcards
User-Defined Variables
User-Defined Variables
Signup and view all the flashcards
String Value
String Value
Signup and view all the flashcards
Test Expression
Test Expression
Signup and view all the flashcards
File Queries
File Queries
Signup and view all the flashcards
Logical Operators
Logical Operators
Signup and view all the flashcards
Bash Script Basics
Bash Script Basics
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 timewho
: Lists currently logged-in userswhoami
: Displays current user IDlogout
: Logs out of the systempwd
: Displays the current working directorymkdir
: Creates a new directoryrmdir
: Removes an empty directorycd
: Changes the current working directoryls
: Lists directory contentschmod
: 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
orBackspace
to delete previous characterctl-w
to delete the previous wordctl-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 directoriespwd
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 outputod
: Displays content in octal formatmore
: Displays files one screen at a time
Other File Commands
head
: Displays the first part of a filetail
: Displays the last part of a filecmp
: Compares two files; shows the first differencediff
: Compares two files; shows all differencescal
: Displays a calendar
File System Commands
piico
,nano
,emacs
: Editors for file manipulationcp
: Copies filesmv
: Moves or renames filesrm
: Removes filesrm -i
: prompts before deleting files
Directory Listing Commands
ls
: Lists files and directories in the current working directoryls -a
: Includes hidden files in listingls -l
: Displays file information in long formatls -ld
: Lists directory information in long format
Directory Manipulation Commands
mkdir
: Creates a new directoryrmdir
: Removes an empty directoryrm -r
: Recursively removes a directory (be cautious)cd
: Changes the current working directorypwd
: 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
andHISTFILESIZE
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
?`
Linux Directories, Inodes, Links
- 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
andkill
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.
Related Documents
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.