Linux Certifications

RHCSA Series: Reviewing Essential Commands & System Documentation – Part 1

RHCSA Series: Reviewing Essential Commands & System Documentation &-8211; Part 1 &-8211; this Article or News was published on this date:2019-05-28 18:51:05 kindly share it with friends if you find it helpful

RHCSA (Red Hat Certified System Administrator) is a certification exam from Red Hat company, which provides an open source operating system and software to the enterprise community, It also provides support, training and consulting services for the organizations.

RHCSA Exam GuideRHCSA Exam Guide

RHCSA Exam Preparation Guide

RHCSA exam is the certification obtained from Red Hat Inc, after passing the exam (codename EX200). RHCSA exam is an upgrade to the RHCT (Red Hat Certified Technician) exam, and this upgrade is compulsory as the Red Hat Enterprise Linux was upgraded. The main variation between RHCT and RHCSA is that RHCT exam based on RHEL 5, whereas RHCSA certification is based on RHEL 6 and 7, the courseware of these two certifications are also vary to a certain level.

This Red Hat Certified System Administrator (RHCSA) is essential to perform the following core system administration tasks needed in Red Hat Enterprise Linux environments:

  1. Understand and use necessary tools for handling files, directories, command-environments line, and system-wide / packages documentation.
  2. Operate running systems, even in different run levels, identify and control processes, start and stop virtual machines.
  3. Set up local storage using partitions and logical volumes.
  4. Create and configure local and network file systems and its attributes (permissions, encryption, and ACLs).
  5. Setup, configure, and control systems, including installing, updating and removing software.
  6. Manage system users and groups, along with use of a centralized LDAP directory for authentication.
  7. Ensure system security, including basic firewall and SELinux configuration.

To view fees and register for an exam in your country, check the RHCSA Certification page.

In this 15-article RHCSA series, titled Preparation for the RHCSA (Red Hat Certified System Administrator) exam, we will going to cover the following topics on the latest releases of Red Hat Enterprise Linux 7.

Part 1: Reviewing Essential Commands & System Documentation

In this Part 1 of the RHCSA series, we will explain how to enter and execute commands with the correct syntax in a shell prompt or terminal, and explained how to find, inspect, and use system documentation.

RHCSA Exam GuideRHCSA: Reviewing Essential Linux Commands – Part 1

RHCSA: Reviewing Essential Linux Commands – Part 1

Prerequisites:

At least a slight degree of familiarity with basic Linux commands such as:

  1. cd command (change directory)
  2. ls command (list directory)
  3. cp command (copy files)
  4. mv command (move or rename files)
  5. touch command (create empty files or update the timestamp of existing ones)
  6. rm command (delete files)
  7. mkdir command (make directory)

The correct usage of some of them are anyway exemplified in this article, and you can find further information about each of them using the suggested methods in this article.

Though not strictly required to start, as we will be discussing general commands and methods for information search in a Linux system, you should try to install RHEL 7 as explained in the following article. It will make things easier down the road.

  1. Red Hat Enterprise Linux (RHEL) 7 Installation Guide

Interacting with the Linux Shell

If we log into a Linux box using a text-mode login screen, chances are we will be dropped directly into our default shell. On the other hand, if we login using a graphical user interface (GUI), we will have to open a shell manually by starting a terminal. Either way, we will be presented with the user prompt and we can start typing and executing commands (a command is executed by pressing the Enter key after we have typed it).

Commands are composed of two parts:

  1. the name of the command itself, and
  2. arguments

Certain arguments, called options (usually preceded by a hyphen), alter the behavior of the command in a particular way while other arguments specify the objects upon which the command operates.

The type command can help us identify whether another certain command is built into the shell or if it is provided by a separate package. The need to make this distinction lies in the place where we will find more information about the command. For shell built-ins we need to look in the shell’s man page, whereas for other binaries we can refer to its own man page.

RHCSA Exam GuideCheck Shell built in Commands

Check Shell built in Commands

In the examples above, cd and type are shell built-ins, while top and less are binaries external to the shell itself (in this case, the location of the command executable is returned by type).

RHCSA Series: How to Perform File and Directory Management – Part 2

RHCSA Series: How to Perform File and Directory Management &-8211; Part 2 &-8211; this Article or News was published on this date:2019-05-28 18:48:50 kindly share it with friends if you find it helpful

In this article, RHCSA Part 2: File and directory management, we will review some essential skills that are required in the day-to-day tasks of a system administrator.

RHCSA: Perform File and Directory Management – Part 2RHCSA: Perform File and Directory Management – Part 2

RHCSA: Perform File and Directory Management – Part 2

Create, Delete, Copy, and Move Files and Directories

File and directory management is a critical competence that every system administrator should possess. This includes the ability to create / delete text files from scratch (the core of each program’s configuration) and directories (where you will organize files and other directories), and to find out the type of existing files.

The touch command can be used not only to create empty files, but also to update the access and modification times of existing files.

RHCSA: Perform File and Directory Management – Part 2touch command example

touch command example

You can use file [filename] to determine a file’s type (this will come in handy before launching your preferred text editor to edit it).

RHCSA: Perform File and Directory Management – Part 2file command example

file command example

and rm [filename] to delete it.

RHCSA: Perform File and Directory Management – Part 2Linux  rm command examples

rm command example

As for directories, you can create directories inside existing paths with mkdir [directory] or create a full path with mkdir -p [/full/path/to/directory].

RHCSA: Perform File and Directory Management – Part 2mkdir command example

mkdir command example

When it comes to removing directories, you need to make sure that they’re empty before issuing the rmdir [directory] command, or use the more powerful (handle with care!) rm -rf [directory]. This last option will force remove recursively the [directory] and all its contents – so use it at your own risk.

Input and Output Redirection and Pipelining

The command line environment provides two very useful features that allows to redirect the input and output of commands from and to files, and to send the output of a command to another, called redirection and pipelining, respectively.

To understand those two important concepts, we must first understand the three most important types of I/O (Input and Output) streams (or sequences) of characters, which are in fact special files, in the *nix sense of the word.

  1. Standard input (aka stdin) is by default attached to the keyboard. In other words, the keyboard is the standard input device to enter commands to the command line.
  2. Standard output (aka stdout) is by default attached to the screen, the device that “receives” the output of commands and display them on the screen.
  3. Standard error (aka stderr), is where the status messages of a command is sent to by default, which is also the screen.

In the following example, the output of ls /var is sent to stdout (the screen), as well as the result of ls /sfnews. But in the latter case, it is stderr that is shown.

RHCSA: Perform File and Directory Management – Part 2Linux input output redirect

Input and Output Example

To more easily identify these special files, they are each assigned a file descriptor, an abstract representation that is used to access them. The essential thing to understand is that these files, just like others, can be redirected. What this means is that you can capture the output from a file or script and send it as input to another file, command, or script. This will allow you to store on disk, for example, the output of commands for later processing or analysis.

To redirect stdin (fd 0), stdout (fd 1), or stderr (fd 2), the following operators are available.

Redirection Operator Effect
> Redirects standard output to a file containing standard output. If the destination file exists, it will be overwritten.
>> Appends standard output to a file.
2> Redirects standard error to a file containing standard output. If the destination file exists, it will be overwritten.
2>> Appends standard error to the existing file.
&> Redirects both standard output and standard error to a file; if the specified file exists, it will be overwritten.
Uses the specified file as standard input.
> The specified file is used for both standard input and standard output.

As opposed to redirection, pipelining is performed by adding a vertical bar (|) after a command and before another one.

Remember:

  1. Redirection is used to send the output of a command to a file, or to send a file as input to a command.
  2. Pipelining is used to send the output of a command to another command as input.

Examples Of Redirection and Pipelining

Example 1: Redirecting the output of a command to a file

There will be times when you will need to iterate over a list of files. To do that, you can first save that list to a file and then read that file line by line. While it is true that you can iterate over the output of ls directly, this example serves to illustrate redirection.

- ls -1 /var/mail > mail.txt
RHCSA: Perform File and Directory Management – Part 2Redirect output of command tot a file

Redirect output of command tot a file

Example 2: Redirecting both stdout and stderr to /dev/null

In case we want to prevent both stdout and stderr to be displayed on the screen, we can redirect both file descriptors to /dev/null. Note how the output changes when the redirection is implemented for the same command.

- ls /var /sfnews
- ls /var/ /sfnews &> /dev/null
RHCSA: Perform File and Directory Management – Part 2Redirecting stdout and stderr ouput to /dev/null

Redirecting stdout and stderr ouput to /dev/null

Example 3: Using a file as input to a command

While the classic syntax of the cat command is as follows.

- cat [file(s)]

You can also send a file as input, using the correct redirection operator.

- cat  mail.txt
RHCSA: Perform File and Directory Management – Part 2Linux cat command examples

cat command example

Example 4: Sending the output of a command as input to another

If you have a large directory or process listing and want to be able to locate a certain file or process at a glance, you will want to pipeline the listing to grep.

Note that we use to pipelines in the following example. The first one looks for the required keyword, while the second one will eliminate the actual grep command from the results. This example lists all the processes associated with the apache user.

- ps -ef | grep apache | grep -v grep
RHCSA: Perform File and Directory Management – Part 2Send output of command as input to another

Send output of command as input to another

RHCSA Series: How to Manage Users and Groups in RHEL 7 – Part 3

RHCSA Series: How to Manage Users and Groups in RHEL 7 &-8211; Part 3 &-8211; this Article or News was published on this date:2019-05-28 18:48:13 kindly share it with friends if you find it helpful

Managing a RHEL 7 server, as it is the case with any other Linux server, will require that you know how to add, edit, suspend, or delete user accounts, and grant users the necessary permissions to files, directories, and other system resources to perform their assigned tasks.

User and Group Management in LinuxUser and Group Management in Linux

RHCSA: User and Group Management – Part 3

Managing User Accounts

To add a new user account to a RHEL 7 server, you can run either of the following two commands as root:

- adduser [new_account]
- useradd [new_account]

When a new user account is added, by default the following operations are performed.

  1. His/her home directory is created (/home/username unless specified otherwise).
  2. These .bash_logout, .bash_profile and .bashrc hidden files are copied inside the user’s home directory, and will be used to provide environment variables for his/her user session. You can explore each of them for further details.
  3. A mail spool directory is created for the added user account.
  4. A group is created with the same name as the new user account.

The full account summary is stored in the /etc/passwd file. This file holds a record per system user account and has the following format (fields are separated by a colon):

[username]:[x]:[UID]:[GID]:[Comment]:[Home directory]:[Default shell]
  1. These two fields [username] and [Comment] are self explanatory.
  2. The second filed ‘x’ indicates that the account is secured by a shadowed password (in /etc/shadow), which is used to logon as [username].
  3. The fields [UID] and [GID] are integers that shows the User IDentification and the primary Group IDentification to which [username] belongs, equally.

Finally,

  1. The [Home directory] shows the absolute location of [username]’s home directory, and
  2. [Default shell] is the shell that is commit to this user when he/she logins into the system.

Another important file that you must become familiar with is /etc/group, where group information is stored. As it is the case with /etc/passwd, there is one record per line and its fields are also delimited by a colon:

[Group name]:[Group password]:[GID]:[Group members]

where,

  1. [Group name] is the name of group.
  2. Does this group use a group password? (An “x” means no).
  3. [GID]: same as in /etc/passwd.
  4. [Group members]: a list of users, separated by commas, that are members of each group.

After adding an account, at anytime, you can edit the user’s account information using usermod, whose basic syntax is:

- usermod [options] [username]

Read Also:
15 ‘useradd’ Command Examples
15 ‘usermod’ Command Examples

EXAMPLE 1: Setting the expiry date for an account

If you work for a company that has some kind of policy to enable account for a certain interval of time, or if you want to grant access to a limited period of time, you can use the --expiredate flag followed by a date in YYYY-MM-DD format. To verify that the change has been applied, you can compare the output of

- chage -l [username]

before and after updating the account expiry date, as shown in the following image.

User and Group Management in LinuxChange User Account Information

Change User Account Information

EXAMPLE 2: Adding the user to supplementary groups

Besides the primary group that is created when a new user account is added to the system, a user can be added to supplementary groups using the combined -aG, or –append –groups options, followed by a comma separated list of groups.

EXAMPLE 3: Changing the default location of the user’s home directory and / or changing its shell

If for some reason you need to change the default location of the user’s home directory (other than /home/username), you will need to use the -d, or –home options, followed by the absolute path to the new home directory.

If a user wants to use another shell other than bash (for example, sh), which gets assigned by default, use usermod with the –shell flag, followed by the path to the new shell.

EXAMPLE 4: Displaying the groups an user is a member of

After adding the user to a supplementary group, you can verify that it now actually belongs to such group(s):

- groups [username]
- id [username]

The following image depicts Examples 2 through 4:

User and Group Management in LinuxAdding User to Supplementary Group

Adding User to Supplementary Group

In the example above:

- usermod --append --groups gacanepa,users --home /tmp --shell /bin/sh sfnews

To remove a user from a group, omit the --append switch in the command above and list the groups you want the user to belong to following the --groups flag.

EXAMPLE 5: Disabling account by locking password

To disable an account, you will need to use either the -L (lowercase L) or the –lock option to lock a user’s password. This will prevent the user from being able to log on.

EXAMPLE 6: Unlocking password

When you need to re-enable the user so that he can log on to the server again, use the -U or the –unlock option to unlock a user’s password that was previously blocked, as explained in Example 5 above.

- usermod --unlock sfnews

The following image illustrates Examples 5 and 6:

User and Group Management in LinuxLock Unlock User Account

Lock Unlock User Account

EXAMPLE 7: Deleting a group or an user account

To delete a group, you’ll want to use groupdel, whereas to delete a user account you will use userdel (add the –r switch if you also want to delete the contents of its home directory and mail spool):

- groupdel [group_name]        - Delete a group
- userdel -r [user_name]       - Remove user_name from the system, along with his/her home directory and mail spool

If there are files owned by group_name, they will not be deleted, but the group owner will be set to the GID of the group that was deleted.

RHCSA Series: Editing Text Files with Nano and Vim / Analyzing text with grep and regexps – Part 4

RHCSA Series: Editing Text Files with Nano and Vim / Analyzing text with grep and regexps &-8211; Part 4 &-8211; this Article or News was published on this date:2019-05-28 18:47:47 kindly share it with friends if you find it helpful

Every system administrator has to deal with text files as part of his daily responsibilities. That includes editing existing files (most likely configuration files), or creating new ones. It has been said that if you want to start a holy war in the Linux world, you can ask sysadmins what their favorite text editor is and why. We are not going to do that in this article, but will present a few tips that will be helpful to use two of the most widely used text editors in RHEL 7: nano (due to its simplicity and easiness of use, specially to new users), and vi/m (due to its several features that convert it into more than a simple editor). I am sure that you can find many more reasons to use one or the other, or perhaps some other editor such as emacs or pico. It’s entirely up to you.

Learn Nano and vi EditorsLearn Nano and vi Editors

RHCSA: Editing Text Files with Nano and Vim – Part 4

Editing Files with Nano Editor

To launch nano, you can either just type nano at the command prompt, optionally followed by a filename (in this case, if the file exists, it will be opened in edition mode). If the file does not exist, or if we omit the filename, nano will also be opened in edition mode but will present a blank screen for us to start typing:

Learn Nano and vi EditorsNano Editor

Nano Editor

As you can see in the previous image, nano displays at the bottom of the screen several functions that are available via the indicated shortcuts (^, aka caret, indicates the Ctrl key). To name a few of them:

  1. Ctrl + G: brings up the help menu with a complete list of functions and descriptions:Ctrl + X: exits the current file. If changes have not been saved, they are discarded.
  2. Ctrl + R: lets you choose a file to insert its contents into the present file by specifying a full path.
Learn Nano and vi EditorsNano Editor Help Menu

Nano Editor Help Menu

  1. Ctrl + O: saves changes made to a file. It will let you save the file with the same name or a different one. Then press Enter to confirm.
Learn Nano and vi EditorsNano Editor Save Changes Mode

Nano Editor Save Changes Mode

  1. Ctrl + X: exits the current file. If changes have not been saved, they are discarded.
  2. Ctrl + R: lets you choose a file to insert its contents into the present file by specifying a full path.
Learn Nano and vi EditorsNano: Insert File Content to Parent File

Nano: Insert File Content to Parent File

will insert the contents of /etc/passwd into the current file.

  1. Ctrl + K: cuts the current line.
  2. Ctrl + U: paste.
  3. Ctrl + C: cancels the current operation and places you at the previous screen.

To easily navigate the opened file, nano provides the following features:

  1. Ctrl + F and Ctrl + B move the cursor forward or backward, whereas Ctrl + P and Ctrl + N move it up or down one line at a time, respectively, just like the arrow keys.
  2. Ctrl + space and Alt + space move the cursor forward and backward one word at a time.

Finally,

  1. Ctrl + _ (underscore) and then entering X,Y will take you precisely to Line X, column Y, if you want to place the cursor at a specific place in the document.
Learn Nano and vi EditorsNavigate to Line Numbers in Nano

Navigate to Line Numbers in Nano

The example above will take you to line 15, column 14 in the current document.

If you can recall your early Linux days, specially if you came from Windows, you will probably agree that starting off with nano is the best way to go for a new user.

Editing Files with Vim Editor

Vim is an improved version of vi, a famous text editor in Linux that is available on all POSIX-compliant *nix systems, such as RHEL 7. If you have the chance and can install vim, go ahead; if not, most (if not all) the tips given in this article should also work.

One of vim’s distinguishing features is the different modes in which it operates:

  1. Command mode will allow you to browse through the file and enter commands, which are brief and case-sensitive combinations of one or more letters. If you need to repeat one of them a certain number of times, you can prefix it with a number (there are only a few exceptions to this rule). For example, yy (or Y, short for yank) copies the entire current line, whereas 4yy (or 4Y) copies the entire current line along with the next three lines (4 lines in total).
  2. In ex mode, you can manipulate files (including saving a current file and running outside programs or commands). To enter ex mode, we must type a colon (:) starting from command mode (or in other words, Esc + :), directly followed by the name of the ex-mode command that you want to use.
  3. In insert mode, which is accessed by typing the letter i, we simply enter text. Most keystrokes result in text appearing on the screen.
  4. We can always enter command mode (regardless of the mode we’re working on) by pressing the Esc key.

Let’s see how we can perform the same operations that we outlined for nano in the previous section, but now with vim. Don’t forget to hit the Enter key to confirm the vim command!

To access vim’s full manual from the command line, type :help while in command mode and then press Enter:

Learn Nano and vi Editorsvim Edito Help Menu

vim Edito Help Menu

The upper section presents an index list of contents, with defined sections dedicated to specific topics about vim. To navigate to a section, place the cursor over it and press Ctrl + ] (closing square bracket). Note that the bottom section displays the current file.

1. To save changes made to a file, run any of the following commands from command mode and it will do the trick:

:wq!
:x!
ZZ (yes, double Z without the colon at the beginning)

2. To exit discarding changes, use :q!. This command will also allow you to exit the help menu described above, and return to the current file in command mode.

3. Cut N number of lines: type Ndd while in command mode.

4. Copy M number of lines: type Myy while in command mode.

5. Paste lines that were previously cutted or copied: press the P key while in command mode.

6. To insert the contents of another file into the current one:

:r filename

For example, to insert the contents of /etc/fstab, do:

Learn Nano and vi EditorsInsert Content of File in vi Editor

Insert Content of File in vi Editor

7. To insert the output of a command into the current document:

:r! command

For example, to insert the date and time in the line below the current position of the cursor:

Learn Nano and vi EditorsInsert Time an Date in vi Editor

Insert Time an Date in vi Editor

In another article that I wrote for, (Part 2 of the LFCS series), I explained in greater detail the keyboard shortcuts and functions available in vim. You may want to refer to that tutorial for further examples on how to use this powerful text editor.

RHCSA Series: Process Management in RHEL 7: Boot, Shutdown, and Everything in Between – Part 5

RHCSA Series: Process Management in RHEL 7: Boot, Shutdown, and Everything in Between – Part 5 &-8211; this Article or News was published on this date:2019-05-28 18:47:16 kindly share it with friends if you find it helpful

We will start this article with an overall and brief revision of what happens since the moment you press the Power button to turn on your RHEL 7 server until you are presented with the login screen in a command line interface.

RHEL 7 Boot ProcessRHEL 7 Boot Process

Linux Boot Process

Please note that:

1. the same basic principles apply, with perhaps minor modifications, to other Linux distributions as well, and
2. the following description is not intended to represent an exhaustive explanation of the boot process, but only the fundamentals.

Linux Boot Process

1. The POST (Power On Self Test) initializes and performs hardware checks.

2. When the POST finishes, the system control is passed to the first stage boot loader, which is stored on either the boot sector of one of the hard disks (for older systems using BIOS and MBR), or a dedicated (U)EFI partition.

3. The first stage boot loader then loads the second stage boot loader, most usually GRUB (GRand Unified Boot Loader), which resides inside /boot, which in turn loads the kernel and the initial RAM–based file system (also known as initramfs, which contains programs and binary files that perform the necessary actions needed to ultimately mount the actual root filesystem).

4. We are presented with a splash screen that allows us to choose an operating system and kernel to boot:

RHEL 7 Boot ProcessRHEL 7 Boot Screen

Boot Menu Screen

5. The kernel sets up the hardware attached to the system and once the root filesystem has been mounted, launches process with PID 1, which in turn will initialize other processes and present us with a login prompt.

Note: That if we wish to do so at a later time, we can examine the specifics of this process using the dmesg command and filtering its output using the tools that we have explained in previous articles of this series.

RHEL 7 Boot ProcessLogin Screen and Process PID

Login Screen and Process PID

In the example above, we used the well-known ps command to display a list of current processes whose parent process (or in other words, the process that started them) is systemd (the system and service manager that most modern Linux distributions have switched to) during system startup:

- ps -o ppid,pid,uname,comm --ppid=1

Remember that the -o flag (short for –format) allows you to present the output of ps in a customized format to suit your needs using the keywords specified in the STANDARD FORMAT SPECIFIERS section in man ps.

Another case in which you will want to define the output of ps instead of going with the default is when you need to find processes that are causing a significant CPU and / or memory load, and sort them accordingly:

- ps aux --sort=+pcpu              - Sort by %CPU (ascending)
- ps aux --sort=-pcpu              - Sort by %CPU (descending)
- ps aux --sort=+pmem              - Sort by %MEM (ascending)
- ps aux --sort=-pmem              - Sort by %MEM (descending)
- ps aux --sort=+pcpu,-pmem        - Combine sort by %CPU (ascending) and %MEM (descending)
RHEL 7 Boot ProcessCustomize ps Command Output

Customize ps Command Output

An Introduction to SystemD

Few decisions in the Linux world have caused more controversies than the adoption of systemd by major Linux distributions. Systemd’s advocates name as its main advantages the following facts:

Read Also: The Story Behind ‘init’ and ‘systemd’

1. Systemd allows more processing to be done in parallel during system startup (as opposed to older SysVinit, which always tends to be slower because it starts processes one by one, checks if one depends on another, and then waits for daemons to launch so more services can start), and

2. It works as a dynamic resource management in a running system. Thus, services are started when needed (to avoid consuming system resources if they are not being used) instead of being launched without a valid reason during boot.

3. Backwards compatibility with SysVinit scripts.

Systemd is controlled by the systemctl utility. If you come from a SysVinit background, chances are you will be familiar with:

  1. the service tool, which -in those older systems- was used to manage SysVinit scripts, and
  2. the chkconfig utility, which served the purpose of updating and querying runlevel information for system services.
  3. shutdown, which you must have used several times to either restart or halt a running system.

The following table shows the similarities between the use of these legacy tools and systemctl:

Legacy tool Systemctl equivalent Description
service name start systemctl start name Start name (where name is a service)
service name stop systemctl stop name Stop name
service name condrestart systemctl try-restart name Restarts name (if it’s already running)
service name restart systemctl restart name Restarts name
service name reload systemctl reload name Reloads the configuration for name
service name status systemctl status name Displays the current status of name
service –status-all systemctl Displays the status of all current services
chkconfig name on systemctl enable name Enable name to run on startup as specified in the unit file (the file to which the symlink points). The process of enabling or disabling a service to start automatically on boot consists in adding or removing symbolic links inside the /etc/systemd/system directory.
chkconfig name off systemctl disable name Disables name to run on startup as specified in the unit file (the file to which the symlink points)
chkconfig –list name systemctl is-enabled name Verify whether name (a specific service) is currently enabled
chkconfig –list systemctl –type=service Displays all services and tells whether they are enabled or disabled
shutdown -h now systemctl poweroff Power-off the machine (halt)
shutdown -r now systemctl reboot Reboot the system

Systemd also introduced the concepts of units (which can be either a service, a mount point, a device, or a network socket) and targets (which is how systemd manages to start several related process at the same time, and can be considered -though not equal- as the equivalent of runlevels in SysVinit-based systems.

Summing Up

Other tasks related with process management include, but may not be limited to, the ability to:

1. Adjust the execution priority as far as the use of system resources is concerned of a process:

This is accomplished through the renice utility, which alters the scheduling priority of one or more running processes. In simple terms, the scheduling priority is a feature that allows the kernel (present in versions => 2.6) to allocate system resources as per the assigned execution priority (aka niceness, in a range from -20 through 19) of a given process.

The basic syntax of renice is as follows:

- renice [-n] priority [-gpu] identifier

In the generic command above, the first argument is the priority value to be used, whereas the other argument can be interpreted as process IDs (which is the default setting), process group IDs, user IDs, or user names. A normal user (other than root) can only modify the scheduling priority of a process he or she owns, and only increase the niceness level (which means taking up less system resources).

RHEL 7 Boot ProcessRenice Process  in Linux

Process Scheduling Priority

2. Kill (or interrupt the normal execution) of a process as needed:

In more precise terms, killing a process entitles sending it a signal to either finish its execution gracefully (SIGTERM=15) or immediately (SIGKILL=9) through the kill or pkill commands.

The difference between these two tools is that the former is used to terminate a specific process or a process group altogether, while the latter allows you to do the same based on name and other attributes.

In addition, pkill comes bundled with pgrep, which shows you the PIDs that will be affected should pkill be used. For example, before running:

- pkill -u gacanepa

It may be useful to view at a glance which are the PIDs owned by gacanepa:

- pgrep -l -u gacanepa
RHEL 7 Boot ProcessFind PIDs of User

Find PIDs of User

By default, both kill and pkill send the SIGTERM signal to the process. As we mentioned above, this signal can be ignored (while the process finishes its execution or for good), so when you seriously need to stop a running process with a valid reason, you will need to specify the SIGKILL signal on the command line:

- kill -9 identifier               - Kill a process or a process group
- kill -s SIGNAL identifier        - Idem
- pkill -s SIGNAL identifier       - Kill a process by name or other attributes 

Conclusion

In this article we have explained the basics of the boot process in a RHEL 7 system, and analyzed some of the tools that are available to help you with managing processes using common utilities and systemd-specific commands.

Note that this list is not intended to cover all the bells and whistles of this topic, so feel free to add your own preferred tools and commands to this article using the comment form below. Questions and other comments are also welcome.