workbook 1 quicktour and more basic’s rh030 linux computing essentials

23
Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Upload: susana-beale

Post on 01-Apr-2015

234 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Workbook 1 Quicktour

And more basic’s

RH030 Linux Computing Essentials

Page 2: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

2

Objectives Usage of some basic commands Become familiar with UNIX command line structure Become familiar with UNIX command line syntax Understanding how the UNIX commands works with options and arguments. Getting help with the man pages to learn about commands and their options. Become familiar with displaying the contents of directories and files. Running multiple commands on a single command -line Use of the Redirection Symbols.

Workbook 1 covers 1. Logging In 2. The Kernel, Programs, and Processes 3. Examining the Filesystem 4. Running Commands 5. Managing Terminals 6. Getting Help

Page 3: Workbook 1 Quicktour And more basic’s 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 4: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

4

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 5: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

5

Switching Between User Accounts You can switch to another user’s account with the su

(“Switch User”) command. su [-] username

Once switched, you are subject to the same constraints as the user you are now logged in as.

The ‘-‘ puts you in the new user’s home directory and reads their profile or initialization files.

If no username is given, root is assumed. The ‘-‘ can still be used (su - ).

exit Type exit to log out as the new user. Puts you back into your own account.

Page 6: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

6

Changing Directories ~ Refers to your home directory . Refers to the current directory .. Refers to the parent directory - 1 level up pwd Displays your current location in the directory tree cd Change the current directory in the directory tree

tab This is called Tab-completion: It is used to automatically list items within the directory. You just put the first letter of the item you want. Then if you press the Tab key it fills in remaining characters of a

unique filename or directory name or lists your options. You can also use it to complete pathnames. This is a feature of the BASH shell.

Page 7: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

7

cd command Used to navigate thru the Directory Tree Structure Remember there are many ways to use this command.

cd - moves you directly to your home directory cd ~ - also moves you directly to your home directory cd .. - moves you automatically up 1 directory level cd <directory> - moves you down into the directory named cd / - moves you directly to the top of the tree structure. cd .. - this moves you up 1 directory level cd ../.. - this moves you up 2 directory level cd ../../.. - this moves you up 3 directory level & so on …..

Page 8: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

8

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 9: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

9

Using the Multiple Virtual Console Interfaces You access the different interface screens by using the Crtl+Alt+F key

combinations to change to the separate terminal screens. Each screen acts as a completely separate environment. You can be logged into them with different user accounts.

Page 10: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

10

The Kernel controls all Virtual Consoles

Figure 3-27: Shells, terminals, and the kernel

Because each acts as a completely separate environment. Each is allocated it’s own shell from the kernel.

Page 11: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

11

Page 12: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

12

Page 13: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

13

ls Command

Gives a listing of the contents of a directory. Syntax:

ls [-option(s)] [pathname(s)] With no options you get a “brief /wide” listing. Sorted alphabetically by default.

Options most commonly used. ls –l ls –a ls –F ls –r ls –R

Page 14: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

14

Displaying Hidden Files

Any file whose name begins with a ‘.’ is a hidden file in Unix.

Not shown with ls by default. The links to ‘.’ and ‘..’ are hidden files.

To see hidden files in Unix, use ls –a to show “all” files. Use ls –A to show all files except ‘.’ and ‘..’.

Page 15: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

15

Displaying File Types Use ls –F to get a “wide” listing with

indicators as to the type of each file.

Page 16: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

16

Displaying a Detailed/ Long Listing ls –l

This gives a “detailed” listing of directory contents. Shows all information relevant to item. Sorted alphabetically by default. Can use ls –lt to sort by time.

Page 17: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

17

Listing Individual Directories and Subdirectories Use ls –ld to find out information about a

directory itself, not the contents of it.

You can use the “recursive” option with ls, ls –R to list a directory and all of its subdirectories. Can produce a lot of output. -r and –R are used with many Unix commands.

Page 18: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

18

More Basic Commands

Table 3-3: Some Common Linux commands

Page 19: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

19

User Commands for what other users are on the system.

who gives detailed information on every user logged onto the

system.

finger gives the same info as who, but can give more detailed

information on individual users. It also gives this info whether the user is logged onto the system or not.

Page 20: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

20

Getting Help Linux contains 1000,s commands And many different text configuration files.

You can get help on all these – thru the “man pages”. Which is the default command-line help program for Linux. Available in all UNIX / Linux versions

At the command prompt, type “man” followed by the item which you want help on.

$ man <command name>

man whoami

man –k usb (need to run makewhatis once to use)

Page 21: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

21

Getting Help There are also other common types of help also available. whatis whereis info pages apropos --help help

PLUS ....... Excellent help on the Internet = HOWTO documents

Page 22: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

Command Summary login passwd $ # su exit pwd date cd ~ . .. cat ls ls –a ls -l * ? > [ ] metacharacters man man –k whatis info apropos --help crtl+alt+F? shutdown

clear reset finger who w whoami id

Page 23: Workbook 1 Quicktour And more basic’s RH030 Linux Computing Essentials

Linux+ Guide to Linux Certification, 2e

23

remote - telnet ssh putty bash csh ksh bourne ps aux ls cat > ~ . .. ps who --help -h -? which ls -s --size -w -r --width=40 control sequences ctrl+c … etc cal tab cat wc ttyn ttySn ptsn :0 ls -R fg man man -k -a info pinfo /usr/share/<filename> .filename = hidden