0% found this document useful (0 votes)
67 views50 pages

Session 1

Uploaded by

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

Session 1

Uploaded by

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

Fo

rA
pt
ec
h
C
en

© Aptech Limited
tre
U
se
O
nl
y
y
nl
• Identify the need for using open source software

O
• Identify how the Linux operating system was originated

se
• Identify the basic principles of Linux

U
• Identify Red Hat operating system distributions
• Describe the features of Red Hat Enterprise Linux 6.0

tre
• Explain how to log on to the Linux system

en
• Explain the root user and shadow passwords
• Explain the Desktop environment and Window’s Managers
• C
Explain the concept of users and groups
h
• Explain the use of some basic and advanced Linux
ec
pt
rA
Fo

© Aptech Limited Introduction to Linux 2


y
nl
• An operating system:

O
 Is a software program that acts as an interface between a user and a computer.

se
 Consists of instructions that are given to the hardware components of the computer

U
to perform specific tasks, such as creating or copying documents and viewing them.
• Examples of operating systems are:

tre
o Linux, Windows XP, Windows 7, Solaris, Mac and UNIX.

en
Derived from the UNIX operating system
C
h
Offers stability, high security, and reliability
ec

Linux Runs on a variety of computer hardware, such as mobile


pt

phones, tablets, and mainframes.


rA

Source code is freely available to everyone


Fo

Popular distributions are Debian, Fedora, Red Hat, SUSE, and


Ubuntu.
© Aptech Limited Introduction to Linux 3
y
nl
• Open source implies free software. The software allows users

O
to freely use the source code and customize it to meet

se
individual requirements.

U
tre
Open source allows users to perform the following tasks:

en

• C
Access the source code of the software
Run the software for commercial or personal use
h
ec

• Customize the source code to meet specific requirements


• Redistribute copies of the software
pt

• Release the customized software to the public in general


rA
Fo

© Aptech Limited Introduction to Linux 4


y
nl
• The proprietary software source code in closed source is not released

O
to end users and is only available in a compiled executable state.

se
• The end users have to purchase the software to use it for personal or

U
commercial purposes.

tre
• Copying or redistributing of the software can be restricted by the
license agreement between the vendor and the end user.

en
• Owned, developed, and distributed by a single vendor to end users
C
who purchase the software for a license fee.
h
• Services, such as upgrades, add-ons, and support are defined by the
ec

license agreement between the vendor and the end user.


pt
rA
Fo

© Aptech Limited Introduction to Linux 5


y
nl
O
Open Solaris • By Sun Microsystems

se
• Linux operating system by Red Hat
Fedora Linux
• Release cycle of six months

U
Red Hat Enterprise • By Red Hat
Linux (RHEL) • End users have to pay subscription fee for support

tre
• By Novell
Open SuSE
• Contains StarOffice and Word Perfect

en
• Open to both individual and enterprise users
Mandrake Linux

• C
Contains complete Microsoft office
Sponsored by Debian community
h
Debian Linux
• Available free of cost
ec

• By Apache Software Foundation


Apache Web Server
pt

• Runs on various platforms


• By Sendmail consortium
rA

Sendmail
• General purpose Internetwork e-mail routing application
• By Sun Microsystems
Fo

MySQL
• Database application

© Aptech Limited Introduction to Linux 6


y
nl
• An open source license is a copyright license that allows the

O
source code of the software to be available for everyone to use

se
and modify.

U
General Public License (GPL)

tre
• Allows users to package and distribute the original or modified source code of
the software only with other GPL licensed software.

en
Lesser General Public License (LGPL)

C
• Allows users to package and redistribute the original or modified source code of
the software only with other LGPL Licensed software.
h
• Also allows the use of proprietary software with LGPL Licensed open source
ec

software.
pt

Berkeley Software Distribution (BSD)


rA

• Allows distribution of original source code after modification even if it uses some
other software not covered under the BSD license.
Fo

• Also allows the use of proprietary software with BSD covered software.

© Aptech Limited Introduction to Linux 7


y
nl
• Derived from UNIX.

O
• Was developed on Minimal UNIX (MINIX),

se
a version of UNIX, using GNU Not UNIX’s

U
(GNU) compiler.

tre
• The name Linux was coined by Linus

en
Torvalds in 1991.
• The Linux source code was made available
C
to everyone on the Internet for study and
h
ec

modification.
• Official mascot for Linux is the Linus
pt
rA

Penguin, Tux.
Fo

© Aptech Limited Introduction to Linux 8


y
nl
• Stable operating system

O
• Does not need to be restarted
periodically

se
• Provides adequate protection

U
against freezing up or slowing
Stability down

tre
• Modular by design
• Multi-user operating system

en
• Large developer base as it is

C
open source and hence bugs are
fixed relatively faster • File system security
h
• Firewall security
ec

• Run levels security


• Services
pt

Security
• Security Enhanced Linux
rA

(SELinux)
• Discretionary Access Control
Fo

(DAC)

© Aptech Limited Introduction to Linux 9


y
nl
Advantages of Linux operating system are:

O
Reliability

se
Backward compatibility

U
tre
Simple installation and upgrade process

en
Low cost of ownership

Support for legacy devices


C
h
Graphic User Interface (GUI)
ec

Excellent security features


pt
rA

Support for development libraries


Fo

Support for high user loads

© Aptech Limited Introduction to Linux 10


y
nl
Multiprogramming

O
Multitasking

se
Virtual memory

U
Shared libraries

tre
POSIX compliance

en
Samba
Network Information Service (NIS)
C
h
Office suites
ec

Data archiving utilities


pt

Apache Web Server


rA

Licensing
Fo

Includes text editors, browsers, and scientific applications

© Aptech Limited Introduction to Linux 11


y
nl
Red Hat provides different variants for different types of users.

O
Users are divided into:

se
U
• Red Hat provides the Red Hat Enterprise Linux
product suite for business users.

tre
• Users are required to pay a product fee for the
Business users software.

en
• Changes in the operating system happen in a slow
pace so that there are no frequent updates.

C
h
ec

• Use Linux for experimental purposes.


pt

• Users do not pay the license fee. They download it


Other users from the Internet and use it free of charge.
rA

• Fedora is an example of a freely downloadable


operating system.
Fo

© Aptech Limited Introduction to Linux 12


y
nl
The various Linux variants provided by Red Hat are:

O
• Red Hat Enterprise Linux Suite

se
 Runs on multiple hardware architecture such as IBM PowerPC, AMD64, Intel
EM64T, and Intel x86/x64

U
 Operating systems of Red Hat Enterprise Linus suite are:

tre
o Red Hat Enterprise Linux AS

en
o Red Hat Enterprise Linux ES

C
o Red Hat Enterprise Linux WS
h
• Red Hat Desktop
ec

 Used for small and medium business groups, supporting a single CPU
pt

 Compatibles with Red Hat Enterprise Linux AS, Red Hat Enterprise Linux ES, and
rA

Red Hat Enterprise Linux WS


 Suitable for document processing, Web browsing, software development, and
Fo

instant messaging

© Aptech Limited Introduction to Linux 13


y
nl
• Fedora Core

O
 General-purpose operating system similar to Windows NT and Macintosh

se
 Red Hat sponsored project

U
 Can be freely downloaded from Websites

tre
• Red Hat Enterprise Linux versions released so far are:

en
• Red Hat Enterprise Linux 2.1 (Panama)

• C
Red Hat Enterprise Linux 3 (Taroon)
h
ec
• Red Hat Enterprise Linux 4 (Nahant)


pt

Red Hat Enterprise Linux 5 (Tikanga)


rA

• Red Hat Enterprise Linux 6 (Santiago)


Fo

© Aptech Limited Introduction to Linux 14


y
nl
• The X Window System:

O
 Provides GUI for Linux.

se
 Is portable and is a network transparent client/server interface between the
hardware and desktop environment.

U
• Windows Manager customizes the desktop according to the user

tre
requirement and the Desktop Environment is a user interface that

en
runs on the Windows Manager.
• Desktop Environment:
C
 Used to create a common graphical user environment by combining
h
ec

various X clients.
 The two types of desktop environments provided by Red Hat Enterprise
pt

Linux 5.0 are:


rA

o Gnome
o KDE
Fo

© Aptech Limited Introduction to Linux 15


y
nl
• Windows Manager:

O
 Used to control the working of the desktop

se
 Helps in controlling moving, hiding, resizing, iconizing, and closing windows
• The different types of Windows Managers are:

U
 kwin:

tre
o Default Window Manager for KDE that supports custom themes

en
 metacity:
o Default Window Manager for Gnome that supports custom themes

 mwm:
C
o Requires installation of the metacity package
h
ec
o Motif Window Manager is a stand-alone Window Manager
o Requires installation of the open motif package
pt

 twm:
rA

o Tab Window Manager can be used as a stand-alone Window Manager as well as with
the desktop environment
Fo

o Available with X11R7.1 release

© Aptech Limited Introduction to Linux 16


y
nl
• The user has to be authenticated to • Login session can be ended by

O
use a Linux system. The typing the logout command at the

se
authentication is done through a shell prompt.
login process. • This logs the user out of the system

U
• Log in to the system console is and a new login prompt appears on

tre
through one of the following ways: the terminal.
 Text based login

en
 GUI based login
• Example:
student@localhost~]$ logout
• For a text based system, a
C
command prompt ending with a $
localhost login:
h
sign is displayed.
ec

• Example:
pt

localhost login: student


rA

Password:
Last login: Mon Sep 15 14:
Fo

30: 46

© Aptech Limited Introduction to Linux 17


y
nl
O
The accounts that exist on the system are termed as users.

se
The concept of Groups in Linux allow groups of users in an organization to share, read, write,
and execute common files amongst them.

U
tre
Every user and group logging into the system is uniquely identified using unique numerical
identification numbers called userid and groupid.

en
The user who creates the file is called the owner and group owner of the file. Each file is

C
assigned different read, write, and execute permissions for individual users and groups.
h
The access permissions for the file are assigned by the root user or the file owner.
ec
pt

Root user:
rA

Is a special administrative account which has unrestrictive access to all files, devices, and
programs in the system.
Fo

Is also known as the super user and guards the system against accidental damages.

© Aptech Limited Introduction to Linux 18


y
nl
• When a user logs into the system, Linux automatically places the user

O
in a directory called the home directory.

se
Pathname: /usr/<username> or /home/<username>.

U
• The home directory is decided by the system administrator at the time

tre
of creating a user account, and the details are stored in the file
/etc/passwd.

en
• When a new user is added to the system, a private user group, having
C
the same name as the user name, is create with the same name as the
h
user’s name.
ec

• A graphical program, called user manager, is included in the Red Hat


pt

Enterprise Linux for managing users and groups.


rA
Fo

© Aptech Limited Introduction to Linux 19


y
nl
• User Manager is started by selecting • Click the Add User button in the ‘User

O
the users and Groups option from the Manager’ window to add a new user.
administration menu. This invokes the

se
user manager window.

U
• All the existing users are listed in the

tre
users tab of this window as shown.

en
C
h
ec
pt
rA
Fo

List of Existing Users Adding a User


© Aptech Limited Introduction to Linux 20
y
nl
• Every user is assigned to a default private group • Click the Add Group button in the ‘User

O
with the same name as the user. The user can Manager’ window to add a new group. This
also become a member of other groups. invokes the create new Group window as

se
• The graphical program to manage the groups shown.
can be invoked by selecting the Users and

U
Groups option from the administration menu.
The user manager window, with the existing

tre
groups being listed in the Groups tab, is
displayed as shown.

en
C
h
ec

Adding a Group
pt
rA
Fo

List of Existing Groups


© Aptech Limited Introduction to Linux 21
y
nl
• Linux is a command line operating system.

O
• The commands in Linux are case-sensitive and usually in lower case.

se
• The general syntax for a command is:

U
command [options]

tre
• date command: Used to display current system date and time.
Syntax:

en
student localhost ~]$ date [options]
C
• The following code snippet shows the use of date command with
h
different options:
ec

[student@localhost ~]$ date “+%T”


pt

21:36:42
rA

[student@localhost ~]$ date “+%y”


08
Fo

© Aptech Limited Introduction to Linux 22


y
nl
• The date command can be used only by the system administrator to change

O
the system date and time.

se
• The common options that can be used with the date command are:

U
Option Function

tre
%m Displays month of the year (in digits)
%d Displays day of the month (in digits)

en
%y Displays year (last two digits)
%D C
Displays date as mm/dd/yy
h
ec
%H Displays hour (00 to 23)
%M Displays minutes (00 to 59)
pt

%S Displays seconds (00 to 59)


rA

%T Displays time as HH:MM:SS


Fo

Options of the date Command


© Aptech Limited Introduction to Linux 23
y
nl
• Used to display the names of all the users logged on to the system.

O
Syntax:

se
[student@localhost ~]$ who [options]

U
• The common options available with the who command are:

tre
Option Function
-b Indicated the most recent startup time and date

en
-l Lists any login process
-H C
Displays a header
h
ec
-q Prints only the login names and the number of users
logged in
pt
rA

Options of the who Command


Fo

© Aptech Limited Introduction to Linux 24


y
nl
• The following code snippet shows the use of the who command:

O
[student@localhost ~]$ who

se
student pts/0 2008-03-26 17:36(:0.0)

U
• The pts in the output denotes a remote terminal. A remote terminal is a

tre
terminal connected from a machine other than the server.

en
• The output of the who command is explained in the following table:

Column# C Description
h
1 Displays a login name
ec

2 Displays a terminal type and number


pt

3 Specifies date and time of logging in


rA

4 Specifies the remote host name of the terminal of the


Fo

users who have not logged in to the server


Output of the who Command
© Aptech Limited Introduction to Linux 25
y
nl
• Used to display pages from the Linux reference manual installed along with the

O
Linux operating system.

se
Syntax:
[student@localhost ~]$ man [-] [-k keywords] topic

U
• The arguments to the man command are as follows:

tre
Argument Function

en
- Displays content of the manual without pausing
-k keywords
C
Searches for the keywords specified within the available
h
manuals
ec

topic Displays the manual for the command typed in


pt

Arguments of the man Command


• The following code lists the help information to the ls command:
rA

[student@localhost ~]$ man ls


Fo

© Aptech Limited Introduction to Linux 26


y
nl
• Displays the names of files and sub-directories within a directory.

O
Syntax:

se
[student@localhost ~]$ ls [options]

U
• The common options available in the ls command are:

tre
Option Function
-a Lists all the files including hidden files

en
-F Displays the file type along with the name
-R
C
Displays the contents of specified directory and sub-directories
h
-r Displays files and sub-directories in the reverse order
ec

-S Lists all files sorted by file size


pt

-A Displays hidden files and files beginning with ‘.’


rA

-l Displays a detailed list of files and directories


Fo

Options of the ls Command

© Aptech Limited Introduction to Linux 27


y
nl
O
This means that the contents of the file can be read using the cat
command.

se
read permission (r)
For directories it means that the content of the directory can be listed with

U
the ls command.

tre
This means that the file can be modified and saved.

en
write permission (w)
For directories, it means that files can be created in that directory by the
user.

C
This means that files can be executed by the shell when its name is typed at
h
the command prompt.
ec

execute permission (x) For directories, the user has the ability to traverse its tree in order to access
pt

files or subdirectories.
The files cannot be seen until the permission is set.
rA
Fo

© Aptech Limited Introduction to Linux 28


y
nl
• The following code snippet displays a detailed list of files and directories using

O
the –l option with the ls command.

se
[student@localhost ~]$ ls -l
total 2

U
-rw-rw-r-- 1 student student 134 Jun 21 00.18 Desktop
drwxr-xr-x 1 student student 10 Jun 21 13.18 X

tre
• The various column outputs of the ls –l command are:

en
Option Function
1
2 C
Specifies file type and File Access Permissions (FAP)
Specifies symbolic links, that is a file that points to another file
h
ec

3 Specifies the name of the file owner


pt

4 Specifies the name of the group owner


rA

5 Specifies the file size in bytes


6, 7, 8 Specifies the last file modification date and time
Fo

9 Specifies the file name


Options of the ls -l Command
© Aptech Limited Introduction to Linux 29
y
nl
• The dir command works like the default ls command, as it

O
lists the files in a sorted manner. The following code snippet

se
shows the use of the dir command.

U
tre
[student@localhost ~]$ dir

en
News axhome nsmail search
author.msg documents reading vultures.msg
auto mail research
C
h
ec
pt
rA
Fo

© Aptech Limited Introduction to Linux 30


y
nl
• The vdir command works like the ls -l option and

O
presents a long listing by default. The following code snippet

se
demonstrates the use of the vdir command.

U
[[student@localhost ~]$ vdir

tre
total 10
drwxr-xr-x 2 bball bball 1024 Nov 12 08:20 News

en
-rw-rw-r-- 1 bball bball 4766 Nov 12 07:41 author.msg
drwxrwxr-x 2 bball bball 1024 Nov 5 10:04 auto
C
drwxrwxr-x 3 bball bball 1024 Nov 12 13:54 axhome d
h
rwxrwxr-x 2 bball bball 1024 Nov 12 15:13 documents
ec
drwx------ 2 bball bball 1024 Nov 12 14:02 mail
drwx------ 2 bball bball 1024 Sep 15 01:57 nsmail
pt

drwxrwxr-x 2 bball bball 1024 Oct 29 20:28 reading d


rwxrwxr-x 5 bball bball 1024 Nov 5 10:03 research
rA

-rwxrwxr-x 1 bball bball 200 Oct 24 13:24 search


Fo

© Aptech Limited Introduction to Linux 31


y
nl
• Used to list the contents of the directory in a tree like format.

O
Syntax:

se
[student@localhost ~]$ tree [options]

U
• The common options available with the tree command are:

tre
Option Function

en
-a Displays all files, except the hidden files
-d Lists the directories only
-f C
Displays the full path prefix for each file
h
-p Displays the file permissions for each file
ec

-s Displays the size of each file along with the name


pt

-r Sorts the output in reverse alphabetical order


rA

-L level Specifies the maximum display depth of the directory tree


Fo

Options of the tree Command

© Aptech Limited Introduction to Linux 32


y
nl
• The following code shows the use of the tree command:

O
se
[student@localhost ~]$ tree
.

U
|-- projects
| |-- current

tre
| `-- old
| |-- 1

en
| `-- 2
`-- trip
`-- schedule.txt
C
4 directories, 3 files [
h
student@localhost ~]$
ec
pt
rA
Fo

© Aptech Limited Introduction to Linux 33


y
nl
• The touch command is used to:

O
 Create a file

se
 Update the file’s modification date

U
Syntax:
[student@localhost ~]$ touch [Options] { File(s)}

tre
• The common options available with the touch command are:

en
Option Function
-a
C
Changes the access time of the file specified. Does not change the
modification time unless –m is also specified.
h
ec

-c Does not create a new file if the file already exists.


-f Attempts to force the execution of touch even if there are read and write
pt

restrictions on a file.
rA

-m Changes only the modification time.


Fo

-r file Uses the access and modification times of the file.


Options of the touch Command
© Aptech Limited Introduction to Linux 34
y
nl
• Used to display the contents of a file on the screen or store it in another file.

O
• Also used to create, combine, overwrite, or append files.

se
Syntax:

U
[student@localhost ~]$ cat filename [options]
• The common options available with the cat command are:

tre
en
Option Function
-n Precedes each line with a line number
-u C
Does not buffer the output
h
-e Displays a character $ at the end of each line
ec

-b Omits line numbers from blank lines


pt

-r file Displays tabs in the output


rA

Options of the cat Command


Fo

© Aptech Limited Introduction to Linux 35


y
nl
• Used to display the contents of a large file in a single screen.

O
Syntax:

se
[student@localhost ~]$ more [options]

U
• The common options available with the more command are:

tre
Option Function

en
-c Clears and redraws the screen before displaying
-d
C
Displays error message if an unknown command is used
h
-i Performs case insensitive pattern matching in searches
ec

+num Specifies the starting line number


pt

-u Ignores backspace and underscores


rA

Options of the more Command


Fo

© Aptech Limited Introduction to Linux 36


y
nl
• The exit command is used to terminate the Linux session.

O
• The shutdown command is used to shutdown the Linux operating system.

se
Syntax:

U
[student@localhost ~]$ shutdown [options]
• The common options available with the shutdown command are:

tre
en
Option Function
-h C
Halts after shutdown
h
ec
-r Reboot after shutdown
-c Cancels a pending shutdown
pt

Options of the shutdown Command


rA
Fo

© Aptech Limited Introduction to Linux 37


y
nl
• The df command stands for Disk Free.

O
• Used to display the amount of space used and the amount of free disk space

se
available on the currently mounted file systems.

U
Syntax:
[student@localhost ~]$ df [option] [File_name]

tre
• The common options available with the df command are:

en
Option Function
-h C
Displays the size in megabytes and gigabytes and appends the
h
data with M and G respectively
ec

-k Displays the data in 1KB blocks


pt

-i Displays the inode usage


rA

-T Adds type of each file system to the report


-help Displays a brief help message
Fo

Options of the df Command


© Aptech Limited Introduction to Linux 38
y
nl
• The following code snippet displays the sizes in an easy to read

O
format.

se
U
[student@localhost ~]$ df -h
Filesystem Size Used Avail Use% Mounted on

tre
/dev/hda2 28G 7.6G 19G 29% /
tmpfs 252M 0 252M 0% /dev/shm

en
/dev/hda1 464M 37M 403M 9% /boot
/dev/hda3 8.3G 429M 7.5G 6% /var
nfs6: /home 520G
C
461G 60G 89% /home
h
ec
pt
rA
Fo

© Aptech Limited Introduction to Linux 39


y
nl
• The ps or Process Status command displays the processes that are currently

O
running on the Linux system.

se
Syntax:
[student@localhost ~]$ ps [option]

U
• The common options available for the ps command are:

tre
Options Function

en
-f Generates a full listing of all the processes
-A C
Displays information of all processes
h
-a Displays information about all frequently
ec

requested processes
pt

-e Displays information about every process that is


rA

currently running
Options of the ps Command
Fo

© Aptech Limited Introduction to Linux 40


y
nl
• The following code snippet lists the currently running processes.

O
se
[student@localhost ~]$ ps
PID TTY TIME CMD

U
3511 pts/1 00:00:00
bash 3514 pts/1 00:00:00 ps

tre
en
• The ps command displays the process ID, the terminal associated with the

C
process, the CPU time, and the executable shell name.
h
ec
pt
rA
Fo

© Aptech Limited Introduction to Linux 41


y
nl
• The kill command is used along with the ps command. It stops the

O
execution of one process.

se
Syntax:
[student@localhost ~]$ kill [options] [pids]

U
• The common options available for the kill command are:

tre
en
Option Function
-a Kills all the processes having the name specified
-l C
Lists all signals
h
-p Prints the process ID of the named processes
ec

without sending the signal


pt

-s Specifies the signal number or name of the signal


rA

Options of the kill Command


Fo

© Aptech Limited Introduction to Linux 42


y
nl
• Used to display the system information.

O
Syntax:

se
student@localhost ~]$ uname [options]

U
• The common options available for the uname command are:

tre
Option Function

en
-a Prints all the basic information currently available from the system
-r
-s C
Prints the operating system release level
Prints the operating system name
h
ec

-m Prints the machine hardware type


pt

-p Prints the machine’s processor type


rA

-v Prints the operating system version


Options of the uname Command
Fo

© Aptech Limited Introduction to Linux 43


y
nl
• The following code snippet prints the basic information of the

O
system along with the OS release level and the OS version.

se
U
[student@localhost ~]$ uname -arv
Linux localhost.localhostdomain 2.6.18-8.el5 #1 SMP Fri Jan 26

tre
14:14:15 EST 2007
i686 i686 i286 GNU/Linux

en
[student@localhost ~]$

C
h
ec
pt
rA
Fo

© Aptech Limited Introduction to Linux 44


y
nl
• Linux treats even the terminals as files. tty (teletype) command

O
is used to display the names of these terminals.

se
Syntax:

U
[student@localhost ~]$ tty

tre
/dev/pts/0

en
• The terminal filename is tty01 and is resident in the /dev
directory. C
h
ec
pt
rA
Fo

© Aptech Limited Introduction to Linux 45


y
nl
• This command sends the job to the print queue.

O
Syntax:

se
[student@localhost ~]$ lpr [options] filename

U
• The common options available with the lpr command are:

tre
Option Function

en
-P destination Name of the printer on which to print
-# number Prints the specified number of copies
-T title C
Prints a title on the banner page of the output
h
ec
-q Holds a job for printing
Options of the lpr Command
pt

• The following code snippet prints 5 copies of the file report.txt on a printer
rA

named accounting.
Fo

[student@localhost ~]$ lpr -P accounting -#5 report.txt

© Aptech Limited Introduction to Linux 46


y
nl
• Used to check the print spool queue for the status of print jobs. It displays

O
user name, position in the queue, filenames, job number, and total file
size (in bytes) for each job.

se
Syntax:

U
[student@localhost ~]$ lpq [option] printer

tre
• The common options available with the lpq command are:

en
Option Function
-P destination Displays information about the printer or class of printers
-a C
Reports jobs on all printers
h
ec
-U username Specifies an alternate username for the user
-E Uses encryption to connect to a print server
pt

Options of the lpq Command


rA

• The following code snippet displays information about the printer lp0.
Fo

[student@localhost ~]$ lpq -P lp0

© Aptech Limited Introduction to Linux 47


y
nl
• Used to remove a job from a queue.

O
Syntax:

se
[student@localhost ~]$ lprm [options]

U
• The common options available with the lprm command are:

tre
Option Function
-P destination Displays information about the printer or class of printers

en
-h server [:port] Specifies an alternate server
-U username C
Specifies an alternate username
h
Options of the lprm Command
ec

• The following code snippet removes request ID 385 from destination.


pt
rA

[student@localhost ~]$ lprm -P kill 385


Fo

© Aptech Limited Introduction to Linux 48


y
nl
• When a process starts in the background, a new bash sub shell is

O
created.

se
• The & is the shell’s operator used to run a process in the background.

U
• To start a process in the background, terminate the process with an &

tre
symbol as shown in the following code snippet.

en
[student@localhost ~]$ sort file1.txt file2.txt &
[1] 2975
C
h
• The shell immediately returns a number which is the PID of the invoked
ec

command.
pt

• The prompt is returned, and the shell is ready to accept another


rA

command, even though the previous command has not been


terminated.
Fo

© Aptech Limited Introduction to Linux 49


y
nl
• An operating system is a software program that acts as an interface between

O
a user and a computer.
• Linux was developed on Minimal UNIX (MINIX), a UNIX version, using GNU

se
Not UNIX’s (GNU’s) C compiler.

U
• The X Window System is a Graphical User Interface in Linux, which provides

tre
the foundation for Window Managers such as GNOME and KDE.
• When a new user is added to the system, a private user group is automatically

en
created with the same name as the user’s name.
C
• The root user is a special administrative account, that has unrestricted access
h
to all the files, devices, and programs in the system.
ec

• The basic Linux commands include: date, who, man, dir, vdir, tree,
cat, and more commands for reading directories and files command, exit
pt

command, and shutdown command.


rA

• The advanced Linux commands include: yydf, ps, kill, uname, tty,
Fo

printing commands such as lpr, lpq, lprm.

© Aptech Limited Introduction to Linux 50

You might also like