Sunteți pe pagina 1din 52

Redhat Enterprise Linux Index SA - 1

Chapters No.
Chapter : 1 : Accessing the Command line
1.
Chapter : 2 : Managing files from the command
line 5.
Chapter : 3 : Getting Help in Redhat Enterprise
Linux 7.
Chapter : 4 : Creating, Viewing and Editing Text
file 8.
Chapter : 5 : Managing Local Linux users and
groups 10.
Chapter : 6 : Controlling Access to files with Linux
file system Permissions 15.
Chapter : 7 : Monitoring and Managing Linux
Processes 18.
Chapter : 8 : Controlling Services and Daemons
21.
Chapter : 9 : Configuring and Securing OpenSSH
Service 22.
Chapter : 10 : Analyzing and Storing Logs
22.
Chapter : 11 : Managing Redhat enterprise Linux
Networking 23.
Chapter : 12 : Archiving and copying files between
Systems 25.
Chapter : 13 : Installing and Updating Software
Packages 29.
Redhat Enterprise Linux Index SA - 2

Chapters No.
Chapter : 2 : Using regular expressions with GREP
32.
Chapter : 3 : Creating and Editing Text Files with
vim : (SA-1's Forth Chapter) 33.
Chapter : 4 : Scheduling Future Linux Tasks
33.
Chapter : 5 : Managing Priority of Linux Processes
34.
Chapter : 6 : Controlling Access to Files with
Access Control Lists (ACLs) 35.
Chapter : 7 : Managing SELinux Security
36.
Chapter : 8 : LDAP : (Light weight Directory Access
Protocol) 37.
Chapter : 9 : Adding Disks, Partitions, and File
Systems to a Linux System 39.
Chapter : 10 : Managing Logical Volume
Management (LVM) Storage 44.
Chapter : 11 : Find Command
48.
Chapter : 12 : Autoldap Command
48.
Chapter : 13 : Controlling and Troubleshooting
the RedHat Enterprise Linux Boot Process 27.
1.

RHCSA FULL COURSE


REDHAT LINUX ENTERPRISE

Redhat Linux Enterprise SA-1


Commands Interface
Chapter:-1
Accessing the Command Line:
Main System Commands:
RHT Vmctl command in Linux : rht-vmctl is an command which is
customized to execute only on Red Hat Class room Lab only.

Command: 1 :- rht-vmctl__fullreset__server__-q

Use: For server reset.

Note : In our RHCSA & RHCE training we have used a command


rht-vmctl reset all , rht-vmctl reset server , rht-vmctl reset desktop to
reset Virtual Machines. => Make sure you have a fresh Installed VM.

Command: 2 :- rht-vmctl__start__server

Use: Only for start server.

Command: 3 :- rht-vmctl__view__server

Use: For view server.

Main Commands in Chapter : 1


2.

Date Command : The date command displays the current date and
time. It can also be used to display or calculate a date in a format you
specify. The super-user (root) can use it to set the system clock.

Command: 1: date

Use: Show the time , date & day.

Command: 2: date__+%x (small - x)

Use: Show only for date.

Command: 3: date__+%X (capital - X)

Use: Show the time with second time format: AM:PM

Command: 4: date__+%R

Use: Show only for time.

Command: 5: date__-s__arguments

Use: Change the time&date.

Fifth command syntax:

1) Time argument : date__-s__hour:minute:second

2) Date argument : date__-s__month/day/year

Cat Command : cat is a standard Unix utility that reads files


sequentially, writing them to standard output. The name is derived
from its function to concatenate files.

Command: 6: cat

Use: Make a File, Editing in File, Show in File content, Replace the File
content

Sixth command syntax and its uses


3.

1) cat >> file name (Make a file & add content)

2) cat > file name (Replace the file content)

3) cat__file name (Show the file)

Head Command : head is a program on Unix and Unix-like operating


systems used to display the beginning of a text file or piped data.

Command: 7: head

Use: Show the header file content.

Seventh command's syntax : head__-no. of line__file name

Tail Command : The tail command is a command-line utility for


outputting the last part of files given to it via standard input. It writes
results to standard output. By default tail returns the last ten lines of
each file that it is given. It may also be used to follow a file in real-time
and watch as new lines are written to it.

Command: 8: tail

Use: Show the tails line.

Eighth command's syntax : tail__-no. of line__file name

WC Command : wc is a command in Unix and Unix-like operating


systems. The program reads either standard input or a list of files and
generates one or more of the following statistics: newline count, word
count, and byte count. If a list of files is provided, both individual file
and total statistics follow.

Command: 9: wc (word counter)

Use: Show the file's word, line & character.

Ninth Command's syntax :

1) wc__file name : show the word, line, character.


4.

2) wc__-w__file name : only show the word.

3) wc__-l__file name : only show the line.

4) wc__-c__file name : only show the characters.

Passwd Command : passwd is a tool on most Unix and Unix-like


operating systems used to change a user's password. The password
entered by the user is run through a key derivation function to create
a hashed version of the new password, which is saved.

Command: 10: passwd

Use: Change the password

Tenth command syntax : passwd__user name

History Command : In Linux, there is a very useful command to


show you all of the last commands that have been recently used. The
command is simply called history, but can also be accessed by looking
at your .bash_history in your home folder. By default, the history
command will show you the last five hundred commands you have
entered.

Command: 11: history

Use: Show the last execute all commands.

Eleventh command's syntax :

history (Show the last execute all commands)

!30 : Show the last execute command's output (any no.)

history__-c : clear the history.


5.

Chapter:-2
Managing files from the command line:
Main Commands in Chapter : 2
PWD Command : pwd command in Linux with Examples. pwd
stands for Print Working Directory. It prints the path of the working
directory, starting from the root. pwd is shell built-in command(pwd)
or an actual binary(/bin/pwd).

Command: 1: pwd

Use: Show the Directory's path.

pwd: ( Present Working Directory)

Command: 2: touch

Use: Make a Blank file.

Command two syntax : touch__file name

Short Note : touch__{ red,green,black,1,2,3}.mp3 ( any extension )

Command: 3: mkdir

Use: Make a Directory.

Command three syntax : mkdir__directory name

Command: 4: mkdir__-p__directory name / direc.../...

Use: Make Directory in Directory.

Command four syntax : mkdir__-p__hmt/red/.../...

Command: 5: cp

Use: For copy the file.


6.

Command five syntax : cp__source__file name destination__file name

Command: 6: cp__-r

Use: For Copy the Directory.

Command six syntax : cp__-r source__directory name


destination__directory name

Short Note : rm__-rf ( For delete the directory )

Command: 7: mv

Use: For File or Directory move & rename.

For Move : mv__source__file or directory name destination__file or


directory name

For Rename : mv__old file name__new file name

LS Command : Listing Files with ls command without any arguments.


The ls command without any options lists files and directories in a
plain format without displaying much information like file types,
permissions, modified date and time to mention just but a few.

Command: 8: ls

Use: For Show the list.

Command: 9: ls__-l

Use: For Show the list in long formate.

Command: 10: ls__-a

Use: For Show the hidden files.

Command: 11: ls__-R

Use: Show the files or directory list in directory.


7.

Command: 12: rm

Use: For remove the files..

Command twelve syntax : rm__file name

Command: 13: rm__-r

Use: For remove the directories.

Command thirteen syntax : rm__-r__file name

Chapter:-3
Getting Help in Redhat Enterprise Linux
Main Commands in Chapter : 3
MAN Command : The man Command. The man command is used to
format and display the man pages. The man pages are a user manual
that is by default built into most Linux distributions (i.e., versions) and
most other Unix-like operating systems during installation.

Command: 1: man

Use: For Show the Command's information.

Command one syntax : man__cat ( any command name )

Pinfo Command : Linux pinfo command usage with examples. Pinfo


is an info file viewer or a program for viewing info files. Info
documentation is structured as hyperlinked info nodes. This format is
more flexible than man pages, allowing thorough discussion of
complex commands and concepts.

Command: 2: pinfo

Use: For Show the Command's information ( in details ).


8.

Command two syntax : pinfo__mv ( any command name )

Gedit Command : gedit is a powerful general purpose text editor in


Linux. It is the default text editor of the GNOME desktop environment.
One of the neatest features of this program is that it supports tabs, so
you can edit multiple files.

Command: 3: gedit

Use: For edit the text file.

Command three syntax : gedit__file name

Chapter:-4
Creating, Viewing, and Editing Text Files
Main Command : vim__File name
Vim Command : Vim is a powerful text editor used in CLI (command
line interface). Linux uses a lot of configuration files, you'll often need
to edit them and vim is a great tool to do so. Vim has a particular
working method, there are two main modes: the command mode and
the other modes.

There are five variable types in vim command


Insert Mode : The default editor that comes with the UNIX
operating system is called vi (visual editor). The UNIX vi editor is a full
screen editor and has two modes of operation: Command mode
commands which cause action to be taken on the file, and. Insert
mode in which entered text is inserted into the file.

1) Insert mode ( Press the i - key )

i : - insert
9.

a : - append

o : - open a new line

Short Note : escape button : Exit of any mode.


2) Edit Mode

yy : - copy full line

dd : - cut full line

p : - paste full line

Visual Mode : Visual Mode. Typing v causes Vim. to enter "visual"


mode. You can then highlight a block a text and then execute a Vim
editing command such as d, y, or > on it. For example, let's highlight a
block of text starting with v and then moving the cursor. The v
command selects text by character.

3) Visual Mode ( Press the v - key )

y : - copy selected word

d : - cut selected line

p : - paste selected line

4) Replace word

: % s / old word / new word / g

( : Colon )

5) Save the Vim File

: wq ! / shift + zz

Note : In Edit Mode, Replace and save the vim file for press the
escape button and run the command.
10.

Chapter:-5
Managing Local Linux Users and Groups
Main Commands in User
Usermod : User-mode Linux enables multiple virtual Linux
kernel-based operating systems to run as an application within a
normal Linux system.

1) Create a User

Syntax : useradd__username

Example : useradd __redhat

2) Change Username

Syntax : usermod__-l__new user name__old user name

Example : usermod__-l__hmt__red

Userid : A user ID (UID) is a unique positive integer assigned by a


Unix-like operating system to each user. Each user is identified to the
system by its UID, and user names are generally used only as an
interface for humans.

3) Change Userid

Syntax : usermod__-u__new user id__user name

Example : usermod__-u__1023__hmt

4) Delete User

Syntax : userdel__username

Example : userdel__hmt

Main Commands in Group


11.

Groupmod : Linux groups are a mechanism to manage a collection of


computer system users. All Linux users have a user ID and a group ID
and a unique numerical identification number called a userid (UID) and
a groupid (GID) respectively. It is the foundation of Linux security and
access.

1) Create a Group

Syntax : groupadd__groupname

Example : groupadd__redhat

2) Change Groupname

Syntax : groupmod__-n__new group name__old group name

Example : groupmod__-n__hmt__red

Groupid : Linux groups are a mechanism to manage a collection of


computer system users. All Linux users have a user ID and a group
ID and a unique numerical identification number called a userid (UID)
and a groupid (GID) respectively.

3) Change Group id

Syntax : groupmod__-g__new group id__group name

Example : groupmod__-g__3453__red

4) Delete Group

Syntax : groupdel__group name

Example : groupdel__redhat

Main Commands in Usermod


User shell : The shell is the command interpretor in an operating
system such as Unix or GNU/Linux, it is a program that executes other
programs. It provides a computer user an interface to the Unix/GNU
12.

Linux system so that the user can run different commands or


utilities/tools with some input data.

1) Change User's Shell

Syntax : usermod__-s__/ sbin / nologin__user name

Example : usermod__-s__/ sbin / nologin__hmt

2) Add User's information

Syntax : chfn__user name or usermod__-c__"write


information"__user name

Example : chfn__hmt or usermod__-c__"This is my account"__red

3) Change User's home directory

Syntax : usermod__-d__new home directory__user name

Example : usermod__-d__Desktop /__hmt

4) Add Exiting User in Group

Syntax : usermod__-G__group name__user name

Example : usermod__-G__red__hmt

5) Different group in add same user

Syntax : usermod__-aG__group name__user name

Example : usermod__-aG__redhat__hmt

6) Remove user in Group

Syntax : gpasswd__-d__user name__group name

Example : gpasswd__-d__hmt__sysgrp

7) Delete user with home directory


13.

Syntax : userdel__-rf__user name

Example : userdel__-rf__redhat

Main Functions in Usermod


1) cat__/ etc / passwd

Use : Store the user's information.

Example : hmt (1) : x (2) : 1001 (3) : 1001 (4) :: (5) / home (6) / red: /
bin / bash (7)

(1) User name

(2) Set passwd

(3) User id

(4) Group id

(5) User's information

(6) User's home directory

(7) Shell

There are two types of Shell : 1) bin / bash 2) sbin / nologin etc /
shadow : In the Linux operating system, a shadow password file is a
system file in which encryption user password are stored so that they
aren't available to people who try to break into the system. Ordinarily,
user information, including passwords, is kept in a system file called
/etc/passwd .

2) cat__/ etc / shadow

Example : hmt (1) : !! (2) 1795 : (3) 0 : (4) 99999 : (5) 7 :::: (6)

1) User name

2) Show password
14.

3) Last password change date

4) Password minimum age

5) Password maximum age

6) Warning

Chage : As a Linux admin, you're probably accustomed to passwd,


chown, chmod, and chgrp...all commands for managing various
elements of user accounts, files, and folders. With the chage command
you can change the number of days between password changes, set a
manual expiration date, list account aging information, and more.

3) chage__user name

SU : The Unix command su, which stands for substitute user is used
by a computer user to execute commands with the privileges of
another user account. When executed it invokes a shell without
changing the current working directory or the user environment.

4) su__user name ( Switch User ) ( Example : student, root )

Use : Jump to one user to other user.

5) User path decided

Ans. super user ( root ) : / root / Desktop / , normal user : / home /


user name / Desktop

Note : usermod --help

Main Functions in Groupmod


1) cat__/ etc / group

Use : Store the Group's information.

Example : sysgrp : (1) x : (2) 1002 : (3) : (4)

1) Group name
15.

2) Set passwd

3) Group id

4) List of users add in group

Note : useradd usermod userdel

Note : groupadd groupmod groupdel

Note : Use tab - key in terminal for show the complete command.

Chapter:-6
Controlling Access to Files with Linux File System
Permissions
Chmod : In Unix and Unix-like operating systems, chmod is the
command and system call which is used to change the access
permissions of file system objects. It is also used to change special
mode flags. The request is filtered by the umask. The name is an
abbreviation of change mode.

1) Chmod :
Use : Change permission of files or directories.

Chown : The command chown, an abbreviation of change owner, is


used on Unix and Unix-like operating systems to change the owner of
file system files, directories. Unprivileged users who wish to change
the group membership of a file that they own may use chgrp.

2) Chown :
Use : Change ownership of files or directories. ( user & group )

Chgrp : The chgrp command may be used by unprivileged users on


Unix-like systems to change the group associated with a file system
object to one of which they are a member. A file system object has 3
16.

sets of access permissions, one set for the owner, one set for the
group and one set for others.

3) Chgrp :
Use : Change ownership of files or directories. ( only for group )

[1] :::---->> USER

[2] :::--->> GROUP

[3] :::--->> OTHER

1) Chmod
There are two methods in Chmod Symbolic Method & Numeric
Method : One is Symbolic method and Numeric method. Here you can
read about symbolic method examples. The chmod (change mode)
command will useful to change your file permissions. Here others
means Everybody (users) can able to view the files or ability to change
the file contents if you give permissions.

(1) Symbolic Method

(2) Numeric Method

1) Symbolic Method
WHO :

u : - user

g : - group

o : - other

a : - all

WHAT :

+ : - add permission
17.

- : - remove permission

= : - replace permission

WHICH :

r : - read

w : - write

x : - execute

2) Numeric Method
read : - 4 (1) user

write : - 2 (2) group

execute : - 1 (3) other

chmod ( who, what, which ) file__or__directory__name

2) Chown ( Main Commands )

Command : chown__user name file__or__directory__name : - only for


user.

Command : chown : group name file__or__directory__name : - only


for group.

Command : chown__user name : group name


file__or__directory__name : - for user and group.

3) Chgrp

Command : chgrp__group name__file__or__directory__name : - only


for group.
18.

Chapter:-7
Monitoring and Managing Linux Processes
PS : In most Unix-like operating systems, the ps program displays the
currently-running processes. A related Unix utility named top provides
a real-time view of the running processes. In Windows PowerShell, ps
is a predefined command alias for the Get-Process cmdlet, which
essentially serves the same purpose.

1) Command : ps

Use : Show the Running Process.

BG : The bg command is part of Linux/Unix shell job control. The


command may be available as both internal and external command. It
resumes execution of a suspended process as if they had been started
with &. Use bg command to restart a stopped background process.

2) Command : bg

Use : Show the Background Process.

Command : bg__cat file name ( and , press the control + z )

Kill : kill command in Linux (located in /bin/kill), is a built-in command


which is used to terminate processes manually. kill command sends a
signal to a process which terminates the process.

3) Command : kill

Use : Close the Process.

FG : Job control is nothing but the ability to stop/suspend the


execution of processes (command) and continue/resume their
execution as per your requirements. This is done using your operating
system and shell such as bash/ksh or POSIX shell.[donotprint] fg
command details. Description. Bring a background process.

4) Command : fg
19.

Use : Show the desktop Process.

Jobs : A job in Linux is a command or a task that is up and running but


hasn't yet finished. Linux is a multitasking operating system and hence
allows for multiple commands to be executed simultaneously. Each
job can be identified by a unique id called the job number. The main
commands you use for job control in Linux are.

5) Command : jobs

Use : Show the stop Process.

Ps__aux : In Linux the command: ps -aux. Means show all processes


for all users. You might be wondering what the x means? The x is a
specifier that means 'any of the users'.

6) Command : ps__aux

Use : Show the long list ( Running Process ) ( kill aux )

Chapter : 7 Command line interface


First of all enter the ps command : ps After Make a cat file : cat > > file
name ( hmt )

After Press the -- > Control + z and save the cat file

After Show the Running Process : ps

After Show the Background Process : bg

After kill the background process : kill ( cat id )

After show the background process and after show the Running
process.

chapter seven syntax :


20.

[ root@localhost Desktop ] # cat >> k1

^Z ( Press the Control + Z )

[ 1 ] + stopped cat >> k1

[ root@localhost Desktop ] # ps

PID TTY TIME CMD

12213 pts/ 0 00:00:00 bash

12468 pts/ 0 00:00:00 cat

12477 pts/ 0 00:00:00 ps

[ root@localhost Desktop ] # bg

[ 1 ] + cat >> k1 &

[ 1 ] + Stopped cat >> k1

[ root@localhost Desktop ] # kill 12468

[ root@localhost Desktop ] # bg

[ 1 ] + cat >> k1 &

[ 1 ] + Terminated cat >> k1

[ root@localhost Desktop ] # ps

PID TTY TIME CMD

12213 pts/ 0 00:00:00 bash

12498 pts/ 0 00:00:00 ps

Note : ps : - cat id and bash id ( bash id isn't stop in terminal )


21.

Chapter:-8
Controlling Services and Daemons
Managing Services and Daemons
Services : A Linux service is an application (or set of applications) that
runs in the background waiting to be used, or carrying out essential
tasks. I've already mentioned a couple of typical ones (Apache and
MySQL). You will generally be unaware of services until you need
them. This is the most common Linux init system.

Daemons : In multitasking computer operating systems, a daemon is


a computer program that runs as a background process, rather than
being under the direct control of an interactive user. Daemons such as
cron may also perform defined tasks at scheduled times.

Systemctl : Linux systemctl command. The systemctl command is a


new tool to control the systemd system and service. This is the
replacement of old SysV init system management. Most of modern
Linux operating systems are using this new tool.

Main Command : systemctl


Daemons : 1) start 2) stop 3) restart 4) enable 5) disable 6) status

Services : 1) httpd 2) chronyd 3) network 4) NetworkManager 5) crond

Note : Daemons and its Services will be process in other commands.


22.

Chapter:-9
Configuring and Securing OpenSSH Service
only for one command in chapter : 9
SSH : SSH Command in Linux. The ssh command provides a secure
encrypted connection between two hosts over an insecure network.
This connection can also be used for terminal access, file transfers, and
for tunneling other applications. Graphical X11 applications can also
be run securely over SSH from a remote location.

Command : ssh__root @ server no. / name ( root / student / other


user... )

Use : Login and access to other server.

Chapter:-10
Analyzing and Storing Logs
Set a NTP ( Network Time Protocol )
NTP : The Network Time Protocol (NTP) is a protocol used to
synchronize computer system clock automatically over a networks.
The most common method to sync system time over a network in
Linux desktops or servers is by executing the ntpdate command which
can set your system time from an NTP time server.

: - > Change the time and synchronization with main system time
Network Time Protocol.

Command : timedatectl : after synchronization

Command : vim__/ etc / chrony.conf

After #### four time hash in server vim and attach the server id for
example : server classroom.example.com iburst
23.

After

systemctl__restart__chronyd

systemctl__enable__chronyd

After

For Verification : chronyc__sources__-V

Note : Verification reached no. 17 / 17 up.

Chapter:-11
Managing Red Hat Enterprise Linux Networking
Network Setup with NMTUI ( Network Management
Text User Information )
NMTUI : nmlci is a wonderful command to configure the network
profiles on Redhat Enterprise Linux 7. nmcli also supports the
command completion function by pressing tab key but still you need
to use the quotes properly. nmtui is an alternative command for nmcli
which is based on Text User Interface.

IP : You can determine the IP address or addresses of your Linux


system by using the hostname , ifconfig , or ip commands. To display
the IP addresses using the hostname command, use the -I option. The
ifconfig command can also be used to display the IP addresses being
used by the system.

Gateway : A gateway is a node or a router that acts as an access


point to passes network data from local networks to remote networks.
There are many ways to find out your gateway in Linux. Here are some
of them from Terminal. You can find default gateway using ip, route
and netstat commands in Linux systems.

DNS : A Domain Name System (DNS) server, or name server, is used


to resolve an IP address to a hostname or vice versa. Berkeley Internet
24.

Name Domain (BIND) is the most commonly used DNS server on the
Internet, especially on Unix-like systems.

Command : nmtui

Add a Connection

Change in System Ethernet 0

Profile name______________________

IP________________________

Gateway____________________

DNS___________________

Apply and Ok.

After

hostnamectl set-hostname server no.example.com

Note : exam id : in chapter:-13 SA - 2


systemctl restart NetworkManager

systemctl enable NetworkManager


25.

Chapter:-12
Archiving and copying Files between Systems
TAR : The tar command used to rip a collection of files and directories
into highly compressed archive file commonly called tarball or tar, gzip
and bzip in Linux. The tar is most widely used command to create
compressed archive files and that can be moved easily from one disk
to another disk or machine to machine.

1) Tar Command :
c : - Create a tar file

x : - extract a tar file

t : - list of achieve file

f : - file name

v : - verbosity

There are three file format in tar command


GZIP : gzip is a file format and a software application used for file
compression and decompression. The program was created by
Jean-loup Gailly and Mark Adler as a free software replacement for
the compress program used in early Unix systems, and intended for
use by GNU.

1) gzip : file name . tar . tgz or file name . tar . gz : - z

BZIP : The bzip2 command is used for compressing and


decompressing files. Data compression, also referred to as just
compression, is the process of encoding data using fewer bits. Most
files can be compressed to a smaller file size than is possible with the
more traditional gzip and zip programs.

2) bzip : file name . tar . bz2 : - j


26.

XZ : xz is a new general-purpose, command line data compression


utility, similar to gzip and bzip2. It can be used to compress or
decompress a file according to the selected operation mode. It
supports various formats to compress or decompress files.

3) xz : file name . tar . xz : - J

Normal tar command : tar -cvf hmt . tar / etc ( / etc destination file
name )

1) gzip command : tar -cvzf red . tar . tgz / etc

2) bzip command : tar -cvjf hmt . tar . bz2 / etc

3) xz command : tar -cvJf red . tar . xz / etc

2) scp command :

SCP : Scp (Secure Copy) is a command line tool to copy or transfer files
across hosts. It uses the same kind of security mechanism like the ssh
program. Infact it uses an ssh connection in the background to
perform the file transfer.

Command : scp / root / Desktop / hmt root @ server no. : / root /


Desktop

Use : For file transfer in other server.

Normal Command : scp / root / Desktop / red student @ server no.


/ home / student / Desktop

3) SFTP Command

SFTP : Linux sftp command. On Unix-like operating systems, sftp is the


command-line interface for using the SFTP secure file transfer protocol.
It is an encrypted version of FTP. It transfers files securely over a
network connection.

Command : sftp root @ server no.


27.

sftp > _______ ( get file name ) ( get : > download file )

sftp > ________ ( put file name ) ( put : > upload file ) ( put -r directory
name : for directorie )

4) rsync Command ( synchronization )

RSYNC : Rsync (Remote Sync) is a most commonly used command for


copying and synchronizing files and directories remotely as well as
locally in Linux/Unix systems.

Command : rsync -av root @ server no. : / root / Desktop / redhat /


root / Desktop /

V : Verbosity Note : Verbose mode. Updated: 02/27/2019 by


Computer Hope. A verbose mode is an option available in many
computer operating systems, including Microsoft Windows, macOS,
and Linux. It provides additional details as to what the computer is
doing and what drivers and software it is loading during startup.

a : archive mode Note : This switch puts rsync into archive mode,
which preserves time stamps, performs a recursive copy, keeps all file
and directory permissions, preserves owner and group information,
and copies any symbolic links. Archive mode gets a lot of use when
you wish to make backups as opposed to just syncing files in a
directory.

Chapter:-13 ( SA : 2 )
Controlling and Troubleshooting the Red Hat
Enterprise Linux Boot Process
Note : This is SA - 2 Chapter, because Repo and Kernel Command isn't
complete to this chapter.

Main System Command

Note : This is only for RHCSA Examination ( Don't try normal user )
28.

First of all full reset the server and after run the Desktop's script

Run The Script : Command : sh run server number . sh

After Login to Server and press the Alt + control + Delete ( view
server )

After

press the e - key

After

In server : linux16 paragraph And cut the line vmconsole__to__tty0

After in Paragraph's end write the rd . break

Note : Adding rd.break to the end of the line with kernel parameters
in Grub stops the start up process before the regular root filesystem is
mounted (hence the necessity to chroot into sysroot). Emergency
mode, on the other hand, does mount

the regular root filesystem, but it only mounts it in a read-only mode.

After : Press the Control + x

After Run These commands :

Command : mount__-o__remount , rw__/ sysroot ( rw : read , write


permission )

Command : chroot__/ sysroot /

Command : passwd

( enter the new password )

Command : touch__/ . autorelabel ( Make a Blank File )

After : Enter the exit after exit


29.

After Process will be run , 1--100 %

After

Login to root : login_______

And Enter the new password________

After

Command : systemctl__set - default__graphical . target ( for


graphically )

After Reboot the system : Command : reboot

After Network Set - up. with NMTUI ( Chapter:-11 SA - 1 )

After Set a Exam id with nmtui for example : hostnamectl set -


hostname station 1 ( pc. no. ) . domain . exam . com

After enter the exam paper with exec bash : Command : exec bash

Chapter:13 ( SA - 1 )
Installing and Updating Software Packages
Set a REPO & KERNEL
Repo : A Linux repository is a storage location from which your system
retrieves and installs OS updates and applications. Each repository is a
collection of software hosted on a remote server and intended to be
used for installing and updating software packages on Linux systems.
Repositories contain thousands of programs.

Kernel : The Linux kernel is a free and open-source, monolithic,


Unix-like operating system kernel. The Linux family of operating
systems is based on this kernel and deployed on both traditional
computer systems.
30.

Repo & Kernel Install


Command : vim__/ etc / yum . repos . d /__hmt ( file name ) . repo

After You are enter in vim, after press the i - key and enter the insert
mode.

In Insert Mode Enter This Details

[ ] ( id name )

name = ____________ ( enter the file name )

baseurl = http : / / content . example . com / rhel 7 . 0 / x86___64 /


dvd ( dvd : For Repo )

gpgcheck = 0

enabled = 1

After Press the V - key and open the visual mode and copy this full
information ( id to enabled )

After Paste this information ( visual mode : chapter:-4 )

[ ] ( id name ) ( Different your id name )

name = ____________ ( enter the file name ) ( Different your file


name )

baseurl = http : / / content . example . com / rhel 7 . 0 / x86___64 /


errata ( errata : For Kernel )

gpgcheck = 0

enabled = 1

After Save the vim file ( save : shift + zz , Chapter:-4 )

After Run This Commands for Repo and Kernel Install


31.

Command : yum__clean__all

Command : yum__Repolist

Command : yum__install__kernel__-y

After Kernel's Process will be run and install and after Reboot the
system

SA : 1 Short Notes
1) > append ( single append )

2) >> dabble append

3) Control + D : File save and exit

4) Control + L : Clear the Terminal's Screen Commands

5) cd Desk.. / Docu.. , Use the tab - key

6) Control + Z : Stop the Command

7) Password break : Alt + Control + Delete

8) touch { 1..100 } . txt , any extansion

9) All files Delete command : rm -rf * ( / Desktop or / root )

10) For files and directories hidden command : mkdir . file name /
directorie name

11) tar -- help


32.

Redhat Linux Enterprise SA-2


Commands Interface
Chapter:-2
Using Regular Expressions with Global Resolution
Expression Print

Grep Command
Grep Definition : grep is a command-line utility that is used for
searching text from standard input or a file for specific expressions,
returning the lines where matches occur. A common use for grep is to
locate and print out certain lines from log files or program output.

1) grep__^ cat__/ usr / share / dict / words

Use : To see the words behind the ahead.

2) grep __cat $__/ usr / share / dict / words

Use : To see the words behind the back.

3) grep__- i cat__/ usr / share / dict / words

Use : Look for the words from the front in the capital & to see the
small words. ( This indicates the limitations )

Main Command : grep__stato__/ usr / share / dict / words > / root /


lines . txt

Use : In this Command, all the information in the stato word is to be


copied in a text file.
33.

Chapter:-3
Creating and Editing Text Files with vim : ( SA-1's Forth
Chapter )
Chapter:-4
Scheduling Future Linux Tasks

Future Tasks
Crontab Definition : The crontab (short for "cron table") is a list of
commands that are scheduled to run at regular time intervals on your
computer system. The crontab command opens the crontab for editing,
and lets you add, remove, or modify scheduled tasks.

Command : crontab__- eu__root

: -> Afterwards, the Insert - Mode will be open and the footer must
run Tasks.

Command : 21__09__*__*__*__mkdir /__ root /__ Desktop /__


test.txt

Command's Syntax : minute__hours__day of month__month__day of


week__mkdir / root / Desktop / test.txt

: Then after save the vim file by shift + zz or wq!

: After run this Command :

Command : systemctl__restart__crond

Command : systemctl__enable__crond

Other Commands :

Command : crontab__-ru__root
34.

Use : For remove the Command.

Command : crontab__-ln__root

Use : For show the Command's result.

Note : These Commands can use to be paste in any text file,


temporary text file or a text message. AT: 09 : 30, etc.. you want to
complete the entire time, in the text file formate, do any location.

Chapter:-5
Managing Priority of Linux Processes
Nice & Renice Defination : Linux nice and renice commands. While
the nice command lets you execute a program/process with modified
scheduling priority, the renice command allows you to change the
scheduling priority of an already running process. Renice alters the
scheduling priority of one or more running processes.

Nice : -20 --- >

Renice : Highest

Nice : 19 --- >

Renice : Lowest 2667

renice -n -15 2667

ps aux -17

Note : This Chapter is not to be asked in the RHCSA examination.


35.

Chapter:-6
Controlling Access to Files with Access Control Lists
(ACLs)
ACL : Access Control Lists
ACL Definition : Access Control Lists(ACL) in Linux. Access control list
(ACL) provides an additional, more flexible permission mechanism for
file systems. It is designed to assist with UNIX file permissions.

: ---- > The First thing to do this paste a directory in / var / tmp called
fstab.

Command : cp__/ etc / fstab__/ var / tmp

Command : chown__root : root__/ var / tmp / fstab

Command : setfacl__-m__u : susan : rw-__/ var / tmp / fstab

Command : setfacl__-m__u : sara : r--__/ var / tmp / fstab

Command : setfacl__-m__o : : r--__/ var / tmp / fstab

Command : getfacl__/ var / tmp / fstab

setfacl__-m__u, g, o : username, groupname, other : rwx ( read, write


permission )

Note : In this lesson, we have to give permission to read, write and


execute in user, group and other. You should have to add user, group
and other.
36.

Chapter:-7
Managing SELinux Security
Selinux Types
Selinux Defination : SELinux is a set of security policies/modules
which are going to apply on the machine to improve the overall
security of the machine. These are the Linux security modules(LSM)
which are loaded in to kernel to improve security on accessing
services/files which improve security.

There are three types of Selinux


1) enforcing :

Use : To increase Security.

2) permissive :

Use : Warning while doing directory access.

3) disable :

Use : There will be no securities.

Note : You will have to permissive it that will be enforcing in the


examination.

Main Command in Selinux :


Command : vim__/ etc / selinux / config

: Then the vim will be open.

: Then open the insert mode by pressing the I - key.

: Insert mode has permissive to be enforcing.

: Then save file by shift + zz.


37.

: After then Reboot the system.

: For verification Command : getenforce

Chapter:-8
LDAP : ( Light weight Directory Access Protocol )
38.

LDAP Definition : The Lightweight Directory Access Protocol is an


open, vendor-neutral, industry standard application protocol for
accessing and maintaining distributed directory information services
over an Internet Protocol network.

Note : If the LDAP are not complete without repo and kernel, So
please repo and kernel the complete first.

Note : LDAP can be displayed in two ways.

1) Graphical Base Interface

2) Command Base Interface

1) Graphical Base Interface ( gtk )


Main Command : yum__install__authconfig - gtk__sssd__krb5 -
workstation__-y

After then run this command : authconfig - gtk

After Then : Authencation Method : LDAP

After Then : LDAP search Base DN : dc = example , dc = com

After Then : LDAP Server : ldap : / / classroom . example . com

After Then : Right use TLS Encryption

After Then : Wright in Bracket : http : / / classroom . example . com /


pub / example -ca . crt ( Note : There will be a different link in the
exam. )

After Then : Click the OK button

After Then : LDAP Password < --- select

After Then : Click the Apply button

After Then Run This Commands


39.

Command : systemctl__restart__sshd

Command : systemctl__enable__sshd

: For Verification

Command : getent__passwd__ldapuser x ( Note : ( x - > PC No. ) )

Exatra Command For Get Information in Terminal :


Command : wget__http : / / classroom . example . com / pub /
example -ca . crt

Note : TUI Command Base Interface is not so much importance in the


examination.

Chapter:-9
Adding Disks, Partitions, and File Systems to a Linux
System
Simple Partition
Partition Defination : fdisk command in Linux with examples. fdisk
also known as format disk is a dialog-driven command in Linux used
for creating and manipulating disk partition table. It is used for the
view, create, delete, change, resize, copy and move partitions on a
hard drive using the dialog-driven interface.

Note : To be examined in the vda.

Two Partition :
1) sda - b : In main system to do Partition.

2) vda - b : In virtual machine to do Partition.

1) Sda Definition : The disk names in Linux are alphabetical.


/dev/sda is the first hard drive (the primary master), /dev/sdb is the
40.

second etc. The numbers refer to partitions, so /dev/sda1 is the first


partition of the first drive.

2) Vda Definition : The Linux XDPing tool is a command-line based


application which automates the process of checking for common
configuration issues with a Linux VDA environment. Pre-flight mode
which can be used to check for system compatibility and configuration
issues prior to installing the Linux VDA package.

Fdisk Command Definition : For computer file systems, fdisk is a


command-line utility that provides disk partitioning functions. It is
available in DOS, FlexOS, OS/2, and Microsoft Windows operating
systems, and in certain ports of FreeBSD, NetBSD, OpenBSD, DragonFly
BSD and macOS for compatibility reasons.

/ dev Command Definition : /dev is the location of special or


device files. It is a very interesting directory that highlights one
important aspect of the Linux filesystem - everything is a file or a
directory. This file represents your speaker device.

Main Commands in Simple Partition

NOTES

There are two partition in VDA / VDB


1) Primary Partition

2) Extended Partition

1) Primary Partition Definition : A primary partition is any of the


four possible first-level partitions into which a hard disk drive (HDD)
on an IBM-compatible personal computer can be divided. An active
partition is one that contains the operating system that a computer
attempts to load into memory by default when it is started or
restarted.

2) Exatended Partition Definition : Extended Partition Definition.


An extended partition is a primary partition that has been divided up
41.

into logical partitions as a means of creating more partitions than the


four that would otherwise be possible. A partition is a logically
independent section of a hard disk drive (HDD).

3) Logical Partition Definition : Logical Partition Definition. A


partition is a logically independent section of a hard disk drive (HDD).
An extended partition is a primary partition that has been designated
for dividing up as a means of creating more partitions than the four
that are permitted by the master boot record (MBR).

Command : fdisk__/ dev / vdb

After Then : Press the n - key ( n -- > new partition )

After Then : Select the extended partition

After Then : Press the Enter ( Three time Enter ( Default Partition size ,
no. ) )

After Then : Press the n - key

After Then : Select the logical Partition no.

After Then : Press the Enter - key

After Then : Enter the partition size : For example : + 200M

Note : The standard partitions scheme for most home Linux installs is
as follows: A 12-20 GB partition for the OS, which gets mounted as /
(called root) A smaller partition used to augment your RAM, mounted
and referred to as swap. A larger partition for personal use, mounted
as /home.

After Then : Press the w - key ( w -- > save )

After Then : partprobe

Note Partprobe : partprobe is a program that informs the operating


system kernel of partition table changes, by requesting that the
operating system re-read the partition table.
42.

After Then : mkfs__-t__ext3__/ dev / vdb5 ( 5 : - Partition Number )

Note : The mkfs Command. The mkfs (i.e., make filesystem) command
is used to create a filesystem (i.e., a system for organizing a hierarchy
of directories, subdirectories and files) on a formatted storage device
or media, usually a partition on a hard disk drive (HDD), A partition is a
logically independent section of a HDD.

After Then : mkdir / t1 ( t1 : - File name )

After Then : vim__/ etc / fstab

After Then : vim terminal open, In vim terminal write this information.
/ dev / vdb5__/ t1__ext3__defaults__0__0

After Then : mount__-a

Note : In computing, mount is a command in various operating


systems. Before a user can access a file on a Unix-like machine, the file
system that contains it needs to be mounted with the mount
command. Frequently mount is used for SD card, USB storage, DVD
and other removable storage devices.

After Then : For verification : df__-h

Note : df command - Shows the amount of disk space used and


available on Linux file systems. du command - Display the amount of
disk space used by the specified files and for each subdirectory. btrfs fi
df /device/ - Show disk space usage information for a btrfs based
mount point/file system.

Swap Partition

Swap Partition Definition : Swap is a space on a disk that is used


when the amount of physical RAM memory is full. When a Linux
system runs out of RAM, inactive pages are moved from the RAM to
the swap space. Swap space can take the form of either a dedicated
swap partition or a swap file.

Command : fdisk__/ dev / vdb


43.

After Then : Press the n - key ( New partition )

After Then : select the logical partition

After Then : default sector --- > Enter

After Then : Enter the Partition size GB / MB

Note : The examination will be provided partition size.


After Then : press the t - key

Note : t - key for change the id.


After Then : default partition no. :--- > Enter

After Then : Hex code : 82

Note : Hex codes system id. Hex codes system id is a unique id for file
system type including Windows, Unix and Linux file system.

After Then : press the w - key ( w : -- > save )

After Then : mkswap__/ dev / vdb5 ( 5 : partition No. )

Note : Make swap Function: Prepare block device to be used as swap


partit

After Then : swapon__-a

Note : Swapon : Enable devices and files for paging and swapping.
After Then : vim__/ etc / fstab

Note : fstab is a system configuration file on Linux and other Unix-like


operating systems that contains information about major filesystems
on the system. It takes its name from file systems table, and it is
located in the /etc directory.

After Then : open the vim terminal and after write this information : /
dev / vdb5__swap__swap__defaults__0__0
44.

After Then : mount__-a

After Then : free__-m , -g

Note : The free Command. The free command provides information


about unused and used memory and swap space on any computer
running Linux or another Unix-like operating system. Swap space is is a
portion of a hard disk drive (HDD) that is used to simulate additional
main memory (i.e., which is used for virtual memory)

Note : Reboot the system after each partition.

Chapter:-10
Managing Logical Volume Management (LVM) Storage
LVM Partition

LVM Definition : LVM stands for Logical Volume Management. It is a


system of managing logical volumes, or filesystems, that is much more
advanced and flexible than the traditional method of partitioning a
disk into one or more segments and formatting that partition with a
filesystem.
45.

What is PV VG LVM in Linux ?


Ans. : LVM (Logical Volume Management) is a flexible and advanced
option available to manage hard disks in most of the major Linux
distributions. Physical Volume (PV): Consists of Raw disks or RAID
arrays or other storage devices. Volume Group (VG): Combines the
physical volumes into storage groups.

What is lvcreate ?
Ans. : Logical volume management (LVM) is a widely-used technique
and extremely flexible disk management scheme. It basically contain
three basic command : a. Creates the physical volumes using pvcreate
b. Create the volume group and add partition into volume group using
vgcreate c. Create a new logical volume using lvcreate
lvm-diagram1

LVM Commands
fdisk__/ dev / vdb

After Then : n - new partition

After Then : l - logical partition

After Then : Default Sector : Enter


46.

After Then : Partition Size : + GB / MB

After Then : t - change the id

After Then : Hex Code : 8e

After Then : w : save

After Then : partprobe

After Then : pvcreate__/ dev / vdb 7

After Then : vgcreate__-s__16M__data__/ dev / vdb 7

Note : virtual group size = 16MB , virtual group name : data


After Then : lvcreate__-l__20__-n__red__data

Note : logical volume size = 20MB , logical volume name : red

After Then : mkfs__-t__ext3__/ dev / data / red

After Then : mkdir__/ work

After Then : vim__/ etc / fstab

After Then : / dev / data / red__/ work__ext3__defaults__0_0

After Then : save the vim file : shift + zz

After Then : mount__-a

After Then : For verification : vgdisplay

After Then : For verification : lvdisplay

After Then : For resize Partition Size

After Then : umount__/ work ( file name )

After Then : lvresize__-L__+100M__/ dev / data / red


47.

After Then : mount__-a

After Then : show the vgdisplay

After Then : df__-h

After Then : resize2fs__/ dev / data / red

After Then : df__-h

What is umount ?
Ans. : The umount command is used to
manually unmount filesystems on Linux and other Unix-like operating
systems. Mounting refers to logically attaching a filesystem to a
specified location on the currently accessible (and thus already
mounted) filesystem(s) on a computer system so that its
contents can be accessed by users.

What is LVresize ?
Ans. : lvresize allows you to resize a logical volume. Resizing snapshot
logical volumes (see lvcreate) for information about creating
snapshots) is supported as well.

What is the difference between Lvresize and Lvextend ?


Ans. : lvresize. The difference is that lvextend can only increase the
size of a volume, whereas lvresize can increase or reduce it. If you
accidentally reduce the size of a volume without first reducing the size
of the filesystem contained within it then the filesystem is likely to be
damaged irreparably.

What is Resize2fs ?
Ans. : The resize2fs program will resize ext2, ext3, or ext4 file systems.
It can be used to enlarge or shrink an unmounted file system located
on device. If the filesystem is mounted, it can be used to expand the
size of the mounted filesystem, assuming the kernel supports on-line
resizing.
48.

Redhat Services : https://access.redhat.com/

Other Chapters : Chapter 11th and 12th


SA : 2

Find Command :
Find__ /__ -user__ susan__ -exec__ cp__ -rpf__ {}__ /home
/student__ \;

Find Command : - In Unix-like and some other operating systems,


find is a command-line utility that searches one or more directory
trees of a file system, locates files based on some user-specified
criteria and applies a user-specified action on each matched file.

Short Note : - Made a LV, if lv is extended l is small and if lv is MB


format L is capital.

Autofs In LDAP ( AUTO LDAP )


: Run this command Step by Step

First of all : yum__install__autofs__-y

After : vim__/ etc / auto . master

After : terminal will be open and in terminal write this command : /


home / guests_____/ etc / auto.misc

Short Note : / home / guests : -- Mount Point

After : vim__/ etc / auto.misc


49.

After : In terminal Write this command :


ldapuser1___-rw,sync__classroom.example.com: / home / guests /
ldapuser0

Short Note : ldapuser1 : ( 1 is P.C. Number )

After : systemctl__restart__autofs

After : systemctl__enable__autofs

After you are login in your ldapuser1 with su__ldapuser1

S-ar putea să vă placă și