0% found this document useful (0 votes)
52 views19 pages

Introduction To Suse Linux Enterprise Server (Sles) : Opensap

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views19 pages

Introduction To Suse Linux Enterprise Server (Sles) : Opensap

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

openSAP

Introduction to SUSE Linux Enterprise Server


(SLES)
Week 4 Unit 1

00:00:09 Hello and welcome to week four, the last week of our openSAP course,
00:00:15 an Introduction to SUSE Linux Enterprise Server. My name is Craig Cole.
00:00:19 I am an instructional designer and training engineer at SUSE.
00:00:24 This week, you will learn about storage administration and shells.
00:00:28 I will take you through SUSE Linux Enterprise Server storage administration, the shell
environment, process administration basics,
00:00:37 and process scheduling. Let's get started with the first unit of this week
00:00:42 on SUSE Linux Enterprise Server storage administration. To begin, we need to define what's
called
00:00:50 the Linux I/O stack. This is simply a diagram here on this slide
00:00:57 that illustrates the components that go into making storage available to end-users
00:01:03 or to even applications. You notice down at the bottom we have
00:01:08 our physical storage layer. This is where our disks are actually located.
00:01:13 Then we have our disk access protocol. This is going to be like SCSI or fiber channel or ATA.

00:01:22 Then you have your logical storage layer, the next layer up. This is where Device-Mapper,
LVM...
00:01:30 where I can do things like multi-pathing, that's where that's going to be controlled.
00:01:35 Then we have the block device layer. This is where block devices show up.
00:01:40 Remember the kernel uses the block devices to make sure that... or to interact with it, to make
sure that
00:01:47 data is available farther up the stack. Then you have the file system layer,
00:01:54 and we're going to talk about the various different types of file systems.
00:01:57 And then, of course, the file system mount layer, where the actual files and directories, the
FHS
00:02:04 is applied at that layer. So that's the Linux I/O stack, from physical layer
00:02:10 all the way up to where files are located up at the top. Now, before we can start putting any
files
00:02:17 on any storage device, we have to format, or partition and format, those locations.
00:02:25 Partitioning being the first step. There are multiple tools that can be used
00:02:30 for performing partitions or partition creation and management on SUSE Linux Enterprise
Server.
00:02:37 We have the YaST partitioner tool, or partitioner module, and its job is to perform those
partitioning tasks
00:02:45 either through a graphical or ncurses interface for both partitioning but also for formatting
00:02:52 and handling block devices. It also allows for other file system management pieces
00:02:58 such as formatting the creation of raid arrays and so forth can also be done inside of this tool.

00:03:05 We also have the fdisk utility. fdisk is ubiquitous and has been around
00:03:10 for a very long time in various different operating systems. It's a traditional command-line tool
for manipulating MS-DOS
00:03:18 or MBR – Master Boot Record – type partition definitions. There's also a new one, or relatively
new, called parted.
00:03:28 Now, parted is a command-line tool that handles both the Master Boot Record or MS-DOS
type partition tables
00:03:35 but also handles the newer GPT type partitions. We're going to be discussing those two
partition types
00:03:42 in just a minute. But as you can see, you can see on the left
00:03:46 at the bottom here, we can see the partitioner tool inside of YaST.
00:03:50 In the middle, we can see fdisk, and you can see also parted on the right.
00:03:56 Notice that parted and fdisk share some similarities. They are similar in a lot of ways although
not identical.
00:04:03 We'll be talking about those utilities in just a minute. Now first of all though, let's talk about
00:04:10 the two different partition types. This is important because these partitions
00:04:14 define certain capabilities of your operating system when it comes to storage.
00:04:20 Now, the traditional way to do partitioning on a SUSE Linux box and most other operating
systems as well
00:04:28 has been to use the Master Boot Record, or MBR, partitioning MS-DOS type partitioning type.

00:04:35 This uses a boot loader inside of a very short section, 446 bytes, a partition table stored in just
64 bytes,
00:04:47 and a magic number section. The problem with the Master Boot Record
00:04:51 is it has some limitations. It's limited to two-terabyte hard drives.
00:04:56 It can only go up so high on size. Now, the globally unique partition table,
00:05:03 or as we call it, GPT, is much more flexible. It doesn't have the limitations that MBR has.
00:05:11 It has a protected Master Boot Record section of 512 bytes, but on top of that, it has a GPT
header which is 512 bytes
00:05:21 and each partition entry takes up 128 bytes. Now within this, the Master Boot Record
00:05:29 all has to be contained within that 512 bytes that it has available to it.
00:05:36 The globally unique partition table, on the other hand, can expand where those definitions sit
00:05:43 and thus can indefinitely include additional entries for partitioning.
00:05:48 Not that we're saying that you need to partition everything so that it has hundreds or even
thousands of partitions,
00:05:54 but it is possible to have hundreds or even thousands of partitions if you choose to under GPT.

00:06:00 We're hoping you don't do that. Now, the other thing that is not a limitation under the GPT,
00:06:08 or globally unique partition table, is that the size of the partition or size of the hard disk
00:06:13 that it addresses is much larger. It's limited to only 9.2 zettabytes of hard drive.
00:06:20 Now I say that with a little bit of irony or sarcasm, but the point is that 9.2 zettabytes is a lot of
data
00:06:27 and much beyond the terabytes, the petabytes, the exabytes, it's the next one up.
00:06:33 So, it's a very large amount of disk space that it's capable of handling.
00:06:38 So, that's the partition types: MBR and globally unique partition table, or GPT.
00:06:45 Device files for block devices are handled a little bit differently under MBR and GPT,
00:06:53 and we need to discuss that. Under MBR, sometimes called MS-DOS partition types,
00:06:59 the partitions are categorized as primary, which... you can only have four primary partitions
with MBR

2
00:07:09 on each drive or disk, but you can take a primary partition and sacrifice it
00:07:17 or turn it into an extended partition. The extended partition,
00:07:21 we don't assign anything into it. All we do is we make it a container
00:07:24 where we can put the next one, which is called a logical partition, inside of it.
00:07:29 This is a sub-partition, and we can have any number of logical partitions underneath it.
00:07:35 So, under this MS-DOS or MBR partition type, under primary partitions,
00:07:43 each device, and let's say it's SCSI, would be defined as a device file under the dev directory,

00:07:50 sda, sdb, sdc for the first, the second, and the third partitions...
00:08:01 as I described it. First, second, and third partitions of a SCSI device: sda, sdb, sdc.
00:08:09 Now, extended partitions are not directly referenced inside of the device files because we don't
ever write data
00:08:17 to an extended partition. We write data to logical partitions
00:08:22 inside of an extended partition. The first logical partition therefore,
00:08:27 since we have four primary partitions and one extended has been turned
00:08:34 from a primary partition, is sda5 if we were using the first SCSI device in a system.
00:08:43 So, dev/sda5 would be the first logical partition inside of an extended partition,
00:08:49 which is actually a type of primary partition. GPT partitions are all primary partitions.
00:08:57 They don't have this need, and they have no special numbering rules
00:09:01 that have to go into them. They're simply numbered as needed.
00:09:06 They do follow the, usually, sda with 1, 2, 3, and 4, but there are some caveats and we'll talk
about them
00:09:14 when we start talking about the mounting and how they're recognized by the system.
00:09:20 But first of all, let's talk about the supported file systems that show up inside of this.
00:09:26 So, we figured out how to do partitioning, we could use those tools, and we know that we can
use
00:09:31 either MBR, that's MS-DOS for 2 terabyte or smaller drives, and then we can use GPT for
larger drives.
00:09:39 We also need to put a file system on them before we can put data on top of them.
00:09:44 The file systems that are supported in SUSE Linux Enterprise Server 15
00:09:50 can be defined as traditional, that's Ext2, Ext3, and Ext4. Those are considered traditional
Linux file systems.
00:10:00 And we have XFS, which is the default in SUSE Linux Enterprise Server 12 and 15 for data
partitions,
00:10:08 and "better-f-s" or "butter-f-s", that's B-t-r-f-s, which is the default for SUSE Linux Enterprise 12
and 15
00:10:17 for the root partition – that's sometimes called the system volume.
00:10:21 And then there are things like JFS and NTFS and VFAT that also play into this.
00:10:28 Now, how do we actually create or put these file systems on there?
00:10:32 This is a destructive format, or that's what formatting is,
00:10:36 so it will delete data that's already on there, so be careful with these tools.
00:10:40 But you would use the mkfs, that's "make file system", dot, and then the file system type you
want to create.
00:10:47 It's a command line tool and will generate the file system in the partition or target that you
define.
00:10:54 mkfs.ext4, space, and the device you want to format would create an Ext4 partition in that
location.
00:11:06 Now, from an application perspective, in most cases, the file system doesn't actually matter

3
00:11:16 to the application because of the use of what's called
00:11:21 the Virtual Filesystem Switch, sometimes just called the virtual filesystem, or VFS.
00:11:29 VFS makes the filesystem opaque. On other operating systems, you only use
00:11:35 one filesystem, you don't use a menagerie or a mix of various filesystems.
00:11:42 But using VFS, we can get around some of the difficulties. When you write a file to a different
filesystem,
00:11:49 it might use different methods to actually store the data, that's what filesystems do.
00:11:55 However, the VFS makes it so it's transparent to applications all the way down
00:12:01 to the actual storage device. In other words, VFS is an abstraction layer,
00:12:06 the virtual filesystem switch, or virtual file system, and a request to write or read something
00:12:13 from the filesystem is interpreted by the VFS and then handed down to whichever filesystem
00:12:19 is underneath it. Again, making it opaque or abstracted
00:12:27 from the actual application. So, VFS, very useful in making sure that that gets done
00:12:34 regardless of the application. Now, another important piece for file systems
00:12:39 in SUSE Linux Enterprise Server is the use of the fstab file in the etc directory.
00:12:45 This stands for file systems table or file systems table inside of or on that SUSE Linux
Enterprise Server.
00:12:53 It's the primary configuration file for determining where, how, and when a partition and other
storage devices
00:13:01 are to be mounted on the local system. There are six fields that define what it's supposed to
be.
00:13:08 The first field is either the name of the device, the file system label itself, or what's called a
UUID
00:13:16 that stands for universal unique identifier and it's a system-generated identifier
00:13:23 for a particular hard drive or partition. Field two is the mount point.
00:13:29 So, field one is the device itself. Field two is the place that it's opposed to be mounted
00:13:35 inside of the file system so I can access it. Field three is the filesystem type.
00:13:40 Is it btrfs? Is it xfs? Is it ext3? Is it swap? What is it?
00:13:46 Then you have the mount options, and these will be things like
00:13:52 whether the root user can access this, whether a regular user can access this, and so forth.
00:14:00 defaults is a menagerie of various settings that are defined elsewhere.
00:14:07 So that's another one that will show up there. So those are mount options,
00:14:11 and then you have two last fields. One of them is: Should we use the dump utility
00:14:15 to perform backups? And the last one is: What is the sequence
00:14:20 of file system checks that we should perform on that particular thing?
00:14:24 You'll notice that in this example, this is an example of a running system,
00:14:29 that none of all of those things are value, meaning that the dump utility is not used
00:14:34 and no automatic file system checks are already defined. So that's the fstab file:
00:14:40 The file that configures where, how, and when a partition is to be mounted automatically or
otherwise.
00:14:49 All right, so we've talked about our device files, we've talked about the file systems,
00:14:54 but how do we actually get those partitions, those devices, how do we get them available to an
end user or to a person?
00:15:02 Well, as an administrator, we could put them in the etc/fstab file.
00:15:06 But what if we need to just mount it manually? Well, there's a tool for that, it's called mount, m-
o-u-n-t.
00:15:13 The corollary for removing a mount is called umount, not UNmount,

4
00:15:19 u-m-o-u-n-t, for unmount. Some examples of things that we can do with it.
00:15:24 We could take and mount a file up on to the system, or a file system into the system.
00:15:30 The most typical place is the /mnt directory for temporarily accessing, let's say,
00:15:37 a thumb drive or something else that we may be selecting. We might also want to simply know
what block devices
00:15:44 we have available to us. So there's a tool, and that's the first screenshot there,
00:15:49 lsblk that will list the block devices that are currently attached to the system
00:15:55 or that the system is currently aware of. You also have the blkid command.
00:16:00 blkid allows you to see not only the device itself, the device file name, but also the UUID
00:16:09 that is assigned to it. And you can see that in the second screenshot there.
00:16:15 So we can see the devices, we can see the block, the UUID that's associated with it,
00:16:21 and if we back up for just a moment and look inside of the fstab file,
00:16:26 you'll notice that the UUID is stated. This is the default in most current Linux distributions.
00:16:34 Now, what other tools do we see out there? We see the df and du utilities – that's listing disk
free or free disk space,
00:16:43 and du, which is listing the amount of used disk space. We might have lsof, which is a list of
open files,
00:16:53 and fuser, which displays the process IDs, the PIDs, of processes using a specific file.
00:17:03 So, very useful tools for tracking what's happening on a system and at least seeing
00:17:09 how the file system's being used, partitions are being used, and what block devices are
available to us.
00:17:17 That concludes our first unit for this week. In the next unit, you will learn about the shell
environment.
00:17:23 Thank you.

5
Week 4 Unit 2

00:00:09 Hello, and welcome to week four, unit two of our openSAP course,
00:00:14 an Introduction to SUSE Linux Enterprise Server. My name is Craig Cole,
00:00:18 and I am an instructional designer and training engineer at SUSE.
00:00:22 In this unit, you will learn about the SUSE Linux Enterprise Server shell environment.
00:00:27 Let's get started. First of all, what is a shell?
00:00:31 A shell is the most basic user interface to SUSE Linux Enterprise Server.
00:00:37 It's also referred to as the command line interface. The shell itself is a little more complex than
that,
00:00:44 and we'll be discussing the details of that. There are multiple shells available
00:00:49 to SUSE Linux Enterprise Server, and they're listed in a file in the etc directory called shells,
00:00:55 so /etc/shells. The default shell is the Bourne Again SHell,
00:01:01 b-o-u-r-n-e, also just referred to as bash. That is the default for SUSE Linux Enterprise Server,

00:01:10 and although it is the default, it's not the only one available.
00:01:14 If some people come from different Unix-like environments, they frequently will prefer things...

00:01:21 maybe not the bash shell, but c shell, which is also available, the korn shell, ksh,
00:01:29 tcsh, also the enhanced c shell is how we refer to that one. You have the zsh, the z shell as
well,
00:01:37 and there are a bunch of others. As you can see from the screenshot there,
00:01:41 you can see that /etc/shells has a bunch of other items in there as well.
00:01:46 We're not going to go through all of them. Just know that there is a list, an extensive list
00:01:51 of various shells that might be of use to you as you're working with SUSE Linux Enterprise
Server.
00:01:58 So the shell environment entails more than just the shell itself and includes variables,
functions,
00:02:06 and aliases that make your work environment from the command line, or from the shell,
behave a certain way
00:02:15 or be customized the way that you prefer. Variables are the most commonly customized part
00:02:22 of a shell environment, and although there are functions, most of which are tied to the type of
shell
00:02:28 that you're using, those can be changed and modified as well, and of course, aliases,
00:02:34 which are shortcuts to more complex typed-out content that can be used with shorter amount
of input.
00:02:43 So as an example, you might do an ls -l in order to get a long listing of a directory's output,
00:02:52 but in SUSE Linux, there is a built-in shortcut or alias, and it's the ll shortcut.
00:02:59 So just type ll and hit Enter and you get the same output as an ls -l, and that's an alias.
00:03:05 We'll be talking more about aliases later. A shell can be invoked in multiple ways.
00:03:12 There are two primary ways that we work with them. There are login shells and non-login
shells.
00:03:19 A login shell entails the user's preferences or preferred environment.
00:03:25 That's the variables, the functions, and the aliases being loaded in and applied to that
command line environment.
00:03:33 There's also a non-login shell. This is where it inherits the shell environment,
00:03:39 inherits its variables, functions, and aliases from an existing or already launched and
established shell.

6
00:03:49 To get a login shell and to tell whether you're in a login shell,
00:03:54 you'll have to put a username and password in there. So that's one way that you know that
you're getting
00:03:59 a login shell, hence, the name login shell. Then you also can request a login shell.
00:04:05 There's more than one way to do it. But one of the ways is to put a --login
00:04:11 as you launch the environment to request that login shell. A non-login shell doesn't prompt you

00:04:19 for a username and password, and some ways that you will see a non-login shell show up
00:04:25 is if you're in something like the Xwindows environment and you launch a gnome terminal.
00:04:32 That will come up, will put you at a prompt and won't have asked you for a username and
password, because the username
00:04:39 and password has probably been entered previously in order to get into that desktop
environment.
00:04:45 Down at the bottom we have two examples, on the left, of a login shell process,
00:04:50 where we're asked for the username or the login ID, and then on the right,
00:04:55 that is a gnome terminal environment, which is a non-login shell.
00:05:01 Okay, so that's the shell environment in a nutshell, but we also have to define where
00:05:08 and how each of these environments are set up. And we use a bunch of different files in order
to do that.
00:05:16 On the left-hand side of this particular slide, you can see the global profiles
00:05:23 – that's for all users – are declared first, and they're in a file called /etc/profile.
00:05:30 But there are variants and variations that can be made to include additional customizations
00:05:38 to your shell environment at the global level. That means global for all users.
00:05:43 The /etc/profile.d directory... anything with a .sh in that directory
00:05:49 would be read in as part of the profile, and you might also have your own customized version

00:05:55 of the /etc/profile called profile.local. Now, .local files are important
00:06:01 because .local files make sure that if there's an update to the RPM package that provides
00:06:10 the /etc/profile file itself, it doesn't overwrite your own customizations.
00:06:17 You put your customizations inside of the .local file, and that ensures that your file won't get
overwritten.
00:06:25 After the /etc/profile and those variations are added in, then the bash.bashrc
00:06:34 in the etc directory is read. There are also subvariants of that in the
00:06:40 bash_completion.d directory, and the bash.bashrc.local file.
00:06:48 Again, that local file allowing us to put customizations in there without worry that an update to
the package
00:06:55 that installed the bash.bashrc file would override our changes.
00:07:01 After we've set – and those are for global environment components – the /etc/profile and the
etc/bash.bashrc,
00:07:11 we then have user-specific profiles in the home directory. That home directory is referenced by
that tilde key, that squiggly line.
00:07:20 In the home directory for each user, there is a .profile, a .bashrc, and a .alias file.
00:07:28 These are customizations that the user can make to override settings that are made higher up

00:07:35 as far as their bash environment. This would be similar to changing the way
00:07:40 that your desktop looks: changing the background, changing resolution, modifying where icons
are laid out,

7
00:07:47 except you're doing it inside of a command line environment in determining how that interface

00:07:51 will work for you. So on the left, we have the files and which ones are called
00:07:56 in what order, at least from a global perspective down to the end user,
00:08:02 but we haven't really described exactly the order in a global scale from start to finish,
00:08:09 how a user's profile, how a user's command line shell environment will be defined.
00:08:16 That's what's on the right-hand side. As we are talking about login shells,
00:08:21 the first 10 items there are read in. We start with the global items.
00:08:26 We set a global set of profile, profile.d, profile.local, then we read the local user, the individual
user's profile.
00:08:37 Then we read the global bashrc file and the bashrc, bash_completion, bash.bashrc.local,
00:08:46 and then we do inputrc, .bashrc in the home directory, and .alias.
00:08:51 In other words, we start with the global settings, and then we go to the individuals' own
customizations,
00:08:57 and we let them override any settings that they prefer in order to make their environment work
for them.
00:09:04 For a non-login shell, you don't read all of those things.
00:09:07 You'll notice that we don't read profile, either the global profile or the individual user's profile,
00:09:15 but we do read bashrc and the alias file. So non-login shells have a little bit of
00:09:22 reading in of information from the individual user's environment.
00:09:26 But if you want the full experience, you request a full login shell in order to get access to all
00:09:33 of your specific environment variables and set up the shell the way you want.
00:09:38 Okay, so that's shell variables in the environment, the files where we make our changes to
customize it
00:09:45 and the order in which they're read. You make sure that you put
00:09:49 your personal changes further down the list, so that you get yours overriding global settings.
00:09:56 There are also what are called aliases. We've referenced aliases, but aliases are ways
00:10:02 to make longer what would be typed commands shrunk down to a shorter level of input,
00:10:09 a shorter number of input. To define an alias you use the alias command.
00:10:15 So alias, space, the name of the alias itself, and the command you want to be executed
00:10:22 when that alias is called. You can remove an alias with an unalias,
00:10:28 and you can actually just see what aliases are on the system or are inside of your shell
environment by typing
00:10:35 the word alias, and will list all of them. If you want to define your own so that every time
00:10:41 you start up they are maintained, you would put them inside of your own home directory in the
.alias file,
00:10:49 and then they would be read in at the creation of a login shell for you, or a non-login shell.
00:10:55 If you remember, the alias file is also read in a non-login shell. Aliases are again very useful,
taking long commands,
00:11:03 shrinking them down to something smaller and easier for you remember,
00:11:06 and command line stuff can actually be quite long at times. Another component of the shell is
the working
00:11:15 with the history. For each user, in their home directory,
00:11:20 there is a bash_history file, where each command that's been entered at the command line,
00:11:25 or at a shell, is stored. To view the history, you can just type the word history
00:11:31 and then scroll through it with the arrow keys if you need to.
00:11:35 We can also search for or work with the strings inside of it, page up and page down will shift
00:11:42 through that history as it's been output. We can also do a more complex searching

8
00:11:49 through our history with ctrl+r when in a shell, and then type the string that you want,
00:11:54 and it will start listing the various things that start with that string.
00:12:00 As it gets listed out, once you find the one you want, if it's exactly the one you want,
00:12:05 you can just hit Enter to execute that command again, or you can hit the Tab key and make
changes to it
00:12:11 and then execute it. Recursively searching through your history,
00:12:15 which is what the Ctrl+r does, is very useful when repeatedly working with longer commands.

00:12:22 We can also re-execute a command after having typed history. There's a number next to it,
00:12:29 and you can type exclamation point and then that number, and it will re-execute that number
from your history.
00:12:36 So that could be very useful. There's an example of the history command
00:12:40 and those numbers on the right-hand side there. So that's your shell history.
00:12:46 What about other functions of the shell? Well, tab auto-completion is one of the best ones out
there.
00:12:53 It makes it very efficient for you to work with the command line.
00:12:59 Commands in the shell can be automatically completed if they're unambiguous,
00:13:06 or a list of possibilities can be displayed if it is ambiguous, meaning that if I type in, as is shown
on the screen,
00:13:15 h-i-s for – I'm going to type history – and I hit the tab button, it will see that history is the only
command that starts
00:13:24 with h-i-s and will auto-complete the rest of the word for me.
00:13:29 I can just hit Enter and history will be the command that's executed.
00:13:34 That's unambiguous. There's no question, when I type h-i-s and hit Tab,
00:13:39 there's only one command that has h-i-s in it. If it's ambiguous, meaning that there's more than
one word,
00:13:46 so if I type h-i and hit Tab, there might be more than one item that will pop up,
00:13:54 and that is the case in the lower box here. If I hit Tab and then Tab again,
00:14:00 it will list the various available options and then I can finish typing to get the one that I want
00:14:06 and press Enter. Tab auto-completion is very useful, it's very efficient,
00:14:11 and should probably get used to using it if you're going to be working on SUSE Linux
Enterprise Server
00:14:16 in the future. Another function we need to define,
00:14:20 although we're not going to go into great detail, is the use of what are called data channels.
00:14:25 Data channels are the way that the shell handles input and output.
00:14:32 Input into a command that is going to be typed in your shell environment is called standard in –
stdin,
00:14:40 or 0 is the number that's used to reference it. Then on the process itself, when it's producing
output,
00:14:49 there's either standard out, that is, stdout, or the number 1, or standard error, stderr,
00:14:59 and the number 2 represents standard error. These data channels are used as a way to
manipulate
00:15:07 the data that's going into a process as it's launched or out of a process once it's running.
00:15:14 You can even input process data into a process while it's running.
00:15:19 We're going to just give you some examples of this, but first of all, let's talk about what's called
redirection
00:15:24 with those channels. When we input or output data,
00:15:29 we can take it from a file or push it to a file. We can even take it from the process

9
00:15:36 and redirect it into another process, and there are utilities or options, commands if you will,
00:15:43 that make this possible. The first command we're going to talk about is the greater than sign,
00:15:48 that's the first one in the list there. And what it does is it simply redirects
00:15:52 the standard output from a process into a file. An example is listed there, where
00:15:59 an ls command for the etc director is given, and it's told to write the output, instead of to the
screen,
00:16:06 write it to a file – very useful. Well, what if you want to preserve
00:16:11 the file because the file already has contents in it? Well, the double greater than sign, the
second option,
00:16:18 redirects stdout but then appends it to the end of a file. You can also... you'll notice that no
number is listed.
00:16:26 Since no number is listed, it assumes that you're talking about the standard output, that's
number one.
00:16:33 But if you want the errors to be sent somewhere, you put a 2 and then the greater than sign,
00:16:39 and that redirects it into a file. If we put two greater than signs with the 2 in front,
00:16:46 it appends it to a file. Notice also that the less than sign is also listed,
00:16:55 and it is used to redirect into a command. An example would be if I type the word mail to
geeko,
00:17:04 that would say I'm sending an email message to the user geeko from the command line, and I
redirect,
00:17:10 or less than, from a text. It will pull the body of that email
00:17:16 and put it as the body of the email itself. That's input redirector.
00:17:22 There's also the pipe. Pipe is very frequently used when issuing commands
00:17:27 and you want to narrow down what's returned. An example would be: List everything
00:17:33 that's in the etc directory, but then only show me the lines that have samba in it, s-a-m-b-a.
00:17:41 That is, as is in the example here, the way that we use a pipe in order to show us the output.
00:17:50 In other words, the output of one command, the command to the left of the pipe, is used as the
input
00:17:56 to the second command. There's also a command called tee, t-e-e.
00:18:03 This allows you to do redirection, excuse me, to do redirection from, or stdin, from one
command
00:18:13 and use it as the output of one to standard input to the other,
00:18:18 but also to have it display on the screen as well. So instead of redirecting and not seeing
everything,
00:18:25 you can tell it to spit it out to a file but also spit it out to the screen so I can see what's going
on.
00:18:32 That's channel redirection. So channel redirection, very useful, very frequently used,
00:18:38 and something, again, you should get used to. We can also chain commands together from
the shell.
00:18:44 We use the semicolon in order to do this. So we take one command, and when it finishes,
00:18:52 we tell it to do another command. We just put a semicolon in between them,
00:18:56 and it will do first the one and then the other. But what if we want to make sure that
00:19:01 the first command succeeds before we proceed with the next one?
00:19:05 That's what the double ampersand is for. Ampersand ampersand between two commands
says:
00:19:11 If the first command succeeds without an error, proceed with the second one.
00:19:15 Now, what if you want to say: I want the first command to execute,
00:19:19 but if it fails, then do the second one? Well, that's what the double pipe is for.

10
00:19:25 That allows you to execute the first thing, and if it fails, go to the second one,
00:19:30 do the second task, as is listed in the example there. So that's chaining commands together.
00:19:38 So one last thing to look at: What about getting help from the command line?
00:19:43 Well, there's more than one way to do it, but the best way usually when looking for help
00:19:49 on a particular command is to type the command and then a -h or --help.
00:19:55 This gives you command-specific information. We also use what are called the man pages
00:20:01 or the manual pages. man, space, and the command – it will give you information
00:20:06 about that command. We can also search inside of man pages
00:20:11 for a specific keyword. So man, space, --k and the keyword you want to look for,
00:20:17 and then it will list all of the manual pages out there that have that information in it.
00:20:23 There's also a whatis command that will give you descriptions for the command.
00:20:28 There's also an info page, which is a long form of, usually, a more verbose version of what you
find in the man pages.
00:20:37 There's also software documentation that can be found in /usr/share/doc packages
00:20:42 and then the name of the package. And then, of course, the release notes for the individual
products
00:20:47 that you're looking at if they come from SUSE. So that's working with help resources from the
command line.
00:20:53 There's lots of options out there. A little bit of practice will get you used to using
00:20:58 and working with the shell and making it work for you. This concludes our unit on the SUSE
Linux Enterprise Server shell environment.
00:21:06 In the next unit, you will learn about process administration basics. Thank you.

11
Week 4 Unit 3

00:00:09 Hello and welcome to week four, unit three of our openSAP course
00:00:13 an Introduction to SUSE Linux Enterprise Server. My name is Craig Cole, and I am an
instructional designer
00:00:20 and training engineer at SUSE. In this unit, you will learn about
00:00:23 the SUSE Linux Enterprise Server process administration basics.
00:00:28 Let's get started. Before we can get too far,
00:00:33 we need to define some terms, some basic terms of how we use
00:00:40 process, application, program, and task. The word program means executable code,
00:00:50 but usually it's still stored on a drive or on a storage device.
00:00:55 It hasn't been executed yet. A process is the same thing, it's the executable code
00:01:02 except for it has been loaded into memory and it has been executed.
00:01:07 A task is just a synonym for the word process. So when we mention process or task,
00:01:14 we're talking about the same thing, although there are some nuances there as well.
00:01:20 There are two basic types of processes. There are user processes,
00:01:27 which are associated with a controlling shell or terminal. So in other words,
00:01:31 a user has started that particular process or task. And then there are daemon, or demon
sometimes pronounced,
00:01:41 tasks which are not associated with a controlling shell or terminal.
00:01:45 And in most cases, those have been started automatically by some startup process or
configuration
00:01:53 within the system itself. So user and daemon.
00:01:57 Now, every single process, regardless of whether it was started
00:02:01 as a user process or as a daemon, is provided a unique process ID,
00:02:08 a unique number or PID, Process ID, that defines or is the identification for that process.
00:02:19 And processes can spawn other additional processes as well in a parent/child relationship.
00:02:26 Now, this relationship with that parent/child relationship, if you end or kill off the parent
process,
00:02:34 the child processes in almost every case will also be terminated as well.
00:02:39 There are ways around that, but we're not going to talk about that today.
00:02:43 So that's the basics of processes. Programs unexecuted.
00:02:47 Processes are executed and tasks are the same thing.
00:02:51 We have user and daemon processes tied to a shell and not tied to a shell respectively.
00:03:00 We have process IDs, the numbers that represent those processes,
00:03:04 and the parent/child relationship between those processes. There are utilities that have been
designed
00:03:11 specifically to allow for administration, and in this case, just viewing what processes are
running on a system.
00:03:21 The ps command, as an example, is used to list the processes running on a system.
00:03:28 In most cases, ps is used with options. These options allow you
00:03:32 to sort what information is displayed or to give you an additional list of information.
00:03:40 ps, space, aux as is listed in the description field there is for all processes to be listed with a
user list,
00:03:50 so who launched it or who is it running as and additional information about it with the aux
options.
00:03:59 There's also a -ef option. This is all processes but it gives you a full- format

12
00:04:05 with, kind of, a command line interface for interacting. So that's ps.
00:04:11 We also have pstree. pstree is used to show the parent/child relationships
00:04:19 between the processes themselves. If you do a pstree -p,
00:04:26 it not only would show the relationship between the various processes that are running,
00:04:30 it will also show the process IDs and their relationship to each other.
00:04:37 There's one other one that is frequently used to display another command
00:04:41 that displays the relationship of processes to their utilization, both of RAM and CPU,
00:04:51 but also to things like their input/output and swap space and so forth, and that's the top
command.
00:04:57 top is used for a lot of other things, but one of the primary things is to see
00:05:02 what processes are running and, in a lot of cases, what process is using the most resource
00:05:10 of whatever resource you sort by. So top can display processes, and it's sorted by usage,
00:05:16 and it has a natural built-in refresh at an interval to show you at that given moment what is
currently using
00:05:25 the most of whatever resource you're sorting by. So ps, pstree, and top: All used for viewing
processes.
00:05:37 Managing processes can mean multiple things, but one of the key components of managing
processes
00:05:43 is sometimes you have to kill them or terminate them, get them to stop.
00:05:48 And there are two utilities for doing that. One of them is kill,
00:05:52 a command where you say kill and the process ID. Now, you can also include a signal with
that.
00:06:00 We're going to talk about the signals in a moment. And then there's the killall command.
00:06:04 Instead of referencing the process ID, the killall command uses the name of the process,
00:06:10 such as firefox or emax, as the thing to kill. And since it says killall,
00:06:19 any instance of firefox or emax would be killed if I did a killall emax,
00:06:26 and then perhaps whatever signal I want. Signals are a way for you to tell the process
00:06:34 how to exit or what exactly you want it to do. And although there is a list of 19 different signals

00:06:42 here on the screen, we're only going to talk about three of them.
00:06:46 They're the most common ones that are used. The most common one is the default,
00:06:51 and that is kill with a signal of 15 or sigterm as it's referred to.
00:06:58 This means terminate the program. sigterm is a gentler way to kill the process
00:07:06 because it tells the process you need to shut down. And it's a nicer way to do it.
00:07:12 The other not nice way that kind of jerks the rug out from under it
00:07:16 is the kill -9 or kill -KILL command, sigkill. That's number 9 there.
00:07:25 It jerks the rug out from under it and terminates that process immediately.
00:07:32 The other one... that's two of the three. The other one that you'll see frequently run
00:07:36 is number 1, that's HUP. It stands for hangup.
00:07:41 It's used frequently when you need to kill and restart a process on the same process ID using
the hangup.
00:07:49 There's more than one use case. There are lots of other options out here.
00:07:53 And if you're interested, of course, very easy to find in our documentation,
00:07:57 how to use each of these signals, should you need to. But we've highlighted the three most
commonly used.
00:08:03 So that's killing a process using the kill command and the killall command
00:08:10 to manage the termination in most cases of a process that's currently running.

13
00:08:18 On top of dealing with these processes, you also have what's called the process priority.
00:08:24 The process priority is relative. In other words, when we set its value,
00:08:29 it's relative to the other tasks that are running on that machine.
00:08:33 And it could be, although we say it's the highest process priority,
00:08:38 it doesn't mean that even system processes are going to be kicked to the back.
00:08:42 The kernel still has to function, certain other utilities have to continue to move
00:08:47 in order for the system to stay up and running. But a relative process or process priority is
defined
00:08:54 from a number of 19 on the positive side to a -20. -20 is the highest relative priority.
00:09:04 It is a not-nice task and it has a higher priority. Now, what does that mean?
00:09:10 Well, we use the nice and renice commands to change the process priority.
00:09:17 Let me put this in real-world terms. If I go to a grocery store
00:09:23 and I'm standing in line to purchase my food, if I'm a nice person and an old lady walks up,
00:09:30 I might let her go in front of me. As a result, it takes me a little bit longer
00:09:35 to get to the cashier and to pay for my food, but I'm a nice person so it doesn't really matter.
00:09:41 I'm not in a hurry, it's okay. So my nice value is higher so I have a lower priority.
00:09:48 Same thing with these processes. If I have a lower nice value,
00:09:52 then I might actually push someone out of the way in order to get to the front of the line,
00:09:56 and that is the same for processes that have a negative nice value.
00:10:03 Nice is used when you're starting a command, you can use nice, space, and the value you
want it to start at
00:10:10 and the command you want it to start, and then it will start at that value.
00:10:16 We can also use renice to change the process priority, renice -15 as an example,
00:10:25 and then the process ID in order to set its value to the one we want.
00:10:29 A couple of notes. A regular user can only increase the nice value,
00:10:35 in other words, make it less process priority, but an administrator, the root user,
00:10:43 can do either higher priority or lower priority based on need.
00:10:49 Okay, so that's process priority. We've got our tasks written.
00:10:52 We've got them up and running. We can deal with them.
00:10:56 But a lot of times when you're interacting with the SUSE Linux box,
00:11:00 you might be doing it over an SSH connection where you're remoted in,
00:11:04 all you've got is a shell in front of you, and you need to perform a bunch of different tasks.
00:11:09 Now, in that shell, most of your tasks are going to be user-based tasks, not daemon started,
00:11:15 but if you start a task and you have the shell, a lot of times it doesn't return you
00:11:20 back to the shell prompt for you to do anything. You have to wait for that job to finish
00:11:25 and then you can continue working at that terminal. Well, there's a way around that.
00:11:30 You can put a task into the background, let it continue to run,
00:11:34 and then when it finishes, you can pull it back up, or when you're done
00:11:38 with whatever other task you're working on, you can pull it back up to the front
00:11:42 and continue on with whatever you need to do with it. To do that, you start your task,
00:11:49 you do Ctrl+z, which will pause the task, then type the command bg and hit Enter.
00:11:56 That will put the task into the background and give you command of the shell again,
00:12:01 where you can do other tasks. And you can do that with as many as you need
00:12:05 in order to accomplish whatever task you're working on. So we can do more tasks than just
one at a time.
00:12:12 We start it, put it into the background, do whatever we need to, put that in the background,

14
00:12:17 when we're done, pull them back up and look at them again. Now, we can start a task in the
background as well.
00:12:25 We simply append an ampersand at the end of the command. So we could do xeyes,
00:12:30 which is just a command on a graphical environment, xeyes &, and it would start xeyes
00:12:37 but then give us command of, or back control of the shell environment
00:12:43 without any trouble. That command is still running.
00:12:46 It's in the background already. We can use the jobs command
00:12:49 to see what tasks are tied to that shell. It will list them for us.
00:12:54 And then we can use the fg command, which stands for foreground, for bringing forward
00:12:59 commands that we want to look at again or to work with. Okay, so that's jobs and processes.
00:13:05 Jobs are simply processes that are tied to a specific shell or terminal
00:13:10 that we're working on. And we can use Ctrl+z and bg
00:13:13 in order to put them into the background. We can use jobs to list
00:13:17 what commands are running in that shell, and then fg in order to return them to the front
00:13:23 for us to work with. This concludes our unit on the SUSE Linux Enterprise Server
00:13:29 process administration basics. In the next unit, you will learn about process scheduling.
00:13:35 Thank you.

15
Week 4 Unit 4

00:00:08 Hello, and welcome to the last unit of our openSAP course, an Introduction to SUSE Linux
Enterprise Server.
00:00:15 My name is Craig Cole, and I am an instructional designer and training engineer at SUSE.
00:00:20 In this final unit, you will learn about the SUSE Linux Enterprise Server process scheduling.
00:00:26 Let's get started. Now, the most common way
00:00:33 that people schedule tasks in SUSE Linux is through the use of what are called cron jobs.
00:00:40 Cron jobs can be for an individual user, or they can be set at the system level.
00:00:46 And user cron jobs are defined using the crontab command. crontab -e, as an example,
00:00:56 will put the user into the edit mode for the user's cron table.
00:01:03 There's also listing of crontabs -l, and -r for removing an entire crontab.
00:01:12 Editing a crontab, it's just a text file, and it has a very specific layout to it.
00:01:18 And each field has a specific purpose. You can see an example of it along with labels
00:01:24 here in this slide. The first five fields are time related,
00:01:31 they're time intervals. The first one is the minute of the hour.
00:01:39 The second one is the hour of the day. The third one is the day of the month.
00:01:44 The fourth one is the month of the year. And the last one is the day of the week.
00:01:51 Using those, you can schedule things to be repeated on a regular schedule, and using some
variation,
00:01:59 you can schedule every 15 minutes, or every 15 minutes, every Monday through Friday,
00:02:05 perform a specific task. The last field in a user's cron table,
00:02:11 or crontab, is the command or the thing to be executed at that time.
00:02:18 In this case, there's a tool called my backup.sh. So that's cron jobs.
00:02:24 We have user cron jobs, but we also have system cron jobs. User cron jobs are managed with
the crontab utility.
00:02:32 System cron jobs are inside of the /etc/crontab file. It includes an additional item in it,
00:02:43 and that is the "who" field. Who is to be executing this particular command.
00:02:51 It's the second set, the one right after the "when". You'll notice, there are still the five fields,
00:03:00 and it's telling us that we're going to perform a task every 15 minutes, and the root user's going
to do it,
00:03:07 and it's going to be this particular command, the "what". That whole thing that starts at test and
ends with 1
00:03:15 cleared down on the second line. So system crontabs – the only difference, again,
00:03:22 is that there is a "who" field. Who does this execute as?
00:03:26 There are also some predefined directories, where tasks can be dropped for an hourly,
00:03:34 daily, weekly, or even monthly execution. Those are the... in the etc directory, there's a
00:03:40 cron.hourly, cron.daily, cron.weekly, and cron.monthly directory.
00:03:47 Each of those will be performed based on as they describe that schedule.
00:03:55 Okay, so system cron jobs – defined by the root user, dropped into those folders or directly
added to the etc
00:04:02 crontab file, and they include that "who" field as well. This is a busy slide, there's a lot on this.

00:04:14 But this is the architecture for cron. If you look down at the bottom right corner,
00:04:22 you can see the /etc/cron.hourly, daily, weekly, and monthly directories like I described.
00:04:28 You'll also notice up above those is the var/spool/cron/tabs/* – that's for each individual user.

16
00:04:37 They will store... their cron jobs will be stored in that directory. It's variable data, so it goes in
the var directory.
00:04:43 For the system cron jobs just to the left, also in green, /etc/crontab and /etc/cron.d, which is a
directory
00:04:51 where you can put additional items as well. But what actually causes these to work?
00:04:56 Well, the administrator controls ultimately what cron jobs are actually run.
00:05:02 Those are listed in red. The items up at the top, the service itself
00:05:06 gets started by the administrator. It's on by default.
00:05:12 But you can turn it off if you need to. You also have the /usr/bin/crontab.
00:05:17 That's the admin creating their cron jobs. And then in the bottom corner,
00:05:25 there are a couple of other utilities. The run-crons, which is a separate utility that
00:05:30 runs those hourly, daily, weekly, and monthly tasks as required.
00:05:36 And it checks for the last time it's run inside of an interval file.
00:05:42 Well it's the .hourly, .daily, .weekly, and .monthly. There's a whole lot going on here
00:05:49 but the basic idea is this. There are specific locations where these
00:05:53 tables are kept that define what tasks are run on a regular basis.
00:05:58 The administrator is ultimately in charge of it, and there are tools at your disposal
00:06:03 in order to make them work. Cron is very useful for running backup scripts,
00:06:08 for running regular updates and other functions that you might run on a regular basis in order
to
00:06:16 make sure that your server is running at the optimal performance and the way that you want it
to.
00:06:25 That's cron. Cron, however, is not the only way that
00:06:29 we can schedule tasks. There's another utility, it's called the at daemon.
00:06:35 At is a single use, one-time execution of a particular task. Personally, I use at when I'm
working on my machine
00:06:46 and it's going to do something, but I'm not going to be sitting at my machine
00:06:49 and I need it to turn off my machine when it's done. So at, let's say, four hours in the future,
00:06:56 go ahead and turn off the machine. That will give me time to finish whatever job
00:07:00 is running in the background, and then it will turn off the machine and be done.
00:07:04 The at command, or batch command, basically allows you to schedule a task.
00:07:09 You type at, hit Enter, it then puts you at a shell where you tell it what command you want to
execute.
00:07:16 Then you type Ctrl+D and it puts that command into the cycle to be executed.
00:07:24 You can also use the -f command to say run this script that's over here where you
00:07:30 specify that file. If you want to see what at jobs have been
00:07:35 committed or put into play, use the atq command that lists any scheduled task for
00:07:42 that particular user. You can also use the atrm command
00:07:47 for removing an at job if you don't want it to execute or change your mind.
00:07:54 There are couple other tools, files actually, that you should be aware of when working with at.

00:08:00 The first one is the at.allow file in the etc directory.
00:08:05 This is a white list. If there is anything in the at.allow file,
00:08:11 any user, then everyone else is denied access to it. This allows you to say that only power
users
00:08:18 that you've already cleared to be good at this particular task can work with
00:08:23 that particular tool at. The at.deny follows a similar vein.

17
00:08:29 In reverse, simply all people can use it except for the people listed in that file.
00:08:35 And that's the at daemon. So there you are, we've talked about scheduling tasks
00:08:39 on SUSE Linux Enterprise Server. You have your cron job in order to schedule them.
00:08:46 Both for users and for the system. And you have the at daemon for one-time,
00:08:50 one-fire, single-fire applications or tasks that you have to perform.
00:08:57 This concludes our course on an introduction to SUSE Linux Enterprise Server.
00:09:03 In this course, you've learned the basics of administrating a SUSE Linux Enterprise Server.
00:09:07 The best administrators, however, are always learning, and I hope you will continue
00:09:11 your journey to understand how you can best use SUSE Linux.
00:09:16 Again, my name is Craig Cole. It has been a pleasure to be your instructor
00:09:19 for this openSAP course. I hope you will join me and your fellow learners
00:09:24 in the discussion forum, where we can talk and you can ask questions of me,
00:09:30 or start any related discussion topics. Thank you.

18
www.sap.com/contactsap

© 2019 SAP SE or an SAP affiliate company. All rights reserved.


No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.

The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.
National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable
for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality
mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are
all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation
to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are
cautioned not to place undue reliance on these forward-looking statements, and they should not be relied upon in making purchasing decisions.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other
countries. All other product and service names mentioned are the trademarks of their respective companies. See www.sap.com/copyright for additional trademark information and notices.

You might also like