Unix V2 Flashcards
(19 cards)
What are the main boot phases in the UNIX boot process?
The UNIX boot process is broken into several phases: BIOS, MBR, GRUB, Kernel, Init, and the Runlevel phase. In order, the BIOS executes the MBR; the MBR loads GRUB; GRUB (the Grand Unified Boot Loader) then executes the Kernel; the Kernel mounts the root filesystem and executes /sbin/init; and finally, the Init process launches runlevel programs to bring the system to its desired state.
Describe the BIOS phase in the UNIX boot process.
During the BIOS phase the system’s firmware performs a Power-On Self-Test (POST) to verify hardware integrity and then searches for and loads the boot loader program from the Master Boot Record (MBR). This phase is responsible for initiating the boot process by handing control over to the MBR.
What is the role of the Master Boot Record (MBR) in the UNIX boot process?
The MBR is located in the first sector of the bootable disk. It is composed of three parts: the primary bootloader, the partition table, and an MBR validity check. Its role is to load and execute the bootloader (typically GRUB), which then continues the boot process.
Explain the function of GRUB (Grand Unified Boot Loader) in UNIX booting.
GRUB provides a boot menu, allowing the user to choose from multiple installed kernel images if available. It also contains an initrd (initial RAM disk) image—a temporary, minimal root filesystem—that it uses to load and execute the Kernel, bridging between bootloader and operating system startup.
How does the Kernel phase contribute to the UNIX boot process?
Once loaded by GRUB, the Kernel mounts the root filesystem specified by the ‘root=’ entry in the GRUB configuration. It then executes the /sbin/init process (the first user-space process with PID 1), which is essential for starting all subsequent system processes and services.
What is the purpose of the init process in UNIX?
The init process is responsible for transitioning the system to its operational state. It executes runlevel programs and maintains the system in a specified runlevel by reading the initialization table (/etc/inittab) to determine the default state, then running the appropriate scripts in /etc/rc.d/rc*.d.
What are UNIX runlevels and what functions do they serve?
Runlevels are predefined system states defined in /etc/inittab. They include: 0 (halt/shutdown), 1 (single-user mode with only terminal access), 2 (multi-user mode without networking), 3 (multi-user mode with networking—the typical operational state without a GUI), 4 (unused/user-definable), 5 (full multi-user mode with networking and GUI), and 6 (reboot). Each runlevel provides a framework for which services and processes are started or stopped.
Where are system logs stored in UNIX and what are some common log files?
UNIX logs are generally stored in the /var/log/ directory. Common log files include /var/log/messages (generic system activity), /var/log/auth.log or /var/log/secure (authentication events), /var/log/boot.log (boot-up messages from scripts like /etc/init.d/bootmisc.sh), /var/log/mail.log (mail server logs), /var/log/faillog (failed login attempts), /var/log/cron.log (cron job activity), and /var/log/kern.log (kernel logs).
What is the primary purpose of the ‘ls’ command in UNIX and what options enhance its functionality?
The ‘ls’ command lists the contents of directories. Common options include: -a (displays all files including hidden ones), -A (almost all files), –hide=[pattern] (omits files matching a pattern), -i (shows inode numbers), -l (long format with permissions, owner, size, date, etc.), -R (recursive listing of subdirectories), and -r (reverse the sort order). This command is fundamental for directory exploration and file management.
How does the ‘ps’ command function in UNIX?
The ‘ps’ command provides a snapshot of the current processes running on the system. Options such as -eF, aux, and -elf allow users to see detailed information including process IDs, user information, and thread details, which is essential for system monitoring and troubleshooting.
What is the function of the ‘grep’ command, and which options are frequently used?
The ‘grep’ command searches files for lines that match a given pattern. It is often used with options like -v (inverse match), -e (enables regex searches similar to egrep), -f (uses a file as the pattern source), -i (case-insensitive search), -w (matches whole words), and -c (outputs count of matches). This makes grep a versatile tool for filtering text data.
Describe the usage and key options of the ‘iptables’ command in UNIX.
The ‘iptables’ command manages IPv4 packet filtering and NAT rules within the Linux kernel. It uses options such as -A (append a rule), -L (list rules in verbose format), -F (flush rules), -i (specify an interface), and -j (jump to a target, which determines how the packet is processed). For example, ‘sudo iptables -A INPUT -i lo -j ACCEPT’ appends a rule to allow local loopback traffic.
What is the purpose of the ‘ifconfig’ command and how does it differ from the ‘ip’ command?
The ‘ifconfig’ command is used to configure and display information about network interfaces, such as IP addresses and netmasks. Although traditionally used, it is now largely replaced by the ‘ip’ command, which provides more extensive control over networking, including routing and interface management.
What role does the ‘traceroute’ command play in UNIX systems, and what common options does it use?
The ‘traceroute’ command traces the path used by packets from the source to a target host. It shows each hop along the route and measures transit delays. Notable options include -I (use ICMP echo requests), -T (use TCP SYN packets), -i (select a specific interface), -m (set maximum TTL), -n (avoid resolving hostnames), and -s (specify an alternative source address).
What information does the ‘netstat’ command provide, and what are its key options?
The ‘netstat’ command displays network connections, routing tables, interface statistics, and more. It can show both active and listening sockets. Options include -a (all connections), -v (verbose output), -n (numerical addresses), and -l (listening sockets only). This command is a key utility for network troubleshooting and monitoring system activity.
What is a Shared Object in UNIX and how does it compare to a Windows DLL?
A Shared Object in UNIX is a dynamically linked library that can be loaded and shared by multiple programs simultaneously, similar to a Dynamic Link Library (DLL) in Windows. It promotes efficient memory use and code reuse by allowing multiple processes to share the same library code in memory.
What types of information are stored in the /etc/shadow and /etc/passwd files?
The /etc/passwd file holds non-sensitive user account information such as usernames, user IDs (UID), group IDs (GID), and comment fields, while the /etc/shadow file securely stores the actual password hashes and password aging information. This separation improves system security.
What is the purpose of the .bashrc file in UNIX?
The .bashrc file, located in an individual user’s home directory, contains shell commands that customize the interactive shell environment. It sets environment variables, defines aliases, and configures the command prompt, ensuring that each new terminal session has a consistent and personalized setup.
How does the crontab command contribute to task scheduling in UNIX?
The crontab command allows users to edit their cron tables, which list commands scheduled to run at specific intervals. This automation tool is crucial for performing regular tasks such as backups, updates, or system maintenance without manual intervention.