30
Understanding the Basic Linux Structure RH030 Linux Computing Essentials

RH030 Linux Computing Essentials

  • Upload
    moira

  • View
    69

  • Download
    2

Embed Size (px)

DESCRIPTION

RH030 Linux Computing Essentials. Understanding the Basic Linux Structure. Objectives. Structure of the Linux OS Use of shells and their relationship to C.L Use of the system directories FSH = hierarchical filesystem structure FSH = structure of the directory tree structure - PowerPoint PPT Presentation

Citation preview

Page 1: RH030  Linux Computing Essentials

Understanding the Basic Linux Structure

RH030 Linux Computing Essentials

Page 2: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

2

Objectives Structure of the Linux OS Use of shells and their relationship to C.L Use of the system directories FSH = hierarchical filesystem structure FSH = structure of the directory tree structure Navigation using absolute / relative pathnames Structure of the command line. Basic navigation commands

Page 3: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

3

Linux / UNIX - Interfaces

User Applications

XWindows – intel = xfree86

SHELL – Command line Interface

Standard Utility Programs - Kernel - Standard library Programs

Hardware

User mode

Kernel mode

Desktop – GNOME, KDE

Page 4: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

4

Main Elements of Linux/Unix OS Kernel

manages memory

manages system resources

manages processes

schedules programs manages file system

- data/file access and storage - enforces security mechanismsperforms all hardware access

Kernel

Hardware

XWindows

shells

ApplicationsApplications

Page 5: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

5

Main Elements of Linux/Unix OS Shell

There are many different shell programs:

- Bourne (sh), Korn (ksh), C (csh) Bourne Again (bash)

It acts as the interface between the user and the kernel

presents each user with a command promptinterprets commands typed by a userexecutes user commandssupports a custom environment for each user

Utilitiesfile management -rm, cat, ls, rmdir, mkdiruser management - passwd, chmod, chgrpprocess management - kill, pscompression – tar, cpio, gzipadministrative – useradd, groupadd, who, su

Kernel

Hardware

XWindows

shells

ApplicationsApplications

Page 6: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

6

Difference between the Windows & Linux Directory Structure

Figure 4-1: The Windows filesystem structure

Figure 4-2: The Linux filesystem structure

Page 7: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

7

Linux FSH = Directory Tree Structure

Page 8: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

8

Under the \ are the System Directories

Table 5-1: Linux directories defined by FHS

Page 9: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

2 Types of Unix/Linux users Superuser # = There is only one system administrator

account, created during installation

They always log onto the system as root.

Regular User $ = These are created by the superuser

All accounts have a home directory. The hierarchical filesystem starts from the top of the tree “ / ” which is

called the “root” directory . Immediately under which are the system directories. 2 of these are: /root directory which is the home directory for the superuser

/home directory which contains a separate home directory for each of the regular user accounts.

Page 10: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

10

You have to Login to Linux Multiuser environments require you to have a users account. You can log in thru command-line interface or a GUI interface. The Command-line interface is always available. You need to install the GUI interface during installation to use it. Login will also require a password.

Page 11: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

11

Even after you login Linux still offers the user many choices for their Interfaces

1. Command-line using shell There are multiple CL screens available for the use of the user. You access them by using the Crtl+Alt+F key combinations to

change to separate terminal screens.

2. Graphical Interface using Xwindows You can start a GUI interface on any of these multiple screens . You can access a GUI interface with the Crtl+Alt+F7 key combination You can use the Crtl+Alt+Bkspace key to shutdown the GUI

You can have access to both GUI & CL interfaces. Load the GUI by default and use terminal program for CL Or load CL by default and switch to a GUI by typing startx This will start a GUI environment on top of the shell

Page 12: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

12

Linux has a wonderful GUI environment. But we will not spend much time on the GUI.

Because anyone can easily learn to use a GUI. CL is much harder. And to be a Linux system administrators you use command-line. The Linux certifications all focus on command-line.

Page 13: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

13

/

FSH = Directory Tree Structure

• FSH is just an inverted tree of containers & files

• parent directories & child directories (subdirectories)

• top the tree is always designated as a forward slash (/)

• this is called the root directory

Page 14: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

14

FSH uses pathnames to access items

•A pathname specifies the location of a file on disk.

•Every file and directory on a system has a pathname.

•The ‘/’ separates file and directory names in a pathname.

•What is the pathname of the file pointed to by the red arrows?

Page 15: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

15

Pathname Components

• Directory paths are important you navigate within the system using them.

• Slashes within the pathname are delimiters between object names

• Object names can be either sub-directories or files

Page 16: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

16

2 Types of Pathnames

Absolute Pathname Specifies the location of a file in relation to the entire file system. Starts with the root (‘/’) directory.

Use the pwd (“Print Working Directory”) command to get the absolute pathname to the current directory.

Relative Pathname Does not start with ‘/’. Specifies the location of a file in relation to the current directory. Can get to a file or directory in the current directory by simply

using its name.

Page 17: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

17

Changing Location in the FSH You use the cd (“Change Directory”) command to move to a different directory in the file system.

Accepts either absolute or relative pathnames.

Relative pathname symbols Are used for navigational shortcuts /timesavers.

. (dot) The current directory.

.. (dot dot) The parent directory.

~ Refers to your home directory

Page 18: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

Absolute verse Relative pathnames

Absolute pathname: always start from the top with a / cd /home/sheila/class-files/dir1

Relative pathname: never starts with “/” cd class-files/dir1cd ./class-files/dir1cd ~/class-files/dir1

Relative pathnames can also move up: using a “..” per layer

cd ../class-files/dir1cd ../../../ class-files/dir1

Page 19: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

19

Examples of Absolute Pathnames

Absolute pathname to the user2 directory = /home/user2

Absolute pathname to the dir1 directory = /home/user2/dir1

Absolute pathname to the coffees directory = /home/user2/dir1/coffees

Page 20: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

20

Examples of Relative Pathnames

If your current directory is /home:

Relative pathname to the user2 directory = user2

Relative pathname to the dir1 directory = user2/dir1

Relative pathname to the coffees directory = user2/dir1/coffees

Page 21: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

21

Basic Structure of Command Syntax

Before you can use Unix commands effectively, you need to understand their general syntax.

$ command [option(s)][argument(s)]

Shell Prompt

Executable Name

Command Modifiers

Command Targets

Page 22: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

Example of command syntax

<command> <options> <arguments>

First immediately after the prompt is the command

$ ls Commands are case sensitive and mostly in lowercase A command may or may not have options Options are used to modify the output.

$ ls - l A command may or may not have arguments Arguments are usually files or directories

$ ls - al /etc

Page 23: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

Example of Basic Shell Commands Linux Commands are case sensitive

DOS LINUX PURPOSE

cd cd change directory

dir ls list the directory contents

copy cp copy

move mv move

del rm delete/remove

deltree rm -r remove directory + contents

type cat display a file

copy con cat > create a file

md mkdir create a new directory

rm rmdir delete a directory

Page 24: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

24

Command Line Syntax

• refers to the structure of the command

• specifies allowable options and arguments

Page 25: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

25

Command Line Examples

Page 26: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

26

Command-Line Syntax Rules

Page 27: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

27

Viewing the contents of Directories

ls command:

ls on it’s own display’s a brief listing of the contents of the directory – listing the items names only

Most commonly used options: ls – l : detailed display or long listing of items.

ll command: Is the default Alias for ls -l ls – a : displays hidden files

Page 28: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

28

Viewing the contents of files

cat command:

cat dante displays dante in the cwd

cat ./dante displays dante in the cwd

cat ~/dante displays dante in your home directory

It can actually be used in many ways. Which we will see later.

Page 29: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

Some really basic commands Where am I in the FSH

$ pwd

Moving around the FSH

$ cd /etc

$ cd thesis/fig

$ cd ..

Displaying the contents of directories.

$ ls

$ ls -a

$ ls -l

$ ls -al

$ ls -ald

Page 30: RH030  Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

Do you have a Redhat Academy Account yet?

Because from now on - you will need one! Lets do todays’s exercises