Topic A: Configure and Use Linux

Ace your homework & exams now with Quizwiz!

You are working on a Windows PC with multiple hard disks. The system is not booting off the correct disk. You've determined that the hardware boot order is correct. What next step could you take in Windows?

Set the active partition. An active partition sets where the system should boot from. When a partition is marked as active, the boot sector is populated with a record that points to the Windows boot loader. The disk management tool can be used to modify partitions.

Which file system is a proprietary file system developed by Apple for use in systems running MacOS?

The HFS file system is a proprietary file system developed by Apple for use in systems running MacOS.

A user's Windows laptop is experiencing routine errors and blue screen crashes. The laptop has been serviced several times with repair installations. What is the recommended approach to fixing the problem?

A clean install is a recommended option for a problematic system. As this system has already been serviced several times, it is cost effective time-wise to erase the system and start fresh. A clean install would require all applications and settings be reinstalled.

NFS (Network File System)

A client/ server application that enables users to access shared files stored on different types of computers and work with those files as if they were stored locally on their own computers.

Mounting Partitions

A file system configured on a partition on a particular storage device is attached to a particular directory (mount point) within the unified file system using the mount command. For example, the following command mounts partition 1 on the mass storage device sda to the directory /mnt/diskC. mount /dev/sda1 /mnt/diskC Mountable file systems are listed in the /etc/fstab file. Note: Think of the root file system representing everything on the computer as "THE" file system and a file system for a particular partition as just "A" file system.

You are testing an automated Windows deployment method. With this method, installation occurs with minimal user interaction. Which installation method are you testing?

An unattended install is an install method that is automated with an answer file that contains answers related to particular setup questions.

--help

Any Linux command will generally give a reasonably detailed explanation of its function and syntax when the --help parameter is used. The help is often several pages long so use of the | more (pipe) at the end of the command is recommended on any command that generates large amounts of output. It shows the results a page at a time. For example: ls --help | more

command - cd

Change Directory The cd command is used to change your working directory. Typical syntax would be: cd /etc—change directory to /etc. This is an absolute path (begins with /) so will work regardless of your current directory. cd documents—change your directory to a subdirectory called documents. This is a relative path. The documents directory must exist below the current directory. cd ..—change your directory to the parent directory of the one you are currently working in.

Common Linux Distributions include:

Red Hat/CentOS—the most commercially successful distribution. Also, the CentOS distribution is a stable, predictable, manageable, and reproducible platform derived from the sources of Red Hat Enterprise Linux (RHEL). CentOS is maintained by The CentOS Project, a community-driven free software effort that is modeled on the structure of the Apache Foundation and has its own governing board. CentOS benefits from Red Hat's ongoing contributions and investment. SUSE—originally developed in Germany, the company was bought out by US networking company Novell. Debian/Ubuntu—one of the many volunteer-driven distributions. Ubuntu is one of the most widely used derivatives of Debian.

Disk Management Commands

The file system choice can be made when the disk has been partitioned. Most Linux distros provide GUI tools for managing disks and file systems, but the following represent the main command-line options: + fdisk—used to create and manage partitions on a hard disk. + mkfs—used to format a partition. + mkswap—used to format a swap partition. The swapon command is used to activate the partition as swap space. + dd—make a copy of an input file (if=) to an output file (of=) and apply optional conversions to the file data. One notable use of dd is to clone a disk (in the following, sda might be the fixed drive and sdb a removable drive): dd if=/dev/sda of=/dev/sdb ++ You would need to boot from a live CD so that the file system was not mounted at the time of cloning. You can also clone a disk to a disk image (.img) file: dd if=/dev/sda of=/mnt/usbstick/backup.img ++ To restore, you could simply reverse the input and output files: dd if=/mnt/usbstick/backup.img of=/dev/sda

sudo (Superuser Do) commands

The sudo command allows a normal user to run specified commands with superuser privilege level. The superuser first has to edit the /etc/sudoers file listing the commands and users that are allowed to run them. The user might be asked to confirm his or her password, if it has not been cached recently.

etc/shadow file

The user password is typically stored as an encrypted hash in the /etc/shadow file, along with other password settings, such as age and expiration date.

Linux Flavors

There are a huge number of flavors, many of which have been developed for specialist applications such as running routers, set-top boxes, smart TVs, Internet of Things (IoT) devices, and so on. The smartphone OS, Android, is based on Linux. ubuntu mint linux fedora suse

Placing multiple commands before entering

You can issue more than one command before pressing Enter. Place a semicolon ( ; ) between the commands and they will be issued one after the other.

Pipes

You can send or redirect the results of one command to another command. Pipes are used to combine Linux tools on a single command line, enabling you to use the output of one command as the input to another. The pipe symbol is a vertical bar ( | ), which you type between two commands.

command - cp

copy files The cp command is used to create a copy of files either in the same or different folder with the same or different name. For example: cp file1.txt file1.old—copy file1.txt in the current working directory to a new file called file1.old in the same directory. cp /etc/hosts /tmp—copy the file hosts from the directory /etc into the directory /tmp, keeping the file name the same. cp -v /var/log/message* /home/usera—copy all files beginning with the name message from the /var/log directory into /home/usera. The -v option displays the files copied.

dd

dd—make a copy of an input file (if=) to an output file (of=) and apply optional conversions to the file data. One notable use of dd is to clone a disk (in the following, sda might be the fixed drive and sdb a removable drive): dd if=/dev/sda of=/dev/sdb

File systems used in Linux

ext4 (Fourth Extended File System) is the latest version of the ext journaling file systems used in Linux. It has the capability of supporting volumes with a size up to 1 exbibyte (EiB) and files with sizes up to 16 tebibytes (TiB).

command - grep

filter files The grep (Globally search a Regular Expression and Print) command is used to search and filter the contents of files, displaying the lines that match the search string. The search string can be a simple text value to match (a literal) or can use a sophisticated pattern-matching system called regular expressions (regex). grep is especially useful for searching long files such as system logs. For example, the following command displays only the lines in the Linux system log file for messages that contain the text uid=1003, ignoring the case of the text with the -i switch: grep -i "uid=1003" /var/log/messages The grep command can also be used to search a directory for a certain file. The ls -l | grep audit command returns a long listing of any files in the current directory whose name contains audit.

mkfs

mkfs—used to format a partition.

mkswap

mkswap—used to format a swap partition. The swapon command is used to activate the partition as swap space.

command - mv

move files The mv command is used to either move files from one directory to another or rename a file. For example: mv /home/usera/data.txt /tmp—move the file data.txt from the /home/usera directory to the /tmp directory, keeping the file name the same. mv alarm.dat /tmp/alarm.bak—move and rename the file alarm.dat in the current directory to alarm.bak in /tmp. mv /var/log/app1.dat /var/log/app1.old—rename the file app1.dat in the /var/log folder to app1.old.

command - rm

remove files The rm command is potentially very dangerous if used incorrectly. Although its main role is to delete files, with an additional parameter (-r) it can also be used to delete directories. For example: rm data.old—remove the single file data.old from the current working directory. rm /var/log/*.bak—remove all files ending in .bak from the /var/log directory. rm -r /home/usera/data—remove the contents of the entire directory tree underneath the folder /home/usera/data. Caution: Use the -r switch with caution! Note: Remember that Linux commands operate without prompts, not allowing you to cancel.

Linux Distribution

A Linux distribution is a complete Linux implementation, including kernel, shell, applications, utilities, and installation media, that is packaged, distributed, and supported by a software vendor.

What is a Refresh Reinstall?

A system refresh is an option that was added beginning with Windows 8. With a system refresh, Windows is reinstalled while keeping certain settings and personal files intact.

man

Alternatively, you can use man to view the help pages for a particular command. For example, use man man to view the help pages for the man command!

Basic Discs

Basic disk types are the default disk types in Windows and are supported in Windows 10 Home edition. Basic disks can be partitioned, but they cannot span multiple volumes like a dynamic disk.

What are boot partitions?

Boot partitions are a partition type that are marked as the partition the system will boot from.

Case Sensitive Character Commands

Commands, parameters, and file and directory names are all case sensitive in Linux. For example, ls -l file.data and ls -L File.data would produce completely different results. Using capitals in the command name would generate an error message.

What is Windows Compatibility Mode?

Compatibility mode is a feature in Windows that allows for an application to be launched as if the operating system was an older version. For example, an application on a Windows 10 PC could be set to launch as if it were running on Windows XP.

Discs not supported in Win10 Home Edition

Dynamic Disks: A dynamic disk can be used to create a volume that spans multiple disks and can be used in a RAID configuration.

Popular Linux GUI Shells

Gnome (GNU Object Model Environment)—the oldest and most widely deployed GUI. Used by default on Fedora and Debian. KDE (K Desktop Environment)—a very popular GUI often used by SUSE. Cinnamon—based on the MINT GUI. Xfce—one of the many lightweight GUIs, designed for systems with less RAM and CPU power.

Linux Disk and File Management

In Linux, the directory structure is defined as a File System Hierarchy. Unlike Windows, drive letters like C: or D: are not used. The file system starts at the root, represented by /. Directories and subdirectories can be created from the root to store files.

You want to create a standard image for installation on multiple computers on the network. What is the first step in the process of image deployment?

Install the operating system on a reference computer.

Unified File System

It is important to realize that everything available to the Linux OS is represented as a file in the file system, including devices. This is referred to as the unified file system. For example, a single hard drive attached to a SATA port would normally be represented in the file system by /dev/sda. A second storage device—perhaps one attached to a USB port—would be represented as /dev/sdb.

Swapping the Linux GUI Shell

It should also be noted that unlike Windows and Mac, the default GUI shell can be swapped for a different one. Many GUIs, including Gnome, will support features like virtual desktop (Mission Control on macOS).

Linux Commands

Linux commands are entered in a standard format, featuring the command followed by a space then a number of options (or switches) and/or arguments, depending on the function of the command. Wildcards (* and ?) can be used in the same way as at the Windows command line.

Linux Originally Developed as...

Linux was originally developed with a Command-Line Interface (CLI) or shell very much like UNIX.

command - ls

List files The ls command is used to display a folder in the same way as dir at the Windows command prompt. Popular parameters include -l to display a detailed (long) list and -a to display all files including hidden or system files. The following example shows the entire contents of the /etc directory in a detailed format: ls -l -a /etc

What partition type can a logical partition be created in?

Logical partitions can be created inside an extended partition. An extended partition is not formatted like a primary partition and the logical partitions within can be used as logical drives. Logical partitions can hold an operating system but are not bootable.

Linux Command Line

Many system tasks still require the use of the command even if a GUI environment is running. Within a GUI, you can open a terminal window to run shell commands.

Linux File Systems

Most Linux distributions use some version of the ext file system to format partitions on mass storage devices. ext3 is a 64-bit file system with support for journaling, which means that the file system tracks changes, giving better reliability and less chance of file corruption in the event of crashes or power outages. Support for journaling is the main difference between ext3 and its predecessor (ext2). ext4 delivers significantly better performance than ext3 and would usually represent the best choice for new systems. Linux can also support FAT/FAT32, though it is designated as VFAT. Additional protocols, such as the Network File System (NFS), can be used to mount remote storage devices into the local file system.

Linux Command Tab Completion

Note: Also note that Linux terminals support Tab completion to help in entering commands. You can use Shift+Page Up or Shift+Page Down and Ctrl+Shift+Up Arrow or Ctrl+Shift+Down Arrow to scroll. Use the Up and Down arrow keys to scroll through previously used commands. Use q to quit a command.

GNU

Note: GNU is a recursive acronym standing for "GNU is Not UNIX." Many of the non-kernel bits of software developed under the open source GNU license to replace their proprietary UNIX equivalents can be used with Linux.

How many extended partitions can be created on a MBR-type (Master Boot Record) partitioned hard drive?

Only one extended partition is allowed on a hard drive. An extended partition is not formatted like a primary partition is. An extended partition is divided into segments known as logical drives.

command - pwd

Print Working Directory The pwd command simply displays the current directory you are working in. Any commands you use which don't specify a directory will assume your current one. The prompt on some distros will show your current working directory or a ~ symbol, which indicates you are in your home directory.

Linux File System Permissions

The Linux file system has a relatively simple security system compared to Windows NTFS. There are just three different rights: Read (r) Write (w) Execute (x)

Command line utilities for managing user information and groups...

The command-line utilities useradd, usermod, and userdel can be used to add, modify, and delete user information. The groupadd, groupmod, and groupdel commands can be used to manage groups.

Navigation in the Linux Directory Structure

The core commands that a technician should know to navigate the Linux file structure include ls, cp, mv, rm, and cd, along with many more. This table describes these commands and how to use them.

Linux Commands Words Options / Switches Arguments

The first "word" input is interpreted as the command. This could be a full or relative path to the executable or just the name of an executable stored in a directory identified by a PATH environment variable. The command "word" is completed by the first space character. Options (or switches) are used to change the operation of a command. They can be single letters (preceded by a single hyphen) or words (preceded by a double hyphen). The order the options are placed on the command is not important Arguments are values supplied to the command for it to operate on, such as file names. Arguments should be supplied in the correct order for the command's syntax.

Linux Kernel

The kernel is the software component that provides the core set of operating system functions. These include features for managing system hardware and for communicating between software and hardware.

passwd (Password Utility)

The passwd command allows a user to change their own password or superuser (root) to change or reset someone else's. When a user runs the command, Linux will prompt first for the existing password then the new one, twice. The superuser can reset another user's password by typing the user name after the command. The existing password is not required in this case. To reset the password for the user fredb, the superuser would enter the command passwd fredb

Linux User Accounts

The root user or the Superuser is the administrative account for Linux.

su (Switch User)

The su command allows a Linux user to switch to another user account, including superuser (or root) if another user id is not specified. The command will prompt the user for the password of the account (or root) before switching to it.

Bash Shell

Today many users of Linux still use the bash shell and server-based editions will often only have the command-line environment installed. Note: There are other CLI shells, include Bourne (sh), C Shell (csh), and Korn (ksh).

Primary Group

User accounts are linked to a primary group, which determines many aspects of security in Linux.

User Settings and Group Settings are stored where?

User settings are stored in the /etc/passwd file and group settings are stored in the /etc/group file.

What's the purpose of SWAP space

Virtual RAM

Swap Partition

Virtual memory allows a computer to use disk space to supplement the amount of system RAM installed. If applications or data files use up the available physical memory, "pages" of data from RAM can be written to swap space on a disk to free up some space. If the paged data is required again, it is transferred from the swap space back to RAM. Most default installations of Linux create a swap partition to use as swap space. The swap partition is formatted with a minimal kind of file system. It can only be used by the memory manager and not for storage of ordinary data files.

Virtual File System

When Linux boots, a system kernel and virtual file system are loaded to a RAM drive. The virtual file system identifies the location of the persistent root partition from the appropriate storage device and loads the file system stored on the disk.

How many partitions can be created with a Guid partition table?

When using GPT-style partions (Guid Partition Table), up to 128 partitions can be created on a disk. GPT is a newer partition style than MBR, however, MBR is still widely used.

You are setting up a Windows 10 PC. You plan on partitioning a hard drive. How many partitions can be created on the disk when using MBR-style partitions?

When using MBR-style (Master Boot Record) partitions, up to four primary partitions can be created. Only one of those partitions may be marked as active. There is a limitation of one extended partition. In that case only three primary partitions could be created, with the fourth being an extended partition.

fdisk

fdisk—used to create and manage partitions on a hard disk.

Linux File Editors - vi or vim

vi or vim is a text file editor derived from a UNIX original. Although this tool is very powerful, it is based on letter- and number-based commands to modify the text. For example, dd when pressed will delete the whole line the cursor is on; 5dd would delete 5 whole lines. When vi is in command mode, input such as this is interpreted as a command. To enter text, you need to switch to insert mode by pressing an appropriate command key. For example, i switches to insert mode at the current cursor position, a appends text after the current cursor position, A appends text at the end of the current line, and o inserts text on a new line below the current line. The Esc key switches from insert mode back to command mode. To save a file, use :w from command mode. To save and quit, use :wq. :q! quits without saving. There are other command-line editors, such as mcedit, nano, pico, or joe, that are easier to learn to use.


Related study sets

Chapter 21: The Immune System: Innate and Adaptive Body Defenses

View Set

Essentials of Investments: Chapter 10

View Set

2.5 Roadways and Their Unique Risks

View Set

Ch4 Analysing the marketing environment.

View Set

Final COMP 530 - Operating Systems

View Set