Introduction to Linux – Full Course for Beginners

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

'codeFreeCamp' based

also this guy looks and sounds like the soyjak guy

πŸ‘οΈŽ︎ 2 πŸ‘€οΈŽ︎ u/[deleted] πŸ“…οΈŽ︎ Feb 23 2023 πŸ—«︎ replies
Captions
welcome to this introduction to Linux course I'm Beau Carnes and I will be teaching this course this course is designed for computer users who have limited or no previous exposure to Linux whether they're working in an individual or Enterprise environment this course explores the various tools and techniques commonly used by Linux system administrators and end users to achieve their day-to-day work in a Linux environment you will gain a good working knowledge of Linux and how to navigate through major Linux distributions system configurations and graphical interfaces of Linux basic command line operations common applications of Linux and more upon completion of this training you should have a good working knowledge of Linux from both a graphical and command line perspective allowing you to easily navigate through any of the major Linux distributions the content of this course was developed by the Linux Foundation Who provided a Grant to make this course possible I've taken their primarily text-based course and turned it into a video based course throughout the course you will see some video segments that were developed by the Linux Foundation also you should know that sometimes throughout this course I put Linux commands on the screen like this the dollar sign at the beginning is not part of the command that just indicates the command should be typed into the system shell or terminal so if you're following along type everything after the dollar sign in the description of this video I've linked to a text-based version of this course okay let's get started by the end of this chapter you should be able to describe the software environment required for this course and describe the three major Linux distribution families in order to fully benefit from this course you will need to have at least one Linux distribution installed if you're not already familiar with the term distribution as it relates to Linux you soon will be you are about to learn some more details about the many available Linux distributions because there are literally hundreds of distributions I'm not covering them all in this course instead I'll focus on the three major distribution families the families and representative distributions this course will focus on are red hat family systems including OS and Fedora Susie family systems including open Susie and Debian family systems including Ubuntu and Linux Mint I'm about to tell you more about red hat Susie and Debian well this course focuses on these three major Linux distribution families as long as there are talented contributors the families of distributions and the distributions within these families will continue to change and grow people see a need and develop special configurations and utilities to respond to the need sometimes that effort creates a whole new distribution of Linux sometimes that if effort will leverage an existing distribution to expand the members of an existing family Red Hat Enterprise Linux or Rel heads the family that includes Centos Centos stream Fedora and Oracle Linux Fedora has a close relationship with Rel and contains significantly more software than red Hat's Enterprise version one reason for this is that a diverse Community is involved in building Fedora with many contributors who do not work for Red Hat furthermore it's used as a testing platform for future Rel releases and this course we'll mainly use synth OS stream from the Red Hat Family the basic version of scint os is also virtually identical to Rel the most popular Linux distribution in Enterprise environments however Centos 8 has no more scheduled updates the replacement is Cento S8 stream some of the key facts about the red hat distribution family are Fedora serves as an upstream testing platform for Rel Centos is a close clone of Rel while Oracle Linux is mostly a copy with some changes it supports Hardware platforms such as Intel x86 arm titanium powerpc and IBM system Z it uses the Yum and dnf RPM based yum package managers to install update and remove packages in the system Rel is widely used by Enterprise which hosts their own systems the Susie family and their the relationship between Susie and open Susi is similar to the one described between Rel sentos and Fedora we use open Susi as the reference distribution for the Susie family as it's available to end users at no cost because the two products are extremely similar the material that covers open Sushi can typically be applied to sles with few problems some of the key facts about the Susie family are the Susie Linux Enterprise server or sles is Upstream from open Susie it uses the RPM based zipper package manager which we'll cover later to install update and remove packages in the system it includes the yast or get another setup tool application for system administration purposes slas is widely used in retail and many other sectors the Debian distribution is Upstream for several other distributions including Ubuntu in turn Ubuntu is Upstream for Linux Mint and a number of other distributions it's commonly used on both servers and desktop computers Debian is a pure open source Community project which is not owned by any Corporation and has a strong focus on stability and Debian provides by far the largest and most complete software repository to its users of any Linux distribution Ubuntu aims to at providing a good compromise between long-term stability and ease of use since Ubuntu gets most of its packages from Debian stable Branch it also has access to a very large software repository for those reasons we will use Ubuntu LTS or long-term support as the reference to the Debian family distributions for this course some key facts about the Debian family are the Debian family is Upstream for Ubuntu and Ubuntu is Upstream for Linux Mint and others it uses the dpkg based apt package manager which we'll cover later in detail to install update and remove packages in the system Ubuntu has been widely used for cloud deployments well and while Ubuntu is built on top of Debian and is gnome based under the hood it differs visually from the interface on standard Debian as well as other distributions so in conclusion there are three major distribution families within Linux Red Hat Susie and Debian in this course we'll work with Representative members of all of these families throughout by the end of this chapter you should be able to define the common terms associated with Linux and discuss the components of a Linux distribution in order for you to get the most out of this course we recommend that you have Linux installed on a machine that you can use throughout this course you can use this brief installation guide preparing your computer for Linux training it will help you to select a Linux distribution to install decide on whether you want to do a standalone pure Linux machine or a dual boot one whether to do a physical or virtual install and more and then it guides you through the steps I'll also cover installation soon well we have not covered everything in great detail but keep in mind that most of the documentation in Linux is actually already on your system in the form of band Pages which we'll discuss in great detail later whenever you do not understand something or want to know more about a command program topic or utility you can just type man and then the topic at the command line so I'll just assume you're thinking this way so I won't constantly repeat for more information look at the man page for this topic On a related note throughout the course we'll use a shorthand that is common in the open source Community when referring to cases where the user has to make a choice of what to enter like a name of a program or file we'll use the shorthand Foo to represent the to basically represent insert file name here so we're not actually suggesting that you manipulate files or install Services called Foo the best way to learn Linux is by doing it so make sure to try things out yourself as you follow along you'll need to have a Linux system up and running that can either be a native Linux system on your Hardware running through a live USB stick or CD or a virtual machine running through a hypervisor we'll show you all these methods so let's get going before you begin using Linux you need to be aware of some basic terms such as kernel distribution bootloader service file system X Windows system desktop environment and command line these are very commonly used by the Linux community the kernel is considered the brain of the Linux operating system it controls the hardware and makes the hardware interact with the applications an example of a kernel is the Linux kernel the most recent Linux kernel along with past Linux kernels can be found at the kernel.org website a distribution also known as distros is a collection of programs combined with the Linux kernel to make up a Linux based operating system some common examples of a distribution are red hat Enterprise Linux Fedora Ubuntu and gen 2. the bootloader as the name implies is a program that Boots the operating system two examples of a bootloader are grub and isolinux a service is a program that runs as a background process some examples of the service are httpd nfsd ntpd ftpd and name d a file system is a method for storing and organizing files in Linux some examples of file systems are ext3 ext4 fat xfs and butter FS the X Windows system provides the standard toolkit and protocol to build graphical user interfaces on nearly all Linux systems the desktop environment is a graphical user interface on top of the operating system gnome KDE xfce and fluxbox are some examples of the desktop environment the command line is an interface for typing commands on top of the operating system the shell is the command line interpreter that interprets the command line input and instructs the operating system to perform any necessary tasks and commands for example bash TC shell and Z shell suppose you have been assigned to a project building a product for a Linux platform project requirements include making sure that project works properly on the most widely used Linux distributions to accomplish this you need to learn about the different components services and configurations associated with each distribution we're about to look at how you would go about doing exactly that so what is a Linux distribution and how does it relate to the Linux kernel the Linux kernel is the core of the operating system a full Linux distribution consists of the kernel plus a number of other software tools for file related operations user management and software package management each of these tools provides a part of the complete system each tool is often its own separate project with its own developers working to perfect that piece of the system while the most recent Linux kernel and earlier versions can always be found in the Linux kernel archives Linux distributions may be based on different kernel versions for example the very popular rel8 distribution is based on the 4.18 Kernel which is not new but is extremely stable other distributions may move more quickly in adopting the latest kernel releases it's important to note that the kernel is not an All or Nothing proposition for example Rel instant OS have Incorporated many of the most the more recent kernel improvements into their older versions as I have Ubuntu opensusi slas and more examples of other essential tools and ingredients provided by distributions include the C and C plus and claim compilers the GDB debugger the core system libraries applications need to to link with in order to run the low level interface for drawing graphics on the screen as well as the higher level desktop environment and the system for installing and updating the various components including the Cur the kernel itself and all distributions come with a rather complete Suite of applications already installed the vast variety of Linux distributions are designed to cater to many different audiences and organizations according to their specific needs and tastes however large organizations such as companies and governmental institutions and other entities tend to choose the major commercially supported distributions from Red Hat Susie and canonical which is Ubuntu sent OS and Os stream are popular free alternatives to Red Hat Enterprise Linux Rel and are often used by organizations that are comfortable operating without paid technical support Ubuntu and Fedora are widely used by developers and are also popular in the educational realm scientific Linux is favored by the scientific research Community for its compatibility with scientific and mathematical software packages both Centos variants are binary compatible with Rel which means in most cases binary software packages will install properly across the distributions many commercial Distributors including Red Hat Ubuntu Susie and Oracle provide long-term fee-based support for their distributions as well as hardware and software certification all major distributions provide update services for keeping your system primed with the latest security and Bug fixes and performance enhancements as well as provide online support resources you have completed chapter two let's summarize the key Concepts covered Linux borrows heavily from the Unix operating system with which its creators were well versed Linux accesses many features and services through files and file like objects Linux is a fully multitasking multi-user operating system with built-in networking and service processes known as daemons some of the more common terms used in Linux are kernel distribution bootloader service file system X Windows system desktop environment and command line and a full Linux distribution consists of the kernel plus a number of other software tools for file related operations user management and software package management by the end of this chapter you should be able to identify Linux file systems identify the differences between partitions and file systems describe the boot process and install Linux on a computer the Linux boot process is the procedure for initializing the system it consists of everything that happens from when the computer is first switched on until the user interface is fully operational having a good understanding of the steps in the boot process may help you with troubleshooting problems as well as with tailoring the computer's performance to your needs on the other hand the boot process can be rather Technical and you can start using Linux without knowing all the details starting in x86 based Linux system involves a number of steps when the computer is powered on the basic input output system or bios and this initializes the hardware including the screen and keyboard and test the main memory this process is also called post power on self-test the bio software is stored on a ROM chip on the motherboard after this the remainder of the boot process is controlled by the operating system once the post is completed the system control passes from the BIOS to the bootloader the bootloader is usually stored on one of the hard disks in the system either in the boot sector for traditional bios or MBR systems or the EFI partition for more recent or unified extensible firmware interfaces or EFI ufi systems up to this stage the machine does not access any mass storage media thereafter information on date time and the most important peripherals are loaded from the CMOS values after technology used for the battery-powered memory store which allows the system to keep track of the date and time when even when it's powered off a number of boot loaders exist for Linux the most common ones are a grub for Grand unified bootloader ISO Linux for booting from removable media and dos u-boot for booting on embedded devices appliances most Linux bootloaders can present a user interface for choosing alternative options for booting Linux and even other operating systems that might be installed when booting Linux the bootloader is responsible for loading the kernel image and the initial Ram disk or file system into memory the bootloader has two distinct stages for systems using the BIOS MBR method the bootloader resides at the first sector of the hard disk also known as the master boot record the size of the MBR is just 512 bytes in this stage the bootloader examines the partition table and finds a bootable partition once it finds a bootable partition it then searches for the second stage Bootloader for example grub it loads it into RAM for systems using the EFI U EFI method UEFI firmware reads its boot manager data to determine which UEFI application is to be launched and from where the firmware then launches the UEFI application for example grub as defined in the boot entry in the firmware's boot manager the second stage bootloader resides under slash boot a splash screen is displayed which allows us to choose which operating system to boot after choosing the OS the bootle boot the bootloader loads the kernel of the selected operating system into RAM and passes control to it kernels are almost always compressed so its first job is to uncompress itself after this it will check and analyze the system hardware and initialize any hardware device drivers built into the kernel the init ramp FS file system image contains programs and binary files that perform all actions needed to mount the proper root file system like providing kernel functionality for the needed file system and device drivers for mass storage controllers with a facility called udev for user device which is responsible for figuring out which devices are present locating the device drivers they need to operate properly and loading them after the root file system has been found it's checked for errors and mounted the mount program instructs the operating system that a file system is ready for use and Associates it with a particular point in the overall hierarchy of the file system the mount point if this is successful the the init Ram FS is cleared from RAM and the init program from the root file system is executed and it handles the mounting and pivoting over to the final real root file system if special Hardware drivers are needed before the mass storage can be accessed they must be in the init Ram FS image near the end of the boot process and it starts a number of text mode login prompts these enable you to type your username followed by your password and to eventually get a command shell however if you're running a system with a graphical login interface you'll not see these at first usually the default command shell is Bash but there are a number of other Advanced command shells available the shell prints a text prompt indicating it is ready to accept commands after the user types the command and presses enter the command is executed and another prompt is displayed after the command is done the bootloader loads the kernel and an initial ram-based file system into memory so it can be used directly by the kernel when the kernel is loaded in Ram it immediately initializes and configures the computer's memory it also configures all the hardware attached to the system this includes all processors i o subsystems storage devices and more the kernel also loads some necessary user space applications once the kernel has set up all its hardware and mounted the root file system the kernel runs the S bin init this then becomes the initial process which then starts other processes to get the system running most other processes on the system Trace their origin ultimately to init exceptions include the so-called kernel processes these are started by the kernel directly and their job is to manage internal operating system details besides starting the system init is responsible for keeping the system running and for shutting it down cleanly one of his one of its responsibilities is to act when necessary as a manager for all non-kernel processes it cleans up after them upon completion and restarts user login Services as needed when users log in and out and does the same for other background system services traditionally this process startup was done using conventions that date back to the 1980s and the system V variety of Unix this serial process had the system passing through a sequence of run levels containing collections of scripts that start and stop Services each run level supported a different mode of running the system with the within each run level Individual Services could be set to run or to be shut down if running however all major distributions have moved away from this sequential run level method of system initialization although they usually emulate many system V utilities for compatibility purposes next we'll discuss the new methods of which system MD has become dominant systems with systemd start up faster than those with earlier init methods this is largely because it replaces a serialized set of steps with aggressive parallelization techniques which permits multiple services to be initiated simultaneously it has been adapted by all major distributions and so we'll not discuss the older system B method or upstart which has become a dead end complicated Startup shell scripts are replaced with simpler configuration files which enumerate what has to be done before a service has started how to execute service startup and what conditions the service should indicate have been accomplished when startup is finished one thing to note is that S Pen slash knit now just points to lib systemd system d so systemd takes over the init process one system D command system control is used for most basic tasks while we have not yet talked about working at the command line here's a brief listing of its used think of a refrigerator that has multiple shelves that can be used for storing various items these shelves help you organize the grocery items by shape size type Etc the same concept applies to a file system which is the embodiment of a method of storing and organizing arbitrary collections of data in a human usable form different types of file systems supported by Linux include conventional disk file systems flash storage file systems database file systems and special purpose file systems this section will describe the standard file system layout shared by most linuxed distributions a partition is a fiscally contiguous section of a disk or what appears to be so in some Advanced setups a file system is a method of storing or finding files on a hard disk usually in a partition one can think of a partition as a container in which a file system resides although in some circumstances a file system can span more than one partition if one uses symbolic links which we'll discuss much later a comparison between file systems in Windows and Linux is shown in this table Linux systems store their important files according to a standard layout called the file system hierarchy standard which has long been maintained by the Linux Foundation having a standard is designed to ensure that users administrators and developers can move between distributions without having to relearn how the system is organized Linux uses the slash character to separate paths unlike Windows which uses the backslash and it does not have multiple Drive letters multiple drives and or partitions are mounted as directories in the single file system removable media such as USB drives and CDs and DVDs will show up as mounted at run slash media slash your username slash disk label for recent Linux systems or under slash media for older distributions for example if your username is student a USB pin Drive labeled Fedora might end up being found at run slash media student Fedora and a file readme.txt on that disk would be at run slash media student slash Fedora slash readme.txt all Linux file systems are case sensitive so these different ways of spelling boot represent three different directories or folders mini distributions distinguish between core utilities needed for proper system operation and other programs and place the ladder in directories under slash USR or user now let's learn about viewing the file system hierarchy from the graphical interface in Ubuntu click the file manager icon on the left panel by default it explores your home directory to see all directories under root directory click computer on the left places pane inside this window double-click the Etsy directory to open it double-click Avi and press Ctrl L to see the current location the current path appears at the top of the window the path for this is Etsy avahi now let's learn about viewing the file system hierarchy from the graphical user interface in opensuse click activities on the top left corner of the screen corner click the file manager icon on the left panel by default it explores your home directory click computer on the left places pane inside this window you can see all directories under the root directory double-click the Etsy directory to open it to see the current location double-click the avahi folder and press Ctrl L the current path appears at the top of the window the path for this is Etsy avahi suppose you intend to buy a new car what factors do you need to consider to make a proper choice requirements which need to be taken into account include the size needed to fit your family in the vehicle the type of engine and Chaos economy your expected budget and available financing options reliability record and after sales Services Etc similarly determining which distribution to deploy also requires planning here you can see some but not all choices note that many embedded Linux systems use custom crafted contents rather than Android or octo some questions worth thinking about before deciding on a distribution include what is the main function of the system what types of packages are important to the organization for example web server word processing Etc how much hard disk space is required and how much is available for example when installing Linux on an embedded device space is usually constrained how often are packages updated how long is the support cycle for each release for example LTS releases have long-term support unique kernel customization from a vendor or a third party what Hardware are you running on for example it might be x86 arm or PPC do you need long-term stability can you accept or need a more volatile Cutting Edge system running the latest software the partition layout needs to be decided at the time of installation it can be difficult to change later while Linux systems handle multiple partitions by mounting them at specific points in the file system and you can always modify the design later it's always easier to try to get it right to begin with nearly all installers provide a reasonable default layout with either all space dedicated to normal files on one big partition and a smaller swap partition or with separate partitions for some space sensitive areas like home and VAR you may need to override the defaults and do something different if you have special needs or if you want to use more than one disk all installations include the bare minimum software for running a Linux distribution most installers also provide options for adding categories of software common applications such as the Firefox web browser and Libra office office suite developer tools like the V and emacs text editors which we'll explore later in other popular services such as the Apache web server tools or mySQL database are usually included in addition for any system with a graphical desktop a chosen desktop such as normal KDE is installed by default all installers set up some initial security features on the new system one basic step includes setting the password for the super user root and setting up an initial user in some cases only an initial user set up direct root login is not configured and root access requires logging in first as a normal user and then using sudo as as we'll describe later some distributions will also install more advanced security Frameworks such as SC Linux or app armor for example all red hat based systems including Fedora and Centos always use SC Linux by default and Ubuntu comes with app armor up and running like other operating systems Linux distributions are provided on removable media such as USB drives and CDs or DVDs most Linux distributions also support booting a small image and downloading the rest of the system over the network these small images are usable on Media or as Network boot images in which case it is possible to perform and install without using any local media mini installers can do an installation completely automatically using a configuration file to specify installation options this file is called a Kickstart file for Red Hat based systems and auto yes profile for sushi based systems and a precede file for dbm based systems each distribution provides its own documentation and tools for creating and managing these files the actual installation process is pretty similar for all distributions after booting from the installation media the installer starts and asks questions about how the system should be set up these questions are skipped if an automatic installation file is provided then the installation is performed finally the computer reboots into the newly installed system on some distributions additional questions are asked after the system reboots most installers have the option of downloading and installing updates as part of the installation process this requires internet access otherwise the system uses its normal update mechanism to retrieve those updates after the installation is done the demonstrations we'll see show how to install Linux directly on your machine erasing everything that was there while the demonstrations will not alter your computer following these procedures in real life will erase all current data there are also alternate methods to install Linux where you won't lose any data so some of those methods include re-partitioning your hard disk to free up enough room to permit dual boot or side-by-side installation of Linux along with your present operating system or using a host machine hypervisor program such as vmware's products or Oracle virtualbox to install a client Linux virtual machine and finally booting off of and using a live CD or USB disk and not running to the hard disk at all the first method is sometimes complicated and should be done when your confidence is high and you understand the steps involved the second and third methods are quite safe and make it difficult to damage your system here are the steps to install Ubuntu now going to do an install of Ubuntu 1804 as a virtual machine under the VMware hypervisor using a red hat seven host system running VMware Player so first thing we need to do is to create a new virtual machine and for that I already have the Ubuntu installed this mounted uh in the virtual CD drive and we'll give it a name for the user as LF student for the username of student now we have to give a password which I have done and then for the name let's just call Ubuntu and then on the host machine I wanna have a certain place I want to put it rather than my home directory I wanted an uh on a disk that has a lot of space and then let's allocate 30 gigabytes of space and I prefer to have it as one big file rather than multiple files or slices I find that clutters my system less and really that's all you have to do to start setting up the install but it's better to click on customize hardware and increase the amount of memory from one gigabyte to four and in my case and I might as well take advantage of having multiple processors so I'll let it use all four processors on this host machine and then I'll just click on finish and it will start the install after a couple of harmless messages about how the virtual machine graphics driver doesn't permit accelerated graphics performance now the beautiful thing about the Ubuntu install on this recent version is that I am done there are no more choices to make I don't have any more parameters to specify Etc if I hadn't been installing in a virtual machine it would have asked me information like username and password at this stage but it was able to pick that up because of the intelligent way that VMware can handle Ubuntu so I'm doing this in real time yeah if you can read the messages you see it just created the the main file system on the system and now it's going through the stage of copying all the files over to the hard disk or I should say the simulated hard disk now this takes a little bit of time so I'll pause the recording for a few seconds so you don't have to watch not much happening I skipped about a minute or so and now it says it's almost finished copying files it's showing a bunch of different blurbs for various features in this bionic Beaver or Ubuntu 18.04 release the status bar has reached all the way to the right so it should be almost done and now it's doing the actual install of the system so it's copied all the files it needs over to the hard disk and it's doing the actual configuration so once again I believe I'll pause for a little while so you don't have to sit here and watch not much happening pause for about a minute now it says it's configuring Hardware so it's finding all the hardware devices in the system making sure it has the right device drivers for it Etc it's now configuring the bootloader the grub and now it's doing cleanup it's getting rid of packages which were only need a journey install then of course that's rolling by far too fast to be readable and so it's doing a little bit more package installation and then I'll pause again for a little while is that it reached the end of the status bar and now it's doing the reboot and shortly I should be getting a login prompt if you notice it's installing openvm tools that's a package of special drivers and configuration stuff that's used when you're running it as a guest under VMware hypervisor and we've reached the login screen running under the greeter so I'll just well again as student and oops I typed in the wrong password I suppose yep and now the system's running there's a few introductory uh messages here and I'll just click through them to get to a fully up system and then just to see what really happened here if I right click I can open up a terminal and then I'm going to run the command DF for disk free Dash T to show me what type of file systems have I have an H to print out the results in megabytes and gigabytes and I see that in the main file system I have 30 gigabytes of space of which I'm using 5.3 and it's an ext4 file system when we install Centos we need to actually specify the type of file system the size of the partition Etc but Ubuntu made choices that he thought were best likewise uh we will talk about this now but if I look at swap files you'll see that there is a swap file of about one and a half gigabytes created uh instead of a swap partition usually distributions create swap partitions so that's all there is to install the latest version of Ubuntu uh absolutely nothing to do during the install it makes what it thinks is sensible decisions for everything and after the system is up and running you can then go into the package manager and put in exactly what you need and configure the system in other ways if you need a more flexible installation to begin with you can make such choices when you start but we we took the easy path here here are the steps to install synth OS we are now going to do a fresh install of Centos 8.1 the latest version of Centos at the time of this installation we have already allocated hardness space for its installation to make a virtual machine under VMware and we have inserted the install disk image and we're ready to begin so we will uh not take the step of testing the media and installing it because that takes some time so we'll just go directly to an install so I'll just move to the first element here and hit return and we'll try to do this install as quickly as possible so we'll choose mostly the default choices and we're going to do a workstation install rather than a server install because this is what is desired for this course to happen to have a user-based install okay so the first choice is to pick the language we'll pick English and then uh we can go really through any order we want through these different choices uh to begin with but let's just go in order so we've already picked an English keyboard with the US layout and also language support is set up for English for United States you can click on these to make those changes for the time and date uh it's actually better to make sure the network is installed first so here I'm going I clicked on network and I'm going to turn on the network it found the network card and it's kind of ready to go probably should configure but I think the default choices will be fine if I go to General this is all users May connect and then if I go to ipv4 settings you'll see it's automatic DHCP so that's generally what you want rather than having to give it a fixed address so we'll just say okay for all this and uh um I guess we should say connect automatically with priority zero that means it'll always connect when you start up the machine and we can say done the reason it's good to do that before we set the time and date is we can now have Network time on which means it will automatically find a time uh I'm currently doing this installation from Central Time Zone in the United States so you can try to do that with the mouse and I got it right it's set for Chicago which is Central Time so I'll say done and then uh the installation source is uh rather important but that's local media I already have the DVD so as you see it's sent OS 8-1 1911 that's the latest version sent to us for the software selection uh let's just keep the workstation I could make it a server with a graphical interface or just a server if I really wanted to be quick I could do a minimal install and then bring everything up later that I need uh but within the workstation I should pick a few things so I'll pick an own applications internet applications uh you'll probably want to pick the office suite and productivity but I'd like this to go quickly so I won't do that right now uh I'll pick development Tools in case I want to compile anything and that's probably the main things I need right now but you can always change everything in detail once the system's up so it's it's good to do a relatively quick install the trickiest part here is to do the installation um partitioning setup so I'll pick I've already got picked here the virtual 30 gigabyte disk and if I wanted to take things really fast I would do automatic storage configuration and let it decide what kind of partitions that should have how big they should be Etc and you may want to at least look at that but let me just do custom because it fits in better with my needs and then I can say done okay and then I get to pick what kind of installation I want to do a standard partition and not an lvm which is logical volume management I just want a simple standard partition so I'll do that and then I actually have to create this partitions I need so I hit the plus sign and I'll have one big partition for everything so it's mounted at slash and let's give it 29 gigabytes and I'll add that this is the 30 gigabyte disk and then I'll add one more okay and that won't be mounted that'll be for swap and if I don't give a desired capacity it should take it all uh which it actually decided it should have three gigabytes I'll let the system go with what it wants it's it's doing that based on how much uh memory I have okay it says I have only like one megabyte left that'll get a total 30 gigabytes the one other thing I get to do for the first mound Point here is pick what kind of file system and you notice the default on red hat now is Orson OS is xfs let me make it ext4 um which is which is easier to mount from other other machines Etc either than xfs but you can just take the the default if you prefer and then I say done and it should be done it's telling me do I really want to do this because it's going to wipe out everything that's on that disc and I'll say sure accept the changes so uh I'm pretty much done uh K dump is a system you can set up so that if the system crashes your produce what's called a core dump file so I'll just you know you probably won't need to use that it'll be a little faster to boot uh when you have a new kernel so I'll just not enable that but if you're doing a develop machine you probably want that we already configured the network and under security policy we won't do any specialization we'll just leave it alone for now you can always change it later and then you just say begin installation now it'll already take a head start on trying to load some packages and files while you have some more information to put in first you'll have to pick a password for the root account and so I'll do that and it's actually LF train for uh virtual machines we use for the classes which is a pretty simple password and uh it's it's hard to read here but it should be saying it's too simple I can't see that oh it says week here but it says press done again to use the password anyway so I'll do that this is a throwaway machine and then I have to create a user I'll make the full name of the user LF student and by choice by default it wants to make the username of the account L student but we'll just make it student will require a password to use this account if we said make this user administrator would be like Ubuntu systems where there's just one password and you have to do as you do to do anything privileged but let's keep a standard Unix type setup with separate accounts and passwords for the student user and the root user so we're going to give a very simple password again just the word student and once again it's oh it says it does not match I must have typed things wrong let's try again s-t-u-d-e-n-t [Music] s-t-u-d-e-n-t yeah so now it says the password contains the username in some form you will have to pass done twice to confirm it it's also considered very weak but we'll accept it once again it's a throwaway machine in real life you shouldn't do this and so I say done and now uh we just have to wait for the install you'll see it is installed 500 some odd packages at a 1481. we can keep watching while this happens but it takes some time so I'm going to pause the recording and come back when it's almost done so it has finished and it's configuring the kernel now uh that takes a little bit of time to get installed I think 1481 packages so now it's doing the actual configuration of the kernel it is doing a few other configuration steps you'll notice it this is installing the bootloader it configured the editors is generating What's called the init Ram FS which is uh needed to boot it contains the initial file system which is stored in memory for just for the system booting which we talk about in detail in this course and this is probably the last thing it really has to do before it's done uh depending on the complexity of things it can take a while is not complete so now we can simply reboot so let's do that and we should have a running system and you see it wants to boot there into the default kernel 4.18.0 and I didn't do anything it will automatically boot on its own and then there's a few things that happen when you start up the first time I I wants me to accept the uh end user license which is pretty simple for uh open source product um and then finish configuration it has a few other things the setup and we're ready to do our first login as student so I clicked on that I'll type in the password and we have an up and running system and uh it's going to ask us to confirm again our choice of language and uh we could check to make sure the keyboard is okay but we're fine with English us and uh I'm going to turn off location services that's uh that's a choice you can make and if you want you can connect to various online accounts so we're going to skip all that then we're ready to go so now we have a fully functional system it brings up a tutorial screen if you want to get some more information we'll just skip that and here we are it's a fully functional system if I want to get a little information let me drop to a command line so I clicked on activities I'll say terminal and here we are so for instance if I do DF Dash h you'll see uh I've used 5.2 gigabytes uh and there's plenty of space available if I wanted to change the size of the screen depending on your hypervisor sometimes you can just kind of drag it out or something but here let me go to display settings and it's set for 1280 times 780 768 and I obviously can go bigger so just to show you for instance let's say I take 19 20. by 12 20. and I'm filling up the whole screen now it's actually bigger than my whole screen so I'll revert to settings but you can do all sorts of other adjustments and we've done a complete install of sentos 8 it's all set and ready to use and customized to your heart's content here are the steps to install open Susie we are now going to do a fresh install of open Suzy as a virtual machine under a VMware hypervisor on a red hat 7 system we have already inserted the install DVD and we're about to begin notice that in our initial screen we can do an installation upgrade or if we scroll down to more we see that we can also use the install DVD as a rescue system uh we can check memory and do various things but we're going to do an install so I'll just click on install and then it will cook for a while before it asks me to do anything uh so now it's finding all the hardware deciding what drivers to use Etc and getting started this is open Suzy leap version 42.3 and this is a typical gnome graphical booting screen while it's getting itself ready so it should take a few more seconds I'll pause so we don't have to watch the whole thing okay it has moved on and it's about ready to bring up a graphical screen and there we go so it's initializing the hardware on the system okay now it's asking whether we want to accept English as a language and also the license agreement so we'll just say sure click on the next button is doing more probing of the system deciding what to do and it says in a very small font initializing the installation now it would like to take a default partition scheme which we will override um so let me say edit proposed settings and I will take a partition-based proposal I will choose for my root partition ext4 I won't have any separate home partition or other partitions to keep things simple and that's all I have to choose so it's pretty simple and it says here it's going to create a swap partition of two gigabytes and then a root partition for everything else 28 gigabytes and so I'm happy enough with that so I'll just say next and first thing is just to pick the time zone so I'll pick Central Time where I am currently sitting and I could do some other settings do that unless I don't want to take automatic time setting so I just say next and here I have a choice for what kind of desktop let me pick the gnome desktop I could pick the KDE or as a server pure text mode no graphical or I can do custom to do something a little more complicated or different and then it wants me to give up a full name for uh the main users I'll say LF student and for the username I'll pick student and I'll give a password and then I will not pick use this password for system administrator that would be like what Ubuntu does and I will not pick automatic log and it's generally not a good idea to let your system log in without having to give a password so I'll say next it doesn't like my password because it's too simple but I'll say okay do it and now I have to give a root password and you might want to test your keyboard layout to make sure you have the right language I'll say next and once again it's going to complain my password is too simple and then I just say install and that's all the choices that I actually have to make so they really nothing except specifying username password and what kind of desktop I want we can do further adjustments once the system is fully installed now while it's installing which should take about 10 minutes the default screen here is a slideshow giving you brochures and information if I click on details it's a little more fun to look at so you can see the overall progress as it goes this first bar here is for each package as it's being installed and on the bottom you can see I'm already about 15 percent installed so I'm going to pause the recordings it's kind of boring to watch it install all 1500 packages and I'll wait until it's asking me to do something again before resuming okay that took about less than 10 minutes and now it's telling me the system is going to reboot and it did um and so we'll just see our normal booing of the new open Suzy system and it should quickly bring up the login screen just a few more seconds and there's our usual greeter screen I'll just type in the password for the student account and we have a fully operational open Souza system now the first thing I would do from here is update the system because there's always new updates to various packages since the DVD installed this was released so that's important for both security and performance and it's even prompting me to go ahead and do that and then I'd probably do some minor customizations about what kind of menus I see how Windows behave the keyboard Etc but I'll leave that for people to do as an exercise you have completed chapter three let's summarize the key Concepts covered a partition is a logical part of the disk a file system is a method of storing or finding files on a hard disk by dividing the hard disk into partitions data can be grouped and separated as needed when a failure or a mistake occurs only the data in the affected partition will be damaged while data on the other partitions will likely survive the boot process has multiple steps starting with the BIOS which triggers the bootloader to start up the Linux kernel from there the init Ram FS file system is invoked which triggers the init program to complete the startup process and determining the appropriate distribution to deploy requires that you match your specific system needs to the capabilities of the different distributions by the end of this chapter you should be able to manage graphical interface sessions perform basic operations using the graphical interface change the graphical desktop to suit your needs you can use either a command line interface or a graphical user interface when using Linux to work at the CLI you have to remember which programs and commands are used to perform tasks on the other hand using the GUI is often quick and easy it allows you to interact with your system through graphical icons and screens for repetitive tasks the CLI is often more efficient while the GUI is easier to navigate if you don't remember all the details or do something only rarely we'll learn how to manage sessions using the GUI for the three Linux distribution families that we cover the most in this course which are red hat including sentos and Fedora Susi open Susi and Debian Ubuntu and mint in subsequent sections of this course will concentrate in great detail on the command line interface which is pretty much the same on all distributions generally in a Linux desktop system the X Windows system is loaded as one of the final steps in the boot process it's often just called x a service called the display manager keeps track of the displays being provided and loads the X server so called because it provides graphical services to Applications sometimes called X clients the display manager also handles graphical logins and starts the appropriate desktop environment after a user logs in X is rather old software it dates back to the mid-1980s and as such it has certain deficiencies on Modern systems for example with security and it's been stretched rather far from its original purpose a newer system known as Weyland is gradually superseding it and is the default display system for Fedora rel8 and other recent distributions for the most part it looks just like x to the user although under the hood it's quite different a desktop environment consists of a session manager which starts and maintains the components of the graphical session and the window manager which controls the placement and movement of Windows the window title bars and controls although these can be mixed generally a set of utilities session manager and Window Manager are used together as a unit and together they provide a seamless duct stop environment if the display manager is not started by default in the default run level you can start the graphical desktop in different in a different way after logging into a text mode console by running start X from the command line when you install a desktop environment the X display manager starts at the end of the boot process it's responsible for starting the graphics system logging in the user and starting the user's desktop environment you can often select from a choice of desktop environment when logging into the system gnome is a popular desktop environment with an easy to use graphical user interface it's bundled as the default desktop environment for most Linux distributions including Red Hat Enterprise Linux Rel Fedora Centos Susie Linux Enterprise Ubuntu and Debian gnome has menu based navigation and is sometimes an easy transition to accomplish for Windows users however as you'll see the look and feel can be quite different across distributions even if they're all using gnome another common desktop environment very important in the history of Linux and also widely used is KDE which has often been used in conjunction with Susi and open Susie as previously mentioned most desktop environments follow a similar structure to gnome and will restrict ourselves mostly to it to keep things less complex let's demonstrate how we log in and log out of a system which has already been booted on all recent distributions this looks pretty much the same here we're showing an instance of Centos stream which has three users on the system and I can log in and any one of them by selecting so let's go with the second one BJ moose and you'll notice that when I log in if I click on the gear item I have a choice of different desktops okay here's the default on Silhouette stream which is a Weyland but I can pick a couple of different kinds of x11s if I want I'll type in the password and I log in I depending on what's going on I may see a little bit of information um and that's all it's involved in logging in I probably won't see a hell of a lot this is a new user without much going on if I click on activities for instance I'll see some favorite applications if I click on Terminal here I can bring up a terminal if I want to do command line activity to log out all I have to do is go in the upper right corner and I can click on my name and then I can say either switch user or log out I would do switch user if I want to keep more than one session active at a time for different people which is something you probably won't want to do very often but it would mean if I came back into this user session I would see the whatever applications I had open but I'll just pick on log out and then I click here log out and I'm back to my greeter or my login screen where I can pick the users again so I can log in on any one of them so that's a simple demonstration of how one logs in and out of a system each Linux distribution comes with its own set of desktop backgrounds you can change the default by choosing a new wallpaper or selecting a custom picture to be set as the desktop background if you don't want to use an image as the background you can select a color to be displayed on the desktop instead in addition you can also change the desktop theme which changes the look and feel of the Linux system the theme also defines the appearance of application windows so let's see how to change the desktop background and theme we're going to demonstrate how to change the background wallpaper on a red hat 7 system all recent Linux distributions have exactly the same method so this will suffice the show for all so all we have to do is click on the background with a right click and change background click on background again and then we have a choice between wallpapers that the system knows already and it's possible to load up other ones so let's say we pick this one here and you see now the background has been changed or I could pick for instance a picture stored on my machine in my pictures directory under my home directory so I'll pick this one and you see it's been changed so that's all we have to do to change the background on any recent Linux system most common settings both personal and system-wide are to be found by clicking in the upper right hand corner on either a gear or other obvious icon depending on your Linux distribution however there are many settings which many users would like to modify which are not accessible in that way the default settings utility is unfortunately rather Limited in modern gnome-based distributions unfortunately the Quest for Simplicity has actually made it difficult to adapt your system to your tastes and needs fortunately there is a standard utility gnome tweaks which exposes many more setting options it also permits you to easily install extensions by external parties not all Linux distributions install this tool by default but it's always available you may have to run it by hitting alt F2 and then typing in the name you may want to add to your favorites list as we shall discuss in this screenshot the keyboard mapping is being adjusted so the useless cap slot key can be used as an additional control key this saves users who use control lot such as emacs aficionados from getting physically damaged by pinky strain the visual appearance of applications the buttons scroll bars widgets and other graphical components are controlled by a theme gnome comes with a set of different themes which can change the way your applications look the exact method for changing your theme may depend on your distribution for older gnome-based distributions you can simply run gnome tweaks as shown in the screenshot from Ubuntu however now you'll be able to see a demonstration for logging in and out on the major Linux distribution families will concentrate on in this course note that Evolution has brought us to a stage where a little it matters little which distribution you choose as they're all rather similar recent Linux distributions which use the gnome desktop look remarkably the same when it comes to the process of starting up and shutting down so we will demonstrate that here by using a VMware hypervisor on a red hat Enterprise Linux host and we'll demonstrate three recent distributions and how they boot so we've already teed them up so here I will start Sentosa stream here I will start Ubuntu 2004 and here I will start open Suzy leap 15.3 so you'll see a little bit different messages on each as they boot uh according to how grub is configured and what the possible kernel choices are it will take longer to boot than they would normally would if I was only doing one at a time simply because uh the host machine is a little bit overloaded running three virtual machines it really doesn't have a ton of memory in this case I have allotted three gigabytes of memory to each out of a total of 16 gigabytes on the machine so it's a little bit memory stressed so we'll just wait till they start and reach their greeter screen which you see we've already done that on Ubuntu we've already done that on open suse a leap and it's taking somewhat longer on Centos uh eight stream so let's log into these guys while we wait for sent a list stream to get ready so I'll log in the student password here on the Ubuntu machine I'll do the same thing on the open suse machine and now we're just waiting for the central S8 machine finally ready and then I'll log in there as well and you notice they have different background pictures just because we have selected different background pictures over time but they all arrive to pretty much the same appearance within activities and applications menu and then Ubuntu still likes to have this sidebar on the left with major applications I can easily bring that up on the other ones for instance if I type activities here activities on open Tuesday I will see the same thing there and then the process of shutting down is also quite similar all I need to do is click in the upper right hand corner and I find the power icon and I just say power off I'll do the same thing with Ubuntu again power off I'm gonna go power off and I could do the same thing with open Suzy power off and power off so it's remarkably the same from distribution to distribution these days it's often a good idea to lock your screen to prevent other people from accessing your session while you're away from your computer no this does not suspend the computer all your applications and processes continue to run while the screen is locked let's show how to lock unlock your screen on any recent gnome distribution so the simplest way is to go the upper right corner and click refine the lock button and simply and simply click on that and then you can unlock it by clicking on the display on the time there and just typing in the password again very simple another way to do it is through combination of keys uh depending on your machine this will generally be the Super Key plus l or the Super Key plus the Escape where the super key is also known as the Windows key uh so let me do that here and once again I brought up the lock window and I can simply unlock it again so that's all that's involved it's very simple Linux is a true multi-user operating system which allows more than one user to be simultaneously logged in if more than one person uses the system it's best for each person to have their own user account and password this allows for individualized settings home directories and other files users can take turns using the machine while keeping everyone's sessions alive or even be logged in simultaneously through the network let us demonstrate how to switch users on an Ubuntu machine with several accounts so first I will choose the Linux Foundation student as the account to log into type my password and sign in and then if I look in the upper right hand corner and click there I will see LF student and I can click on either log out or switch user notice if I log out I really log out but if I switch user I will just lock the user account and then when I start up I will preserve all my sessions and open Windows Etc when I restart on some distributions you may actually see a list of users at this screen but not on Ubuntu so I'll say switch user back to the greeter screen and let me pick the second one Theodore cleaver and login as that other user and there we go and now if I look up here again I can do the same thing so let me click on the name and I'll say switch user and if I pick student again you notice here it says unlock and not restart that means that if I were to log in now I will have preserved all the open windows and running applications from before this will look the same essentially on all Linux distributions of recent vintage so it's very easy to switch users and not lose any information from what you're already doing besides normal daily starting and stopping of the computer a system restart may be required as part of certain major system updates generally only those involving installing a new Linux kernel initiating the shutdown process from the graphical desktop is rather trivial on most current Linux distributions with very little variation we'll discuss later how to do this from the command line using the shutdown command in all cases you click on either a settings or gear or a power icon and follow the prompts to shut down the computer on any recent gnome based Linux distribution perform the following steps first click the power or the gear icon in the upper right hand corner of the screen second click on click on the power off restart or cancel if you do nothing the system will shut down in 60 Seconds shut down reboot and log out operations will ask for confirmation before going ahead this is because many applications will not save their data their data properly when terminated this way always save your documents and data before restarting shutting down or logging out all modern computer support suspend or sleep mode when you want to stop using your computer for a while suspend mode saves the current system State and allows you to resume your session more quickly while remaining on but uses very little power in the sleeping state it works by keeping your system's applications desktop and so on in system Ram but turning off all the other Hardware this shortens the the time for a full system startup as well as conserves battery power once note that modern Linux distributions actually boot so fast that the amount of time saved is often minor even experienced users can forget the precise command that launches an application or exactly what options and arguments it requires fortunately Linux allows you to quickly open applications using the graphical interface applications are found at different places in Linux and with a gnome they can be found from the applications menu in the upper left hand corner or from the activities menu in the upper left hand corner also in some Ubuntu versions from the dash button in the upper left hand corner for KDE and some other environments applications can be opened from the button in the lower left hand corner in the upcoming sections you will learn how to perform basic Linux operations using the graphical interface unlike other operating systems the initial install of Linux usually comes with a wide range of applications and software archives that contain thousands of programs that enable you to accomplish a wide variety of tasks with your computer for most key tasks a default application is usually already installed however you can always install more applications and try different options for example Firefox is popular as the default browser in many Linux distributions while Epiphany concodor and chromium the open source of Google Chrome are usually available for install from software repositories proprietary web browsers such as Opera and chrome are also available locating applications from The Gnome and KDE menus is easy as they're neatly organized and functional sub-menus multiple applications are available to accomplish various tasks and to open a file type of a file of a given type for example you can click on a web address while reading an email and launch a browser such as Firefox or Chrome to set the default applications enter the settings menu on all recent Linux distributions and then click on either default applications or details default applications let's now demonstrate how to set default applications on a red hat system we go to the upper right hand corner click on the top bar then scroll down to the gears icon for settings go down to the bottom for details and then I can click on default applications so you see under web or browser there are three choices on this system I have Google Chrome Firefox or Opera we'll leave it at Google Chrome for video the default choices videos which is actually a program called totem but let's switch it to the VLC media player and for the image viewer I have the built-in image viewer or I could switch to the new image manipulation program better known as so on all recent distributions with a known desktop the procedure is identical and absolutely the same and it's very simple to change your default applications each distribution implements the Nautilus or file manager utility which is used to navigate the file system it can locate files and when a file is clicked upon either it will run if it's a program or an associate application will be launched using the file as data this behavior is completely familiar to anyone who has used other operating systems to start the file manager you will have to click on its icon a file cabinet which is easily found usually under favorites or accessories it will have the name files this will open a window with your home directory displayed the left panel of the file manager window holds a list of commonly used directories such as desktop documents downloads and pictures the file manager lets you access different locations on your computer and the network including the home directory the desktop documents pictures and other other locations every user with an account on the system will have a home directory usually created under home slash home usually named according to the user such as slash home student by default files the user saves will be placed in a Directory Street starting there account creation whether during system installation or at a later time when a new user is added also induces default directories to be created under the user's home directory such as documents desktop and downloads the file manager allows you to view files and directories in more than one way you can switch between the icons and list formats either by clicking The Familiar icons in the top bar or you can press Ctrl 1 or control 2 respectively in addition you can also arrange the files and directories by name size type or modification to date for future sorting to do so click View and select arrange items another useful option is to show hidden files sometimes and precisely called system files which are usually configuration files that are hidden by default and whose name starts with a DOT to show him file select show hidden files from the menu or press Ctrl H the file browser provides multiple ways to customize your window view to facilitate easy drag and drop file operations you can also alter the size of the icons by selecting zoom in and zoom out under the view menu the file manager includes a great Search tool inside the file browser window one click search in the toolbar to bring up a text box then enter the keyword in this text box this causes the system to perform a recursive search from the current directory for any file or directory which contains a part of this keyword you can refine your search beyond the initial keyword by providing drop down menus to further filter the search deleting a file in Nautilus will automatically move the deleted file to the local share slash trash files directory basically a trash can under the user's home directory there are several ways to delete files and directories under Nautilus one you can select all you select all the files and directories that you want to delete then press Ctrl delete on your keyboard or right click the file then select move to trash note that you may have a delete permanently option which bypasses the trash folder and this option may be visible all the time or only in list rather than icon mode to permanently delete a file on the left panel inside a nautilus file browser window right click on the trash the on the trash directory select empty trash and that's all alternatively select the file or directory you want to permanently delete and press shift delete let's see how to locate the Firefox application in locate Firefox click activities on the top left corner of your desktop on the left panel click the show applications icon click the Firefox icon close Firefox by clicking close in the top right corner of the Firefox window next let's explore the home directory using the file manager try to View files in list mode create a new empty document save it and remove it click activities in the upper left corner of your desktop in the left panel click the file manager icon this will by default open the home directory to View files in list mode click the list icon in the upper right of the file manager window double-click the document directory to open it click activities in the top left corner of your desktop to launch G edit type G edit in the search box click the G edit icon to open it type your name and click close in the top right corner of the G edit window to create and close a file click save as to save the created file select documents from the left panel of the save as window type test to save the file by that name click save to save the file and close G edit this brings you back to the document directory right-click the test file in the document window select move to trash to remove the file you have completed chapter 4. let's summarize the key Concepts covered gnome is a popular desktop environment and graphical user interface that runs on top of the Linux operating system the default display manager for Gnome is called gdm the gdm display manager presents the user with the login screen which prompt for the user the login username and password log out through the desktop environment kills all processes in your current X session and returns to the display manager login screen Linux enables users to switch between logged in sessions so spending puts the computer into sleep mode for each key task there is generally a default application installed every user created in the system will have a home directory the places menu contains entries that allow you to access different parts of the computer and the network Nautilus gives three formats to View files each Linux distribution comes with its own set of desktop backgrounds gnome comes with a set of different themes which can change the way your applications look by the end of this chapter you should be able to apply system display and date and time settings using the system settings panel track the network settings and manage connections using the network manager in Linux install and update software in Linux from a graphical interface note that we'll revisit all these tasks later when we discuss how to accomplish them from the command line the system settings panel allows you to control most of the basic configuration options and desktop settings such as specifying the screen resolution managing network connections or changing the date and time of the system for The Gnome desktop manager one clicks on the upper right hand corner and then selects the tools image the screwdriver crossed with a wrench or gear depending on your distribution you may find other ways to get into the settings configurations as well you'll also find variations in the menu layout between Linux distributions and versions so you may have to hunt for the settings you need or to examine or modify to get deeper into configuration one can click on the devices on the previous menu in order to configure items like the display the keyboard the printers Etc one can also click on the users icon which may be under details to set values for system users such as their login picture password Etc a lot of personalized configuration settings do not appear on the settings menu instead you have to launch a tool called either gnome tweaks or gnome tweak tool we have not really discussed working at the command line yet but you can always launch a programs such as this by doing alt F2 and typing in the command some distributions have a link to the tweaks menu and the settings but for some mysterious reason many obscure this Tool's existence and it becomes hard to discover how to modify even rather basic desk type attributes and behaviors important things you can do with this tool include selecting a theme configuring extensions which you can get from your distribution or download from the internet you can control fonts modify the keyboard layout and set which programs start when you log in the most recent gnome versions have removed a lot of the functionality of gnome tweaks extensions now have to be configured using a new a new app called gnome extensions app the reasoning for this is obscure here you can see a screenshot from a red hat system with quite a few extensions installed but not all being used clicking on settings displays or settings devices displays will expose the most common settings for changing the desktop appearance these settings function independently of the specific display drivers you're running the exact appearance will depend enormously on how many monitors you have and other factors such as Linux distribution and particular version if your system uses a proprietary video card driver usually from Nvidia or AMD you'll probably have a separate configuration program for that driver this program may give more configuration options but may also be more complicated and might require this admin root access if possible you should configure the settings in the displays panel rather than with the proprietary program the X server which actually provides the the GUI uses slash Etc X11 xorg.com as its configuration file if it exists in modern Linux distributions this file is usually present only in unusual circumstances such as when certain less common graph drivers are in use changing this configuration file directly is usually for more advanced users while your system will usually figure out the best resolution for your screen automatically it may get this wrong in some cases or you might want to change the resolution to meet your needs you can accomplish this using the displays panel the switch the switch to the new resolution will be effective when you click apply and then confirm that the resolution is working in case the selected resolution fails to work or you're just not happy with the appearance the system will switch back to the original resolution after a short timeout once again the exact appearance of the configuration screen will vary a lot between distributions and versions but usually it's rather intuitive and easy Once you find the configuration menus in most cases the configuration for multiple displays is set up automatically as one big screen spanning all monitors using reasonable guests for screen layout if the screen layout is not as desired a checkbox can turn on mirrored mode where the same display is seen on all monitors clicking on a particular monitor image lets you configure the resolution of each one and whether they make one big screen or mirror the same video configuring display settings such as resolution is almost identical on all major distributions so we'll demonstrate that running virtual machines under VMware on a red hat 8 host so let's begin with showing what it looks like on Ubuntu so I go up in the upper right hand corner and I find the settings button and then in the main uh panel here we have displays so we've already clicked on that and you see uh the easiest thing to do here is I can change the resolution to be any one of these numbers now you can continuously vary the display size usually on a virtual machine and by dragging and dropping the corners you see now it's changed to another number but that's all that's involved in Ubuntu for instance if I want to go to open well let's try Centos incentives 8 stream actually I find the settings once again and then here I have to scroll down to devices and then displaces in there and we have the identical setup except for this night light option which is for looking in a darker situation which we also had in the Ubuntu was just located in a different place on open Tuesday you'll see it's virtually identical as well I just click on the settings gear button here and once again I have to go to devices like I did on the red hat system and I have the identical situation you couldn't tell what operating system you were on if you just looked at this now these are all virtual machines with one terminal if I look on the host which actually has three different monitors hooked up to it you'll see then I get something like this where I can see all three of my monitors uh I can figure any one of them here it's doing those the smaller one the 18 inch one but I could switch to the 27 or the 24 and I can control their different resolutions if I move these guys around here I can change the way the three of them are laid out for left to right I don't particularly want to do that because it gets kind of messy but this is how you can control which ones in the middle which is on the right or left Etc so these days configuring the display resolution and some other basic things is really very simple very intuitive the hardest thing is just to find the the settings icon to click on by default Linux always uses coordinated universal time for its own internal time keeping displayed or stored time values rely on the system time zone setting to get the proper time UTC is similar to but more accurate than Greenwich Mean Time if you click on the time displayed on the top panel you can adjust the format with which the date and time is shown on some distributions you can also alter the values the more detailed date and time settings can be selected from the date and time window in the system settings menu the automatic settings are referring to the use of network time protocol which we'll discuss next the network time protocol is the most popular and reliable protocol for setting the local time by Consulting established internet servers Linux distributions always come with a working ntp setup which refers to a specific time servers run or relied on by the distribution this means that no setup Beyond on or off is generally required for Network time synchronization all Linux distributions have network configuration files but file formats and locations can differ from one distribution to another hand editing of these files can handle quite complicated setups but it's not very dynamic or easy to learn and use network manager was developed to make things easier and more uniform across distributions it can list all available networks both wired and wireless allow the choice of a wired Wireless or a mobile broadband Network handle passwords and set up virtual private Networks except for unusual situations it's generally best to let network manager establish your connections and keep track of your settings in this section you'll learn how to manage network connections including wired and wireless connections and mobile broadband and VPN connections wired connections usually do not require complicated or manual configuration the hardware interface and Signal presence are automatically detected and then network manager sets the actual network settings via Dynamic host configuration protocol or DHCP for static configurations that do not use DHCP manual setup can also be done easily through network manager you can also change the Ethernet Mac address or media Access Control address if your Hardware supports it the MAC address is a unique hexadecimal number of your network card wireless networks are usually not connected by default you can view the list of available wireless networks and see which one if any you're currently connected to by using network manager you can then add edit or remove known wireless networks and also specify which ones which ones you want connected by default when present to configure a wireless network in any recent gnome-based distribution click on the upper right corner of the top panel which brings up a settings and or network window while the exact appearance will depend on Linux distribution inversion it will always be possible to click on a Wi-Fi Sub menu as long as the hardware is present here is an example from a rel8 system select the wireless network you wish to connect to if it's a secure network the first time it will request that you enter the appropriate password by default the password will be saved for subsequent connections if you click on Wi-Fi settings you will bring up this if you click on the gear icon for any connection you can configure it in more detail older and other Linux distributions may look quite a bit different in detail but the steps and choices are essentially identical as they're all running network manager with perhaps somewhat different clothing let's demonstrate how to control wired and wireless network connections on a red hat system if I click on the upper right hand corner for instance if I want to look at the wired connection I can just scroll down to the wired connection and then wired settings and it asks me for my password the root the root password because it wants to have a super user only control network connections and you'll see I have a thousand megabit connection if I click on the gear icon I can control the settings on the details first screen it says it connects automatically when the system starts and all users can use it on identity I give what the name of the interface looks like not the name of the system in older systems that would have been eth0 eth1 Etc but as we will discuss later newer systems have these more complex names under ipv4 we control the basic Internet Protocol systems settings most of the time you'll leave it alone it automatically hcp Dynamic host configuration protocol where the system figures out its address from the server Etc if you understand how the importance of manual settings you can specify an address a net mask a Gateway you can select a particular DNS server and you can specify routes to certain addresses if you understand those Concepts this is where you would go to control all that we're not changing anything so I'll just hit cancel now if I want to control Wi-Fi settings I could go back to that upper right corner or I can just click on the Wi-Fi setting here and once again it's asking me for the super user password these are the different wireless networks that have to be that are available at the moment they all have lots next to them means they require a password this is the one that I'm actually on coopj the first one if I click on the settings there once again it's going to ask me for um my my super user password and I see essentially the exact same settings I had on the wired connection the automatic startup as other people use it the identity and whether I want to use DHCP or set things manually or not so that's all there really is in the graphical interface to control basic network connections it's rather simple and it looks the same at all recent Linux distributions you can set up mobile broadband connection with network manager which will launch a wizard to set up the connection details for each connection once the configuration is done the network is configured automatically each time the Broadband network is attached network manager can also manage this manage your VPN connections it supports many VPN Technologies such as native ipsec Cisco open connect via either the Cisco client or a native open source client Microsoft pptp and openvpn you might get support for a VPN as a separate package from your distributor you need to install this package if your preferred VPN is not supported each package and Linux distribution provides one piece of the system such as the Linux kernel the C compiler utilities for manipulating text or configuring the network or for your favorite web browsers and email clients packages often depend on each other for example because your email client communicates using SSL TLS it will depend on a package which provides the ability to encrypt and decrypt SSL and TLS communication and will not install unless that package is also installed at the same time all systems have a lower level utility which handles the details of unpacking a package and putting the pieces in the right places most of the time you will be working with a higher level utility which knows how to download packages from the internet and can manage dependencies and groups for you in this section you will learn how to install and update software in Linux using the dbn packaging system used by systems such as Ubuntu as well and RPM Packaging Systems which is used by both red hat and the Susie family systems there are these are the main ones and use although there are other ones which work well for other distributions which are less used let's look at the package management for the Debian family system dpkg is the underlying package manager for these systems it can install remove and build packages unlike high-level packages Management Systems it does not automatically download and install packages and satisfy their dependencies for deviant based systems the higher level package management system is the advanced package tool or apt system of utilities generally while each distribution within the Debian family uses apt it creates its own user interface on top of it for example aptkit or app kit synthetic Ubuntu software sensor Etc although apt repositories are generally compatible with each other the software they contain generally is not therefore most repositories Target a particular distribution like Ubuntu and often software Distributors ship with multiple repositories to support multiple distributions demonstrations are shown later in this section Red Hat package manager or RPM is the other package management system popular on Linux distributions it was developed by red hat and adopted by a number of other distributions including Sushi and open Sushi OS Oracle Linux and others the high level package manager differs between distributions Red Hat Family distributions historically use Rel or syn Os and Fedora uses dnf while retaining good backward compatibility with the older yum program Susie family distributions such as open Susi also use RPM but use the zipper interface the yet another setup tool or yes software manager is similar to other graphical package managers it's an RPM based application you can add remove or update packages using this application very easily to access the yes software manager first click activities then in the search box type yeast and click on the yes icon then click software management you can also find yes by clicking on applications other guest which is a strange place to put it but open sources yes software management application is similar to The graphical package managers and other distributions a demonstration of the yes software manager is seen later in this section we are now going to demonstrate software package management from a graphical interface using the open Suzy Linux distribution the tool we want to use for doing this is yes yast and there's two different ways I can reach it if I have the gnome shell extension installed which shows the applications menu which doesn't come by default I can go down to systems tools and then go down to yes or I can always go up to the upper right hand corner click on the tool icon and then at the bottom here on the system click on yes it will want the root password because I'm going to manipulate what's installed on the system and so if I go to software I can go to software management now the first thing that yes has to do is study the system and get a database of every possible package so it you can look at the packages on the system in different ways you can look by what's called RPM groups so here's all the games and are grouped under Amusements I have applications development and all different kinds of development subcategories tools documentation Etc or RPM groups that is rpm groups okay or I can look at package groups which maybe is a little more intuitive so I could click on let's say multimedia and see all the different programs are involved in uh in dealing with multimedia suppose I want to install something or inquire as to where something is installed I can click on search and type something in here I'll type the new plot and I bring up quickly all the different canoe plot uh pro programs there are the main one you see has a check mark in the box that means it's already installed [Music] um I will decide to install gnu plot.doc which is a small documentation package and then in order to do the install I will click on accept and it will go ahead and do it it's a pretty small package it doesn't take long if you needed some other packages to function it would have installed them at the same time so now I'll say continue and if I could want to remove it because I don't really need it I'll type it that in the search again and then I click on here um until I get an X for removal and then I say accept and it's removing it so that's all I had to do to do some basic package installation and removal under gnome software with open Susie pretty simple experienced Linux administrators probably do most of their package management from the command line rather than from a graphical interface however every Linux distribution has at least one graphical interface for installing upgrading removing Etc various software packages so let's take a look at a recent Ubuntu system I can go to Applications and then down to system tools and first let's look at the one at the bottom here which just says software this is actually a program called gnome software you can always install it if it hasn't been installed on your system it looks somewhat like an app store or a Play Store from Android and it's pretty obvious you can click on any one of these to try to install Etc and at the bottom you'll see things are grouped by category so for instance oh I could click on utilities and then I'll see a bunch of different utilities that may or may not be installed on your system already okay or I could search for various things so let me go back to the main page and um if I click on The Hourglass up in the corner here I can search so let's say I search on Terminal here you'll see it'll come up with a number of different things I could install you'll see here this terminal here is the gnome terminal that it says installed in a rather small font here uh and if I wanted to install something else I could just say for instance here I could click on that and I would say install and it could just be installed or if I want something a little more fun let's say look for a program called cheese which lets you use your webcam to take pictures or or make videos Etc and I can say remove because it turns out it's already installed so let me remove it and it's going to want a password to do this which should be that price surprising so I type my password and it's removing it and then uh you know if I want to reinstall it which I'll do I'll just say install and give the password again so this is not a very complex program to use uh it's pretty easy to use Canon software and you'll notice at the top you have a list here of explore which is where we are now installed would be all your installed packages and if you do updates it's telling me the system has two sets of updates that I really should install but to save time I'll do that right now so that's one graphical interface there's a much older graphical interface that's available in Ubuntu called synaptic so let's do that one photo is under system tools there we go synaptic package manager and once again this is going to ask for a password and uh it's an informatory message and this is actually a very simple easy to use and uh gives you a clearer uh vision of exactly where everything came from compared to the more modern graphical interfaces it's pretty straightforward to use um it's organized by either sections here I can do it in other ways I can do searching uh uh Etc so suppose I want to search I'll do the same search here terminal and it's going to show me all the packages that either have terminal the name or discuss terminal if I want to restrict it to ones that have only uh in the name I can do that and it's pretty straightforward to use I won't run through this these are already installed because they're in green uh I can install any of these other ones and I can just click on that and then I will say I want to do QT terminal I would say Mark for installation and it says in order to this the work it has to install all these other packages too which it depends on so we won't bother to do that and that's briefly what you can do on an Ubuntu system with a graphical software package installations and removals you have completed chapter five so let's summarize the key Concepts covered you can control basic configuration options and desktop settings through the system settings panel Linux always uses coordinated universal time or UTC for its own internal timekeeping you can set the date and time settings from the system settings window the network time protocol is the most popular and reliable protocol for setting the local time via internet servers the displays panel allows you to change the resolution of your display and configure multiple screens the network manager can present available wireless networks it allows the choice of a wireless or mobile broadband Network handles passwords and sets up vpns the dpkg and RPM are the most popular package Management Systems used on Linux distributions deviant distributions use dpkg and apt-based utilities for package management RPM was developed by red hat and adopted by a number of other distributions including open succe Oracle Linux and others by the end of this chapter you should be familiar with common Linux applications including internet applications such as browsers and email programs office productivity Suites such as Libra office developer tools such as compilers debuggers Etc multimedia applications such as those for audio and video graphic editors such as the and other Graphics utilities the internet is a Global Network that allows users around the world to perform multiple tasks such as searching for data communicating through emails and online shopping obviously you need to use Network aware applications to take advantage of the internet these include web browsers email clients streaming media applications Internet relay chats and conferencing software as discussed in the graphical interface chapter Linux offers a wide variety of web browsers both graphical and text space including Firefox Google Chrome chromium Epiphany renamed web conquer links lynx w3m and Opera email applications allow for sending receiving and reading messages over the Internet Linux systems offer a wide number of email clients both graphical and text-based in addition many users simply use their browsers to access their email accounts most email clients use the internet message access protocol or IMAP or the older pop post office protocol to access email stored on a remote mail server most email applications are we also display HTML formatted emails that include objects like pictures and hyperlinks Linux support the following types of email applications graphical email clients such as Thunderbird Evolution and Clause mail text mode email clients such as Mutt and mail all web browser-based clients such as Gmail Yahoo mail and office 365. Linux systems provide many other applications for performing internet related tasks these include filezilla pigeon ikiga and hexchat most day-to-day computer systems have productivity applications sometimes called office suites available or installed each Suite is a collection of closely coupled programs used to create and edit different types of files such as text spreadsheets presentations graphical objects most Linux distributions offer a Libra office an open source office suite that started in 2010 and has evolved from open Office while other office suites are available as as we have listed LibreOffice is the most mature and it's most it's also the most widely used and intensely developed in addition Linux users have full access to internet-based office suites such as Google Docs and Microsoft Office 365. the component applications included in Libra office are writer for word processing calc for spreadsheets impress for presentations draw for creating and editing graphics and diagrams the LibreOffice applications can read and write non-native document formats such as those used by Microsoft Office usually Fidelity is maintained quite well but complicated documents might have some imperfect conversions Linux distributions come with a complete set of applications and tools that are needed by those developing or maintaining both user applications and the kernel itself these tools are tightly integrated and include Advanced editors customized for programmers needs such as V and emacs compilers for every computer language that has ever existed including very popular or new ones such as golang and rust debuggers such as GDB and various graphical front ends to it and other and many other debugging tools performance measuring and monitoring programs some with easy to use graphical interfaces others more Arcane and meant to be used only by serious experienced development Engineers complete integrated development environments or Ides such as eclipse and visual studio code that put all these tools together another operating systems these tools have to be obtained and installed separately often at a high cost well in licks they are all available at no cost through standard package installation systems multimedia applications are used to listen to music watch videos Etc as well as to present and view text and Graphics Linux systems offer a number of sound player applications including amarok audacity and Rhythm box of course Linux systems can also connect with commercial online music streaming services such as Pandora and Spotify through web browsers movie and video players can portray input from many different sources either local to the machine or on the Internet Linux systems offer a number of movie players including VLC and player zine totem movie editors are used to edit videos or movies like systems offer a number of movie editors including cinepaint blender Cinderella and ffmpeg graphic editors allow you to create edit View and organize images of various formats the new image manipulation program or is a feature-rich image retouching and editing tool similar to Adobe Photoshop and it's available on all Linux distributions some features of of are it can handle any image format it has many special purpose plugins and filters it provides extensive information about the image such as layers channels and histograms in addition to there are other Graphics utilities that help perform various image related tasks including EOG inkscape convert and scribus you have completed chapter six let's summarize the key Concepts covered Linux offers a wide variety of Internet applications such as web browsers email clients online media applications and others web browsers supported by Linux can be either graphical or text-based such as Firefox Google Chrome Epiphany w3m links and other others Linux supports graphical email clients such as Thunderbird Evolution and cosmile and text mode email clients such as Mutt and mail Linux systems provide many other applications for performing internet related tasks such as filezilla xchat pigeon and others most Linux distributions offer LibreOffice to create and edit different kinds of documents Linux systems offer entire Suites of development applications and tools including compilers and debuggers Linux systems offer a number of sound players including amarok audacity and Rhythm box Linux systems offer a number of movie players including VLC and players Dean and totem Linux systems offer a number of movie editors including Kino cinepaint blender among others the utility is a feature-rich image retouching and editing tool available on all Linux distributions other Graphics utilities that help perform various image related tasks are EOG inkscape convert and scrivas by the end of this chapter you should be able to use the command line to perform operations in Linux search for files create and manage files install and update software Linux system administrators spend a significant amount of their time in a command line prompt they often automate and troubleshoot tasks in this text environment there's a saying graphical user interfaces make easy tasks easier while command line interfaces make difficult tasks possible Linux relies heavily on the abundance of command line tools the command line interface provides the following advantages no ugui overhead is incurred virtually any and every task can be accomplished while sitting at the command line you can Implement scripts for often used or easy to forget tasks and series of procedures you can sign into remote machines anywhere on the internet you can initiate graphical applications directly from the command line instead of hunting through menus while graphical tools may vary among Linux distributions the command line interface does not a terminal emulator program emulates or simulates a standalone terminal within a window on the desktop by this we mean it behaves essentially as if you were logging into the machine at a pure text terminal terminal with no running graphical interface most terminal emulators programs support multiple terminal sessions by opening additional tabs or Windows by default on gnome desktop environments The Gnome terminal application is used to emulate a text mode terminal in a window other available terminal programs include extern console default on KDE and Terminator to open a terminal on any system using a recent gnome desktop click on applications system tools terminal or applications utilities terminal if you do not have the applications menu you will have to install the appropriate gnome shell extension package and turn it on with gnome tweaks on any but some of the most recent gnome based distributions you can always open a terminal by right-clicking anywhere on the desktop background and selecting open in terminal if this does not work you will once again need to install and activate the appropriate gnome shell package you can also hit alt F2 and type in either gnome terminal or console whichever is appropriate because distributions have had a history of bearing opening up a command line terminal and the place in menus may vary in the desktop GUI it is a good idea to figure out how to pin the terminal icon to the panel which might mean adding it to the favorites grouping on gnome systems there are some basic command line utilities that are used constantly and it would be impossible to proceed further without using some some of them in simple forms before we discuss them in more detail a short list has to include cat used to type out a file or combine files head used to show the first few lines of a file tail used to show the last few lines of a file man used to view documentation this screenshot shows Elementary uses of these programs note the use of the pipe symbol the vertical line you used to have one program take as input the output of another for the most part we will only only use these utilities and screenshots displaying various activities before we discuss them in detail most input lines entered at the Shell prompt have three basic elements the command the options and the arguments the command is the name of the program you are executing it may be followed by one or more options or switches that modify what the command may do options usually start with one or two dashes for example Dash p or dash dash print in order to differentiate them from arguments which represent what the command operates on however plenty of commands have no options no arguments or neither in addition other elements such as setting environment variables can also appear on the command line when launching a task all the demonstrations created have a user configured with pseudo capabilities to provide the user with administrative privileges when required sudo allows users to run programs using the security privileges of another user generally root the super user on your own systems you may need to set up enable sudo to work correctly to do this you need to follow some steps that will not explain much detail now but you will learn about later in this course when running on Ubuntu and some other recent distributions Sudo is already always set up for you during installation another Linux distributions you will likely need to set up sudo to work properly for you after the initial installation next you will learn the steps to setup and run sudo on your system if your system does not already have sudo set up in and enabled you need to do the following steps you'll need to make modifications to the administrative or super user root while sudo will become the preferred method of doing this we do not have to have it set up yet so we use we will use Su which we'll discuss later in detail Instead at the command line prompt type Su and press enter you'll then be prompted for the root password so enter it and press enter you'll notice that nothing is printed this is so so others cannot see the password on the screen you should end up with a different looking prompt often ending with a hash mark or a pound sign for example Su and then password now you need to create a configuration file to enable your user account to use sudo typically this file is created in the slash Etc slash sudoers.d slash directory with the name of the file that as the same as your username for example for this demo let's say your username is student after doing step one you would then create the configure duration file for student by doing this Echo student all equals all all and then the the directory here finally some Linux distributions will complain if you do not also change from missions on the file by doing chmod 440 and then put the file name that should be it for the rest of this course if you use sudo you should be properly set up when using sudo by default you will be prompted to give a password your own user password at least the the first time you do it within a specified time interval it's possible though very insecure to configure pseudo to not require password or change the time window in which the password does not have to be repeated with every pseudo command the customizable nature of Linux allows you to drop the graphical interface temporarily or permanently or to start it up after the system has been running most Linux distributions give an option during installation or have more than one version of the install media to choose between desktop with a graphical desktop and server usually without one Linux production servers are usually installed without the GUI and even if it is installed usually do not launch it during the system startup removing the graphical interface from a production server can be very helpful in maintaining a lean system which can be easier to support and keep secure VT or virtual terminals are console sessions that use the entire display and keyboard outside of a graphical environment such terminals are considered virtual because although there can be multiple active terminals only one terminal remains visible at a time a VT is not quite the same as command line terminal window you can have many of those visible at once on a graphical desktop one virtual terminal usually number one or seven is reserved for the graphical environment and text logins are enabled on the unused VTS Ubuntu uses vt7 but since OS in Rel and opensuse vt1 for the graphical display an example of a situation where using VTS is helpful is when you run into problems with the graphical desktop in this situation you can switch to one of the text VTS and troubleshoot to switch between VTS press Ctrl alt function key for for the VT for example press Ctrl alt F6 for vt6 actually you only have to press the alt F6 key combination if you are in a VT and want to switch to another VT Linux distributions can start and stop the graphical desktop in various ways the exact method differs from distribution and among distribution versions for the newer system md-based distributions the display manager is run as a service you can stop the GUI desktop with the system control utility and most distributions will also work with the tel init command as in sudo system control stop gdm or Studio telnet 3 and restart it after logging into the console with sudo system control start gdm or sudo telen 5. I'm going to move to versions before 18.04 LTS substitute light DM for gdm in this section we will discuss how to accomplish basic operations from the command line these include how to log in and log out from the system restart or shut down the system locate applications access directories identify absolute and relative paths and explore the file system an available text terminal will prompt for a username with the string login and password when typing a password nothing is displayed on the terminal not even a an asterisk to indicate that you typed in something and this is to prevent others from seeing your password after you've logged into the system you can perform basic operations once your session is started either by logging into a text terminal or via a graphical terminal program you can also connect and log into remote systems by using SSH for example by typing SSH student at remote server.com SSH which control it would connect securely to the remote machine or remote server.com and give student that's the user a command line terminal window either using a password as with regular logins or a cryptographic key to sign in without providing a password to verify the identity the preferred method to shut down or reboot the system is to use the shutdown command this sends a warning message and then prevents further users from logging in the init process will then control shutting down or rebooting the system it's important to always shut down properly failure to do so can result in damage to the system and or loss of data the Halt and power off commands issue shutdown Dash 8 to Halt the system reboot issue shutdown Dash R and causes the machine to reboot instead of just shutting down both rebooting and shutting down from the command line requires super user or root access when administering a multi-user system you have the option of notifying all users prior shutdown as in sudo shutdown-hs 10 o'clock sitting down for scheduled maintenance depending on the specifics of your particular distributions policy programs and software packages can be installed in various directories in general executable programs and scripts should live in the slash bin or slash user slash band or slash s-pan or slash user s spend directories or somewhere under slash opt they can also appear in the slash user slash local span or slash user slash local s bin or a directory and a user's account space such as slash home student bin one way to locate programs is to employ the which utility for example to find out exactly where the diff program resides on the file system you can do which diff slash user slash bin stiff if which does not find the program where is is a good alternative because it looks for packages in a broader range of system directories so where is diff when you first log into a system or open a terminal the default directory should be your home directory you can prove you can print the exact path of this by typing Echo home mini Linux distributions actually open new graphical terminals in the dollar China home desktop the following commands are useful for directory navigation let's get some practice navigating among directories at the command line so suppose I go to the temp directory CD slash TMP I do PWD for print working directory I'm at TMP I could do go to the home directory by doing CD dollar home you see PWD now is home student if I do CD dot dot I go up one level to just home another way to navigate is to use the push D and pop D commands so I could do push d temp okay and it showed me my previous history I was at temp and I was at home and I go to temp now if I do pop d it puts me back at the home directory another thing I can do is CD Dash and that takes me to the previous directory just like pop D did so let's do some basic day-to-day practices of navigating directories that one does all the time on a Linux system there are two ways to identify paths absolute path name which an absolute path name begins with the root directory and follows the tree branch by Branch until it reaches the desired directory or file absolute paths always start with a slash or the relative path name a relative path name starts from the present working directory relative paths never start with a slash multiple slashes between directories and files are allowed but all but one slash between elements in the path name is ignored by the system so if you have a bunch of slashes it's valid but it's just seen as just having a single slash by the system most the time it's most convenient to use relative paths which require less typing usually you take advantage of the shortcuts provided by use dot for present directory dot dot for Parent Directory or the utility for your home directory for example suppose you're currently working in your home directory and wish to move to the slash user slash spin directory the following two ways will bring you to the same directory from your home directory there is the absolute path name method and the relative path name method in this case the absolute path name method requires less typing traversing up and down the file system tree can get tedious the tree command is a good way to get a bird's eye view of the file system tree use tree Dash D just to view just the directories and to suppress listing the names the following commands can help in exploring the file system let's get started with how to explore the file system to access slash USR slash local slash live from the slash USR directory using absolute path add command prompt type CD slash USR slash local slash live and press enter go back to slash USR directory by typing CD slash USR and press enter to access slash USR slash local slash live from the slash USR directory using relative path at command prompt type CD local slash live and press enter get to the root directory at the command prompt type the CD slash command and press enter to get a list of the files and directory in the present working directory at the command prompt type the ls command and press enter to get a list of hidden files and hidden directories at the command prompt type the ls-a command and press enter to get a tree view of the file system at the command prompt type the tree command and press enter to get a tree view of only directories in the file system at the command prompt type the treat Dash diesel slash command and press enter the end utility is used to create hard links and with the dash s option soft links also known as symbolic links or stem links these two kinds of links are very useful in Unix based operating systems suppose that file 1 already exists a hard link called File 2 is created with the conf with this command note that two files now appear to exist however a closer inspection of the file listing shows that this is not quite true so we'll do ls-li file 1 name File 2 and the dash I option to LS prints out in the First Column the in node number which is a unique quantity for each file object this field is the same for both these files so what is really going on here is that there's only one file but it has more than one name associated with it as indicated by the two that appears in the ls output thus there was already another object linked to file 1 before the command was executed hard links are very useful and they save space but you have to be careful with their use sometimes in subtle ways for one thing if you remove either file 1 or file 2 in the example the inode object and the remaining file name will remain which might be undesirable as it may lead to subtle errors later if you recreate a file of that name if you edit one of the files exactly what happens depends on your editor most editors including V and G edit will retain the link by default but it's possible that modifying one of the names may break the link and result in the creation of two objects soft or symbolic links are created with a dash s option as in ln-s file one file 3 or ls-li 501 file three notice file three no longer appears to be a regular file and it clearly points to file 1 and has a different enote number symbolic links take notes or space on the file system unless their names are very long they're extremely convenient as they can easily be modified to point to different places an easy way to create a shortcut from your home directory to long path names is to create a symbolic link unlike hard links soft links can point to objects even on different file systems partitions and or disks and other media which may or may not be currently available or even exist in the case where the link does not point to a currently available or existing object you obtain a dangly link the CD command remembers where you were last and lets you get back there with CD dash for remembering more than just the last directory visited use push D to change the directory instead of CD this pushes your starting directory onto a list using pop D will then send you back to those directories walking in reverse order the most recent directory will be the first one retrieved with pop D the list of directories is displayed with the durs command Linux provides many commands that help you with viewing the contents of a file creating a new file or an empty file changing the timestamp of a file and moving removing and renaming a file or directory these commands help you in managing your data and files and in and ensuring that the correct data is available at the correct location in this section you will learn how to manage files let's get a feel for how to look at some of the lines in a given text file on your machine so we have on all our Linux Foundation virtual machines a file called ready for DOT sh which I'm using word count to show me it has 5127 lines if I just want to type the whole file out I could do that with the cat utilities so let me just do that but it went very very fast and in fact if I do cat dash n it shows me the line numbers as it goes and it is indeed 51.27 the way to page your way through is to use the less utility so then I would do less ready 4.sh and then I get one screen at a time if I hit the space bar I see the second screen third screen Etc and I can keep going all the way through the file as fast as I want and by the way I can also do the less Dash capital n option and then I also get line numbers I did with catfishing well similar thing now suppose I just want to look at the first few lines of the file I could do head ready 4.sh and you see that only gave me I believe 10 lines if I wanted to get 20 lines I could just give that as an argument okay so there we see the first 20 lines likewise with tail by default I get the last 10 lines if I wanted to see the last 20 lines I would do tail-20 and if you want to have some fun you can use the TAC utility where you'll notice that Tac is cat backwards and that just gives you the entire file backwards so these are day-to-day utilities one uses just to look at the contents of text files touch is often used to set or update the access change and modify times of files by default it resets the file's timestamp to match the current time however you can also create an empty file using touch like this touch and then the file name this is normally done to create an empty file as a placeholder for a later purpose touch provides several useful options for example the dash T option allows you to set the date and time stamp of the file to a specific value as in touch Dash T and then we put the value and then the file name make there is user create directory such as maker sampner it creates a sample directory named sampner under the current directory maker slash user slash sampner will create a sample directory called sampner under slash user removing a directory is done with rmdir or remove directory the directory must be empty or the command will fail to remove a directory and all of its contents you have to do rm-rf note that MV does double duty and that it can simply rename a file or move a file to another location while possibly changing its name at the same time if you're not certain about removing files that match a pattern you supply it's always good to run RM in interactively RM dash dash I to prompt before every removal rmdir Works only at empty directories otherwise you get an error so while typing RM Dash RF is a fast and easy way to remove a whole file system tree recursively it's extremely dangerous and should be used with the utmost care especially when used by root recall that recursive means drilling down through all subdirectories all the way down a tree the PS1 variable is the character string that is displayed as the prompt on the command line most distributions set PS1 to a known default value which is suitable in most cases however users may want custom information shown on the command line for example some system administrators require the user and the host system name to show up on the command line as in this example this could prove useful if you're working in multiple roles and want to be always reminded of who you are and what machine you are on the prompt above could be implemented by setting the PS1 variable to the following for example you could do that with this command here by convention most systems are set up so that the root user has a pound sign as they're prompt let's gained some experience with day-to-day basic file operations on a centos8 stream system this would be the same on any Linux system so first let's create a couple of files uh it could be empty or they could be small one way to do it is to use the echo command and just say Echo and the direct actually nothing into file one another way to do it is with the touch command I'll say Touch file 2. then if I do ls-a file 1 and file two I see two very small files both created at the same time basically if I want to rename one of them I could rename it with the move command like move file one to file one new name and then if I do LS shells star file star I see there it is uh it it it has the new name now if I want to remove them I can simply say RM file to and it just work it's a good idea though to always use the I option for interactive when doing removal then I would say RMI Dash I file one new name It'll ask me if I really want to do it many distributions will set up the I option to be the defaults so they always have a chance uh to change your mind about removing something before you do it now how would I make a directory I could do Meg Deer uh dear one in fact I can make more than one directory on the same line I can do make deer deer 2 and deer three and if I look now I see I have three different directories or all actually empty so let me put a couple of files in one of the directories so I'll do Touch deer2 file one and I'll do touch deer to file two so if I do ls-l-r just to see everything that's there in the directory files uh that's what I'll see deer one is empty deer two has these two files and dear three uh is also empty now the command for removing directories is our end here so let's say I just try to remove them all with a RM dear dear star uh you notice it got rid of deer one and dear two but it couldn't remove deer the deer one and dear three I should say couldn't get rid of deer too because there's files in it to do that instead of using R and D or I would say RM RF dr2 and then that goes and descends into the directory and gets rid of all the files be very careful with the RN Dash RF uh command because if you give the bad argument you could even wipe out your whole system but that is a standard way to get rid of a whole directory tree so that's just some of the very basic commands for renaming files moving them creating directors removing them Etc when commands are executed by default there are three standard file streams or descriptors always open for use standard input standard output and standard error usually the standard input is your keyboard and standard output and standard error are printed on your terminal standard error is often redirected to an error logging file while standard n is supplied by directing input to come from a file or from the output of a previous command through a pipe standard out is also often redirected into a file since standard error is where error messages are written usually nothing will go there in Linux all open files are represented internally by what are called file descriptors simply put these are represented by numbers starting at zero standard n is file descriptor 0 standard out is file descriptor 1 standard errors file descriptor 2. typically if other files are opened in addition to these three which are open by default they will start at the file descriptor 3 and increase from there on the next section and in the chapters ahead you will see examples which alter where a where a running command gets its input where it writes its output or where it prints diagnostic or error messages through the command shell we can redirect the three standard file stream so that we can get input from either a file or another command instead of from our keyboard and we can write output and errors to files or use them to provide input for subsequent commands for example if we have a program called do something that reads from standard in and writes to standard out and standard error we can change its input source by using the less than sign followed by the name of the file to be consumed for input data here's an example if you want to send the output to a file use the greater than sign as in this example because standard error is not the same as standard out error messages will still will still be seen on the terminal windows in the above example if you want to redirect standard error to a separate file you use standard errors file descriptor number two the greater than sign followed by the name of the file you want to hold everything the running command writes to standard error so here's how you do that a special shorthand notation can send anything written to file descriptor to standard error to the same place as file descriptor 1. standard out you can do it like this bash permits an easier Syntax for the above which is like so the Unix Linux philosophy is to have many simple and short programs or commands cooperate together to produce quite complex results rather than have one complex program with many possible options and modes of operation in order to accomplish this extensive use of pipes is made you can pipe the output of one Commander program into another as its input in order to do this we use the vertical bar pipe symbol between commands as in this example here this represents what we often call a pipeline and allows Linux to combine the actions of several commands into one this is extraordinary efficient because Command 2 and command 3 do not have to wait for the previous pipeline commands to complete before they can begin hacking at the data in their input streams on multiple CPU or core systems the available computing power is much better utilized and things get done quicker furthermore there is no need to save output in temporary files between the stages in the pipeline which saves disk space and reduces reading and writing from disk which is often the slowest bottleneck and getting something done being able to quickly find the files you are looking for will save you time and enhance productivity you can search for files in both your home directory space or in any other directory or system or or location on the system the main tools for doing this are the locate and find utilities we'll also show how to use wild cards and Bash in order to specify any file which matches a given generalized request the locate utility program performs a search taking advantage of a previously constructed database of files and directories on your system matching all entries that contain a specified character string this can sometimes result in a very long list to get a shorter and possibly more relevant list we can use the grep program as a filter grep will print only the lines that contain one or more specified string as in this example which will list all the files and directories with both zip and Bin in their name we'll cover this crap in much more detail later notice the use of the pipe or the vertical line to pipe the two commands together locate utilizes a database created by a related utility update DB most Linux systems run this automatically once a day however you can update it at any time by just running update DB from the command line as the root user let's get some practice with locating and finding files on an Ubuntu system so suppose I want to find all files that have the string lfs 300 in them so I could do locate lfs 300. and it finds indeed just one file that's in the home student directory on the subdirectory there and I could also find it by doing find dot meaning the current directory name lfs 300 star and then I'll see it finds it if I want to find out a little more I can give the ls option which will show me who owns it what group they're in the length of the file the inode the date Etc now if I create another file just by doing Echo into lfs 300 so it creates essentially an empty file the find command will find the new file as well as the old one but the locate command will not because I need to update the database that uh that the locate command uses and I do that by running as root so I need as you do as you do update DB and that was pretty quick uh and then if I say locate it now it finds both files okay and um just to get rid of the file I didn't really need I'll remove it I run update DB again well I need it to be root so I have to say yes you do and then once again okay FS 300 won't find this new file now I can configure update dbe and locate to do a bunch of things so if I go to the ETC directory you'll see there's a file called update DB Dot comf and it controls where update DB does not look where locate does not look so for instance under prune task it says don't look in these places like the temp directory because they're temporary and you don't want to keep track of what's there particularly and prune FS these are file systems really pseudo file systems that are not real file systems that you shouldn't look in because they're also the contents change every time you boot let's say so for instance you don't look in the proc directory or this is FS directory or the dev directory uh well Dev FS directory because these things disappear every time you reboot uh and so it's pretty easy to configure some other things you can do which you can learn by looking at the documentation on your system you can search for a file name containing specific characters using wild cards to search for files using the question mark wildcard replace each unknown character with question mark for example if you know only the first two letters are ba of a three letter file name without an extension you can type this to search for files using the wildcard replace the unknown string with the asterisk for example if you remember only that the extension was dot out type LS asterisk dot out let's get some experience using wild cards on an Ubuntu system so I've gone to the VAR log directory and let me just do an LS to see what's there so for instance uh let me use the DU or disk usage utility which tells me all the bytes that are being used by a given file or subdirectory I could do something like d u that s uh h uh a star and you'll see these are all the different things under a summer directories like app the others are just files if I only wanted to look at ones which have log in the name I could do d u this s h a star log star and so only ones that have log in their names if I only want to look at the ones that start from the letter P or later in the alphabet I could do d u that sh a and then I could say uh square brackets p through z star you're seeing it neglected the alternative ones uh which would have done that if I just want to look at uh ones which have a certain character in them I could do something like d u star Dot uh one character dot star so those are all the ones that have a substring in them with one character here it's always a number but it wouldn't have to be surrounded by periods on both sides now you have to be careful with wild cards that the system doesn't quote glob what you were doing the string that you're putting in so to give you an example you'll notice there's a bunch of different files here that start with the name VMware well they're all over in the right column here so suppose I try to do uh uh apt-get install VMware star and I should make that as you do well it's actually looking for packages with all these names like VMware Network one VM VSC root 2. log and there are of course no packages with silly names like that but I could do something like this now let me put the VMware star in quotes and you see it actually did find things it found two packages VMware NSX common VMware manager and it wants to install them and it needs these other Utilities in order for them to work uh I'm not going to do this because I don't need these guys so I'll just say no so when you put something in quotes it says don't look in the current directory to like fill out the names to expand what you're doing instead looking in this case in the database packages so you have to be careful and you'll often see people use quotes even when there's no need for them just to be safe so that's a little bit of demonstration of the use of wild cards fine is an extremely useful and often used utility program in the daily life of a Linux system administrator it recurses down the file system tree from any particular directory or set of directories and locates files that match specified conditions the default path name is always the present working directory for example administrators sometimes scan for potentially large core files which contain diagnostic information after a program fails there are more than several weeks old in order to remove them it's also common to remove files that are not essential or that are outdated in the slash TMP directory especially those that have not been accessed recently many Linux distributions use shell scripts that run periodically through cron to perform such house cleaning when no arguments are given find list all files in the current directory and all of its subdirectories commonly used options to sort in the list include Dash name which only lists files with a certain pattern in their name Dash I name also ignore the case of the file names and dash type which will restrict the results to files of a certain specified type such as D for directory L for symbolic link or F for a regular file here's how you can search for files and directories named GCC here's how to search only for directories named GCC here's how to search for or only for regular files named GCC another good use of find is being able to run commands on the files that match your search criteria the dash exec option is used for this purpose to find and remove all files that end with DOT swp you can use this the squiggly brackets are a placeholder that will be filled with all the file names that result from the find expression and the preceding command will be run on each one individually please note that you have to in the command with either a semicolon including the single quote or a slash semicolon both forms are fine one can also use the dash OK option which behaves the same as Dash exec except that find will prompt you for permission before executing the command this makes it a good way to test your results before blindly executing any potentially dangerous commands it is sometimes the case that you wish to find files according to attributes such as when they were created last used or based on their size it's easy to perform such searches to find files based on time you can use this here Dash C time is when the inode metadata or the file and ownership the permissions last change it's often but not necessarily when the file was first created you can also search files based on when they were accessed or last read or based on when they were modified or last written the number is the number of days and can be expressed in either a number in that means exactly that Value Plus n which means greater than the number or minus n which means less than that number there are similar options for times in minutes as in the def C Min Dash amen and dash M Min to find files based on sizes you can do this note that the size here is in 512 byte blocks by default you can also specify bytes kilobytes megabytes gigabytes Etc as with the time numbers above file sizes can also be exact numbers for details consult the man page for find for example to find files greater than 10 megabytes in size and running a command on those files you can use this command let's gain some experience using a very powerful find utility on an Ubuntu system and I'll work in the VAR log directory so suppose I wanted to see every file here that's underneath our log and let me do it as you do because otherwise it will give me error messages about not having permissions to look at some files so do as you do find Dot I get a very long list of every single file and directory that's underneath here if I wanted to restrict it just to directories I would do type D and you'll see this just shows me the directories and subdirectories okay because like some of them like live vert have multiple directories if I add to that another parameter Max Def One you see it suppressed the subdirectories here I only see live bird now so I only went down a depth of one and actually I could do two and three or whatever is necessary though here it doesn't go that deep anyway now you can always add commands to any fine command so I could do find Dot type f and then I can say exact grep Dash H log and I put in that parentheses uh pair there and then let's say slash um semicolon you can also do a single Dash semicolon single Dash and it searched through every single file that had the word login and printed out all the different things that were there or to keep it a little simpler I could have done exec just ls-l and it would give me listings of all these files okay now there actually is a LS option built into fine so I didn't really have to do that and it will just show me that kind of information there's other things I can do like find size zero it's finding all the files I should have done as you do but all the files that have the size of zero and if I want to verify that I'll add the ls option you see these are all files of the name with size 0. you can also do things like find let's say I want to find everything that's newer than this file B temp here I could do something like this you do find dot newer B temp and it showed me everything that's been done since then there's a million options to find it can be used on a lot of complicated ways you can negate any parameter you want to put in by saying not you can combine uh different search criteria and I recommend heavily that you really read up on find if you're going to use it because it's a little hard to describe in a few seconds but there's a million things you can do with it the core parts of a Linux distribution and most of its add-on software are installed via the package management system each package contains the files and other instructions needed to make one software component work well and cooperate with the other components that comprise the entire system packages can depend on each other for example a package for a web-based application written in PHP can depend on the PHP packets there are two broad families of packages package managers those based on Debian and those which use RPM as their low-level package manager the two systems are incompatible but broadly speaking provide the same features and satisfy the same needs there are some other systems used by more specialized Linux distributions in this section you will learn how to install remove or search for packages from the command line using these two package Management Systems both package Management Systems operate on two distinct levels a low level tool such as dpkg or RPM takes care of the details of unpacking individual packages running scripts getting the software installed correctly while a high level tool such as apt-get dnf yum or zipper works with groups of packages downloads packages from the vendor and figures out dependencies most of the time users need to work only with the high level tool which will take care of calling the low level tool as needed dependency resolution is a particularly important feature of the high level tool as it handles the details of finding and installing each dependency for you be careful however as installing a single package could result in many dozens or even hundreds of dependent packages being installed the advanced patching tool apt is the underlying package management system that manages software on Deviant based systems while it forms the back end for graphical package managers such as the Ubuntu software Center and synaptic its native user interface is at the command line with programs that include apt or apkit and app cache dnf is the open source command line package management utility for the RPM compatible Linux systems that belongs to the red hat family dnf has both command line and graphical user interfaces Fedora and rel8 replaced the older yam utility with dnf thereby eliminating a lot of historical baggage as well as introducing many nice new capabilities dnf is pretty much backwards compatible with yum for day-to-day commands zipper is the package management system for the Susie or open Susie family and it's also based on RPM zipper also allows you to manage repositories from the command line zipper is fairly straightforward to use and resembles dnf or yum quite closely to learn the basic package commands take a look at these basic packaging commands let's get some practice with the basic low-level command for the Debian packaging system dpkg or D package so to get a list of all the packages on the system I can simply type dpkg dash dash list and I'll just pipe that into the list because it's a long list okay actually if I don't use less for some reason it's more compact okay so there are a lot of different packages on the system now if I want to see some information just about a particular package I could just grip let's say bzip two to see what's going on would be zip2 and that's the information about bzip2 that tells us the version number the architecture which here is AMD 64 and its description is a high quality block sorting file compressor utility so it's a more advanced program with better compression than gzip or the old-fashioned zip program if I want to see what's actually contained in that package I can do DP kg list files and then the name of it and then I'll go slower by putting it into less and you'll see there's the executables in the bin directory and then what's under user is basically documentation under user share doc user sure man Etc if I try to remove the package let's see what happens so do as you do d p k g of course have to have root privilege to remove the package so I'm removing these zip2d package remove B sub 2. and it's telling me I cannot do this because I need the developer and package dpkg-st Dev that would be headers and stuff for programs which use this in a library version and firewaller which is a archive extractor that's common on Linux systems so I would have to remove all three of them we'll see later when we use tools like app dead it's easier to deal with these dependencies we'll now get some practice using the low level RPM command in order to look at a package try to remove itself so we're going to type rpm-qa for query and look at all packages on the system and then we're going to grip to look for the package B zip2 okay and you see there's actually two RPM packages which have B zip2 in their names the actual bzip 2 program and then bzip two lives which is libraries that depend on bzip2 so let's take a look more at information about B sub 2 if I do RPM if I do RPM there's Q for query I for information and then L for a list of files and that's a lot so I'll pipe it through less oops I forgot to give the name in the package so B zip2 you see the name is B zip2 you see it's version 1.06 um we see it's Source RPM here we see when it was released in November 2015 out of centos.org and then a description of what it does these are freely available patent free high quality data compressor Etc I'm going to list of the files that are part of bzip2 if I want to get a little bit more detailed look at what's in there I could do something a little fancier like RPM that Q L B zip2 we just list the files and then I'll make that a show command and substitute for it and do an ls-lf on that so this will give me a detailed listing and then I'll pipe it into less and these are the actual files that are in the package and a little bit more detail like their length and what type of files you'll notice for instance B unzip two and B zip2 are really the same file it's just a symbolic link and the system knows what to do or I should say the application knows what to do whether the zipper unzip depending on how it's called now let's see what happens if I try to remove the package so I I would should be uh rude to do that so do an S you do and then I'll do RPM Dash e for a race and then just to be extra careful I'll use the dash there's test which means it won't actually do anything with this option it'll just see if it could do it bzip two so I try to remove it and it's telling me that I can't do that because it's needed by those following three packages as well as the file roller program which is an archiving program present on basically all Linux distributions and then I can get a little more information in a different way with rpm-q dash dash what provides B zip2 and you'll see it's the B zip2 package and if I do what requires I get the same information about the three packages that would like that need to have bzip2 installed for them to behave properly and not crash or anything a little bit later we're going to discuss yum and zipper and also dnf which are higher level programs that can handle dependencies in robust fashion RPM is really designed for individual packages which are listed on the command line or groups of packages listed on the command line let's get some practice using dnf from the command line on a recent Fedora system so in order to do that first I'll have to bring up the command line so I'll do that with activities and I'll click on the terminal icon at the bottom and I've got a nice command line terminal and I'll make it a little bit bigger because the the font's bigger that is because it's hard to see with the smaller fonts and then first let's get a list of all packages that have the string bzip two in their name so I'll do that with dnf list and the first package is that will come up will be the ones that are already installed so let me scroll up a little because there's a really long list here so there I have the actual program bc2 a development package in case I want to write code that uses bzip2 in internally and then uh bzip two lives would be used by programs that have been zip2 and already built into them the two I'm going to be interested in installing here are the lbzip tube packages lbzip 2 is a parallel version of B sub 2 that can separate the amount of work into a number of pieces that can be done simultaneously so for instance if you had four processors or cores you could split the work up into four pieces and do them all at the same time and then merge them at the end and in theory it could run almost four times as quickly so let's try to install the utilities package I do as you do dnf install live bzip two yeah I guess it's lb is it two B zip two utils and you'll see yes it's happy to do that but it also needs the lbzip 2 package which it depends on so say yes I'll just type y and it will install the two packages um I probably have a program now called lbzip2 but let's check if that's the case with which and yes I do so I could go ahead and use it now if I wanted if I don't really want these installed and I want to clean up with them I could do uh something like yes you do dnf remove lb zip2 and you notice it's happy to remove it but it's telling me that because lbzip 2 utils depends on lbzip two if I remove lb zip2 I better remove them both otherwise I'll have an unsatisfied dependency so I'll just say yes so that's just a really simple uh example of using dnf in the command line unfortunately recent red hat-based systems do not have a really good graphical package management utility Fedora has something called dnf Dragon but it can be rather slow to load and a little bit buggy and there's nothing at all for Red Hat Aid or Central S8 so experienced developers will just always tend to do things from the command line let's demonstrate some basic package managing functions on an open Souza system using the zipper utility so first let's look for all packages with zipper search that have the string new cloth in them and we see a number of packages let's concentrate on the documentation package so suppose I try to install that and for that I have to be a super user for an installation so I do as you do zipper install new plot Dot and you notice it's telling me I not only have to install new plot.talk I would have to install new plot which is the actual program that new plot.doc their stock documents so I'll say sure yes and it's been done successfully if I want to get some information about the package I can do rpm-qi new clot their stock and for this once again I do not have to be root and it's telling me the name the version the size all sorts of things and under the purposes telling me it concludes the man and the info Pages for this rather useful plotting program now suppose I want to remove this package I can do zipper remove the new plot let's say I try to remove the new plot not not new plot. and it's telling me that if I am remove new plot I also have to remove new plot. because otherwise there would be unmet dependencies so say yes for sure and now both of them are gone so that's basic steps you would take to look for a package install it get some information about it and remove it using zipper so let's do some basic package management on an Ubuntu system using Debian Packaging we're going to use the high level utilities which understand dependencies at Cash cannot get so first let's look for all packages that contain the string that you get two so we do that with app cache search wget2 and it comes up with wget 2 and wget to Dev this is uh an enhancement to the standard wget utility which is used for recursive downloading of the content of a website or some other kinds of resources so let's just try and install so the as you do at get install wget to dash Dev and it's telling me it also needs to install W live W get 0 and wget 2. it shouldn't be that surprising that you need to install the base packages on which the development packages built up and it will download 264 kilobytes of archives but once everything's installed it will expand out to 805 kilobytes so let's just say yes I'll type y and it quickly goes ahead and does all that now suppose I want to remove wget to devil more interesting let's try to remove wget uh itself so what is it doing well I shouldn't have removed W again I meant W get two w again I do not want to remove so I'll type it again with the two and you see it wants to remove wget to Dev as well because without wget wget to Dev isn't have much meaning okay and we no longer need the live W get zero um it's sort of orphaned out but we'll leave it there for now so I'll just say yes and I have removed things from my system so that's the most basic operations you would need to do on an Ubuntu system using Debian Packaging you have completed chapter seven let's summarize the key Concepts we covered virtual terminals or VT and Linux are consoles or command line terminals that use the connected Monitor and keyboard different Linux distributions start and stop the graphical desktop in different ways a terminal emulator program on the graphical desktop works by emulating a terminal within a window on the desktop the Linux system allows you to either log in via text terminal or remotely via the console when typing your password nothing is printed to the terminal not even a generic symbol to indicate that you typed the preferred method to shut down or reboot the system is to use the shutdown command there are two types of path names absolute and relative an absolute path name begins with the root directory and follows the tree branch by Branch until it reaches the desired directory or file a relative path name starts with the present working directory using hard and soft symbolic links is extremely useful in Linux CD remembers where you were last and lets you get back there with CD Dash locate performs a database search to find all file names that match a given pattern find locates files recursively from a given directory or set of directories find is able to run commands on the files that it lists when used with the dash X exec options touch is used to set the access change and edit time to files as well as to create empty files the advanced package tool packaging tool apt this package management system is used to manage installed software on dbm based sus systems you can use the dnf command line package development utility for the RPM based Red Hat Family Linux distributions the zipper package management system is based on RPM and used for open Susie by the end of this chapter you should be able to use different sources of documentation use the Man pages access the new info system use the help command and the dash dash help option use other documentation sources whether you are an inexperienced user or a veteran you'll not always know or remember the proper use of various Linux programs and utilities what is the command to type what options does it take Etc you'll need to consult help documentation regularly because Linux based systems draw from a large variety of sources there are numerous reservoirs of documentation and ways of getting help Distributors consolidate this material and present it in a comprehensive and easy to use manner important Linux documentation sources include the Man pages short for manual pages new info the help command and dash def's help option other documentation sources like the Gen 2 handbook The Man pages are the most often used source of Linux documentation they provide in-depth documentation about many programs and utilities as well as other topics including configuration files and programming apis for system calls library library routines and the kernel they are present on all Linux distributions and are always at your fingertips The Man pages infrastructure was first introduced in the early Unix versions in the beginning of the 1970s the name man is just an abbreviation for manual typing man with a topic name as an argument retrieves the information stored in the Topic's Man pages the man program searches formats and displays the information contained in the man page system because many topics have copious amounts of relevant information output is piped through a pager program such as less to be viewed one page at a time at the same time the information is formatted for a good visual display a given topic may have multiple Man pages associated with it and there is a default order determining which one is displayed when no options or section number is specified to list all pages on the topic use the dash F option to list all pages that discuss a specific topic even if the specified topic is not present in the name use the dash dash K option let's use the man utility to get some information about sockets on our system I just type man socket I get chapter two of the Linux programmers manual I get the page in there in chapter two that has to do with sockets and this is a pretty General page that tells me a lot of information about sockets and different protocols that they can use if I want to get a list of all the pages that occult socket I do man Dash fsocket you see there's actually five of them in different chapters that by the way is exactly the same as saying what is socket so man Dash F and apropower are the same if I want to see a particular page say chapter seven I can do nand seven socket and I'm getting the man page in chapter seven which is rather detailed if I want to see them all at once I can say Man dash a socket for all I guess and I can space my way through this one if I hit Q it's telling me if I hit return I'll see the next one 3p so let's do that I'll hit Q again you see if I want to get out rather than going through the rest of them the next one would be seven I can hit Ctrl C Ctrl D would just skip the next one if I want to see all Man pages that have the word socket in there this basic description I do that with Man dash k that's arrived a long list because sockets are pretty basic and involve all sorts of things on your system Man dash K is exactly the same just typing apropos socket and I get the exact same thing so that's just some basic day-to-day functioning of using man to get information you should play around with different Man pages and look at the real contents in them and see how they differ from page to page the next source of Linux documentation is the new info system this is the new project standard documentation format which it prefers as an alternative to man the info system is basically freeform and supports linked subsections functionally info resembles man in many ways however topics are connected using links even though its design predates the World Wide Web information can be viewed through either a command line interface a graphical help utility printed or viewed online typing info with no arguments in a terminal window displays an index of available topics you can browse through the topic list using the regular movement Keys arrows page up and page down you can view help for a particular topic by typing info topic name the system then searches for the topic in all available info files some useful keys are queue to quit is for help and enter to select a menu item the topic which you view and then info page is called a node this table lists the basic keystrokes for moving between nodes nodes are essentially sections and subsections in the documentation you can move between nodes or view each node sequentially each node may contain menus and links subtopics or items items function like browser links and are identified by an asterisk at the beginning of the item name named items outside menu are identified with double colons at the end of the item name items can refer to other nodes within the file or to other files let's gain some experience using the info command for documentation so suppose I type info make I will get information about the make you utility used by all programmers and this takes me to the top of the info page or the head node if I want to look for a particular topic I can hit slash and you'll see at the bottom it's prompting me for assert so I'll say example and it brought me down here to rule example if I just hit return I get that page now at the top you'll notice it says the node is root example the next one is Rule syntax so if I hit an n I get the rule syntax it says the next one is prerequisite types if I hit and again I get prerequisite types if I hit P I will go back to the previous one so I hit B rule syntax if I want to look again for example I can just hit the slash again and it's it's prompting me for the same string so I'll just hit return and I'm finding a later example about wild card examples and if I hit return I find out above that if I want to go all the way up I can hit a u it takes me to the top of section 4.4 I hit U again I'm at chapter four I hit you again I'm at the very top of everything so I want to get information on the various keystroke bindings I can hit an H for help and you'll see in the bottom window where the focus is shifted to it lists all the possible keystrokes and what they can do so that's basically how I would use info if I hit Q I am out of it and the rest you can learn by navigating within the info page of any topic that interests you another important source of Linux documentation is the use of the dash dash help option most commands have an available short description which can be viewed using the dash dash help or the dash H option along with the command or application for example to learn more about the man command you can type man def Dash help the dash help option is useful as a quick reference and it displays information faster than the man or info pages when running within a bash command shell some popular commands such as Echo and CD actually run especially built-in bass versions of the commands rather than the usual binaries found on the file system it's more efficient to do so as execution is faster because fewer resources are used one should note that there can be some usually small differences in the two versions of the command to view a synopsis of these built-in commands you can simply type help as shown in this screenshot for these built-in commands help performs the same basic function as the dash H and dash dash help arguments perform for Standalone programs in addition to the Man pages the new info system and the help command there are other sources of Linux documentation some of the some examples of which include desktop help system package documentation and online resources you have completed chapter 8. let's summarize the key Concepts covered the main sources of Linux documentation are the Man pages new info and the help options and commands and a rich variety of online documentation sources the man utility searches formats and displays Man pages The Man pages provide in-depth documentation about programs and other topics about the system including configuration files system calls Library routines and the kernel the new info system was created by the new project as a as its standard documentation it's robust and it's accessible via command line web and graphical tools short descriptions for commands are usually displayed with the dash 8 or dash dash help argument you can type help at the command line to display a synopsis of built-in commands there are many other help resources both on your system and on the internet by the end of this chapter you should be able to describe what a process is and distinguish between types of processes enumerate process attributes manage processes using PS and top understand the use of load averages and other process metrics manipulate processes by putting them in background and restoring them to foreground use at cron and sleep to schedule processes in the future or pause them a process is simply an instance of one or more related tasks threads executing on your computer it's not the same as a program or a command a single command may actually start several processes simultaneously some processes are independent of each other and others are related a failure of one process may or may not affect the others running on this on the system processes use mini system resources such as memory CPU cycles and peripheral devices such as network cards hard drives printers and displays the operating system especially the kernel is responsible for allocating a proper share of these resources to each process and ensuring overall optimized system utilization a terminal window one kind of command shell is a process that runs as long as needed it allows users to execute programs and access resources in an interactive environment you can also run programs in the background which means they become detached from the shell processes can be of different types according to the task being performed here's some different process types along with their description descriptions and examples a critical kernel function called the scheduler consistently shifts processes on and off the CPU sharing time according to the relative priority how much time is needed and how much has already been granted to a task when a process is in a so-called running state it means it's either currently executing instructions on a CPU or it's waiting to be granted a share of time a Time slice so it can execute all processes in this state reside on what is called a run queue and on a computer with multiple CPUs or cores there there's a run cue on each CPU or core however sometimes processes go into what is called a sleep State generally when they're waiting for something to happen before they can resume perhaps for the user to type something in this condition a process is said to be sitting in a weight queue there are some other less free process States especially when a process is terminating sometimes a child process completes but its parent process has not asked about its state amusingly such a process is said to be called a said to be in a zombie State it's not really alive but still shows up in the system's list of processes at any given time there are always multiple processes being executed the operating system keeps track of them by assigning each of each a unique process ID or PID number the PID is used to track process State CPU usage memory use precisely where resources are located in memory and other characteristics new pids are usually assigned in ascending order as processes are born thus pid1 denotes the init process and and succeeding processes are gradually assigned higher numbers the table explains the PID types and their descriptions at some point one of your applications may stop working properly how do you eliminate it to terminate a process you can type kill Dash Sig kill PID or kill-9 the PID no however you can only kill your own processes those belonging to another user are off limits unless you're root many users can access a system simultaneously and each user can run multiple processes the operating system identifies a user who starts the process by the real user ID or the ruid assigned to the user the user who determines the access rights for the users is identified by the effective uid the euid the EU ID may or may not be the same as the ruid users can be categorized into various groups each group is identified by the real group ID or the rgid the access rights of the group are determined by the effective group ID the EG ID each user can be a member of one or more groups most of the time we ignore these details and just talk about the user ID the uid and the group ID GID at any given time many processes are running on the system however a CPU can actually accommodate only one task at a time just like a car can have only one driver at a time some processes are more important than others so Linux allows you to set and manipulate process priority higher priority processes get preferential access to the CPU the priority for a process can be set by specifying a nice value or niceness for the process for the the lower the nice value the higher the priority low values are assigned to important processes while high values are assigned to processes that can wait longer a process with a high nice value simply allows other processes to be executed first in Linux a nice value of negative 20 represents the highest priority and positive 19 represents the lowest well this may sound backwards this convention goes back to the earliest days of Unix you can also sign a so-called real-time priority to time sensitive tasks such as controlling machines through a computer or collecting incoming data a very high priority and is not to be confused with what is called hard real time which is conceptually different and has more to do with making sure a job gets completed within a very well-defined time window so now let's show how to see what the niceness or priority of our process is and how you can change it with the renice command or how you can do it actually from a graphical user interface so let's look at the processes in this current screen with the PS command which we will discuss in detail later and we see that this current bash shell is 30 77. to see the priority I can run PS with the options LF and there you see 3077 here is is uh here is the bash command and the license is zero so let's try to change the license I can do re nice um plus 5 30 77 and you see it did change the priority to five which I can see once again with the PS command it has made it five here notice that the child processor ran off during the command pslf also has a nice sense of five is there anything else I create in this shell will have that new niceness so this is a lower priority remember increasing the nicest lower to priority so now suppose I try to increase their priority by decreasing the nicest to -5 you notice it says I can't do that that's because only the super user or root is allowed to increase the priority of a process but if I type the same command over again with s you do it worked just fine and I can verify that once again with pslf and there you see it's set up to be minus five now as well as the new um the new uh PS command that I issued now if I want to do this from a graphical utility I can run gnome system monitor I'll start from the command line here though I could get it from a menu and uh this is on the first possible screen here on processes so if I hear that was process 30 that was process 3077 it's right here and you notice it says priority High I could right click on there and I can go to change priority and I can just say low and now you see that it's low and if I get out of the graphical utility and I look at the niceness again you see now the priority has come up to five I'm not the niceness of five so that means it's a little priority again so that's how you can manipulate the priority of a process from the command line or from a graphical utility the load average is the average of the load number for a given period of time it takes into account processes that are actively running on a CPU considered runnable but waiting for a CPU to become available or sleeping I.E waiting for some kind of resource to become available the load average can be viewed by running W top or uptime the load average is displayed using three numbers such as 0.45 0.17 and 0.12 in this screenshot assuming our system is a single CPU system the three load average numbers are interpreted as follows 0.45 means for the last minute the system has been 45 utilized on average 0.17 means for the last five minutes utilization has been 17 and 0.12 is for the last 15 minutes utilization has been 12 percent if we saw a value of 1 in the second position that would imply the single CPU system was 100 util lies on average over the past five minutes this is good if we want to fully use a system value over one for a single CPU system implies that the system was over utilized there were more processes needing CPU than CPU was available if we had more than one CPU say a quad CPU system we would divide the load average numbers by the number of CPUs in this case for example seeing a one minute load average of 4.0 implies that the system as a whole was one hundred percent four divided by four utilized during the last minute short-term increases are usually not a problem a high peak you see is likely a burst of activity not a new level for example at startup mini processes start and then act and then activities to settles down the high peak is seen in the 5 and 15 minute load averages it may be cause for concern Linux supports background and foreground job processing a job in this context is just a command launched from a terminal window foreground jobs run directly from the shell and when one foreground job is running other jobs need to wait for Shell access at least in that terminal window if using the GUI until it's completed this is fine when jobs complete quickly but this can have an adverse effect if the current job is going to take a long time even several hours to complete in such cases you can run the job in the background and free the shell for other tasks the background job will be executed at lower priority which in turn will allow smooth execution of the interactive tasks and you can type other commands in the terminal window while the background job is running by default all jobs are executed in the foreground you can put a job in the background by suffixing and or the Amber stand to the command for example update DB ampersand and you can either use Ctrl Z to suspend a foreground job or control C to terminate a foregun job and you can always use the BG and FG commands to run a process in the background and foreground respectively the job utility displays all jobs running in the background the display shows the job ID State and command name as shown here jobs L provides the same information as jobs and adds the PID of the background jobs the background jobs are connected to the terminal window so if you log off the jobs utility will not show the one started from that window PS provides information about currently running processes keyed by pid if you want a repetitive update of this status you can use top or other commonly installed variants such as h-top or atop from the command line or invoke your distributions graphical system monitor application PS has many options for specifying exactly which tasks to examine what information to display about them and precisely what output format should be used without options PS will display all processes running under the current shell you can use the dash U option to display information of processes for a specified username the command ps-ef displays all the processes in the system in full detail the command ps-elf goes one step further and displays one line of information for every thread remember a process can contain multiple threads PS has another style of option specification which stems from the BSD variety of Unix where options are specified without preceding dashes for example the command PS aux displays all processes of all users the command PS EXO allows you to specify which attributes you want to view this screenshot shows a sample output of PS with the aux and axo qualifiers the PS utility is used very often at the command line to gather information about what is running on the system about the various processes and tasks which are running what resource they were using what relationship they have to each other Etc if I just type PS without any arguments I get the processes which have been launched underneath this particular terminal window and in order to make it more interesting I have a background processes running I have a cat an orderless which is the file manager and the events which is the PDF viewer and get more information if I type ps-f which you see now also tells me that parent process ID so you notice bash as a process like Z of 2942 and that's the parent process for both the cat and the Nautilus which I launched directly out of the shell as well as the PS command itself uh the events command is actually has something else is apparent for complicated reasons having to do with how the gnome shell runs if I want to get a different piece of information I can do ps-l and now uh I'm also seeing information in these two columns about the priority and the niceness which on most Linux systems is just a a numerical shift okay from a neutral niceness of zero means the default priority of 80 which is what all normal processes start out with now I can do more than this if I want to give additional arguments so I do PS there's elf this will tell me about all processes on the system and let me type it into less so it doesn't go too quickly so you can see this is everything which is actually running on my system you'll notice that the first bunch of processes in this rather long list all have these square brackets around them that means they were not started by a user program they're running inside the kernel to do various kinds of background tasks that run in the kernel all the time handle moving things from one CPU to another for instance and all kinds of other things uh and you see they have different priorities uh they the minus 20 here uh minus 20 there that means they're higher priorities okay it's kind of backwards the lower the priority number here the higher the priorities if I page down to the bottom I will eventually get to the tests which are not running inside the kernel which are uh running for instance uh under my name here Coop as you see these are the actual user processes and they they're quite a bit different now one reason the PS command can be a little confusing is that there are different kinds of options those which have a dash in which those which do not so for instance P Ash Dash e is different than PS space e one commonly set of options is psaux without a dot dash and there you see uh one nice additional piece of information is the percentage of CPU being used and of course there isn't much going on in the system right now so that tends to be zero so you can customize what the output of the PS command is uh if you look at the man page for PS you'll see there's ways to have it print out only the columns that you want if you want to produce some customized reports Etc but a standard Linux system administrator probably uses PS every day for one thing or another Street displays the processes running on the system in the form of a tree diagram showing the relationship between a process and its parent process and any other processes that it created repeated entries of that process are not displayed and threads are displayed in curly braces while a static view of what the system is doing is useful monitoring the system performance live over time is also valuable one option would be to run PS at regular intervals say every few seconds a better alternative is to use top to get constant real-time updates until you exit by typing q.top this clearly highlights which processes are consuming the most CPU cycles and memory using appropriate commands from within top the first line of the top output displays a quick summary of what is happening in the system including how long the system has been up how many users are logged on and what is the load average the load average determines how busy the system is load average of 1.00 per CPU indicates a fully subscribed but not overloaded system if the load average goes above the value and it indicates that the processors are competing for CPU time if the load average is very high it might indicate that the system is having a problem such as a runaway process a process and a non-responding state the second line of the top output displays the total number of processes the number of running sleeping stopped and zombie processes comparing the number of running processes with the load average helps determine if the system has reached its capacity or perhaps a particular user is running too many processes the stopped processes should be examined to see if everything is running correctly the third line of the top output indicates how the CPU time is being divided between the users and the kernel by displaying the percentage of cputine used for each the percentage of user jobs running at a lower priority niceness Dash ni is then listed idle mode or ID should be low if the load average is high and and vice versa the percentage of jobs waiting wa for Io is listed interrupts include the percentage of Hardware or hi versus software interrupts SI steel time St is generally used with virtual machines which has some of its idle CPU time taken for other uses the fourth and fifth lines of the top output indicate memory usage which is divided into categories physical memory or Ram displayed on line 4 and swap space displayed on line 5. both categories display total memory used memory and free space you need to monitor memory usage very carefully to ensure good system performance once the physical memory is exhausted the system starts using swap space or temporary storage space on the hard drive as an extended memory pool and since accessing disk is much slower than access accessing memory this will negatively affect the system performance if the system starts using swap often you can add more swap space however adding more physical memory should also be considered each line in the process list of the top output displays information about a process by default processes are ordered by highest CPU usage the following information about each process is displayed process identification number PID process owner the user priority PR and nice values ni virtual physical and shared memory status that's a percentage of CPU and memory used execution time the time plus and command besides reporting information top can be utilized interactively for monitoring and controlling processes well top is running in a terminal window you can enter single letter commands to change its behavior for example you can view the top ranked processes based on CPU or memory usage if needed you can alter the priorities of running processes or you can stop or kill a process this table lists what happens when pressing various Keys when running top the top utility is used to interactively monitor what processes and tests are doing on your system to start it up all you have to do is type top and it will refresh itself at some interval of a I think by default two or three seconds it's easily changed it shows you standard information about each process similar to what you get with the PS command such as the process ID the user the priority and niceness some information about how the memory is being used by the process the state SB meaning sleeping for instance and by default it is sorted by CPU time and then there's also memory the total time and what the actual command is the lines at the top or or have been designed over the years to convey a lot of information so in the first one you see how long the system has been up how many users there are the low to average or rolling averages of how much time has been spent in the last I believe one minute five minutes Etc there are currently 295 tests running on the system but really only one is running the others are sleeping um and this shows you the CPU time percentage is used by the user processes by the system by so-called nice processes and then idle and how many would be waiting how many are high priority and and some other details like that and then you have basic information about the memory such how much is being used how much swap there's available being used how much is in cash Etc if I type the letter one I get statistics for each CPU instead of uh just The Amalgamated total and that can be rather useful one will take it back again if I hit H I get a listing of what the possible keys I can hit are and what they do would make sense to try to run through much of that here but I highly recommend that you run top and play with these different keys and try to understand what kind of information you can extract well top is how you can do it from the command line and if you hit q that will kill the program you can get some information by going to your menus and finding system monitor and then uh let me drag that over to this screen uh the processes pane on here is pretty much the same as tops get the same information it's easier to do things like restore because I could just click on memory and get it sorted by how much memory is used if I click again I'll get it in descending order uh priorities CPU Etc you can also once again change the priority of processes you can kill them Etc so you can do a lot if you want to see the graph just click on resources you can see what's going with the constantly redrawn graph and with file systems you can see how much of your file systems on the computer are actually full where they're mounted Etc so that's a brief explanation of top and some related issues suppose you need to perform a task on a specific day sometime in the future however you know you will be away from the machine on that day how will you perform the task you can use the at utility program to execute any non-interactive command at a specified time as Illustrated in this screenshot KRON is a time-based scheduling utility program it can launch routine background jobs at specific times and or days on an ongoing basis cron is driven by a configuration file called the cron table which contains the various shell commands that need to be run at the properly scheduled times they are both system-wide cront tab files and individual user-based ones each line of the cront tab file represents a job and is composed of a so-called cron expression followed by a shell command to execute typing cront tab e will open the cront tab Editor to edit existing jobs or to create new jobs each line of the cront tab file will contain six fields and here are some examples sometimes a command or job must be delayed or suspended suppose for example an application has read the and processed the contents of a data file and then needs to save a report on a backup system if the backup system is currently busy or not available the application can be made to sleep or wait until it can complete its work such a delay might might be to mount the backup device and prepare it for writing sleep suspends execution for at least the specified period of time which can be given as the number of seconds the default minutes hours or days after that time has passed or an interrupting signal has been received execution will resume the syntax is sleep and the number and then the suffix where the suffix may be S for seconds the default M for minutes H for hours or D for days sleep and at or at are quite different sleep delays execution for a specific period Well at starts execution at a later time you have completed chapter nine let's summarize the key Concepts covered processes are used to perform various tasks on the system processes can be single threaded or multi-threaded processes can be of different types such as interactive and non-interactive every process has a unique identifier the PID to enable the operating system to keep track of it the nice value or niceness can be used to set priority PS provides information about the currently running processes you can use top to get constant real-time updates about overall system performance as well as information about the processes running on the system load average indicates the amount of utilization the system is under at particular times Linux supports background and foreground processing for a job at executes any non-interactive command at a specified time KRON is used to schedule tasks that need to be performed at regular intervals by the end of this chapter you should be able to explore the file system and its hierarchy explain the file system architecture compare files and identify different file types and back up and compressed data in Linux and all unix-like operating systems it is often said everything is a file or at least at least it's treated as such this means whenever you are dealing with normal data files and documents or with devices such as sound cards and printers you interact with them through the same kind of input output operations this simplifies things you open a file and perform normal operations like reading the file and writing on it which is one reason why text editors which you will learn about in an upcoming section are so important on many systems including Linux the file system is structured like a tree the tree is usually portrayed as inverted and starts at what is most often called the root directory which marks the beginning of the hierarchical file system and is also sometimes referred to as the trunk or simply denoted by a slash the root directory is not the same as the root user the hierarchical file system all also contains other elements in the path or directory names which are separated by forward slashes as in user slash spin slash emacs where the last element is the actual file name in this section you will learn about some basic concepts including the file system hierarchy as well as about disk partitions Linux supports a number of native file system types expressly created by Linux developers such as ext3 exe4 squash fs and BT RFS it also offers implementations of file systems used on other alien operating systems such as those from Windows SGI IBM or Mac OS many older Legacy file systems such as fat are also supported each file system on a Linux system occupies a disk partition partitions help to organize the contents of disks according to the kind and use of the data contained for example important programs required to run the system are often kept on a separate partition known as root or slash this is a separate partition than the one that contains files owned by regular users of the system in slash home in addition temporary files created and destroyed during the normal operation of Linux may be located on dedicated partitions one advantage of this kind of isolation by type and variability is that when all available space on a particular partition is exhausted the system may still operate normally this picture shows the use of the G parted utility which displays the partition layout on a system which has four operating systems on it roll eight Cent OS 7 Ubuntu and Windows before you can start using a file system you need to mount it on the file system tree at the mount point this is simply a directory which may or may not be empty where the file system is to be grafted on sometimes you may need to create the directory if it does not already exist but keep in mind this warning if you mount a file system on a non-empty directory the former contents of that directory are covered up and not accessible until the file system is unmounted thus Mount points are usually empty directories the mountain command is used to attach a file system which can be local to the computer or on a network somewhere within the file system tree the basic arguments are the device node and the mount point for example pseudo Mount or slash Dev slash sda5 slash home will attach the file system contained in the disk partition associated with the slash Dev slash sda5 device node into the file system tree at the slash home Mount point there are other ways to specify the partition other than the device node such as using the disk label or the uuid to unmount the partition the command would be sudo u-mount slash home note the command is u-mount not unmount only a root user has the privilege to run these commands unless the system has been otherwise configured if you want it to be automatically available every time the system starts up you need to edit the slash Etc fstab accordingly looking at this style will show you the configuration of all pre-configured file systems man f-stab will display how this file is used and how to configure it executing Mount without any arguments will show all presently mounted file systems the command DF th disk free will display information about Mountain file systems including the file system type and usage statistics about currently used and available space it's often necessary to share data across physical systems which may be either in the same location or anywhere that can be reached by the internet a network or distributed file system may have alt data on one machine or have it spread out on more than one network node a variety of different file systems can be used locally on the individual machines a network file system can be thought of as a grouping of lower level file systems of varying types mini system administrators Mount remote users home directories on a server in order to give them access to the same files and configuration files across multiple client systems this allows the users to log into different computers you still have access to the same files and resources the most common such file systems is named simply NFS the network file system it has a very long history and was first developed by Sun Microsystems another common implementation is cifs also termed Samba which has Microsoft routes in this section you will learn to identify and differentiate between the most important directories found in Linux we start with ordinary users home directory space each user has a home directory usually placed under the slash home the slash root directory on Modern Linux systems is no more than the home directory of the root user or super user or system administrator account on multi-user systems the slash home directory infrastructure is often mounted as a separate file system on its own partition or even exported remotely on a network through NFS sometimes you may group users based on their department or function you can then create subdirectories under the slash home directory for each of these groups for example a school May organize home with something like the following slash Home factory home staff home students the slash bin and slash S Pen directory the slash bin directory contains executable binaries essential commands used to boot the system and essential commands required by all system users such as cat cpls MV PS and RM likewise the slash S Pen directory is intended for essential binaries related to system administration such as fssck and IP to view a list of these programs you can type LS slash bin slash S Pen commands that are not essential for the system to boot or operate in single user mode are placed in the slash user slash bin and slash user slash S Pen directories historically this was done so slash user could be mounted as a separate file system that could be mounted at a later stage of system startup or even over a network however nowadays most find this distinction is obsolete in fact many distributions have been discovered to be unable to boot with this separation as this modality had not been used or tested for a long time thus on some of the newest Linux distributions slash user slash Spin and slash bin are actually just symbolically linked together as our slash user slash S ban and slash S Pen certain file systems like the one mounted at slash proc are called pseudo file systems because they have no permanent presence anywhere on the disk the slash proc file system contains virtual files files that only exist in memory that permit viewing constantly changing kernel data slash proc contains files and directories that mimic kernel structures and configuration information it does not contain real files but runtime system information IG system memory devices mounted Hardware configuration Etc some important entries in slash proc are the following so let's broadcast subdirectories as well including the following the first example shows there is a directory for every process running on a system which contains Vital Information about it the second example shows a virtual directory that contains a lot of information about the entire system in particular it's hardware and configuration the slash proc file system is very useful because the information and reports is gathered only as needed and never needs storage on the disk the slash Dev directory contains device nodes a type of pseudo file used by most hardware and software devices except for network devices this directory is empty on the disk partition when it's not mounted and also contains entries which are created by the udep system which creates and manages device nodes on Linux creating them dynamically when devices are found the slash Dev directory contains items such as slash Dev sda1 the first partition on the first hard disk slash Dash lp1 the second printer slash Dev slash random a source of random numbers the slabs of VAR directory contains files that are expected to change in size and content as the system is running VAR stands for a variable such as the entries in the following directories system log files slash log and packages and database files like slash lib print queues slash VAR slash S Pool and temporary files slash TMP the slash of our directory may be put on its own file system so that growth of the files can be accommodated and any exploding file sizes do not fatally affect the system network service directories such as slash bar FTP the FTP Service in slash www the HTTP web service are also found under slash bar the slash Etc directory is the home for system config configuration files it contains no binary programs although there are some executable scripts for example slash Etc resolve.conf tells the system where to go on the network to obtain hostname to IP address mappings DNS files like password Shadow and group for managing user accounts are found in the slash Etc directory while some distributions have historically had their own extensive infrastructure under slash Etc with the admin of systemmd there is much more uniformity among distributions today note that slash Etc is for system-wide configuration files and only the super user can modify files there user-specific configuration files are always found under their home directory this last boot directory contains the few essential files needed to boot the system for every alternative kernel installed on the system there are these four files VM Li news which is the compressed Linux kernel required for booting in it Ram FS which is the initial Ram file system required for booting sometimes called init Rd not in it Ram fs and then config the kernel configuration file only used for debugging and bookkeeping and finally system.map which is the kernel symbol table only used for debugging each of these files has a kernel version appended to its name the grub files such as boot grub slash grub.com or slash boot slash grub2 grub2cfd are also found under the slash boot directory this screenshot shows an example listing of the slash boot directory taken from the Rel system that has multiple installed kernels including both distribution supplied and custom compiled ones names will Aryan things will tend to look somewhat different on a different distribution slash lib contains libraries which is which are common code shared by applications and needed for them to run it contains libraries for essential programs in slash bin and slash S Bend these Library file names either start with LD or lib here's an example most of these are what is known as dynamically loaded libraries also known as shared libraries or shared objects on some Linux distributions there exists a slash lib64 directory containing 64-bit libraries while slash lib contains 32-bit versions on recent Linux distributions you can find this just like for slash bin and slash S bin the directories just point to the those under slash user kernel modules or kernel code often device drivers that can be loaded and unloaded without restarting the system are located in slash lib slash modules slash and then the kernel version number one often uses removable media such as USB drives CDs and DVDs to make the material accessible through the regular file system it has to be mounted at a convenient location most linked systems are configured so any removable media are automatically mounted when the system notices something has been plugged in while historically this was done under the slash media directory modern Linux distributions place these Mount points under the slash run directory for example a USB pin drive with a label my USB drive for a user named student will be mounted at slash run slash media student slash my USB drive the slash Mount directory has been used since the early days of Unix for temporarily mounting file systems these can be those on removable media but more often they might be Network file systems which are not normally mounted or these can be temporary partitions or so-called loopback file systems which are files which pretend to be partitions here's some additional directories to be found under the root directory the slash user directory tree contains theoretically non-essential programs and scripts in the sense that they should not be needed to initially boot the system and has at least the following subdirectories shown here now that you know about the file system and its structure let's learn how to manage files and directories diff is used to compare files and directories this often used utility program has many useful options including the ones you see here to compare two files at the command prompt type diff and options file name 1 file name two diff is meant to be used for text files for binary files one can use CMP in this section you will learn additional methods for comparing files and how to apply patches to files you can compare three files at once using diff3 which uses one file as the reference basis for the other two for example suppose you and a co-worker both have made modifications to the same file working at the same time independently diff 3 can show the differences based on the common file you both started with here's the Syntax for diff3 this graphic shows the use of diff3 many modifications to source code and configuration files are distributed utilizing patches which were applied not surprisingly with the pets program a pets file contains the Deltas or changes required to update an older version of a file to the new one the patch files are actually produced by running diff with the correct options as in this command Distributing just the patch is more concise and efficient than Distributing the entire file for example if only one line needs to change in a file that contains one thousand lines the patch file will be just a few a few lines long to apply patch you can just do either of these two methods the first usage is more common as it's often used to apply changes to an entire directory tree rather than just one file as in the second example to understand the use of the dash P1 option and many others see the man page for patch in Linux a files extension often does not categorize it the way it might in other operating systems one cannot assume that a file name file.txt is a text file and not an executable program in Linux a file name is generally more meaningful to the user of a system than the system itself in fact most applications directly examine a file's contents to see what kind of app object it is rather than relying on an extension this is very different from the way Windows handles file names where a file naming ending in exe for example represents an executable binary file the real nature of a file can be determined by using the file utility for the file names given as arguments it examines the contents and certain characteristics to determine whether the files are plain text shared libraries executable programs scripts or something else there are many ways you can backup data or even your entire system basic ways to do so include the use of simple copying with CP and use of the more robust rsync both can be used to synchronize entire directory trees however our sync is more efficient because it checks if the file being copied already exists if the file exists and there's no change in size or modification time our sync will avoid an unnecessary copy and save time furthermore because our sync copies only the parts of the file that have actually changed it can be very fast CP can only copy files to and from destinations on the local machine but rsync can also be used to copy files from one machine to another locations are designated in the Target colon path form where Target can be the form of someone at host and the someone at part is optional and used if the remote user is different from the local user our sync is very efficient when recursively copying One Directory tree to another because only the differences are transmitted over the network one often synchronizes the destination directory tree with the origin using the dash R option to recursively walk down the directory tree copying all files and directories below the one listed as the source our sink is a very powerful utility for example a very useful way to back up a project directory might be to use this command note that rsync can be very destructive accidental misuse can do a lot of harm to data and programs by inadvertently copying changes to where they are not wanted take care to specify the correct options and paths it's highly recommended that you first test your RC command using the dash dry dash run option to ensure that it provides the results that you want to use rsync at the command prompt type rsync source file destination file where either file can be on the local machine or on a network machine the contents of source file will be copied to destination file a good combination of options is shown here the file data is often compressed to save disk space and reduce the time it takes to transmit files over networks Linux uses a number of methods to perform this compression including these these techniques vary in the efficiency of the compression or how much space is saved and how long they take to compress generally the more efficient techniques take longer decompression time does not vary as much across different methods you have completed chapter 10. let's summarize the key Concepts covered the file system tree off starts at what is often called the root directory or trunk or slash the file system hierarchical standard FHS provides Linux developers and system administrators a standard directory structure for the file system partitions help to segregate files according to usage ownership and type file systems can be mounted anywhere on the main file system tree at a mount Point automatic file systems mounting can be set up by editing Etc fstab in a fast or network file system is a useful method for sharing files and data through the network systems file systems like slash proc are called pseudo file systems because they exist only in memory slash root is the home directory for the root user slash VAR may be put in its own file system so that growth can be contained and not fatally affect the system slash boot contains the basic files needed to boot the system patch is a very useful tool in Linux many modifications to source code and configuration files are distributed with patch files as they contain the Deltas or changes to go from an old version of a file to the new version of a file file extensions in Linux do not necessarily mean that a file is of a certain type CP is used to copy files on the local machine while rsync can be all can be used to copy files from one machine to another as well as synchronize contents by the end of this chapter you should be familiar with how to create and edit files using the available Linux text editors Nano a simple text-based editor G edit a simple graphical editor VI and emacs to Advanced editors with both text-based and graphical interfaces at some point you will need to manually edit text files you might be composing an email offline writing a script to be used for bash or other command interpreters altering a system or application configuration file or developing source code for a programming language such as C python or Java Linux administrators May sidestep using a text editor instead employing graphical utilities for creating and modifying system configuration files however this can be more laborious than directly using a text editor and be more limited in capability note that word processing applications including those that are part of common Office application Suites are not really basic text editors they add a lot of extra usually invisible formatting information that will probably render system administration configuration files unusable for their intended purpose so knowing how to confidently use one or more text editors is really an essential skill to have for Linux by now you have certainly realized Linux is packed with choices when it comes to text editors there are many choices ranging from quite simple to very complex including Nano G edit VI or emacs in this section we learned first about the Nano and Geeta editors which are relatively simple and easy to learn and then later the more complicated choices VI and emacs before we start let's take a look at some cases where an editor is not needed sometimes you may want to create a short file and don't want to bother invoking a full text editor in addition doing so can be quite useful when used from within scripts even when creating longer files you'll no doubt find yourself using this method when you start on the later chapters that cover shell skip scripting if you want to create a file without using an editor there are two standard ways to create one from the command line and fill it with content the first one is to use Echo repeatedly like shown here note that while a single greater than sign will send the output of a command to a file two of them will append the new output to an existing file the second way is to use can't combined with redirection as in this example here both techniques produce a file with the following lines in it line one line two line three and are extremely useful when employed by Scripts there are some text editors that are pretty obvious they require no particular experience to learn and are actually quite capable even robust particularly easy to use one is the text terminal base editor Nano just invoke Nano by giving a file name as an argument all the help you need is displayed at the bottom of the screen and you should be able to proceed without any problem as a graphical editor G edit is part of the gnome desktop system K Wright is associated with KDE the G edit and K write editors are very easy to use and are extremely capable they're also very configurable they look a lot like notepad and windows other variants such as Kate are also supported by KDE Nano is easy to use and requires very little effort to learn to open a file type Nano and then the file name and press enter if the file does not exist it will be created Nano provides a two-line shortcut at the bottom of the screen that lists the available commands so these commands are Ctrl G display the help screen control o right to a file Ctrl X execute exit a file Ctrl R insert contents from another file to the current buffer or control C show the cursor position G edit is a simple to use graphical editor that can only be run within a graphical desktop environment it is visually quite similar to the notepad text editor in Windows but it's actually far more capable and very configurable and has a wealth of plugins available to extend its capabilities further to open a new file find the program in your desktop's menu system or from the command line type G edit and then the file name if the file does not exist it will be created using G edit is pretty straightforward and does not require much training its interface is composed of quite familiar elements developers and administrators experienced in working on unix-like systems almost always use one of the two venerable editing options VI and emacs both are present or easily available on all distributions and are completely compatible with the versions available on other operating systems both VI and emacs have a basic purely text-based form that can run in a non-graphical environment they also have one or more graphical interface forums with extended capabilities these may be friendlier for a less experienced user while VI and emacs can have significantly steep learning curves for new users they are extremely efficient when one is learned how to use them usually the actual program installed on your system is vim which stands for Vim proved and is aliased to the name VI even if you don't want to use VI it's good to gain some familiarity with it it's a standard tool installed on Virtual actually all Linux distributions and Mac OS indeed there may be times when there is no other editor available on the system and remember VI and them are going to be very similar gnome extends VI with a graphical interface known as gvm and KDE offers cavem either of these may be easier to use at first when using VI all commands are entered through the keyboard you don't need to keep moving your hands to use a pointer device such as a mouse or a touchpad unless you want to do so when using one of the graphical versions of the editor typing Vim tutor launches a short but very comprehensive tutorial for those who want to learn their first VI commands even though it provides only an introduction and just seven lessons it has enough material to make you a very proficient VI user because it covers a large number of commands after learning these basic ones you can look up new tricks to incorporate into your list of VI commands because there are always more optimal ways to do things in VI with less typing VI provides three modes as described in this table here it's vital to not lose track of which mode you're in many keystrokes and commands have quite different behave quite differently in different modes this table describes the most important commands used to start exit read and write files in VI the enter key needs to be pressed after all these commands and this table describes the most important keystrokes used when changing cursor positions in VI line mode commands those following a colon require the enter key to be pressed after the command is typed let's get started on using modes and cursor movements in VI open VI by typing VI followed by the file name VI opens in command mode type I to enter insert mode VI's insert mode is displayed type the following sentences the quick brown fox jumped over the lazy dog nobody expects the Spanish Inquisition to exit insert mode and switch to command mode press Escape to exit VI and save the file type colon WQ and press enter open the recently saved file and place the cursor on the letter k in the word quick in the first sentence to move the cursor four characters to the left type h four times the cursor is moved to letter Q of the word quick to move the cursor to the next line type J to move the cursor to the beginning of the next word type w the cursor is moved to the beginning of the word expects to move the cursor to the end type the dollar sign the cursor is moved to the end of the second sentence type I to enter insert mode VI insert mode is displayed to insert text at the end of the second sentence type A and type history the word history is displayed to the end of the sentence to exit insert mode and switch to command mode press escape to exit VI and save the file type colon WQ and press enter here you can see the most important commands used when searching for text in VI the enter key should be pressed after typing the search pattern this table describes the most important keystrokes used when searching for text in VI and this table describes the most important keystrokes used when changing adding and deleting text in VI typing the sh command opens an external command shell when you exit the shell you will resume your editing session piping exclamation point executes a command from within VI the command follows the exclamation point this technique is best suited for non-interactive commands such as exclamation point WC percentage typing this will run the word count command on the file the character the percentage represents the file currently being edited let's get started on using external commands saving and closing in Vim editor open VI editor by typing VI followed by the file name VI opens in command mode type I to enter insert mode VI's insert mode is displayed type the following sentences nobody expects the Spanish Inquisition nobody expects the 2020 Revolution to exit insert mode and switch to command mode press escape to write and quit the file type colon WQ the file is updated with the changes enclosed open VI by typing VI followed by the file name to count the words in the current file type colon exclamation WC percent the word count is displayed press enter to continue editing to quit if no edits were made in the file type colon queue the file is closed open VI by typing VI followed by file name to quit without saving the file type colon queue exclamation the file is closed without saving the changes the Emax editor is a popular competitor for Vi unlike VI it does not work with modes emacs is highly customizable and includes a large number of features it was initially designed for use on a console but was soon adopted to work with a GUI as well emacs has many other capabilities other than Simple Text editing for example it can be used for email debugging and many other things rather than having different modes for command and insert like VI emacs uses the control and meta or alt or Escape keys for special commands here you can see some of the most important key combinations that are used when starting exiting reading and writing files in emacs the emacs tutorial is a good place to start learning basic commands it's available anytime when in emacs by simply typing Ctrl H for help and then the letter t for tutorial we will now demonstrate some of the operations you can do with emacs in your daily work so first let's get a file to edit so working in the TMP directory let's get a copy of Etc password and bring it over here and then in order to work on it I just have to say emacs pass in the name of the file Now the default font here is a little small so I'll play a trick and hit control and the middle button of the mouse to control the size of the font and then I'll make the window a little bigger Okay so we've done that now suppose I want to look for a certain string let's say FTP I would hit Ctrl s and type in the very bottom window at the very bottom line here FTP so you can see down here and you'll see it brought me to FTP I'll go back to the beginning of the line is hitting Ctrl a and then let's say I want to change all occurrences of the string FTP to something else I hit Escape percent Mark and then I'll say FTP again and the bottom line and then let's just do it backwards in capitals PTF and you see I hit space it does the first one space it does the second one space it does the third one if I had hit an exclamation point it would have done all of them in the entire file suppose I want to remove a line I can just hit Ctrl K and it's gone Ctrl K is gone again suppose I want to remove a range of lines I hit control space and then I go down a few lines uh with either the arrow key or control N I hit Ctrl w and they're gone if I want to move them further on in the file I go down a few lines and I hit Ctrl y for yank and they're back in there one nice thing I can do with emacs is open up multiple windows at the same time so let me hit Ctrl x 2 and now I've got two windows and I can switch to the bottom window by hitting Ctrl x o for other and then I hit control x f i could put a different file in that buffer so let's say I put in ETC group okay once again I'll make the font a little bigger by hitting control and the middle button on the mouse okay and you'll notice the bottom line is actually uh right protected so I can't really delete anything because it belongs to root if I try to delete this line it won't let me do it it says buffer is read only but in general like if I had two files with the same permissions I could cut and paste and go from one to the other to get back to just one I can do control X1 and I have only this but if I really wanted the other window I could hit Ctrl xB and I'm back in the password file if I want to rewrite it I can hit Ctrl x w control X control W and that would let me write it as a different name so I'll say p-a-s-w-d revised and it's there if I want to terminate the program I say control x s make sure things have been saved and then control XC and I'm done so you can see we use the control key quite a bit in Emax the position most keyboards put it in these days is a little unnatural all the way at the bottom left or right so veteran Emax users tend to remap the keyboard so that the caps lock key also works as control so that's some of the basic operations you would do in day-to-day use of emacs you have completed chapter 11. let's summarize the key Concepts covered text editors rather than word processing programs are used quite often in Linux for tasks such as creating or modifying system configuration files writing scripts developing source code and more Nano is an easy to use text-based editor that utilizes on-screen prompts G edit is a graphical editor very similar to notepad and windows the vi editor is available on all Linux systems and is very widely used graphical extension versions of VI are widely available as well the max is available on all Linux systems as a popular alternative to VI emacs can support both a graphical user interface and a text mode interface to access the vi tutorial type Vim tutor at a command line window to access the emacs tutorial type control h and then T from within emacs VI is three modes command insert and line emacs has only one but requires use of special keys such as control and Escape both editors use various combinations of keystrokes to accomplish tasks the learning curve to master these can be long but once mastered using either editor is extremely efficient by the end of this chapter you should be able to use and configure user accounts and user groups use and set environment variables use the previous shell command history use keyboard shortcuts use and Define aliases use and set file permissions and ownership as you know Linux is a multi-user operating system meaning more than one user can log on at the same time to identify the current user type who am I to list the currently logged on users type who giving who the dash a option will give more detailed information in Linux the command shell program generally bash uses one or more startup files to configure the user environment files in the slash Etc directory define global settings for all users while initialization files in the user's home directory can include and or override the global settings the startup files can do anything the user would like to do in every command shell such as customizing The Prompt defining command line shortcuts and aliases setting the default text editor setting the path for where to find executable Pro or setting the path for where to find executable programs the standard prescription is that when you first log into Linux slash Etc profile is read and evaluated after which the following files are searched if they exist in this order dot batch profile dot bash login dot profile where the squiggly line slash dot denotes the user's home directory the Linux login shell evaluates whatever startup file that it comes across first and ignores the rest this means that if it finds dot batch profile it ignores dot best login and Dot profile different distributions may use different startup files however every time you create a new shell or terminal window you do not have to perform a full system login only a file name dot bat RC file is read and evaluated although this file is not read and evaluated along with the login shell most distributions and or users include the dot bash RC file from within one of the three user-owned startup files most commonly users only fiddle with the dot bashrc as it is it is invoked every time a new command line shell initiates or another program is launched from a trauma window while the other files are read and executed only when the user first logs on to the system recent distributions sometimes do not even have bash profile and or bash login and some just do little more than include dot bash RC you can create customized commands or modify the behavior of already existing ones by creating aliases most often these aliases are placed in your bashrc file so they're available to any command shells you create on Alias removes an alias typing Alias with no argument will list currently defined aliases please note that there should not be any spaces on either side of the equal sign and the Alias definition needs to be placed within either single or double quotes if it contains any spaces all Linux users are assigned a unique user ID uid which is just an integer normal users start with a uid of 1000 or greater Linux uses groups for organizing users groups are collections of accounts with certain shared permissions control of group membership is administered through the slash Etc group file which shows a list of groups and their members by default every user belongs to a default or primary group when a user logs in the group membership is set for their primary group and all the members enjoy the same level of access and privilege permissions on various files and directories can be modified at the group level users also have one or more group IDs GID including a default one which is the same as the user ID these numbers are associated with names through the files slash Etc password and slash Etc group groups are used to establish a set of users who have common interests for the purpose of x success rights Privileges and security considerations access rights to files and devices are granted on the basis of the user and the group they belong to distributions have straightforward graphical interfaces for creating and removing users and groups and manipulating group membership however it's often useful to do it from the command line or from within shell scripts only the root user can add and remove users and groups adding a new user is done with user ad and removing an existing user is done with user Dell in the simplest form an account for the new user BJ moose would be done with sudo user ad BJ moose which by default sets the home directory to slash home slash BJ moose populates it with some basic files copied from slash Etc skell and adds a line to the slash ett slash password such as this and sets the default shell to slash spin slash bash removing a user account is as easy as typing user Dell BJ moose however this will leave the slash home slash BJ moose directory intact this might be useful if it's a temporary inactivation to remove the home directory while removing the account one needs to use the dash R option to user Dell typing ID with no arguments gives gives information about the current user as in this ID if given the name of another user as an argument ID will record information about that other user let's get some experience with creating modifying and removing a new user account we will do this on Ubuntu 1704. there are some variations between distributions about what exactly is created when a new account is is created and exactly which files are there Etc this is mostly controlled by a file under Etc default user ad appropriately named so you can see for example in here the default shell is set to be shell bsh bin sh now on some distributions such as red hat this files rather short and not very well documented on Ubuntu is rather long so let's create the account as you do a user ad and I'll say Dash M to make sure it creates a home directory some uh some distributions do not do that by default the Ubuntu does not for instance and neither does open Souza I'll give the full name to be Eric dolphy I'll specify the default shell to be bin bash with the S option and here's the name e d o l p h y e dolphin now I still have to pass a specify a password so I'll do that whatever you do past w d e d o l p h y and then I type something and now the accounts exist and I can verify that by making sure entries were made uh in the etcy password file and etcy group and there we go notice it is now user 1001 remember normal users start at 1000 and student is user 1000 and so that's appropriate and also the other information I specified is there such as the full username and the shell bin Bash and the group is set to be 1001 which is the same ID as the user all users are created with at least one group that has the same number as their username now let's actually try to log into that account and I'll do that with SSH and e-d-o-l-p-h-y at localhost and I'll give the password and I succeeded just fine so let's see what's actually in that directory and you'll see there isn't much but these are files that all new users get um and let me log out now and that's controlled by whatever's in the ETC skel directory anything you put in there let me do the a option anything you put in there will show up in any new users account so let's just clean up and I'll do that with user Del Dash R uh e dolphy and the R is necessary to make sure it removes the home directory you know as I get a warning message about not having created a mail spool file that's harmless and if you do lssl on home now we see the account is gone so we're all cleaned up adding a new group is done with group AD so you can use sudo slash user slash S Pen slash group AD a new group the group can be removed with sudo slash user slash S Pen slash group Dell a new group adding a user to an already existing group is done with user mod for example when you would first look at what groups the user already belongs to and then add the new group sudo slash user slash S Pen slash user mod Dash a dash G in your group RDS squirrel RJ squirrel and then groups RJ squirrel will show the new group these utilities update the slash Etc group as necessary make sure you use the dash a option for append so as to avoid removing already existing groups group mod can be used to change group properties such as the group ID with the dash G option or its name with the with the dash in option removing a user from the group is somewhat trickier the dash G option to user mod must give a complete list of groups thus if you do pseudo slash user slash S Pen slash user mod Dash g r j squirrel RJ squirrel and then do groups RJ squirrel you'll see that only the RJ squirrel group will be left the root account is very powerful and has full access to the system other operating systems often call this the administrator account in Linux it's often called the super user account you must be extremely cautious before granting full root access to a user it's rarely if ever Justified external attacks often consist of tricks used to elevate the root account however you can use sudo to assign more limited privileges to user accounts but only do it on a temporary basis and only for a specific subset of commands when assigning elevated privileges you can use the command Su the switch or substitute user to launch a new shell running as another user you must type the password of the user you are becoming most often this other user is root and the new shell allows the use of elevated privileges until it's until it is exceeded it's almost always a bad practice to use slsu to become root resulting errors can include deletion of vital files from the system and security breaches granting privileges using Sudo is less dangerous and is preferred by default Studio must be enabled on a per user basis however some distributions such as Ubuntu enable it by default for at least one main user or give this as an installation option to temporarily become the super user for a series of commands you can type Su and then be prompted for the root password to execute just one command with root privileges type sudo and then the command when the command is complete you will return to being a normal unprivileged user sudo configuration files are stored in the slash Etc sudoers file and in the slash Etc pseudoers.d directory by default the pseudoers.directory is empty and whenever you talk about sudo in a course or article you're basically required to show this webcomic by XKCD environment variables are quantities that have specific values which may be utilized by the command shell such as bash or other utilities and applications some environment variables are given preset values by the system which can usually be overridden While others are set directly by the user either at the command line or within startup and other scripts an environment variable is actually just a character string that contains information used by one or more applications there are a number of ways to view the values of currently set environment variables one can type set EMV or export depending on the state of your system set May print out many more lines than the other two methods by default variables created within a script are only available to the current shell child processes subshells will not have access to values that have been set or modified allowing child processes to see the values requires use of the export command you can also set environment variables to be fed as a one shot to a command as in the following this feeds the values of the Esters and K root environment variables to the command make modules install home is an environment variable that represents the home or login directory of the user CD without arguments will change the current working directory to the value of home note the tilde character is often used as an abbreviation for home thus CD home and CD with utility are completely equivalent statements foreign path is an ordered list of directories the path which is scanned when a command is given to find the appropriate program or script to run each directory in the path is separated by colons a null or empty directory name or slash indicates the current directory at any given time so in this example there is a null directory before the first colon similarly for this there is a null directory between path 1 and path 2. to prefix a private bin directory to to your path you can use this command the environment variable shell points to the user's default command shell the program that is handling whatever you type in a command window usually bash and it contains the Full path name to the Shell prompt statement or Ps is used to customize your prompt string in your terminal Windows to display the information you want PS1 is the primary prompt variable which controls what your command line prompt looks like the following special characters can be included in PS1 they must be surrounded in single quotes when they are used as in this example bash keeps track of previously entered commands and statements in a history buffer you can recall previously used commands simply by using the up and down cursor keys to view the list of previously executed commands you can just type history at the command line this list of commands is displayed with the most recent command appearing last in the list this information is stored in the slash dash dash history if you have multiple terminals open the commands typed in each session are not saved until the session terminates several Associated environment variables can be used to get information about the history pile his file is the location of the history file his file size is the maximum number of lines in the history file default 500 his size is the maximum number of commands in the history file his control is how commands are stored hist ignore is which command lines can be unsaved for a complete description of the the use of these environment variables see the man page and Bash there are specific keys to perform various tasks if you want to recall a command in the history list but do not want to press the arrow key repeatedly you can press Ctrl R to do a reverse intelligent search as you start typing the search goes back in reverse order to the First Command that matches the letters you have typed by typing more successive letters you make the match more and more specific you can use keyboard shortcuts to perform different tasks quickly this table lists some of these keyboard shortcuts and their uses note the case of the hotkey does not matter meaning doing control a is the same as doing control capital a in Linux and other Unix based operating systems every file is associated with a user who is the owner every file is also associated with a group a subset of all users which has an interest in the file and certain rights or permissions read write and execute the following utility programs involve user and group ownership and permission settings files have three kinds of permissions read write and execute these are generally represented as the rwx these permissions affect the three groups of owners owner user owner group and others as a result you have the following three groups of three permissions there are a number of different ways to use chmod for instance to give the owner and others execute permission and remove the group write permission you can do this where the U stands for user or owner o stands for other world and G stands for group this kind of syntax can be difficult to type and remember so one often uses a shorthand which lets you set all the permissions in one step this is done with a simple algorithm and a single digit suffices to specify all three permission bits for each entity this digit is the sum of four if read permission is desired two if right permission is desired one if execute permission is desired so 7 means read write execute six means read write 5 means read execute when you apply this to the the chmod command you have to give three digits for each degree of Freedom such as chmod 755 sum file now let's see an example of changing file ownership using CH own as shown in this screenshot first we create two empty files using touch notice it requires sudo to change the owner of file 2 to root the second CH ohm command changes both owner and group at the same time finally only the super user can remove the files now let's see an example of changing the group ownership using chgrep you have completed chapter 12. let's summarize the key Concepts covered Linux is a multi-user system to find the currently logged on users you can use the who command to find the current user ID you can use the who am I command the root account has full access to the system it's never sensible to Grant full root access to a user you can assign root privileges to regular user accounts on a temporary basis using the sudo command the shell program or bash uses multiple startup files to create the user environment each file affects the interactive environment in a different way slash ectc profile provides the global settings advantages of startup files include that they customize the user's prompt set the user's terminal type set the command line shortcuts and aliases and set the default text editor an environment variable is a character string that contains data used by one or more applications the built-in shell variables can be customized to suit your requirements the history command recalls a list of previous commands which can be edited and recycled in Linux various keyboard shortcuts can be used at the command prompt instead of long actual commands you can customize commands by creating aliases adding an alias to the slash.rc file will make it available for other shells file permissions can be changed by typing chmod permissions in the file name file ownership is changed by typing CH own then the owner and the file name the file group ownership is changed by typing CHC Erp then the group then the file name by the end of this chapter you should be able to display and append to file contents using cat and Echo edit and print file content to contents using SED and ewk search for patterns using grep use multiple other utilities for file and text manipulation irrespective of the role you play with Linux such as system administrator developer or user you often need to browse through and parse text files and or extract data from them these are file manipulation operations thus it's essential for the Linux user to become Adept at performing certain operations on files most of the time such file manipulation is done at the command line which allows users to perform tasks more efficiently than while using a GUI furthermore the command line is more suitable for automating often executed tasks indeed experienced system administrators write customized scripts to accomplish such repetitive tasks standardized for each particular environment we'll discuss such scripting later in much detail in this section we'll concentrate on command line file and text manipulation related utilities cat is short for concatenate and is one of the most frequently used Linux command line utilities it's often used to read and print files as well as for simply viewing file contents to view a file use the following command cat and then the file name for example cat readme.txt will display the contents of readme.txt on the terminal however the main purpose of cat is often to combine or concatenate multiple files together you can perform the actions listed in this table using cat the tech command or cat spelled backwards prints the lines of a file in reverse order each line Remains the Same but the order of lines is inverted the syntax of TAC is exactly the same as for cat as in the following cat can be used to read from standard input such as the terminal window if no files are specified you can use the greater than operator to create and add new lines to file and the double greater than operator to append lines or files to an existing file to create a new file at the command prompt type cat greater than file name and press the enter key this command creates a new file and waits for the user to edit or enter the text after you finish typing the required text press Ctrl D at the beginning of the next line to save and exit the editing let's demonstrate some of the basic operations you can perform with the cat utility where the word cat stands for concatenate it's typically used to copy files combine them Etc so first we will need a couple of simple text files to play with let's create one using a text editor let's say Nano so Nano file 1. text and I will just type in a couple of lines actually three lines with a point one at the end I hit control X for exit I say yes I want to save the modified buffer and I keep the name so now I can look at the the file created with cat so I do cat file one to text perfect now let's create another one interactively using cat itself as we talked about earlier so I can say cat in their Direction with elf and I'll put it into file 2.txt and here is a second file with a few lines and then I just type eof on a line and that closes the input phase and I can say cat file 2.6 it's there if I want to see them both together I can say cat file one the text file two dot text I see a combined or I could send it into a third file file three that text and then clear the screen I can say cat file three a text and I see the combined two files in a third file so this is how we use CAD it's an everyday operation you rarely do anything that much more complicated with it system administrators need to work with configuration files text files documentation files and log files some of these files may be larger or become quite large as they accumulate data with time these files will require both viewing and administrative updating in this section you will learn how to manage such large files for example a banking system might maintain one simple large log file to record details of all of One day's ATM transactions due to a security attack or a malfunction the administrator might be forced to check for some data by navigating within the file in such cases directly opening the file in an editor will cause issues due to high memory utilization as an editor we'll usually try to read the whole file into memory first however one can use less to view the contents of such a large file scrolling up and down Page by Page without the system having to place the entire file in memory before starting this is much faster than and using a text editor viewing some file can be done by typing either of the two following commands less some file or cat some file pipe less by default Man pages are sent through the less command you may have encountered the older more utility which has some basic functionality but fewer capabilities I.E less is more head reads the first few lines of each named file 10 by default and displays it on standard output you can give a different number of lines in an option for example if you want to print the first five lines from Etc slash default scrub we can use this command head Dash in and then Etc default scrub you can also just do this head Dash 5 Etc default scrub tail prints the last few lines of each named file and displays it on standard output by default it's it displays the last 10 lines you can give a different number of lines as an option tail is especially useful when you are troubleshooting any issue using log files as you probably want to see the most recent lines of output for example this to display the last 15 lines of some file.log we can use this command tail Dash end 15 some file that log you can also just do this tail that's 15 some file that log continually monitor new output in a growing log file we can do tail Dash F some follow that log this command will continuously display any new lines of output in some file.log as soon as they appear thus it enables you to monitor any current activity that is being reported and recorded it's very common to create and then repeatedly edit and or extract contents from a file let's learn how to use SED and awk to easily perform such operations note that many Linux users and administrators will write scripts using comprehensive scripting languages such as Python and Perl rather than use SED and awk and some of the other utilities we'll discuss later using such utilities is certainly fine in most circumstances one should always feel free to use the tools one is experienced with however the utilities that are described here are much lighter I.E they use fewer system resources and execute faster there are situations such as during booting the system where a lot of time would be wasted using the more complicated tools and the system may not even be able to run them so the simpler tools will always be needed SED is a powerful text processing tool and is one of the oldest earliest and most powerful Unix utilities it's used to modify the contents of a file or input stream usually placing the contents into a new file or output stream its name is is an abbreviation for stream editor said SED can filter text as well as perform substitutions in data streams data from an input source or file is taken and moved to a working space the entire list of operations or modifications is applied over the data in the working space and then file contents are moved to the standard output space or stream you can invoke Saturn sdd using commands like those listed in this table the dash e option allows you to specify multiple editing commands simultaneously at the command line it's unnecessary if you only have one operation invoked now that you know that you can perform multiple editing and filtering operations with said let's explain some of them in more detail the table explains some basic operations where pattern is the current string and replace underscore string is the new string let's demonstrate some of the most Elementary operations you can perform with SCD on a fedora system so I have taken the Liberty to prepare a simple text file uh before we start which looks like this cat in file that text it just says three lines indicating their presence so balls I do scd-e slash and then let's say is to R on the file and the output will go right on standard out and you see it changed only the first instance on every line so I even have VAR instead of this um I can make a slight modification to the command if I put a g at the end of it and you see this time we caught every instance I could also do something like this one comma 2s and it only did it on the first and the second line but I left the third line alone you'll notice that I don't have to use a forward slash I can use many other characters so here I'll use a colon and it makes no difference what I use now there is an option for SED to change character streams in place on the original file but it's a pretty dangerous operation to do since you destroying the original file so generally it's better to send the output into another file so I'll do I'll call that one out file.txt oh I forgot to say infile.text for input so it hung so now I can look at out file.text you see and that's the output and if I want to use the diff command to see the difference I can do something like this diff in file.text Al file dot text and it shows me the two lines that have changed now you can do some pretty complicated things with SCD when you're trying to deal with special characters including spaces and question marks and stars life can get pretty complicated it it respects everything in the world about what are called regular Expressions which can look rather strange but it's a daily tool that's just the administrators do to make Elementary substitutions and files so that's a little bit about SCD awk awk is used to extract and then print specific contents of a file is often used to construct reports it was created at Bell labs in the 1970s and derived its name from the last names of its authors akes the following features it's a powerful utility and interpreted programming language it's used to manipulate data files and for retrieving and processing text it works well with Fields containing a single piece of data essentially a column and Records a collection of fields essentially a line in a file awk is invoked as shown in this example as was said short op commands can be specified directly at the command line but a more complex script can be saved in a file that you can specify using the dash F option this table explains the basic tasks that can be performed using awk the input file is read one line at a time and for each line awk matches the given pattern in the given order and performs a requested action the dash F option allows you to specify a particular field separator character for example the slash Etc password file uses a colon to separate Fields so the dash F colon option is used with the slash EDC slash password file the command or action in AUC needs to be surrounded with apostrophes or single quotes awk can be used like the following like in this example in managing your files you may need to perform tasks such as sorting data and copying data from one location to another Linux provides numerous file manipulation utilities that you can use while working with text files in this section you will learn about the following file manipulation programs sort unique paste join and split you also learn about regular expressions and search patterns sort is used to rearrange the lines of a text file in either ascending or descending order according to a sort key you could also sort with respect to particular fields or columns in a file the default sort key is the order of the ASCII characters I.E essentially alphabetically so it can be used like this when used with the dash U option sort checks for Unique values after sorting the records or lines it's basically equivalent to running unique on the output of sort unique removes duplicate consecutive lines in a text file and it's useful for simplifying the text display because unique requires that the duplicate entries must be consecutive when often run sort first and then pipes output into unique if sort is used with the dash U option it can do all this in one step to remove duplicate entries from multiple files at once use this command or you can use do this one to count the number of duplicate entries use this command suppose you have a file that contains the full name of all employees and another file that lists their phone numbers and employee IDs you want to create a new file that contains all the data listed in three columns name employee ID and phone number how can you do this effectively without investing too much time Paste can be used to create a single file containing all three columns the different columns are identified based on delimiters which is spacing used to separate two fields for example delimiters can be a blank space a tab or an enter in this image a single space is used as a delimiter in all files paste accepts the following options Dash D for the delimiters which specify a list of delimiters to be used instead of tabs for separating consecutive values on a single line each delimiter is used in turn when the list has been exhausted Pace begins again at the first delimiter dash s which causes Pace to append the data in series rather than in parallel that is in a horizontal rather than vertical fashion Paste can be used to combine Fields such as name or phone number from different files as well as combine lines from multiple files for example Line 1 from file 1 can be combined with line 1 of file 2 and line 2 from file 1 can be combined with line 2 of file two and so on to paste contents from two files one can do this and here's the syntax to use a different delimiter common delimiters are space Tab and comma suppose you have two files with with similar columns you have saved employees phone numbers and two files one with the first name and the other with their last name you want to combine the files without repeating the data of common columns how do you achieve this this task can be achieved using join which is essentially an enhanced version of paste it first checks whether the files share common fields such as names or phone numbers and then joins the lines and two files based on a common field to combine two files on a common field at the common prompt type join file one file 2 and press the enter key for example the common field I.E it contains the same values among the phone book and cities files is the phone number and the result of joining these two files is shown here split is used to break up or split a file into equal size segments for easier viewing and manipulation and it's generally used only on relatively large files by default split breaks up a file into 1000 line segments the original file remains unchanged and a set of new files with the same name plus added prefix is created by default the X prefix is added to split a file the segments use the command split and file to split file into segments using a different prefix use the command split in file and then the prefix we will apply split to an American English dictionary file of over 99 000 lines and in this example we've used WC which stands for word count that we'll discuss shortly to report on the number of lines in the file and then you just type this this will split the American English style into 100 equal size segments named dictionary XX the last one will of course be somewhat smaller regular expressions are text strings used for matching a specific pattern or to search for a specific location such as the start or end of a line or a word regular Expressions can contain both normal characters or so-called meta characters such as an asterisk or an and a dollar sign many text editors and utilities such as VI said OC find and grep work extensively with regular Expressions this table lists the search patterns and their usage for example consider the following sentence the quick brown fox jumped over the lazy dog some of the patterns that can be applied to the sentence are shown here grep is extensively used as a primary text searching tool it scans files for specified patterns and it can be used with regular Expressions as well as simple strings as shown in this table strings is used to extract all printable character strings found in a file or files given as arguments it's useful in locating human readable content embedded in binary files for text files one can just use grep for example to search for the string my underscore string in a spreadsheet you can use this command and this screenshot shows a search of a number of programs to see which ones have GPL licenses of various versions in this section you will learn about some additional text utilities that you can use for performing various actions on your Linux files such as changing the case of letters or determining the count of words lines and characters in a file the TR utility is used to translate specified characters into other characters or to delete them the general syntax is as follows TR options set 1 and set 2. the items in the square brackets are optional TR requires at least one argument and accepts a maximum of two the first designated set one in this example lists the characters in the text to be replaced or removed the second set two lists the characters that are to be substituted for the characters listed in the first argument sometimes these sets need to be surrounded by apostrophes or single quotes in order to have the shell ignore that they mean something special to the Shell it's usually safe and may be required to use the single quotes around around each of the sets as you'll see in these examples for example suppose you have a file named City containing several lines of attacks in mixed case to translate all lowercase characters to uppercase at the command prompt type cat City pipe TR adz adfz and press the enter key takes the output from any command and while sending to the standard output it also saves it in a file in other words it tees the output stream from the command one stream is displayed on the standard output and the other is saved to a file for example to list the contents of a directory on the screen and save the output to a file at the command prompt type ls-l pipe T new file and press enter key typing can't new file will then display the output of ls-l WC or word count counts the number of lines words and characters in a file or a list of files options are given in this table by default all three of these options are active cut is used for manipulating column based files and is designed to extract specific columns the default column separator is the tab character different deliminator can be given as a command option for example to display the third column delimited by a blank space at the command prompt type ls-s pipe cut Dash d double quote space double quote and then Dash F3 and then you press the enter key you have completed chapter 13. let's summarize the key Concepts covered the command line often allows the users to perform tasks more efficiently than the GUI cat sort 4 concatenate is used to read print and combine files Echo displays a line of text either on standard output or to place in a file set is a popular stream editor often used to filter and perform substitutions on files and Text data streams awk is an interpretive programming language typically used as a data extraction and reporting tool sort is used to sort text files and output streams in either ascending or descending order unique eliminates duplicate entries in a text file paste combines fields from different files you can also extract and combine lines from multiple sources join combines lines from two files based on a common field it works only if files share a common field split breaks up a large file into equal size segments regular expressions are text strings used for pattern matching the pattern can be used to search for a specific location such as the start or end of a line or a word grep searches the text files and data streams for patterns and can be used with regular expressions TR translates characters copy standard input to standard output and handle special characters T saves a copy of standard output to a file while still displaying at the terminal WC for word count displays the number of lines words and characters in a file or a group of files cut extracts columns from a file less views files a page at a time and allow scrolling in both directions head displays the first few lines of the file or data stream or standard standard output by default it displays 10 lines tail displays the last few lines of a file or data stream on standard output by default it displays 10 lines strings extracts printable character strings from binary files by the end of this chapter you should be able to explain basic networking Concepts including types of networks and addressing issues configure network interfaces and use it and use basic networking utilities such as ifconfig IP ping route and trace route use graphical and non-graphical browsers such as links w3m Firefox Chrome and Epiphany transfer files to and from clients and servers using both graphical and text mode applications such as filezilla FTP SFTP curl and wget a network is a group of computers and Computing devices connected together through communication channels such as cables or wireless media the computers connected over a network may be located in the same geographical area or spread across the world a network is used to allow the connected devices to communicate with each other enable multiple users to share devices over the network such as music and video servers printers and scanners share and manage information across computers easily most organizations have both an internal Network and an internet connection for users to communicate with machines and people outside the organization the internet is the largest Network in the world and can be called the network of Networks devices attached to a network must have at least one unique Network address identifier known as the IP or Internet Protocol address the address is essential for routing packets of information through the network exchanging information across the network requires using streams of small packets Each of which contains a piece of the information going from one machine to another these packets contain data buffers together with headers which contain information about where the pack is going to and coming from and where it fits in the sequence of packets that constitute the Stream Network Protocols are in software are rather complicated due to the diversity of machines and operating systems they must deal with as well as the fact that even very old standards must be supported there are two different types of IP addresses available ipv4 version 4 and IPv6 version 6. ipv4 is older and by far the most widely used while IPv6 is newer and is designed to get past limitations inherent in the older standard in furnace many more possible addresses ip4 uses 32-bits for addresses they're only 4.3 billion unique addresses available furthermore many addresses are allotted and reserved but not actually used ipv4 is considered inadequate for meeting future needs because the number of devices available on the global network has increased enormously in recent years IPv6 uses 128 bits for addresses this allows for a 3.4 times 10 to the power of 38 unique addresses if you have a larger network of computers and want to add more you may want to move to IPv6 because it provides more unique addresses however it can be complex to migrate to IPv6 the two protocols do not always interoperate well thus moving equipment and addresses to IPv6 require significant effort and has not been quite as fast as was originally intended we'll discuss ipv4 more than IPv6 as you're more likely to deal with it one reason ipv4 has not disappeared is there are ways to effectively make many more addresses available by methods such as Nat the network address translation net enables sharing one IP address among many locally connected computers Each of which has a unique address only seen on the local network while this is used in organizational settings it's also used in simple home networks for example if you have a router hooked up to your internet provider such as a cable system it gives you one externally visible address but issues each device in your home an individual local address a 32-bit ipv4 address is divided into four 8-bit sections called octets so here's an example note that octet is just another word for byte Network addresses are divided into five classes a b c d and e classes a B and C are classified into two parts Network addresses netid and host address host ID the netid is used to identify the network while the host ID is used to identify a host in the network class D is used for special multicast applications information is broadcast to multiple computers simultaneously in class E is reserved for future use in this section you will learn about classes a b and c Class A addresses use the first octet of an IP address as their net ID and use the other three octets as their host ID the first bit of the first octet is always set to zero so you can only use seven bits for Unique Network numbers as a result there are a maximum of 126 Class A networks available not surprisingly this was only feasible when there were very few unique networks with large numbers of hosts as the use of the internet expanded classes B and C were added in order to accommodate the growing the growing demand for independent Networks each class a network can have up to 16.7 million unique hosts on its Network the range of host addresses is from 1.0.0.0 to 127.255.255.255 Class B addresses use the first two octets of their IP address as their netid and the last two octets as their host ID the first two bits of the first octet are always set to Binary 10. so there are a maximum of 16 384 Class B networks the first octet of a Class B address has values from 128 to 191. the introduction of Class B networks expanded the number of networks but but it soon became clear that a further level would be needed each class B Network can support a maximum of 65 536 unique hosts on its Network the range of post addresses is from 128.0.0.0 to 191.255.255.255 Class C addresses use the first three octets of the IP address as their net ID in the last octet as their host IDE the first three bits of the first octet are set to Binary one one zero so almost 2.1 million Class C networks are available the first octet of a Class C address has values from 19192 to 223 these are most common for smaller networks which don't have many unique hosts each class seed Network can support up to 256 unique hosts the range of host addresses is from 192.0.0.0 to 223.255.255.255 typically a range of IP addresses are requested from your internet service provider your ISP by your organization's network administrator often your choice of which class of IP address you're given depends on the size of your network and expected growth needs if Nat is an operation such as in a home network you only get one externally visible address you can assign IP addresses to computers over a network either manually or dynamically manual assignment adds static or never changing addresses to the network dynamically assigned addresses can change every time you reboot or even more often the dynamic host C configuration protocol DHCP is used to assign IP addresses name resolution is used to convert numerical IP address values into a human readable format known as the hostname for example 104.95.5.15 is the numerical IP address that refers to the hostname whitehouse.gov host names are much easier to remember given an IP address you can obtain its corresponding hostname accessing the machine over the network becomes easier when you can type the hostname instead of the IP address you can view your system's hostname simply by typing hostname with no argument the special host name localhost is associated with the IP address 127.0.0.1 and describes the machine you are currently on which normally has additional Network related IP addresses let's get a feel for how the domain name server works on a recent Ubuntu system so first we need to log in and when you log in we'll open up a command line terminal because we're going to do all our operations from the command line so I have done that by right clicking on the desktop and then let me make a bigger font and I might as well go full screen while I'm at it so there are a couple of important files on your system one is called etcresult.conf now on older Linux systems you didn't have all this information at the top you just had important thing here name server 127.0.053 you're more likely to find your name server is not a one two seven one which all one two seven addresses are on the actual machine but one nine two one six eight that one that one for instance would be a common thing might point to your your wireless modem which is attached to your internet service provider for instance recent systems use a systemd service called systemd resolve D which works in a more complicated way it makes a DNS server on the local machine which caches the results or previous searches so we're not going to get into the details of that but uh that's a recent development that you'll find on newer machines another important file is ETC hosts this file is consulted before the domain name server is consulted so you'll see for instance here at the bottom we've got two machines on the local network we give their IP addresses and a name that we can use to get at them and you'll notice you can have more than one name tied to an IP address so for instance I could do ping Theodore and that's going to take me to 200 or I could do ping uh beaver it takes me to the same machine now if I want to look at something which isn't specified in that file or in fact I can do that host uh Theodore and it will go look at the file but if I want to get something out on the internet I could do most linuxfoundation.org and I'll get the both the ip4 and the ip6 addresses here of the Linux foundation and also information about the mail services provided by the Linux Foundation I can do another utility for similar information is NS lookup so I'll do that and this lookup foundation.org linksfoundation.org so you see you got the same basic information a little more compactly I've got here's the ip4 address and then the two ip6 addresses another utility I can use is dig so let's do dig Linux foundation.org and you'll see I once again got the information about the IEP address and then a lot more information about the search to find that server so that's just a little bit of what you can do with DNS and some of the files that are associated with it network configuration files are essential to ensure that interfaces function correctly they are located in the slash Etc directory tree however the exact files used have historically been dependent on the particular Linux distribution and version being used for deviant family configurations the basic network configuration files could be found under slash Etc Network while for red hat and Susie family systems one needed to inspect Etc sysconfig Network modern systems emphasize the use of network manager which we briefly discussed when we considered graphical system administration rather than keep up with all the files and slash Etc while the graphical versions of network manager do look somewhat different in different distributions the nmt UI utility shown here varies almost not at all as does even more sparse in mcli or command line interface utility if you are proficient in the use of gui's by all means use them if you're working on a variety of systems the lower level utilities may make life easier network interfaces are a connection Channel between a device and a network physically network interfaces can proceed through a network interface card or it can be more abstractly implemented as software you can have multiple network interfaces operating at once specific interfaces can be brought up or activated or brought down deactivated at any time information about a particular network interface or all network interfaces can be reported by the IP and ifconfig utilities which you may have to run as the super user or at least give the full path name IE spin ifconfig IP is newer than ifconfig and has far more capabilities but its output is uglier to the human eye some new Linux distributions do not install the older net tools packets to which ifconfig belongs and so you would have to install it if you want to use it to view the IP address you can do this S Pen slash IP address show to view the routing information slash S Pen slash IP route show IP is a very powerful program that can do many things older and more specific utilities such as ifconfig and Route are often used to accomplish similar tasks a look at the relevant Man pages can tell you much more about these utilities ping is used to check whether or not a machine attached to the network can receive and send data I.E confirms that the remote host is online and is responding check the status of the remote host at the command prompt type ping and then the hostname peeing is frequently used for Network testing and management however its usage can increase Network load unacceptably hence you can abort the execution of ping by typing control C or by using the dash C option which limits the number of packets that ping will send before it quits when when an execution stops a summary is displayed a network requires the connection of many nodes data moves from source to destination by passing through a series of routers and potentially across multiple networks servers maintain routing tables containing the addresses of each node in the network the IP routing protocols enable routers to build up a forwarding table that correlates final destinations with the next hop addresses one can use the route utility or the newer IP route command to view or change IP routing table to add delete or modify specific static routes to specific codes or networks this table explains some commands that can be used to manage IP routing foreign is used to inspect the route which the data packet takes to reach the destination host which makes it quite useful for troubleshooting Network delays and errors by using trace route you can isolate connectivity issues between hops which helps resolve them faster to print the route taken by the packet to reach the network host at the command prompt type trace route and then the address now let's learn about some additional networking tools networking tools are very useful for monitoring and debugging network problems such as network connectivity and network traffic let's get started on using more networking tools to use more networking tools open the command prompt to query network interface connected to eth2 type sudo eth tool eth0 and press enter to display all active connections and routing tables type netstat-r and press enter all active connections and routing tables are displayed to scan open ports on a network type sudo nmap Dash SP 10.0.2.15 24 and press enter the open ports on a network are displayed browsers are used to retrieve transmit and explore information resources usually on the world wide web Linux users commonly use both graphical and non-graphical browser applications the common graphical browsers used in Linux are Firefox Google Chrome chromium conquer and Opera sometimes you either do not have a graphical environment to work in or have reason not to use it but still need to access web resources in such a case you can use non-graphical browsers such as these sometimes you need to download files and information but a browser is not the best choice either because you want to download multiple files or you want to perform the action from a command line or a script wget it's a command line utility that can capably handle the following types of downloads large file downloads recursive downloads where a web page refers to other web pages and all are downloaded at once password required downloads and multiple file downloads to download a web page you can simply type wget and then the URL and then you can read the downloaded page as a local file using a graphical or non-graphical browser besides downloading you may want to obtain information about a URL such as the source code being used curl can be used from the command line or a script to read such information curl also allows you to save the contents of a web page to a file as does wget you can read a URL using curl URL for example if you want to read freecodecamp.org type curl HTTP colon freecodecamp.org it to get the contents of a web page and store it to a file type curl slash o save.html and then the website address the contents of the main index file at the website will be saved in save.html secure shell SSH is a cryptographic network protocol used for secure data communication it's also used for remote services and other secure Services between two devices on the network and is very useful for administering systems which are not easily available to physically work on but to which you have remote access to log in to a remote system using your Sam username you can just type SSH some system and press enter SSH then prompts you for the remote password you can also configure SSH to securely allow your remote access without typing a password each time if you want to run as another user you can do either ssh-l someone some system or SSH someone at some system to run a command on a remote system via SSH at the command prompt you type SSH sum system my command we can also move files securely using secure copy SCP between two networked hosts SCP uses the SSH protocol for transferring data to copy a local file to a remote system at the command prompt type sdp in the local file and then the user at the remote system clones home slash user and then you press enter you will receive a prompt for the remote password you can also configure sap so that it does not prompt for a password for each transfer let's do a simple demonstration of using secure shell and secure copy between two virtual machines Ubuntu machine and a Centos machine so first from the Ubuntu machine let's try to log into the Centos machine well first I need to know the IP address of both machines so I can do that with IP and I'll say brief to get a condensed output um addr for address shows and I can see my address on this machine is one seven two one six two four nine one three three I'll do the same command on the Cent OS machine and see the address is the same except for the last byte or octet which is one two nine so first let's log into the Centos machine from Ubuntu I do SSH student at 172.16.249.129 and it's the first time I'm doing this so it wants to make sure that I'm authentic so I say yes and now I have to give the password and it's fine I'm on the central s machine as you can see from the prompt now in that command I really didn't have to give student that because we're using student account on both machines but it never hurts to do that so let me exit now let's do from the Centos machine Let's copy over directory using SCP over to the Ubuntu machine so let me do scp-r for recursive to get the whole directory and everything underneath it uh and this time uh I won't as a home student I'll copy the home student directory I won't bother saying student ad I'll just give the address 172.16-249.133 and I'll put it in the temp directory once again it wants to make sure that it's authentic so I'll say yes and once again I have to give the password and it's copied over and if I go over to the Ubuntu machine and I look in the temp directory I'll see the account is now there the directory is now there so that's all there is to do a pretty simple demonstration of using secure shell and secure copy you have completed chapter 14. let's summarize the key Concepts covered the IP or Internet Protocol address is a unique logical Network address that is assigned to a device on a network ipv4 uses 32 bits for addresses and IPv6 uses 128 bits for addresses every IP address contains both a network and a host address field there are five classes of network addresses available a b c d and e DNS domain name system is used for converting Internet domain and host names to IP addresses the ifconfig program is used to display current Active network interfaces the commands IP addr show and IP route show can be used to view IP addresses and routing information you can use ping to check if the remote host is alive and responding you can use the route utility program to manage IP routing you can monitor and debug networking problems using networking tools Firefox Google Chrome chromium and Epiphany are the main graphical browsers used in Linux non-graphical or text browsers used in Linux are links links and w3m you can use wget to download web pages you can use kernel to obtain information about urls you can use SSH to run commands on remote systems we've reached the end of the course you should now have a good working knowledge of Linux from both a graphical and command line perspective I mentioned at the beginning of the course that there is a text-based version of this course Linked In the video's description that version also has sections about the bash shell and scripting Printing and local security principles those won't be relevant to everybody but feel free to check that out if you want to learn about those topics so good luck as you use and administer Linux
Info
Channel: freeCodeCamp.org
Views: 775,335
Rating: undefined out of 5
Keywords:
Id: sWbUDq4S6Y8
Channel Id: undefined
Length: 367min 31sec (22051 seconds)
Published: Thu Feb 23 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.