Hardik Patel The Perspective
Redhat Linux Enterprise SA-1 Commands Interface
Chapter:-1
Accessing the Command Line:
Main System Commands:
Command: 1 :- rht-vmctl fullreset server-q
Use: For server reset.
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
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
Command: 6: cat
Use: Make a File, Editing in File, Show in File content, Replace the File content
Sixth command syntax and its uses.
1) cat >> file name (Make a file & add content)
2) cat > file name (Replace the file content)
3) cat file name (Show the file)
Command: 7: head
Use: Show the header file content.
Seventh command's syntax : head -no. of line file name
Command: 8: tail
Use: Show the tails line.
Eighth command's syntax : tail -no. of line file name
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.
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.
Command: 10: passwd
Use: Change the password
Tenth command syntax : passwd user name
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.
Chapter:-2
Managing the files or directory command line:
Main Commands in Chapter : 2
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 extansion )
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.
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
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.
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
Main Commands in Chapter : 3
Command: 1: man
Use: For Show the Command's information.
Command one syntax : man cat ( any command name )
Command: 2: pinfo
Use: For Show the Command's information ( in details ).
Command two syntax : pinfo mv ( any command name )
Command: 3: gedit
Use: For edit the text file.
Command three syntax : gedit file name
Chapter:-4
Main Command : vim File name
There are five variable types in vim command
1) Insert mode ( Press the i - key )
i : - insert
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
3) Visual Mode ( Press the v - key )
y : - copy selected word
d : - cut full 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.
Chapter:-5
Main Commands in User
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
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
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
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
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
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
2) cat / etc / shadow
Example : hmt (1) : !! (2) 1795 : (3) 0 : (4) 99999 : (5) 7 :::: (6)
1) User name
2) Show password
3) Last password change date
4) Password minimum age
5) Password maximum age
6) Warning
3) chage__user name
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
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
1) Chmod :
Use : Change permission of files or directories.
2) Chown :
Use : Change ownership of files or directories. ( user & group )
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
(1) Symbolic Method
(2) Numeric Method
1) Symbolic Method
WHO :
u : - user
g : - group
o : - other
a : - all
WHAT :
+ : - add permission
- : - 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.
Chapter:-7
1) Command : ps
Use : Show the Running Process.
2) Command : bg
Use : Show the Background Process.
Command : bg cat file name ( and , press the control + z )
3) Command : kill
Use : Close the Process.
4) Command : fg
Use : Show the desktop Process.
5) Command : jobs
Use : Show the stop Process.
6) Command : ps aux
Use : Show the long list ( Running Process ) ( kill aux )
Chapter : 7 Command line inter face
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 progress : kill ( cat id )
After show the background progress and after show the Running progress.
chapter seven syntax :
[ 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 )
Chapter:-8
Managing Services and Daemons
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.
Chapter:-9
only for one command in chapter : 9
Command : ssh root @ server no. / name ( root / student / other user... )
Use : Login and access to other server.
Chapter:-10
Set a NTP ( Network Time Protocol )
: - > 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
After
systemctl restart cronyd
systemctl enable cronyd
After
For Verification : cronyc sources -V
Note : Verification reached no. 17 / 17 up.
Chapter:-11
Network Setup with NMTUI ( Network Management Text User Information )
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 ( exam id : in chapter:-13 SA - 2 )
systemctl restart NetworkManager
systemctl enable NetworkManager
Chapter:-12
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
1) gzip : file name . tar . tgz or file name . tar . gz : - z
2) bzip : file name . tar . bz2 : - j
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 :
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 root @ server no.
sftp > _______ ( get file name ) ( get : > download file )
sftp > ________ ( put file name ) ( put : > upload file ) ( put -r directory name : for directorie )
4) rsync Command ( synchronization )
Command : rsync -av root @ server no. : / root / Desktop / redhat / root / Desktop /
V : Verbosity
a : achieve mode
Chapter:-13 ( SA : 2 )
Password Cracker in Linux OS
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 )
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
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
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 )
Set a REPO & KERNEL
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
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
Created By : Hardik Patel