Главная страница

Open Source Software


Скачать 1.28 Mb.
НазваниеOpen Source Software
Дата26.05.2022
Размер1.28 Mb.
Формат файлаdocx
Имя файлаFinal_OS 2.docx
ТипДокументы
#551026
страница30 из 39
1   ...   26   27   28   29   30   31   32   33   ...   39

$ echo line one > myfile

$ echo line two > myfile

$ echo line three > myfile



$ cat << EOF > myfile

> line one

> line two

> line three

> EOF

$

Правильно

This option works



$ echo -e 'line one\nline two\nline three ' > myfile

Правильно

This option works



$ echo line one > myfile

$ echo line two >> myfile

$ echo line three >> myfile

Правильно

This option works

3.

Вопрос 3

Which statement is true?

1 / 1 балл



edt involves switching between command and insert mode by hitting the Escape key



emacs involves switching between command and insert mode by hitting the Escape key



nano involves switching between command and insert mode by hitting the Escape key



vi involves switching between command and insert mode by hitting the Escape key

Правильно

vi has these command modes

4.

Вопрос 4

Which pair of editors has partisan advocates who tend to wage war over which is better than the other?

1 / 1 балл



gedit and emacs



pico and nano



vi and emacs



vi and nano

Правильно

vi and emacs have very partisan advocates who waste their time fighting

5.

Вопрос 5

Which editor can always be found installed by default on virtually any Linux system?

1 / 1 балл



WordStar



kwrite



libreoffice



emacs



vi

Правильно

vi can be installed with a very small size and is always available

Тест№5 Shells, Bash, and the Command Line

1.

Вопрос 1

Which of the following commands would add newbin, a directory in your home directory, to the PATH (Select all answers that apply)?

1 / 1 балл



PATH=$HOME/newbin:$PATH

Правильно

This puts the newbin program at the beginning of the path.



PATH=$HOME/$newbin:$PATH



PATH=$PATH:$HOME/newbin

Правильно

This puts the newbin program at the end of the path.



$PATH=$PATH:$HOME/newbin

2.

Вопрос 2

To make an environment variable (VAR) effective for only one command (foobar), you should do:

1 / 1 балл



VAR=value ; ./foobar



VAR=value && ./foobar



VAR=value ./foobar



export VAR=value ./foobar

Правильно

This is correct.

3.

Вопрос 3

Which of the following expressions will give the correct mathematical result (7) for x = 10 (Select all answers that apply)?

1 / 1 балл



$ echo $x - 3



$ echo $(expr $x-3)



$ echo $(($x - 3 ))

Правильно

This will work as intended ; try it!



$ echo $(expr $x - 3)

Правильно

This will work as intended ; try it!

4.

Вопрос 4

Which commands will get both the normal and error outputs of prog into a file? Select all answers that apply.

1 / 1 балл



foo >& file

Правильно

This will work as intended ; try it!



foo 2>&1 file



foo > file 2>&1

Правильно

This will work as intended ; try it!



foo >> file

5.

Вопрос 5

Which of the following commands has the correct syntax for specifying an alias?

1 / 1 балл



alias doitall="make clean; make all; evince output.pdf"

Правильно

You can have blank spaces in an alias if you use single or double quotes.



alias doitall=make clean; make all; evince output.pdf



alias doitall= "make clean; make all; evince output.pdf"

Тест №6 Filesystem Layout, Partitions, Paths, and Links

1.

Вопрос 1

Which of the following pseudo-directories are empty when the system is not running (Select all answers that apply)?

1 / 1 балл



/etc



/proc

Правильно

/proc contains only pseudofiles created in memory after system start.



/boot



/sys

Правильно

/sys contains only pseudofiles created in memory after system start.



/dev

Правильно

/dev contains only pseudofiles created in memory after system start.

2.

Вопрос 2

Which of the following statements describes the best practice?

1 / 1 балл



The current directory should not be placed in the path



The current directory should be appended to the path



The current directory should be prepended to the path

Правильно

3.

Вопрос 3

If file does not exist, which command will produce an error?

1 / 1 балл



ln file file2



ln -s file file2

Правильно

You cannot have a "dangling" hardlink

4.

Вопрос 4

Which command will list the partition information on the first hard disk and then exit?

1 / 1 балл



fdisk /dev/sda



fdisk -l /dev/sda



fdisk -l hd1

Правильно

This will give a report and return to the command line.

5.

Вопрос 5

Which directory trees usually have frequently changing data, and would not be desirable on a partition that is more static? Select all answers that apply.

1 / 1 балл



/tmp

Правильно

/tmp is designed for temporary data.



/usr



/home

Правильно

/home stores user accounts and data which will change every time the user is on the system.



/bin



/var

Правильно

/var is designed for variable, volatile data.

Тест №7 System Initialization

1.

Вопрос 1

What is the proper order of system initialization stages on most x86-based systems?

1 / 1 балл



BIOS -> GRUB -> init (PID 1)



GRUB -> BIOS -> init (PID 1)



init (PID 1) -> BIOS -> GRUB

Правильно

The system starts with BIOS, then moves to GRUB, and then starts first user process, init.

2.

Вопрос 2

Which files need to be in the /boot directory for the system to boot up (select all that apply)?

1 / 1 балл



System.map



initramfs

Правильно

This is the initial ram filesystem, which contains essential drivers for hardware and filesystems.



vmlinuz

Правильно

This is the compressed Linux kernel.



config

3.

Вопрос 3

Using GRUB lets you (Select all correct answers):

1 / 1 балл



Choose various options for booting up the system

Правильно

One can change many parameters that the system starts with



Choose which Linux kernel to user for boot

Правильно

One can either have different options in the menu, or add one at run time



Choose between operating systems or different Linux distributions

Правильно

One can have a multiple boot system, with multiple versions of Linux, Microsoft Windows, etc

4.

Вопрос 4

Select the order in which the following system initialization methods were introduced:

1 / 1 балл



SysVinit -> Upstart -> systemd



SysVinit -> systemd -> Upstart



systemd -> SysVinit -> Upstart

Правильно

SysVinit goes back many years and systemd is the most recent

Тест №8 Memory

1.

Вопрос 1

A rather complete picture of memory usage can be obtain by viewing the following pseudofile:

1 / 1 балл



/proc/meminfo



/sys/meminfo



/proc/cpuinfo



/proc/memory

Правильно

This contains a detailed view of memory usage.

2.

Вопрос 2

Select all true statements:

1 / 1 балл



Using swap space ties up system memory, but boosts performance.



There is no uniform prescription for how much swap space to use.

Правильно

Prescriptions vary, but the most common choice is swap size = RAM size.



Memory used directly by the Linux kernel is never swapped out.

Правильно

Kernel memory is "pinned" unlike that used by applications.



Using swap space lets the system pretend it has more memory than it physically has.

Правильно

Swap extends your physical memory.

3.

Вопрос 3

Which statement(s) are correct?

1 / 1 балл



A process may contain many threads.

Правильно

Multithreaded processes are common.



A thread may contain many processes.



The pthreads library enables multithreaded applications to be written just once for many different operating systems.

Правильно



A process may contain only one thread.

4.

Вопрос 4

The OOM Killer:

1 / 1 балл



Suspends the system until more memory becomes available



Tries to keep the system running by killing processes which are using more memory than can be supplied

Правильно

The idea is to keep running or at least get a graceful shutdown

5.

Вопрос 5

Which of the following are utilities used to work with swap space? Select all answers that apply.

1 / 1 балл



swap



swapon

Правильно

The only three swap utilities are mkswap, swapon and swapoff.



swapoff

Правильно

The only three swap utilities are mkswap, swapon and swapoff.



swapchk



mkswap

Правильно

The only three swap utilities are mkswap, swapon and swapoff.

Тест №9 Networking

1.

Вопрос 1

Which networking configuration interface is newer and has extended capabilities?

1 / 1 балл



ifconfig



ip

Правильно

ip can replace the work of ifconfig, route and other networking utilities.

2.

Вопрос 2

Using Predictable Network Interface Device Names (PNIDN) has come into use because (select all answers that apply):

1 / 1 балл



It makes it harder for bad actors to guess interface names



Many computers are no longer in one location; for example, laptops are on the move, and available interfaces are subject to change

Правильно

Mobile computing is daily life now.



On modern systems, the order in which network hardware is found is less predictable

Правильно

Order can change due to changes in kernel, for example.



Hardware such as USB devices can be added and removed at runtime

Правильно

One can never be sure what devices will be added to a system.

3.

Вопрос 3

Which command will bring the network interface eth0 up and assign an address to it (select all answers that apply)?

1 / 1 балл



sudo ifconfig up 192.168.1.200 eth0



sudo ip addr add 192.168.1.100 dev eth0

Правильно

This is the proper syntax for the ip command.



sudo ip addr ifconfig add 192.168.1.100 add default eth0



sudo ifconfig eth0 up 192.168.1.100

Правильно

This is the proper syntax for the ifconfig command.

4.

Вопрос 4

You can see statistics for the eth0 interface by (select all answers that apply):

1 / 1 балл



looking at /sys/class/net/eth0/statistics

Правильно

Look at the entries in this directory. Try it!



doing sudo ip -s link show eth0

Правильно

ip -s link will show for all devices.



doing sudo ifconfig eth0

Правильно

This is a standard method.

5.

Вопрос 5

What does MTU stand for?

1 / 1 балл



Multiple Target Unleashing



Maximum Transfer Unit (usually 1500 bytes by default) for Ethernet packets



Many Transport Uploads

Правильно

Тест №10 System Monitoring

1.

Вопрос 1

Which of the following utilities can be used to monitor I/O activity? (We encourage you to try all of them, as this is the best way to learn)

1 / 1 балл



iotop

Правильно

iotop must be run by a root user and directly displays I/O usage on the system, interactively refreshing every few seconds.



vmstat

Правильно

vmstat reports a lot of information about not only I/O activity, but memory and other areas.



iostat

Правильно

iostat gives detailed information about current I/O activity and can report at a specified interval, as many times as desired.



sar

Правильно

sar gives comprehensive system activity reports, including but not limited to I/O activity.

2.

Вопрос 2

Which of the following utilities can be used to monitor process and system load activity? (We encourage you to try all of them as this is the best way to learn)

1 / 1 балл



uptime

Правильно

uptime shows how long the system has been running.



free



df



ps

Правильно

ps is a frequently used tool that lists some or all processes on the system and shows their state and resource allocation.



top

Правильно

top is a frequently used interactive and constantly updating tool to see what processes running on the system and what resources they are using, sorted by factors that can be chosen.

3.

Вопрос 3

Your system seems memory-starved and is slowing down. Which utilities would give you information about your memory usage?

1 / 1 балл



vmstat

Правильно

vmstat will show current used and free memory, will show activity interactively specifying interval and count, such as vmstat 2 6



pmap

Правильно

pmap is process map: it shows detailed use of the memory used for a given process.



pstree



netstat



free

Правильно

free gives basic statistics about memory used, free, in cache, in swap, etc.

4.

Вопрос 4

Which statement is true?

1 / 1 балл



It is easier to monitor system activity using graphical interface tools, as they vary little from one Linux distribution to the next.



It is easier to monitor system activity using command line tools, since they vary little from one Linux distribution to the next.

Правильно

The command line tools are generally identical on all Linux-based systems.

5.

Вопрос 5

Which are high level graphical system monitoring tools?

1 / 1 балл



Network Manager



gnome-system-monitor

Правильно

gnome-system-monitor is associated with the GNOME desktop, but can be installed on almost any Linux distribution.



ksysguard

Правильно

ksysguard is associated with the KDE desktop, but can be installed on almost any Linux distribution.



wireshark

Тест №11 Kernel Modules and Device Management

1.

Вопрос 1

Which statements are true?

1 / 1 балл



It is possible to unload a kernel module being used by another module if you use the -f option to either rmmod or modprobe -r



It is impossible to unload a kernel module being used by an application.

Правильно

Doing so would almost certainly crash the application and possibly the system.



It is impossible to unload a kernel module being used by another module

Правильно

Doing so would likely crash the system, as it would try to execute code that has been removed from memory.



It is possible to unload a kernel module being used by an application if you use the -f option to either rmmod or modprobe -r

2.

Вопрос 2

The lsmod utility shows for each loaded module (select all correct answers):

1 / 1 балл



Its size in bytes

Правильно

This indicates how much memory is consumed by loading, but not how much memory it might be using to do its work



When the module was loaded



What other modules are using it

Правильно

This is important to make sure it is not removed and pulls the rug out from other modules.



Which user loaded the module



How many processes depend on it

Правильно

You don't want to remove a module that is being used by a process. However, sometimes this number is not accurate, such as for network drivers.

3.

Вопрос 3

Udev (select all correct answers):

1 / 1 балл



Loads and unloads device drivers and other kernel modules as needed

Правильно

This is its basic purpose.



Is designed to control which users can use a particular device



Stands for User Device

Правильно

That is indeed the name origin.



Stands for Deviant User



Is responsible for populating the /dev directory once the system is up and running

Правильно

Device nodes are created on the fly.

4.

Вопрос 4

Which command will ensure the httpd service (Apache) starts at system boot?

1 / 1 балл



sudo systemctl enable httpd.service



sudo systemctl init httpd.service



sudo systemctl start httpd.service



sudo systemctl status httpd.service

Правильно

The enable subcommand ensures the service will start at boot.

5.

Вопрос 5

How could you ensure the httpd service (Apache) is restarted if it is already running, say to absorb a revised configuration file (select all correct answers)?

1 / 1 балл



sudo killall httpd && sudo startall httpd



sudo systemctl restart httpd

Правильно

You don't really need to say httpd.service and this is true for most services.



sudo restart httpd



sudo systemctl stop httpd && sudo systemctl start httpd

Правильно

You don't have to do this in two steps, but it works. Note the use of && instead of ; This makes sure the second command does not run if the first fails.

Тест №12 System Administration

1.

Вопрос 1

Depending on Linux distribution, which commands can install the libaio package and any packages it needs to function that are not already installed (Select all answers that apply)?

1 / 1 балл



sudo apt-get install libaio

Правильно

This will work on Debian-based distributions.



sudo zypper install libaio

Правильно

This will work on SUSE systems.



sudo rpm -Uvh libaio



sudo dnf install libaio

Правильно

This will work on Red Hat-based distributions, such as CentOS and Oracle Linux.



sudo yum install libaio

Правильно

This will work on Fedora systems that use dnf replacing rpm.



sudo dpkg -i libaio

2.

Вопрос 2

Which command(s) can upgrade an entire system (Select all answers that apply)?

1 / 1 балл



sudo apt-get update



sudo yum update

Правильно

This will update the system on on old RHEL/CentOS systems.



sudo apt-get dist-upgrade

Правильно

Once the databases are updated, this will update/upgrade the system.



sudo dnf update

Правильно

This updates the data bases, as well as doing the installation on Red Hat-based systems.



sudo zypper update

Правильно

This will update the system on SUSE-based systems.

3.

Вопрос 3

System logging files are kept under:

1 / 1 балл



/etc/log



/var/log



/tmp/log



/proc/log

Правильно

All logging information should go here.

4.

Вопрос 4

Where would the user named student usually find their personal files?

1 / 1 балл



/var/student



/student



/home/student



/usr/local/student

Правильно

This is the general prescription, although some administrators might put it in a subdirectory, like /home/students/student

5.

Вопрос 5

The logrotate program:

1 / 1 балл



Erases all logging files on the system



Provides a game where lumberjacks have to roll logs into the river



Rotates the text in logfiles so they are hard to read



Cyclically rotates and optionally compresses log files to save space

Правильно

Тест №13 Users and Groups

1.

Вопрос 1

Basic information about the characteristics of a user's account can be found in:

1 / 1 балл



/etc/passwd



/var/users/params



/etc/users



/etc/permissions

Правильно

This is a standard important file

2.

Вопрос 2

Adding a new user to a group is done with:

1 / 1 балл



groupmod



usermod



groupadd



chgroup

Правильно

usermod can add a user to a group.

3.

Вопрос 3

Which provides stronger security and auditing for system activity:

1 / 1 балл



su



sudo

Правильно

sudo is much more controlled than su and has good auditing facilities.

4.

Вопрос 4

Differences between su and su - include (Select all answers that apply):

1 / 1 балл



su starts a new login shell, while su - just continues the current shell but gives it super privileges



su - starts a new login shell, while su just continues the current shell, but gives it super privileges

Правильно

Yes, this is a correct statement.



su preserves more information, such as current directory, path and environment variables

Правильно

su without the dash preserves information



su - preserves more information, such as current directory, path and environment variables

5.

Вопрос 5

Which is the proper way to use sudo with echo?

1 / 1 балл



sudo echo 3 | cat - > /proc/sys/vm/drop_caches



sudo -c bash "echo 3 > /proc/sys/vm/drop_caches"



sudo bash -c "echo 3 > /proc/sys/vm/drop_caches"



sudo echo 3 > /proc/sys/vm/drop_caches

Правильно

Without the -c option, echo sudo would not be accessing the root-owned file

Linux Tools for Developers (Course 3)

1.


Вопрос 1

Which command will list all files under the current directory with a .cfg extension, and then delete them?

1 / 1 балл



find . -exec rm {} ';' -name "*.cfg"



find . -name "*.cfg" -exec rm {} ';'



find -name "*.cfg" . -exec rm {} ';'



find -exec rm {} ';' -name "*.cfg" .

Правильно

Note you could use \; instead of ';' - they both work

2.


Вопрос 2

Which command will list all files and directories on the system with cfg in their name?

1 / 1 балл



locate cfg -exec ls -l {} ';'



ls -l $(locate cfg)



locate



find cfg

Правильно

This will search the whole system and feed the result to ls

3.


Вопрос 3

Which command will find all files and directories in the system whose name ends with cfg?

1 / 1 балл



locate cfg



locate -r "^cfg"



locate -r "cfg$"



locate cfg$

Правильно

You need the -r option so you can feed a regular expression, not just a string

4.


Вопрос 4

Which commands can change all occurrences within a file of the string boris to natasha (Select all answers that apply)?

1 / 1 балл



sed -e s/boris:natasha/g file



sed -e s/boris/natasha/g file

Правильно

The /g ensures all occurrences on every line are dealt with



sed -e s\boris\natasha\g file



sed -e s:boris:natasha:g file

Правильно

This will work, you can use different delimiters, such as / or :

5.


Вопрос 5

Which command will print out all lines beginning with "X" in all files in the current directory?

1 / 1 балл



grep "X$" *



grep "^X" *



grep $X *

Правильно

Note the quotation marks

Test 2
1   ...   26   27   28   29   30   31   32   33   ...   39


написать администратору сайта