Podcast
Questions and Answers
What is one of the strengths of Command Line Interfaces (CLIs)?
What is one of the strengths of Command Line Interfaces (CLIs)?
GUIs are well-suited for automation tasks.
GUIs are well-suited for automation tasks.
False
What type of interface was dominant on personal computers before Microsoft Windows and the Apple Macintosh existed?
What type of interface was dominant on personal computers before Microsoft Windows and the Apple Macintosh existed?
Text User Interfaces
A typical CLI display contains about ______ kilobytes of data.
A typical CLI display contains about ______ kilobytes of data.
Signup and view all the answers
Why are CLIs often used over remote connections?
Why are CLIs often used over remote connections?
Signup and view all the answers
Graphical User Interfaces (GUIs) are well-suited for occasional tasks.
Graphical User Interfaces (GUIs) are well-suited for occasional tasks.
Signup and view all the answers
Match the following interfaces with their characteristics:
Match the following interfaces with their characteristics:
Signup and view all the answers
What was the state of computing in the very early days?
What was the state of computing in the very early days?
Signup and view all the answers
What type of user interface enables the user to interact with multiple application windows?
What type of user interface enables the user to interact with multiple application windows?
Signup and view all the answers
Operating systems provide at least three types of user interfaces.
Operating systems provide at least three types of user interfaces.
Signup and view all the answers
What is the primary purpose of the user interface?
What is the primary purpose of the user interface?
Signup and view all the answers
Most operating systems provide a set of basic starter applications, such as a _______________, clock, a few games, and sometimes a web browser.
Most operating systems provide a set of basic starter applications, such as a _______________, clock, a few games, and sometimes a web browser.
Signup and view all the answers
Match the following user interfaces with their descriptions:
Match the following user interfaces with their descriptions:
Signup and view all the answers
Utilities in an operating system can use either the GUI or CLI.
Utilities in an operating system can use either the GUI or CLI.
Signup and view all the answers
What is another term for Text-Based User Interface?
What is another term for Text-Based User Interface?
Signup and view all the answers
What type of tasks do utilities in an operating system perform?
What type of tasks do utilities in an operating system perform?
Signup and view all the answers
What is the primary function of the kernel?
What is the primary function of the kernel?
Signup and view all the answers
System libraries are provided by third-party vendors.
System libraries are provided by third-party vendors.
Signup and view all the answers
What are system libraries?
What are system libraries?
Signup and view all the answers
The kernel operates in a special ______________________ mode, which enables it to manage resources and security settings.
The kernel operates in a special ______________________ mode, which enables it to manage resources and security settings.
Signup and view all the answers
Match the following components of an Operating System:
Match the following components of an Operating System:
Signup and view all the answers
The kernel is loaded by the computer's firmware.
The kernel is loaded by the computer's firmware.
Signup and view all the answers
What are services in an Operating System?
What are services in an Operating System?
Signup and view all the answers
What is NOT a component of an Operating System?
What is NOT a component of an Operating System?
Signup and view all the answers
What was a key difference between Unix and DOS?
What was a key difference between Unix and DOS?
Signup and view all the answers
DOS used the forward-slash character in filenames.
DOS used the forward-slash character in filenames.
Signup and view all the answers
What was the version of DOS that introduced Unix-like features?
What was the version of DOS that introduced Unix-like features?
Signup and view all the answers
Microsoft introduced features from ______________ into DOS.
Microsoft introduced features from ______________ into DOS.
Signup and view all the answers
What was the reason DOS used the backward-slash character in filenames?
What was the reason DOS used the backward-slash character in filenames?
Signup and view all the answers
DOS was a multi-tasking system.
DOS was a multi-tasking system.
Signup and view all the answers
Match the following operating systems with their characteristics:
Match the following operating systems with their characteristics:
Signup and view all the answers
What was the original heritage of DOS?
What was the original heritage of DOS?
Signup and view all the answers
What is the primary purpose of hardware abstraction in an Operating System?
What is the primary purpose of hardware abstraction in an Operating System?
Signup and view all the answers
One customer of a cloud server can access another customer's data.
One customer of a cloud server can access another customer's data.
Signup and view all the answers
What is the primary benefit of maintaining the programming model in an Operating System?
What is the primary benefit of maintaining the programming model in an Operating System?
Signup and view all the answers
An application can send data to the network in the same way regardless of whether the connection uses _______________, WiFi, or 5G.
An application can send data to the network in the same way regardless of whether the connection uses _______________, WiFi, or 5G.
Signup and view all the answers
Match the following benefits of Operating System abstraction with their descriptions:
Match the following benefits of Operating System abstraction with their descriptions:
Signup and view all the answers
What is an example of an Operating System abstraction?
What is an example of an Operating System abstraction?
Signup and view all the answers
Multiple programs can be written to work in the same region of memory without conflict.
Multiple programs can be written to work in the same region of memory without conflict.
Signup and view all the answers
What is the primary benefit of multi-tenancy in a cloud server?
What is the primary benefit of multi-tenancy in a cloud server?
Signup and view all the answers
What is the current significance of the Unix trademark?
What is the current significance of the Unix trademark?
Signup and view all the answers
Linux is an officially recognized Unix system.
Linux is an officially recognized Unix system.
Signup and view all the answers
What are the two operating systems focused on in this course?
What are the two operating systems focused on in this course?
Signup and view all the answers
A CLI is provided by two components: a terminal program which accepts user input from a _______________ and displays text output.
A CLI is provided by two components: a terminal program which accepts user input from a _______________ and displays text output.
Signup and view all the answers
Match the following operating systems with their characteristics:
Match the following operating systems with their characteristics:
Signup and view all the answers
What is the primary interface available on the lab computers?
What is the primary interface available on the lab computers?
Signup and view all the answers
Graphical User Interfaces (GUIs) are well-suited for automation tasks.
Graphical User Interfaces (GUIs) are well-suited for automation tasks.
Signup and view all the answers
What is the name of the large server system that provides a Linux CLI by remote connection?
What is the name of the large server system that provides a Linux CLI by remote connection?
Signup and view all the answers
What was added to PC-DOS/MS-DOS 2.0?
What was added to PC-DOS/MS-DOS 2.0?
Signup and view all the answers
All modern versions of Windows are derived from MS-DOS.
All modern versions of Windows are derived from MS-DOS.
Signup and view all the answers
When was the X Window System introduced?
When was the X Window System introduced?
Signup and view all the answers
Unix was originally a proprietary product of ________________.
Unix was originally a proprietary product of ________________.
Signup and view all the answers
Match the following operating systems with their characteristics:
Match the following operating systems with their characteristics:
Signup and view all the answers
What was the primary purpose of the X Window System?
What was the primary purpose of the X Window System?
Signup and view all the answers
Unix became a family of related operating systems customized by various vendors.
Unix became a family of related operating systems customized by various vendors.
Signup and view all the answers
What was the new 32-bit operating system released in 1993?
What was the new 32-bit operating system released in 1993?
Signup and view all the answers
What is the primary purpose of the kernel?
What is the primary purpose of the kernel?
Signup and view all the answers
System libraries are provided by third-party vendors.
System libraries are provided by third-party vendors.
Signup and view all the answers
What are the two broad categories of software licenses in use?
What are the two broad categories of software licenses in use?
Signup and view all the answers
What type of argument is 'ls -l' in the command 'ls -l'?
What type of argument is 'ls -l' in the command 'ls -l'?
Signup and view all the answers
The copyright holder can license the software to another party under a _______________________ license.
The copyright holder can license the software to another party under a _______________________ license.
Signup and view all the answers
Open Source Software is generally protected by patent.
Open Source Software is generally protected by patent.
Signup and view all the answers
What type of user interface enables the user to interact with multiple application windows?
What type of user interface enables the user to interact with multiple application windows?
Signup and view all the answers
What is the primary purpose of the option '-l' in the command 'ls -l'?
What is the primary purpose of the option '-l' in the command 'ls -l'?
Signup and view all the answers
Match the following types of Open Source Licenses with their characteristics:
Match the following types of Open Source Licenses with their characteristics:
Signup and view all the answers
The 'dir' command is used to list files in _______________ systems.
The 'dir' command is used to list files in _______________ systems.
Signup and view all the answers
Match the following types of arguments with their descriptions:
Match the following types of arguments with their descriptions:
Signup and view all the answers
DOS used the forward-slash character in filenames.
DOS used the forward-slash character in filenames.
Signup and view all the answers
What are the two operating systems focused on in this course?
What are the two operating systems focused on in this course?
Signup and view all the answers
The 'cp' command is used to copy files in Windows systems.
The 'cp' command is used to copy files in Windows systems.
Signup and view all the answers
What is the purpose of the option '-h' in the command 'ls -l -h'?
What is the purpose of the option '-h' in the command 'ls -l -h'?
Signup and view all the answers
What type of argument is 'new' in the command 'cp old new'?
What type of argument is 'new' in the command 'cp old new'?
Signup and view all the answers
What is a shell?
What is a shell?
Signup and view all the answers
All commands are built into the shell.
All commands are built into the shell.
Signup and view all the answers
What is the name of the shell widely used on Linux systems?
What is the name of the shell widely used on Linux systems?
Signup and view all the answers
Commands may also be called ______________, utilities, applications, or executables.
Commands may also be called ______________, utilities, applications, or executables.
Signup and view all the answers
Match the following shells with their primary usage:
Match the following shells with their primary usage:
Signup and view all the answers
What is the primary purpose of a command?
What is the primary purpose of a command?
Signup and view all the answers
The terms 'programs', 'utilities', 'applications', and 'executables' are interchangeable only in the context of shell scripting.
The terms 'programs', 'utilities', 'applications', and 'executables' are interchangeable only in the context of shell scripting.
Signup and view all the answers
What is the structure of most commands?
What is the structure of most commands?
Signup and view all the answers
What is the name of the course being discussed in the lecture?
What is the name of the course being discussed in the lecture?
Signup and view all the answers
Labs account for 30% of the total mark in OPS102.
Labs account for 30% of the total mark in OPS102.
Signup and view all the answers
What is the name of the Linux distribution that provides a command-line interface by remote connection?
What is the name of the Linux distribution that provides a command-line interface by remote connection?
Signup and view all the answers
The course OPS102 focuses on two operating systems: _______ and Windows.
The course OPS102 focuses on two operating systems: _______ and Windows.
Signup and view all the answers
Why did the instructor swap weeks 1 and 2 in OPS102?
Why did the instructor swap weeks 1 and 2 in OPS102?
Signup and view all the answers
All modern versions of Windows are derived from MS-DOS.
All modern versions of Windows are derived from MS-DOS.
Signup and view all the answers
Match the following course components with their weightage:
Match the following course components with their weightage:
Signup and view all the answers
What is the course code that was replaced by OPS102 for SDDS students?
What is the course code that was replaced by OPS102 for SDDS students?
Signup and view all the answers
What is required to access Matrix?
What is required to access Matrix?
Signup and view all the answers
You can connect to Matrix from any location using SSH.
You can connect to Matrix from any location using SSH.
Signup and view all the answers
What protocol is used to securely connect to Matrix?
What protocol is used to securely connect to Matrix?
Signup and view all the answers
You can connect to Matrix from any Seneca lab workstation, or from your personal computer using ___________________.
You can connect to Matrix from any Seneca lab workstation, or from your personal computer using ___________________.
Signup and view all the answers
Why is SSH used to connect to Matrix?
Why is SSH used to connect to Matrix?
Signup and view all the answers
Web access is allowed to Matrix from off-campus.
Web access is allowed to Matrix from off-campus.
Signup and view all the answers
Match the following access methods with their descriptions:
Match the following access methods with their descriptions:
Signup and view all the answers
What is the name of the server system that provides a Linux CLI by remote connection?
What is the name of the server system that provides a Linux CLI by remote connection?
Signup and view all the answers
What might be the reason you can't connect to matrix.senecapolytechnic.ca?
What might be the reason you can't connect to matrix.senecapolytechnic.ca?
Signup and view all the answers
PuTTY is a terminal emulator for MacOS only.
PuTTY is a terminal emulator for MacOS only.
Signup and view all the answers
What is the port number used when connecting to matrix.senecapolytechnic.ca using PuTTY?
What is the port number used when connecting to matrix.senecapolytechnic.ca using PuTTY?
Signup and view all the answers
To connect to matrix from MacOS, you would use the command ssh [email protected]
To connect to matrix from MacOS, you would use the command ssh [email protected]
Signup and view all the answers
What is the default connection type used in PuTTY?
What is the default connection type used in PuTTY?
Signup and view all the answers
You should not log out of matrix.senecapolytechnic.ca when you're finished.
You should not log out of matrix.senecapolytechnic.ca when you're finished.
Signup and view all the answers
Match the following platforms with their corresponding terminal emulators:
Match the following platforms with their corresponding terminal emulators:
Signup and view all the answers
What is the hostname used when connecting to the Linux server?
What is the hostname used when connecting to the Linux server?
Signup and view all the answers
What is the name of the server cluster that provides a Linux CLI by remote connection?
What is the name of the server cluster that provides a Linux CLI by remote connection?
Signup and view all the answers
All modern versions of Windows are derived from MS-DOS.
All modern versions of Windows are derived from MS-DOS.
Signup and view all the answers
What type of OS is CentOS?
What type of OS is CentOS?
Signup and view all the answers
Matrix has been configured to allow users to only interact with the Linux OS using a _______________ interface.
Matrix has been configured to allow users to only interact with the Linux OS using a _______________ interface.
Signup and view all the answers
Match the following storage systems with their descriptions:
Match the following storage systems with their descriptions:
Signup and view all the answers
Linux is a multi-tasking system.
Linux is a multi-tasking system.
Signup and view all the answers
What is the primary benefit of maintaining the programming model in an Operating System?
What is the primary benefit of maintaining the programming model in an Operating System?
Signup and view all the answers
How do Seneca students access the Linux OS on matrix?
How do Seneca students access the Linux OS on matrix?
Signup and view all the answers
What is the purpose of the /dev directory in a Linux file system?
What is the purpose of the /dev directory in a Linux file system?
Signup and view all the answers
A relative pathname always starts with a slash.
A relative pathname always starts with a slash.
Signup and view all the answers
What is the symbol used to represent the user's home directory in Linux?
What is the symbol used to represent the user's home directory in Linux?
Signup and view all the answers
In Linux, the path separator is a _______________.
In Linux, the path separator is a _______________.
Signup and view all the answers
Match the following directory paths with their descriptions:
Match the following directory paths with their descriptions:
Signup and view all the answers
The kernel operates in a user mode.
The kernel operates in a user mode.
Signup and view all the answers
What is the purpose of the /tmp directory in a Linux file system?
What is the purpose of the /tmp directory in a Linux file system?
Signup and view all the answers
A full pathname that starts from the root of the hierarchy is called a _______________ pathname.
A full pathname that starts from the root of the hierarchy is called a _______________ pathname.
Signup and view all the answers
What is the command to create a directory in Linux?
What is the command to create a directory in Linux?
Signup and view all the answers
The 'rmdir' command can remove non-empty directories.
The 'rmdir' command can remove non-empty directories.
Signup and view all the answers
What is the purpose of the 'touch' command?
What is the purpose of the 'touch' command?
Signup and view all the answers
The 'rm' command is used to _______ files or directories.
The 'rm' command is used to _______ files or directories.
Signup and view all the answers
Match the following commands with their functions:
Match the following commands with their functions:
Signup and view all the answers
What is the command to move or rename files/directories in Linux?
What is the command to move or rename files/directories in Linux?
Signup and view all the answers
The 'pushd' and 'popd' commands are used to change directories.
The 'pushd' and 'popd' commands are used to change directories.
Signup and view all the answers
What is the purpose of the 'cp' command?
What is the purpose of the 'cp' command?
Signup and view all the answers
What is a primary purpose of the "man" command in Linux/Unix systems?
What is a primary purpose of the "man" command in Linux/Unix systems?
Signup and view all the answers
In Linux/Unix, text files are commonly used for data, presentations, configuration, logs, and more.
In Linux/Unix, text files are commonly used for data, presentations, configuration, logs, and more.
Signup and view all the answers
What is the primary function of file management skills in Linux/Unix systems?
What is the primary function of file management skills in Linux/Unix systems?
Signup and view all the answers
In Linux/Unix, the system and shell provide "easy" ways to deal with ______.
In Linux/Unix, the system and shell provide "easy" ways to deal with ______.
Signup and view all the answers
What is a common use of file management skills in Linux/Unix systems?
What is a common use of file management skills in Linux/Unix systems?
Signup and view all the answers
Match the following file operations with their descriptions:
Match the following file operations with their descriptions:
Signup and view all the answers
The "man" command is divided into sections, and you can see these sections by running "man man".
The "man" command is divided into sections, and you can see these sections by running "man man".
Signup and view all the answers
What is the primary purpose of the "dir /?" command in Windows?
What is the primary purpose of the "dir /?" command in Windows?
Signup and view all the answers
What is the purpose of file globbing in Linux?
What is the purpose of file globbing in Linux?
Signup and view all the answers
File globbing is a feature provided by the kernel.
File globbing is a feature provided by the kernel.
Signup and view all the answers
What happens when you press the enter key after typing a command with wildcards?
What happens when you press the enter key after typing a command with wildcards?
Signup and view all the answers
When you type a command with wildcards and press the enter key, the shell performs _______________________ on any wildcards on the command line before executing the command.
When you type a command with wildcards and press the enter key, the shell performs _______________________ on any wildcards on the command line before executing the command.
Signup and view all the answers
Which of the following commands is used to find specific lines in a file?
Which of the following commands is used to find specific lines in a file?
Signup and view all the answers
The find
command is used to sort the lines of a file.
The find
command is used to sort the lines of a file.
Signup and view all the answers
Match the following file operations with their descriptions:
Match the following file operations with their descriptions:
Signup and view all the answers
Bash shell automatically expands wildcards into the names of all the files and directories in the current working directory before executing the command.
Bash shell automatically expands wildcards into the names of all the files and directories in the current working directory before executing the command.
Signup and view all the answers
What is the purpose of the "touch" command in Linux/Unix systems?
What is the purpose of the "touch" command in Linux/Unix systems?
Signup and view all the answers
In Linux/Unix systems, the "cp" command can only copy files to a new directory.
In Linux/Unix systems, the "cp" command can only copy files to a new directory.
Signup and view all the answers
What is the purpose of the "rm" command with the "-r" option?
What is the purpose of the "rm" command with the "-r" option?
Signup and view all the answers
The "cat" command is used to ______ the contents of a file.
The "cat" command is used to ______ the contents of a file.
Signup and view all the answers
Match the following Linux/Unix commands with their functions:
Match the following Linux/Unix commands with their functions:
Signup and view all the answers
What is the purpose of the "head" command in Linux/Unix systems?
What is the purpose of the "head" command in Linux/Unix systems?
Signup and view all the answers
In Windows, you can use the "cat" command to display the contents of a file without any additional software.
In Windows, you can use the "cat" command to display the contents of a file without any additional software.
Signup and view all the answers
What is the difference between the "mv" and "cp" commands in Linux/Unix systems?
What is the difference between the "mv" and "cp" commands in Linux/Unix systems?
Signup and view all the answers
What is the purpose of the question mark (?) in globbing?
What is the purpose of the question mark (?) in globbing?
Signup and view all the answers
The character class [0-2] will match any character that is not 0, 1, or 2.
The character class [0-2] will match any character that is not 0, 1, or 2.
Signup and view all the answers
What is the effect of using an exclamation mark (!) as the first character in a character class in globbing?
What is the effect of using an exclamation mark (!) as the first character in a character class in globbing?
Signup and view all the answers
The command rm img?.jpg
will delete all files with names starting with "img", followed by _______________, and ending with ".jpg".
The command rm img?.jpg
will delete all files with names starting with "img", followed by _______________, and ending with ".jpg".
Signup and view all the answers
What is the interpretation of the pattern ls File?.pdf
?
What is the interpretation of the pattern ls File?.pdf
?
Signup and view all the answers
Match the following patterns with their interpretations:
Match the following patterns with their interpretations:
Signup and view all the answers
The command ls File[0-2].pdf
will list all files with names starting with "File", followed by any zero or more characters, and ending with ".pdf".
The command ls File[0-2].pdf
will list all files with names starting with "File", followed by any zero or more characters, and ending with ".pdf".
Signup and view all the answers
What is the purpose of globbing in the bash shell?
What is the purpose of globbing in the bash shell?
Signup and view all the answers
What is the main purpose of a text editor?
What is the main purpose of a text editor?
Signup and view all the answers
Graphical User Interfaces (GUIs) are well-suited for automation tasks.
Graphical User Interfaces (GUIs) are well-suited for automation tasks.
Signup and view all the answers
What is the end-of-line indicator in UNIX/Linux?
What is the end-of-line indicator in UNIX/Linux?
Signup and view all the answers
In Windows, the end-of-line indicator is a _______________ followed by a line feed.
In Windows, the end-of-line indicator is a _______________ followed by a line feed.
Signup and view all the answers
Match the following text files with their uses:
Match the following text files with their uses:
Signup and view all the answers
Why are text files important in Linux/Unix?
Why are text files important in Linux/Unix?
Signup and view all the answers
CLIs are well-suited for automation tasks.
CLIs are well-suited for automation tasks.
Signup and view all the answers
What is the name of the commands that can help when transferring text files between systems?
What is the name of the commands that can help when transferring text files between systems?
Signup and view all the answers
Manual typewriters and teletype machines worked similar to how _______________ files work.
Manual typewriters and teletype machines worked similar to how _______________ files work.
Signup and view all the answers
Match the following with their descriptions:
Match the following with their descriptions:
Signup and view all the answers
What was the original editor used on Unix systems?
What was the original editor used on Unix systems?
Signup and view all the answers
Which of the following text editors is the default on many Linux distributions?
Which of the following text editors is the default on many Linux distributions?
Signup and view all the answers
The vi editor was developed by Bill Joy at UCBerkeley.
The vi editor was developed by Bill Joy at UCBerkeley.
Signup and view all the answers
The notation ^G in nano editor means pressing and holding the __________ key and then the G key.
The notation ^G in nano editor means pressing and holding the __________ key and then the G key.
Signup and view all the answers
Which of the following text editors is known for its visual mode?
Which of the following text editors is known for its visual mode?
Signup and view all the answers
What is the purpose of the grep command?
What is the purpose of the grep command?
Signup and view all the answers
Match the following text editors with their characteristics:
Match the following text editors with their characteristics:
Signup and view all the answers
All modern versions of Windows are derived from MS-DOS.
All modern versions of Windows are derived from MS-DOS.
Signup and view all the answers
The ed editor was replaced by __________ on Unix systems.
The ed editor was replaced by __________ on Unix systems.
Signup and view all the answers
What is a benefit of using the nano editor?
What is a benefit of using the nano editor?
Signup and view all the answers
The vim editor is an older version of the vi editor.
The vim editor is an older version of the vi editor.
Signup and view all the answers
What is the purpose of the ^G command in nano?
What is the purpose of the ^G command in nano?
Signup and view all the answers
The _______ command is used to open a file in nano.
The _______ command is used to open a file in nano.
Signup and view all the answers
Why is it recommended to become familiar with vi/vim?
Why is it recommended to become familiar with vi/vim?
Signup and view all the answers
Nano is a more advanced text editor than vi/vim.
Nano is a more advanced text editor than vi/vim.
Signup and view all the answers
Match the nano command with its function:
Match the nano command with its function:
Signup and view all the answers
What is the purpose of the vimtutor(1) command?
What is the purpose of the vimtutor(1) command?
Signup and view all the answers
The nano editor is suitable for ________________ use.
The nano editor is suitable for ________________ use.
Signup and view all the answers
Vi/vim is only used by programmers.
Vi/vim is only used by programmers.
Signup and view all the answers
What is the purpose of the "chmod" command in Linux?
What is the purpose of the "chmod" command in Linux?
Signup and view all the answers
In the "ls -l" output, the first character represents the file type.
In the "ls -l" output, the first character represents the file type.
Signup and view all the answers
What are the three types of permissions that can be set for a file in Linux?
What are the three types of permissions that can be set for a file in Linux?
Signup and view all the answers
The "chmod" command uses ______ methods to set permissions: symbolic and octal.
The "chmod" command uses ______ methods to set permissions: symbolic and octal.
Signup and view all the answers
Match the following permissions with their corresponding abbreviations:
Match the following permissions with their corresponding abbreviations:
Signup and view all the answers
What is the purpose of the "chmod" command with the "g+rw" option?
What is the purpose of the "chmod" command with the "g+rw" option?
Signup and view all the answers
In the octal method of setting permissions, permissions can be set explicitly by "chmod" with an octal number.
In the octal method of setting permissions, permissions can be set explicitly by "chmod" with an octal number.
Signup and view all the answers
What is the purpose of the "chmod" command with the "a-w" option?
What is the purpose of the "chmod" command with the "a-w" option?
Signup and view all the answers
What is the primary purpose of setting permissions in a multi-user operating system?
What is the primary purpose of setting permissions in a multi-user operating system?
Signup and view all the answers
In Linux, directory permissions have the same meaning as file permissions.
In Linux, directory permissions have the same meaning as file permissions.
Signup and view all the answers
What are the three permission indicators in Linux?
What are the three permission indicators in Linux?
Signup and view all the answers
In Linux, the ______________ permission allows the execution of a file as a command.
In Linux, the ______________ permission allows the execution of a file as a command.
Signup and view all the answers
What is the purpose of Access Control Lists (ACLs) in Linux?
What is the purpose of Access Control Lists (ACLs) in Linux?
Signup and view all the answers
Match the following permissions with their descriptions:
Match the following permissions with their descriptions:
Signup and view all the answers
In Linux, the kernel operates in user mode.
In Linux, the kernel operates in user mode.
Signup and view all the answers
Why is it necessary to have read permission to execute a script in Linux?
Why is it necessary to have read permission to execute a script in Linux?
Signup and view all the answers
What is the purpose of the setuid bit in a file's mode?
What is the purpose of the setuid bit in a file's mode?
Signup and view all the answers
The chmod
command with 3 octal digits sets the permissions for user, group, and others.
The chmod
command with 3 octal digits sets the permissions for user, group, and others.
Signup and view all the answers
What is the octal representation of the permissions rwxr-x---
?
What is the octal representation of the permissions rwxr-x---
?
Signup and view all the answers
The chmod
command with the octal number 754
sets the permissions to ______________.
The chmod
command with the octal number 754
sets the permissions to ______________.
Signup and view all the answers
Match the following special permission bits with their descriptions:
Match the following special permission bits with their descriptions:
Signup and view all the answers
What is the purpose of the sticky bit in a file's mode?
What is the purpose of the sticky bit in a file's mode?
Signup and view all the answers
What is the binary representation of the octal number 7
in permissions?
What is the binary representation of the octal number 7
in permissions?
Signup and view all the answers
The command chmod 755 file1.txt
sets the permissions to ______________.
The command chmod 755 file1.txt
sets the permissions to ______________.
Signup and view all the answers
What is the purpose of the setuid bit in Linux?
What is the purpose of the setuid bit in Linux?
Signup and view all the answers
The sticky bit is used to ensure the privacy and security of files in shared directories.
The sticky bit is used to ensure the privacy and security of files in shared directories.
Signup and view all the answers
What is the purpose of the umask in Linux?
What is the purpose of the umask in Linux?
Signup and view all the answers
The 'passwd' command allows users to change their own password without requiring ________________ access.
The 'passwd' command allows users to change their own password without requiring ________________ access.
Signup and view all the answers
What is the effect of the sticky bit on a directory?
What is the effect of the sticky bit on a directory?
Signup and view all the answers
The umask is set on a per-user basis.
The umask is set on a per-user basis.
Signup and view all the answers
Match the following Linux security features with their descriptions:
Match the following Linux security features with their descriptions:
Signup and view all the answers
What is the purpose of the 'passwd' command in Linux?
What is the purpose of the 'passwd' command in Linux?
Signup and view all the answers
What is the purpose of the 'x' permission in a Linux directory?
What is the purpose of the 'x' permission in a Linux directory?
Signup and view all the answers
The 'ls -l' command shows permissions and details of a file.
The 'ls -l' command shows permissions and details of a file.
Signup and view all the answers
What option is used with the 'ls' command to show permissions and details of a directory?
What option is used with the 'ls' command to show permissions and details of a directory?
Signup and view all the answers
The 'r' permission grants permission to _______________________ the contents of a directory.
The 'r' permission grants permission to _______________________ the contents of a directory.
Signup and view all the answers
What is the purpose of the 'w' permission in a Linux directory?
What is the purpose of the 'w' permission in a Linux directory?
Signup and view all the answers
Match the following Linux permissions with their descriptions:
Match the following Linux permissions with their descriptions:
Signup and view all the answers
Write permission on a directory allows removing files in that directory.
Write permission on a directory allows removing files in that directory.
Signup and view all the answers
The 'ls -ld' command shows permissions and details of the _______________________ directory.
The 'ls -ld' command shows permissions and details of the _______________________ directory.
Signup and view all the answers
What is the standard input file descriptor?
What is the standard input file descriptor?
Signup and view all the answers
The greater than symbol (>) is used to read input from a file.
The greater than symbol (>) is used to read input from a file.
Signup and view all the answers
What does the '2>&1' syntax do in the command './myprog >myoutput.txt 2>&1'?
What does the '2>&1' syntax do in the command './myprog >myoutput.txt 2>&1'?
Signup and view all the answers
The shell uses special characters and syntax on command lines to implement I/O _______________________.
The shell uses special characters and syntax on command lines to implement I/O _______________________.
Signup and view all the answers
Match the file descriptors with their standard streams:
Match the file descriptors with their standard streams:
Signup and view all the answers
What is the purpose of the '>>' symbol in the command 'tr '[A-Z]' '[a-z]' lowercase.txt >> output.txt'?
What is the purpose of the '>>' symbol in the command 'tr '[A-Z]' '[a-z]' lowercase.txt >> output.txt'?
Signup and view all the answers
The 'less than' symbol (<) is used to write output to a file.
The 'less than' symbol (<) is used to write output to a file.
Signup and view all the answers
What is the purpose of the '2>' syntax in the command 'gcc -o myprog myprog.c 2>gccerrors.txt'?
What is the purpose of the '2>' syntax in the command 'gcc -o myprog myprog.c 2>gccerrors.txt'?
Signup and view all the answers
The shell provides convenient ways to attach the file descriptors to _______________________, devices, or other commands.
The shell provides convenient ways to attach the file descriptors to _______________________, devices, or other commands.
Signup and view all the answers
What is the purpose of the '>' symbol in the command 'tr '[A-Z]' '[a-z]' lowercase.txt > output.txt'?
What is the purpose of the '>' symbol in the command 'tr '[A-Z]' '[a-z]' lowercase.txt > output.txt'?
Signup and view all the answers
What is a key aspect of the Unix philosophy?
What is a key aspect of the Unix philosophy?
Signup and view all the answers
In Unix, commands can only read input from files.
In Unix, commands can only read input from files.
Signup and view all the answers
What is the universal interface in Unix?
What is the universal interface in Unix?
Signup and view all the answers
Commands can send their output to files or other commands instead of displaying it on the _______________.
Commands can send their output to files or other commands instead of displaying it on the _______________.
Signup and view all the answers
Match the following concepts with their descriptions:
Match the following concepts with their descriptions:
Signup and view all the answers
What is a characteristic of Unix/Linux commands?
What is a characteristic of Unix/Linux commands?
Signup and view all the answers
Error messages are typically printed on the terminal.
Error messages are typically printed on the terminal.
Signup and view all the answers
What is the term for redirecting output or error messages to files or commands?
What is the term for redirecting output or error messages to files or commands?
Signup and view all the answers
In Unix, commands can get their input from _______________ or the terminal.
In Unix, commands can get their input from _______________ or the terminal.
Signup and view all the answers
What is a key concept in Unix philosophy?
What is a key concept in Unix philosophy?
Signup and view all the answers
What is the purpose of "/dev/null" in Linux?
What is the purpose of "/dev/null" in Linux?
Signup and view all the answers
Commands can send their standard output directly to the standard input of another command. (True or False)
Commands can send their standard output directly to the standard input of another command. (True or False)
Signup and view all the answers
What is the magic of pipes in Linux?
What is the magic of pipes in Linux?
Signup and view all the answers
The shell uses the ______ system call to connect the necessary file descriptors before running commands.
The shell uses the ______ system call to connect the necessary file descriptors before running commands.
Signup and view all the answers
Match the following Linux filter commands with their descriptions:
Match the following Linux filter commands with their descriptions:
Signup and view all the answers
What is the purpose of the "|" pipe operator in Linux?
What is the purpose of the "|" pipe operator in Linux?
Signup and view all the answers
Commands must be chained in a specific order when using pipes in Linux. (True or False)
Commands must be chained in a specific order when using pipes in Linux. (True or False)
Signup and view all the answers
What is the standard output of a command in Linux?
What is the standard output of a command in Linux?
Signup and view all the answers
The "2>" symbol in the command "grep Linux * 2>/dev/null" redirects ______ to /dev/null.
The "2>" symbol in the command "grep Linux * 2>/dev/null" redirects ______ to /dev/null.
Signup and view all the answers
What is the benefit of using pipes in Linux?
What is the benefit of using pipes in Linux?
Signup and view all the answers
What is the primary function of the OS in process management?
What is the primary function of the OS in process management?
Signup and view all the answers
The 'ps' command in Linux shows all running processes by default.
The 'ps' command in Linux shows all running processes by default.
Signup and view all the answers
What is the purpose of the 'pstree' command in Linux?
What is the purpose of the 'pstree' command in Linux?
Signup and view all the answers
The OS keeps track of the ______________ and of the system resources.
The OS keeps track of the ______________ and of the system resources.
Signup and view all the answers
Match the following Linux commands with their functions:
Match the following Linux commands with their functions:
Signup and view all the answers
What is an important concept in all operating systems?
What is an important concept in all operating systems?
Signup and view all the answers
The 'top' command in Linux offers a snapshot of processes.
The 'top' command in Linux offers a snapshot of processes.
Signup and view all the answers
Why is it crucial for system administrators to monitor processes?
Why is it crucial for system administrators to monitor processes?
Signup and view all the answers
During the lifetime of a process, it uses many system resources like ______________ and memory.
During the lifetime of a process, it uses many system resources like ______________ and memory.
Signup and view all the answers
What is the primary benefit of process management in operating systems?
What is the primary benefit of process management in operating systems?
Signup and view all the answers
What is the command to display all processes of the current user?
What is the command to display all processes of the current user?
Signup and view all the answers
The 'ps' command only displays processes that are currently using the CPU.
The 'ps' command only displays processes that are currently using the CPU.
Signup and view all the answers
What is the state of a process that is waiting for its parent process to retrieve its exit code?
What is the state of a process that is waiting for its parent process to retrieve its exit code?
Signup and view all the answers
The 'pstree' command shows a tree view of all current _______________.
The 'pstree' command shows a tree view of all current _______________.
Signup and view all the answers
What is the purpose of the 'top' command?
What is the purpose of the 'top' command?
Signup and view all the answers
Foreground processes are initiated by the system and run in the background.
Foreground processes are initiated by the system and run in the background.
Signup and view all the answers
What is the command to display process information of a specific user?
What is the command to display process information of a specific user?
Signup and view all the answers
Match the following process states with their descriptions:
Match the following process states with their descriptions:
Signup and view all the answers
The 'ps' command displays information about processes, including _______________, TTY, Time, and CMD.
The 'ps' command displays information about processes, including _______________, TTY, Time, and CMD.
Signup and view all the answers
All processes in Linux are initiated by the 'systemd' process.
All processes in Linux are initiated by the 'systemd' process.
Signup and view all the answers
What type of processes usually run in the background?
What type of processes usually run in the background?
Signup and view all the answers
Foreground processes do not take away the command line until the process is finished.
Foreground processes do not take away the command line until the process is finished.
Signup and view all the answers
How can you start a process in the background?
How can you start a process in the background?
Signup and view all the answers
To send a process to the background while also stopping it, you can press ______ and then the 'bg' command.
To send a process to the background while also stopping it, you can press ______ and then the 'bg' command.
Signup and view all the answers
Match the following process types with their characteristics:
Match the following process types with their characteristics:
Signup and view all the answers
What is the purpose of the 'kill' command?
What is the purpose of the 'kill' command?
Signup and view all the answers
The 'kill' command can kill multiple processes at once.
The 'kill' command can kill multiple processes at once.
Signup and view all the answers
What is the syntax for the 'kill' command?
What is the syntax for the 'kill' command?
Signup and view all the answers
To start a process in the foreground, you can simply run the command ______.
To start a process in the foreground, you can simply run the command ______.
Signup and view all the answers
What happens when you press Ctrl+Z and then the 'bg' command?
What happens when you press Ctrl+Z and then the 'bg' command?
Signup and view all the answers
What happens when you press Ctrl+Z in the terminal?
What happens when you press Ctrl+Z in the terminal?
Signup and view all the answers
The kill command can only send the TERM signal to a process.
The kill command can only send the TERM signal to a process.
Signup and view all the answers
What is the purpose of the jobs command?
What is the purpose of the jobs command?
Signup and view all the answers
The bg command is used to move a job to the _______________________.
The bg command is used to move a job to the _______________________.
Signup and view all the answers
Match the following commands with their functions:
Match the following commands with their functions:
Signup and view all the answers
What is the purpose of the kill -9 command?
What is the purpose of the kill -9 command?
Signup and view all the answers
Process management is not an important component of an operating system.
Process management is not an important component of an operating system.
Signup and view all the answers
What is the purpose of the fg command?
What is the purpose of the fg command?
Signup and view all the answers
The _______________________ signal is sent to a process by default when using the kill command.
The _______________________ signal is sent to a process by default when using the kill command.
Signup and view all the answers
You can only send two types of signals to a process using the kill command.
You can only send two types of signals to a process using the kill command.
Signup and view all the answers
What is monitored in the Details tab of Task Manager?
What is monitored in the Details tab of Task Manager?
Signup and view all the answers
Windows PowerShell provides commands for managing processes.
Windows PowerShell provides commands for managing processes.
Signup and view all the answers
What is the purpose of the Get-Process command in PowerShell?
What is the purpose of the Get-Process command in PowerShell?
Signup and view all the answers
The Set Affinity option is used to set the ______________________ priority of a process.
The Set Affinity option is used to set the ______________________ priority of a process.
Signup and view all the answers
Match the following PowerShell commands with their functions:
Match the following PowerShell commands with their functions:
Signup and view all the answers
What can be done to a specific process by right-clicking on the process name?
What can be done to a specific process by right-clicking on the process name?
Signup and view all the answers
Process management is not an important component of every operating system.
Process management is not an important component of every operating system.
Signup and view all the answers
Why should users monitor the processes?
Why should users monitor the processes?
Signup and view all the answers
Monitor resource usage includes monitoring ______________________ usage.
Monitor resource usage includes monitoring ______________________ usage.
Signup and view all the answers
What can be used to monitor a specific process?
What can be used to monitor a specific process?
Signup and view all the answers
What is the term used in Windows for a process?
What is the term used in Windows for a process?
Signup and view all the answers
In Windows, the Task Manager is used to monitor threads.
In Windows, the Task Manager is used to monitor threads.
Signup and view all the answers
What is the function of the CreateProcess() function in Windows?
What is the function of the CreateProcess() function in Windows?
Signup and view all the answers
In Windows, the ___________________ function is used to wait for a process to finish.
In Windows, the ___________________ function is used to wait for a process to finish.
Signup and view all the answers
Match the following Windows functions with their descriptions:
Match the following Windows functions with their descriptions:
Signup and view all the answers
What is the hierarchical structure of processes in Windows?
What is the hierarchical structure of processes in Windows?
Signup and view all the answers
In Windows, all processes run as the same user.
In Windows, all processes run as the same user.
Signup and view all the answers
What is the primary interface for monitoring processes in Windows?
What is the primary interface for monitoring processes in Windows?
Signup and view all the answers
In Windows, the ___________________ function is used to close a process handle.
In Windows, the ___________________ function is used to close a process handle.
Signup and view all the answers
What is the Microsoft documentation resource for process management in Windows?
What is the Microsoft documentation resource for process management in Windows?
Signup and view all the answers
Study Notes
User Interfaces
- Command Line Interfaces (CLI) are used in Windows, Linux, and Android
- Graphical User Interfaces (GUI) are used in Windows and Linux
- GUIs are well-suited for graphical tasks, but may require excessive repetitive actions
- CLIs are well-suited for automation, but not for occasional tasks
- GUIs require more data than CLIs (e.g., 6 megabytes vs. 2 kilobytes)
GUI vs CLI
- GUIs are suitable for graphical tasks, such as editing images and documents
- CLIs are suitable for automation, such as mass-conversion of thousands of images
- GUIs require more data than CLIs, making CLIs suitable for remote connections
Text User Interfaces
- A Text User Interface (TUI) employs the same display technology as a CLI, but presents a full-screen interface
- TUIs were dominant in personal computers before Microsoft Windows and Apple Macintosh
- TUIs are still common in traditional business applications, such as banking
A Bit of History
- In the early days of computing, standardization was impossible due to unique computers
- One customer of a cloud server should not be able to access another customer's data
- Multiple smartphone apps may be permitted to access a single photo album
Hardware Abstraction
- The OS hides hardware details so that application software can deal with hardware consistently
- Examples: a program can request input from a keyboard without knowing the connection, and an application can send data to the network regardless of the connection type
Maintaining the Programming Model
- The OS controls the hardware to maintain the illusion of the programmer's model
- Example: multiple programs can operate simultaneously without conflict, using the hardware virtual memory system to load programs into different regions of physical memory
The User Interface(s)
- The user interface is the software that enables the user to interact with the system
- Most operating systems provide at least two types of user interfaces: text-based (CLI) and graphical (GUI)
Components of an Operating System
- The four key components of an operating system are:
- The Kernel
- System Libraries
- Services
- User Interface(s)
- Utilities and Applications
The Kernel
- The kernel is the heart of the operating system, operating in a special privileged mode
- The kernel manages resources and security settings for all other software
- The kernel is loaded by the computer's firmware and initializes the hardware and resources
System Libraries
- System libraries provide a common set of software routines for programs to access
- These libraries eliminate the need for duplicate code in programs for common operations
- Examples: drawing on the screen, accessing the network, and playing sound
Services
- Services are programs that run continuously in the background, providing services such as WiFi authentication, print management, and file sharing
Unix and Unix-like Operating Systems
- Unix became a trademark, and any operating system that conforms to the Unix standards can use the Unix trademark.
- Apple's MacOS is officially a Unix system, but Linux is not.
- Unix-like operating systems include Linux, Mac OS, iOS, FreeBSD, OpenBSD, and NetBSD.
Operating Systems in this Course
- The course focuses on two operating systems: Windows 10 (a proprietary operating system) and Linux (representing Unix-like operating systems).
- Windows 10 is installed on the lab computers, and Linux is available through a remote connection to a server called Matrix.
Command Line and Commands
- A Command Line Interface (CLI) is provided by two components: a terminal program and a shell.
- The shell interprets commands, starts and stops programs, and displays output.
- Common shells include Bash, PowerShell, and CMD.
What is a Command?
- A command is a small program that performs a specific task.
- Commands can be built into the shell or be separate programs.
- Examples of commands include the Chrome web browser, git version control tool, and LibreOffice Writer word processor.
Command Structure
- Most commands have a similar structure:
command_name arguments
. - The
command_name
is the name of the command, and thearguments
are options, values, or positional arguments.
Types of Arguments
- Option (or switch or control argument): alters the operation of the command.
- Option with a value: consists of an option followed by a value.
- Positional arguments: all other arguments, where the position may be significant.
Options – Examples
-
ls
command: lists files, with options like-l
for long output. -
dir
command: lists files, with options like/b
for bare output.
Options – Long and Short Versions (Linux)
-
ls -l -h
: shows human-readable sizes. -
ls -l --human-readable
: same as above. -
ls -lh
: same as above.
Option with a Value
-
ls -l -sort=size
: sorts files by size (Linux). -
ls -l -sort time
: sorts files by time (Linux).
Positional Arguments
-
cp old new
: copies file "old" to "new" (Linux). -
copy old new
: copies file "old" to "new" (Win10).
Open Source and Proprietary Software
- Software is protected by copyright, and the copyright holder controls how it is used.
- There are two broad categories of software licenses: proprietary licenses and open source licenses.
Open Source Licenses
- Open source licenses conform to the Open Source Definition (https://opensource.org/osd/).
- There are two types of open source licenses: free software licenses and permissive licenses.
Types of Open Source Licenses
- Free software licenses: require redistributing software under the same terms as received.
- Permissive licenses: allow redistributing software without the same permissions as received.
Course Introduction and Overview
- OPS102 is a course about Operating Systems for Programmers, covering both Linux and Windows.
- The course is designed for software developers and replaced ULI101 for SDDS students.
- The course breakdown includes labs (20%), quizzes (25%), mid-term test (25%), and final test (30%).
Matrix and Connecting to Matrix
- Matrix is a server cluster with multiple computers running CentOS (a version of Linux).
- All registered students in OPS102 have access to an account on Matrix.
- To connect to Matrix, you must be on campus or connected to SenecaNet, or off campus with Seneca VPN.
- You can connect to Matrix from any Seneca lab workstation or personal computer using SSH (secure shell).
- SSH is a protocol for secure remote login/connection from one computer to another.
Simple Commands to Start With
- Simple commands to practice on Matrix include basic Linux commands.
Hierarchical File Systems
- A file system location is found by following the directory tree hierarchy.
- There are multiple ways of specifying pathnames: absolute, relative, and relative to home.
- Absolute pathnames start from the root of the hierarchy, while relative pathnames do not start with a slash.
- Relative to home pathnames use a tilde (~) as a shorthand for the user's home directory.
Practicing Linux Commands and File Systems
- You will practice Linux commands and perform lab exercises on Matrix.
- You will reference your Matrix account during quizzes and tests.
Troubleshooting Connection Issues
- Common connection issues include mis-spelled username, password, or hostname.
- Ensure that your username is in lowercase and CAPS LOCK is off.
Connecting to Matrix Using PuTTY (Windows) or Terminal (MacOS/Linux)
- Download and install PuTTY on Windows, or use the Terminal app on MacOS/Linux.
- Set up PuTTY with the host name "matrix.senecapolytechnic.ca", port 22, and connection type SSH.
- On MacOS/Linux, use the SSH command to connect to Matrix.
Files in Linux/Unix
- Data is saved in files, and Linux/Unix systems prefer text files.
- Files are used for data, presentations, configuration, logs, and more.
- The system and shell provide easy ways to deal with files.
Learning About Commands
- Extensive documentation is available on Linux/Unix systems using the "man" command.
- The "man" command provides access to most documentation, which is divided into sections.
- Man pages can be accessed using the command "man man".
File and Directory Operations
- Important file management skills include creating and deleting files and directories, reading file contents, copying files, moving or renaming files, and viewing file contents without editing.
- These operations can be performed using various commands:
- Creating directories:
mkdir
(Linux/Unix) andmkdir
(Windows) - Moving files and directories:
mv
(Linux/Unix) andmove
(Windows) - Copying files and directories:
cp
(Linux/Unix) andcopy
(Windows) - Deleting files and directories:
rm
(Linux/Unix) anddel
(Windows) - Removing empty directories:
rmdir
(Linux/Unix) andrmdir
(Windows) - Recursive directory removal:
rm -r
(Linux/Unix) anddeltree
(Windows)
- Creating directories:
Directory Operations
- The "cd" command is used to change directories.
- The "pushd" and "popd" commands are also used to manipulate directories.
- The "mkdir" command creates one or more directories, and the "-p" option ensures the path/parents exist.
- The "rmdir" command removes one or more empty directories.
File Operations
- Files can be created using a text editor or output from program output redirection.
- The "touch" command creates an empty file or updates the file's timestamp.
- The "cp" and "mv" commands copy and move files, respectively.
- The "rm" command removes files, and the "-r" option removes directories recursively.
Working with Text Files
- Linux/Unix systems have many tools for working with text files, including:
-
cat
andcopy file con:
(Windows) to display the contents of a file. -
more
andless
to display the contents of a file one screen at a time. -
head
andtail
to display the beginning or end of a file. -
file
to determine the type of file.
-
- Windows typically requires add-on programs for most of these operations, or the use of WSL (Windows Subsystem for Linux).
Working with Text Files (cont'd)
- Additional tools for working with text files include:
-
sort
to sort the lines of a file. -
uniq
to display identical consecutive lines only once. -
cut
to remove undesired columns from data in a file. -
tr
to translate/replace the occurrences of characters. -
grep
to find specific lines in a file. -
find
to find files matching specific criteria in the filesystem. -
diff
to show the differences between two files.
-
File Globbing
- File globbing is a feature provided by the shell, allowing the use of special characters called wildcards to write a generic name that the shell will expand into specific matching names.
- Wildcards include:
-
*
to match any characters. -
?
to match any one character. -
[ ]
to match any one of the characters contained in the class. -
!
to invert the character class and match any character not listed.
-
File Globbing Examples
-
*
can be used to expand into a list of files and directories, such asimg001.jpg
,imgface.jpg
, andimg500.jpg
. -
?
can be used to match files with a specific pattern, such asFile?.pdf
to match files starting withFile
, followed by any one character, and ending with.pdf
. -
[ ]
can be used to match files with a specific pattern, such asls File[123].pdf
to match files starting withFile
, followed by any one of the characters1
,2
, or3
, and ending with.pdf
.
What is a Text File?
- A text file is a file that contains data in a human-readable format.
- In Linux/Unix, text files are widely used for data, presentations, configuration, logs, and more.
- The system and shell provide "easy" ways to deal with files.
Line Endings in Text Files
- Each line in a text file has an end-of-line indicator.
- In UNIX/Linux, the end-of-line indicator is a "new line" (line feed or ^J or \n).
- In Windows, the end-of-line indicator is a "carriage return" (^M or \r) followed by a "line feed".
- In MacOS, the end-of-line indicator is a "carriage return" (^M or \r).
- When text files are transferred between systems, there could be problems.
Text Editors
- A text editor is a software that allows users to create, modify, and save editing changes to text files.
- Text editors are essential for programmers and administrators in Unix and Linux systems.
- Text editors are used for editing system configuration files, writing scripts and programs, writing/editing documentation, and developing web pages.
Text Editors – History
- Before video terminals, "line editors" were used, such as qed, ed, and edlin (DOS).
- The ed(1) editor was replaced by ex(1) on Unix, which later evolved into vi(1).
- The vi(1) editor originated from Bill Joy at UCBerkeley and first appeared in BSD.
Text Editors – Many Choices Today
- There are many text editors available in Linux and Windows, such as VIM, Nano, Gedit, Notepad, Notepad++, and Sublime.
Nano Text Editor Introduction
- The Nano text editor is an easy-to-use text editor installed on many Linux systems.
- Nano editing commands typically use control characters.
- The menu is always displayed at the bottom of the nano screen.
More About Nano
- Basic Nano commands include:
- ^G – to get help at any time
- ^R – open a file
- ^O – save a file
- ^W – find
- ^\ – replace
- ^X – exit
Nano vs Vi
- The vi(1) command is often actually vim(1), which adds modern features to classic vi.
- For casual, occasional use, the nano editor is fine.
- For anything beyond the basics, it's recommended to become familiar with vi (or vim).
File System Security: Permissions
- In multi-user operating systems, controlling access to files and folders is crucial, and this is achieved by setting permissions.
How Does setuid/setgid Work?
- setuid allows a program to run with the permissions of the file owner, enabling it to perform actions that would typically require the owner's privileges.
- An example of setuid in action is the "passwd" command, which allows users to change their own passwords without requiring "sudo" access for root user permissions.
The Sticky Bit
- The sticky bit is a special permission that can be set on directories, ensuring that only the owner of a file or the root user can delete or rename the file.
- The main purpose of the sticky bit is to ensure the privacy and security of files in shared directories.
Default Permissions and Umask
- umask is an attribute of a process that is inherited by child processes, and is normally set at shell start-up.
- umask "masks off" (disables) permission bits for any files or directories created by the process.
File Permissions in Linux
- Every file and folder in the file system has its own set of permissions, which determine who may access a file, and in what way(s).
- There are three permission indicators: user (u), group (g), and others (o).
- Permissions include:
- Read (r): allows reading the file's contents.
- Write (w): allows modifying the file's contents.
- Execute (x): allows executing the file as a command, and scripts also need read permission to execute.
Directory Permissions in Linux
- Directory permissions are similar to file permissions, but have slightly different meanings.
- Permissions include:
- Read (r): grants permission to read the contents of the directory, and list contents using the "ls" command.
- Write (w): grants permission to change or edit the directory content, and create or delete subdirectories and files.
- Execute (x): allows access to and through the directory, but does not in itself allow reading or writing.
Viewing Permissions
- The "-l" (long) option to "ls" shows permissions and other details about files and directories.
- The "ls -d" command on a directory shows the directory, not its contents.
Setting Permissions
- The "chmod" (change mode) command is used to change or grant permissions to different users or groups.
- There are two methods to set permissions with "chmod": the symbolic method and the octal method.
Symbolic Method for "chmod"
- Permissions are set for user (u), group (g), others (o), or all (a).
- Permissions are set by adding (+), removing (-), or setting (=) read (r), write (w), and/or execute (x) permissions.
Octal Method for "chmod"
- Permissions can be set explicitly by "chmod" with an octal number.
- Octal numbers represent the permission bits, with read = 4, write = 2, and execute = 1.
- Combine the octal representation of user, group, and other permissions to form a 3-digit octal number.
Standard Input, Output, and Error
- Every program or command has three open file descriptors: 0 (standard input), 1 (standard output), and 2 (standard error output).
- These file descriptors can be attached to files, devices, or other commands.
Input/Output Redirection and the Shell
- The shell uses special characters and syntax to implement I/O redirection.
-
<
is used to read input from a file. -
>
is used to write output to a file, overwriting the file if it exists. -
>>
is used to append output to a file. - I/O redirection can be used with any command, but it may not be useful with some commands (e.g., "date").
Redirecting Error Output
- The standard error output can be redirected using
2>
or2>>
. -
2>&1
sends the standard error output to the same place as the standard output.
Input/Output and "/dev/null"
-
/dev/null
is a special file that can be written to or read from, but the data is discarded. -
/dev/null
is useful for ignoring output or error messages.
Connecting Commands with Pipes
- Pipes connect the output of one command to the input of another command.
- The
|
operator is used to create a pipe between commands. - Commands can be chained together in a specific order to achieve a specific task.
The Unix Philosophy
- The Unix Philosophy states that programs should:
- Do one thing and do it well.
- Work together.
- Handle text streams, which is a universal interface.
- Many Linux/Unix commands act as filters, reading input, processing or modifying it, and sending it as output.
Process Management
- Process management is crucial in operating systems, where programs executing are referred to as processes
- The OS keeps track of processes and system resources to manage them fairly
Monitoring Processes
- System administrators need to monitor:
- Which processes are running in the system
- The current state of the processes
- Resources these processes are taking
- Which user started which process
- Tools for monitoring processes:
- "ps" command: offers a snapshot of processes
- "pstree" command: offers a tree view of process, branching from parent process to child process
- "top" command: offers a dynamic real-time view of processes
The "ps" Command
- Displays all processes of the current user by default
- Options:
- "-e" displays all processes currently running
- "aux" displays user-oriented variant, all processes
- "-u username" displays process of a user named username
- Columns description:
- PID: Process ID
- TTY: The terminal that controls the process
- Time: the number of hours, minutes, and seconds the process has been running
- CMD: the command line, the process was called with
Process States
- Processes in Linux can exist in four different states:
- (R)unning: currently using the CPU
- (S)leeping: waiting in queue to use the CPU
- s(T)opped: stopped (but not terminated), either by user or other process
- (Z)ombie: terminated but waiting for its parent process to retrieve its exit code
The "pstree" Command
- Shows a tree view of all current processes
- Processes are always instantiated by other processes
- Your system starts with the "systemd" process
- Parent processes start child processes
The "top" Command
- Provides a dynamic view of what’s going on
- Shows process listed according to CPU usage
- Shows memory usage and status
Process Control
- Two types of processes in Linux:
- Foreground: interactive, initiated by a user and controlled through terminal session
- Background: non-interactive, not connected to a terminal
Starting a Process
- Once you run a command or program, it will start a process in the system
- You can start a process in the background by appending "&" at the end of the command line
- System-related processes usually run in the background and are called daemons
Terminating (Signalling) a Process
- The "kill" command is used to send signals to processes
- Syntax: "kill PID" (PID or %job)
- The kill command sends signals to processes, including the terminate signal
- Many different signals are available
- Ctrl+Z sends the TSTP (terminal stop) signal
Jobs – Foreground, Stopped, Background
- The shell starts processes and allows you to stop/re-start and foreground/background processes (jobs)
- Ctrl+Z stops the currently active foreground job and returns you to the shell prompt
- The jobs command shows stopped and background processes
- bg moves a job to the background, fg moves to foreground
- Add a job number to affect a particular job e.g. bg %2
Process Management in Windows
- Monitor resource usage: CPU, Memory, Disk, Network, and GPU.
- The Details tab of Task Manager shows the process states.
Process Control in Windows
- When an application is started, a process is created, which can be viewed in the Task Manager.
- Right-clicking on the process name shows actions that can be taken on the specific process, including:
- End task
- Set Priority
- Set Affinity
Managing Processes Using PowerShell
- Windows PowerShell provides the following commands for managing processes:
- Get-Process: Get a list of running Windows processes
- Start-Process: Start a process/program
- Stop-Process: Forcibly stop (kill) a process
- Debug-Process: Debug a process
- Wait-Process: Wait until a process ends
- Monitoring processes using Get-Process, and monitoring a specific process using Get-Process.
Process Management Recap
- Everything that runs on a computer is a process.
- Processes in Linux are hierarchical - every process has a parent.
- Tools like "ps", "pstree", and "top" are used to manage processes.
- The shell allows foreground, stopped, and background processes.
- Signals can be sent to processes with the "kill" command.
Processes in Windows
- Windows generally says "task" rather than "process".
- A hierarchy of parent and child processes exists, and tasks can run as different users.
- In code, CreateProcess(), WaitForSingleObject(), and CloseHandle() are used.
- Microsoft documentation provides more information on processes and threads.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.