Chapter 9 Flashcards

Adjusting Localization Options

1
Q

Describe how Linux works with different languages. 

A

Linux stores and displays language characters by using character sets. ASCII, Unicode, and UTF-8 are the most commonly used character sets for Linux.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain how to change the current character set on a Linux system. 

A

You can use the export command to change the LANG or LC_ALL environment variable to define a new character set. If your Linux distribution uses the Systemd utilities, you can also use the localectl command to display or change the system character set.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe how the time zone is set on a Linux system. 

A

Time zones are defined in Linux by individual files in the /usr/share/zoneinfo folder. Debian-based Linux distributions copy the appropriate time zone file to the /etc/timezone file, whereas Red Hat–based Linux distributions use the /etc/localtime file. To change the time zone for an individual script or program, use the TZ environment variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Summarize the tools you have available to work with the time and date on a Linux system. 

A

The hwclock command allows you to sync the Linux system time with the hardware clock on the system, or vice versa. The date command allows you to display the time and date in a multitude of formats or set the current time and date. The timedatectl command is from the Systemd utilities and allows you to display lots of different information about the system and hardware time and date in addition to allowing you to set them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe how NTP works and how Linux systems use it. 

A

The Network Time Protocol (NTP) allows Linux systems to synchronize their time and date from a centralized server across the network. There are three common software packages that implement NTP in Linux: the ntpd package, the chrony package, and the timesyncd program from the Systemd utilities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain how you can see the amount of time it takes for an application to run on the system. 

A

The time command allows you to place a timer on a specific application as it runs on the system. The output from the time command shows the actual elapsed time it took the program to run and how much user and system CPU time the application required.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which character set uses 7 bits to store characters?

UTF-8
UTF-16
ASCII
Unicode
UTF-32
A

C. The ASCII character set uses a 7-bit code to store English language characters, so option C is correct. The UTF-8 character set uses 1 byte (8 bits) to store characters, so option A is incorrect. The UTF-16 character set uses 2 bytes (16 bits) to store characters, so option B is incorrect. The Unicode character set uses 3 bytes (24 bits) to store characters, so option D is incorrect, and the UTF-32 character set uses 4 bytes (32 bits) to store characters, so option E is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What two character sets use a transformation code to store characters?

UTF-8
UTF-16
ASCII
Unicode
locale
A

A, B. The UTF-8 and UTF-16 character sets use a transformation process to reduce the Unicode character set into 1 byte (UTF-8) or 2 byte (UTF-16) values, so options A and B are correct. The ASCII character set doesn’t transform any characters, so option C is incorrect. The Unicode character set also doesn’t transform characters, so option D is incorrect. locale is a Linux command and not a character set, so option E is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which character set uses a 3-byte code and can represent characters from most languages used in the world?

ASCII
LC_ALL
UTF-8
UTF-16
Unicode
A

E. The Unicode character set uses 3 bytes to store characters, which provides enough space to represent all the characters in the known world languages, so option E is correct. The ASCII character set only supports English language characters, so option A is incorrect. The LC_ALL environment variable defines a character set to use for the Linux system but isn’t a character set in itself, so option B is incorrect. Both the UTF-8 and UTF-16 character sets are a subset of the Unicode character set, so they can’t represent all the language characters in use in the world, so options C and D are incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What Linux command displays all the localization environment variables and their values?

date
time
hwclock
LANG
locale
A

E. The locale command displays all of the LC_ environment variables and their values, so option E is correct. The date command only displays the time and date, not the localization information, so option A is incorrect. The time command displays the amount of time an application uses on the system, not the localization information, so option B is incorrect. The hwclock command displays the hardware clock time, not the localization information, so option C is incorrect. The LANG environment variable allows you to set all the LC_ environment variables in one place, but it doesn’t display all their settings, so option D is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What two environment variables control all the localization settings?

LC_MONETARY
LC_NUMERIC
LANG
LC_CTYPE
LC_ALL
A

C, E. The LANG and LC_ALL environment variables control all the localization environment variable settings, so options C and E are correct. The LC_MONETARY, LC_NUMBERIC, and LC_CTYPE environment variables each control a single category of localization environment variables, but not all of the localization environment variables, so options A, B, and D are all incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

___________ is the ability to adapt a Linux system to a specific language.

locale
Localization
Character set
Unicode
ASCII
A

B. Localization is the process of adapting a Linux system’s character set to use a local language, so option B is correct. The locale command allows you to view the character sets, but it doesn’t adapt the Linux system to the locale environment, so option A is incorrect. The character set is used to specify language characters, but it doesn’t adapt the Linux system to a specific language, so option C is incorrect. Unicode and ASCII are two types of character sets, and they don’t adapt the Linux system to a specific language, so options D and E are incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What Systemd utility allows you to change the localization on your Linux system?

timedatectl
time
date
localectl
locale
A

D. The localectl command is part of the Systemd package and allows you to display and change the localization settings for your Linux system, so option D is correct. The timedatectl command is also part of the Systemd package, but it only applies to time and date changes and not the localization changes, so option A is incorrect. The time, date, and locale programs are legacy programs and not part of the Systemd package, so options B, C, and E are incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which Linux command changes the value of a localization environment variable?

time
export
locale
date
hwclock
A

B. The export command sets the value associated with an environment variable, so option B is correct. The time command displays the amount of time an application used on the system, not the values of an environment variable, so option A is incorrect. The locale command displays the values of the localization environment variables but doesn’t allow you to change them, so option C is incorrect. The date command displays and sets the time and date values but not the localization environment variables, so option D is incorrect. The hwclock command displays and sets the hardware clock but not the localization environment variables, so option E is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which LC_ environment variable determines how Linux displays dollar and cents values?

LC_NUMERIC
LC_MONETARY
LC_CTYPE
LC_TIME
LC_COLLATE
A

B. The LC_MONETARY environment variable determines the character set used for displaying monetary values, so option B is correct. The LC_NUMERIC environment variable determines how Linux displays numeric values, so option A is incorrect. The LC_CTYPE environment variable determines the default character set used by programs but not necessarily only for monetary values, so option C is incorrect. The LC_TIME environment variable determines how the Linux system displays time, not monetary values, so option D is incorrect. The LC_COLLATE environment variable determines how Linux sorts alpha characters, not how it displays monetary values, so option E is incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A __________ determines the time relative to the UTC time in a specific location.

time zone
localization
character set
locale
hardware clock
A

A. Each time zone determines the offset from UTC that applies to a specific location, so option A is correct. The localization determines the character set used to display language characters but not the time, so option B is incorrect. The character set determines how to display the language characters but not the time, so option C is incorrect. The locale determines how Linux displays the time but not the actual time setting, so option D is incorrect. The hardware clock is the time the physical workstation or server is set to in BIOS or UEFI; it doesn’t necessarily represent the time relative to UTC and can even be stored as a UTC value, so option E is incorrect.

17
Q

Which Linux commands allow you to retrieve the time from the physical workstation or server? (Choose all that apply.)

date
hwclock
time
locale
timedatectl
A

B, E. Both the hwclock and timedatectl commands retrieve the time and date from the physical workstation or server, so options B and E are correct. The date command displays the system time and date, not the time and date set on the physical hardware, so option A is incorrect. The time command displays the amount of time a program uses on the system, not the physical hardware time and date on the workstation or server, so option C is incorrect. The locale command displays the localization environment variables and their values, not the hardware time and date, so option D is incorrect.

18
Q

What file do Red Hat–based systems use to define the time zone for the Linux system?

/etc/localtime
/etc/timezone
/usr/share/zoneinfo
/usr/share/timezone
/usr/share/localtime
A

A. Red Hat–based systems use the /etc/localtime file to store the appropriate time zone file for the location where the system is running, so option A is correct. The /etc/timezone file is normally used by Debian-based systems, so option B is incorrect. The /usr/share/zoneinfo folder stores time zone files that you must copy to the /etc/localtime file, so option C is incorrect. The /usr/share/timezone and /usr/share/localtime folders are incorrect folder names, so options D and E and incorrect.

19
Q

Which folder contains template files for each time zone that Linux supports?

/etc/localtime
/usr/share/zoneinfo
/etc/timezone
$HOME
/usr/share/timezone
A

B. The /usr/share/zoneinfo folder contains template files for each of the time zones supported in Linux, so option B is correct. The /etc/localtime and /etc/timezone files are the locations where you copy or link the appropriate time zone file to, but neither of them is the template folder, so options A and C are incorrect. The $HOME folder contains the user environment settings and user files but not the time zone template files, so option D is incorrect. The /usr/share/timezone folder is an incorrect folder name, so option E is incorrect.

20
Q

Which command displays the current date, system time, hardware time, and time zone?

date
timedatectl
time
hwclock
localectl
A

B. The timedatectl command from the Systemd package displays the current date, the Linux system time, the hardware clock time, and the time zone, so option B is correct. The date command displays the current system time, date, and time zone but not the hardware time, so option A is incorrect. The time command displays the amount of time an application uses on the CPU, not the current date and time, so option C is incorrect. The hwclock command displays the current hardware time but not the system time, date, or time zone, so option D is incorrect. The localectl command displays the localization settings for the system but not the time, date, hardware time, or time zone, so option E is incorrect.

21
Q

Which command do you use to display the current time and date using a specific output format?

date
time
timedatectl
localectl
hwclock
A

A. The date command allows you to specify a format for displaying the time and date, so option A is correct. The time command displays the amount of CPU time an application consumes, not the current time and date, so option B is incorrect. The timedatectl command displays the current time and date but doesn’t allow you to format the output, so option C is incorrect. The localectl command displays the localization settings for the system, but not the current time and date, so option D is incorrect. The hwclock command displays the current hardware time but doesn’t allow you to specify the format, so option E is incorrect.

22
Q

Which commands allow you to set the Linux system time to the workstation BIOS clock time? (Choose all that apply.)

hwclock
date
time
timedatectl
localectl
A

A, D. The hwclock and timedatectl commands allow you to synchronize the Linux system time to the workstation BIOS time, so options A and D are correct. The date command allows you to change the date and time, but it doesn’t allow you to synchronize it with the workstation BIOS time, so option B is incorrect. The time command allows you to display the amount of CPU time an application consumes, but it doesn’t allow you to synchronize the system time with the workstation BIOS time, so option C is incorrect. The localectl command is used for localization, not for setting the time, so option E is incorrect.

23
Q

What network time package do Red Hat–based Linux systems use to synchronize the system time with a network time server?

ntpd
chrony
localectl
timedatectl
timesyncd
A

B. Red Hat–based Linux systems utilize the chrony software package for connecting to network time servers. The ntpd package is a legacy software package and not often used, so option A is incorrect. The localectl command isn’t used for setting time, so option C is incorrect. While you can set the local time using the timedatectl command, you can’t use it to set the time using a network time server, so option D is incorrect. Although Red Hat–based systems utilize the Systemd utilities, they don’t use the timesyncd program for network time, so option E is incorrect.

24
Q

Which environment variable can programmers use to temporarily change the time zone setting for just their environment?

LANG
LC_MONETARY
LC_NUMBERIC
LC_ALL
TZ
A

E. The TZ environment variable overrides the default system time zone for session applications, so option E is correct. The LANG and LC_ALL environment variables set the entire system time zone, not just the programming environment, so options A and D are incorrect. The LC_MONETARY and LC_NUMERIC environment variables set the localization for money values and numeric values, but they don’t change the time zone setting, so options B and C are incorrect.

25
Q

Which character set has replaced ASCII as the default character set used in U.S. Linux installations?

Unicode
UTF-16
UTF-8
UTF-32
locale
A

C. The UTF-8 character set duplicates the ASCII character set, and it’s the default used in most U.S. Linux installations, so option C is correct. The Unicode, UTF-16, and UTF-32 character sets use more than 1 byte to represent characters, so they are not often used for English language characters, making options A, B, and D incorrect. The locale command displays the localization environment variables and their values—it is not a character set code, so option E is incorrect.

26
Q

Which command lists all the localizations installed on your Linux system?

timecatectl
localectl
locale
LANG
LC_ALL
A

B. The localectl command uses the list-locales option to display all the localizations installed on the Linux system, so option B is correct. The timedatectl command displays the local time and date, but it doesn’t provide information on which localization files are installed, so option A is incorrect. The locale command displays the localization environment variable settings but doesn’t list which localizations are installed, so option C is incorrect. The LANG and LC_ALL environment variables set the current localization but can’t display which ones are installed on the system, so options D and E are incorrect.

27
Q
A