Chapter 9 Flashcards
Adjusting Localization Options
Describe how Linux works with different languages.
Linux stores and displays language characters by using character sets. ASCII, Unicode, and UTF-8 are the most commonly used character sets for Linux.
Explain how to change the current character set on a Linux system.
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.
Describe how the time zone is set on a Linux system.
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.
Summarize the tools you have available to work with the time and date on a Linux system.
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.
Describe how NTP works and how Linux systems use it.
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.
Explain how you can see the amount of time it takes for an application to run on the system.
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.
Which character set uses 7 bits to store characters?
UTF-8 UTF-16 ASCII Unicode UTF-32
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.
What two character sets use a transformation code to store characters?
UTF-8 UTF-16 ASCII Unicode locale
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.
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
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.
What Linux command displays all the localization environment variables and their values?
date time hwclock LANG locale
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.
What two environment variables control all the localization settings?
LC_MONETARY LC_NUMERIC LANG LC_CTYPE LC_ALL
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.
___________ is the ability to adapt a Linux system to a specific language.
locale Localization Character set Unicode ASCII
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.
What Systemd utility allows you to change the localization on your Linux system?
timedatectl time date localectl locale
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.
Which Linux command changes the value of a localization environment variable?
time export locale date hwclock
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.
Which LC_ environment variable determines how Linux displays dollar and cents values?
LC_NUMERIC LC_MONETARY LC_CTYPE LC_TIME LC_COLLATE
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.