Basic Command of Red Hat Enterprise
In this article, we will explain the basic command of the Red Hat enterprise.
Basic Command
Turn off: | Restart |
# init □ 0 | #init □ 6 |
# poweroff | #reboot |
# shutdown □ –h □ now | |
# shutdown □ –h □ 5 | |
Normal user’s can use only these commend | Mode: |
#poweroff | Ctrl+Alt+f1 [ For Text mode] |
#reboot | Ctrl+Alt+f7 [ For Graphical mode] |
Text Mode Terminal | |
Alt+f1 or f2 or f3 or f4 or f5 or f6 | |
Command prompt: | Calendar, Date and Time |
Bash | # cal |
Sh | # cal □ 12 □ 1990 |
Csh | # date |
# bash | # date □ 0320090113 |
# sh | # hdparm □ –t □ /dev/sda |
# pwd | # badblocks □ –s □ /dev/sda |
# whoami | ls Command |
# hostname | # ls |
# fdisk –l | # ls □ /etc |
# df –h /dev/sda1 or 2 or 5 | # cd □ /etc |
cd Commend | # ls □ –s |
# cd □ /var | # ls □ –F |
# cd □ .. | # ls □ –s □ /root |
# cd □ ppp | # ls □ –h □ file_name |
# ls □ –a | |
# ls □ –l | |
# man □ ls | |
# history | |
# !9 |
Comment for creating a file
- Cat
- Touch
- Vi
# cat>file_name [For save – ctrl+d]
# cat>>file_name
#cat □ flie1 □ file2>file3
# touch □ file1 □ file2 □ file3 [ For create one more blank file]
# vi □ file_name [ Create, Edit, and see file Information ]
I (prass) [Insert mode for typing]
Esc (press) [For disable Insert mode]
yy [Copy one line]
p [ For Paste]
dd [ For cut or move or delete]
10yy [Copy ten lines]
p [For Paste]
:5 [ Insertions pointer going 5th line]
/Keyword [Search main word]
:%s □ /cat/rat [ Word replaces ]
:set □ nu [ Set line number of the file]
:set □ ic
:set □ nonu
:q [ Exit without save]
:wq [ Save and Exit]
😡 [Save and Exit]
:w [Save]
:wg! □ /mnt/file_name [ save as]
U (prass) [Undo]
Ctrl+r [Redo]
# aspell □ check □ filename
# vim □ -0 □ file1 □ file2
Ctrl+w+downerro
Ctrl+w+uperro
Ctrl+w+n
Copy:
Syntax- # cp □ –rf □ SourceAdd □ DegtinationAdd
Example- # cp □ –rf □ /mnt/file1 □ /root/file1
# cp □ –rf □ /mnt/file1 □ /root/file3
Move:
Syntax- # mv □ –rf □ SourceAdd □ DegtinationAdd
Example- # mv □ –rf □ /etc/file1 □ /root/file1
# mv □ –rf □ /etc/file1 □ /backup/file3
Rename:
Syntax- # mv □ –rf □ SourceAdd □ SourceAdd
Example- # mv □ –rf □ /mnt/file1 □ /mnt/Nabil
Remove
Syntax- # rm □ –rf □ SourceAdd
Example- # rm □ –rf □ /var/File_name or Directory_name
Create a Folder or Directory:
Syntax- # mkdir /DestinationAdd
#mkdir –p /var/folder1/folder2/folder3 [Create one more sub directory]
Example- # mkdir /var/ftp
#mkdir /backup
Find Command:
Syntax- # find □ / □ –type □ f □ –name □ file_name [For file]
# find □ / □ –type □ d □ –name □ directory_name [For folder]
Find & Remove:
Syntax- # find □ / □ –type □ f □ –name □ file_name □ –ok □ rm □ –rf □ {} □ \;
# find □ / □ –type □ d □ –name □ directory_name □ –exec □ rm □ –rf □ {} □ \;
User:
Syntax-
# useradd □ user_name [Create User]
# passwd □ user_name [ For set password for a user ]
# passwd □ –d □ user_name [ For remove password]
# passwd □ –l □ user_name [ For lock password]
# passwd □ –u □ user_name [ For unlock password]
# useradd □ –d □ /testdir □ –m □ user_name [ Create User with his directory path]
# id □ –u □ user_name [For see user ID]
# usermod □ –u □ (id no) □ user_name [For change user ID no(ID = 520 )]
# chage □ –l □ user_name [ For see information about expire date]
# chage □ –m □ (day) □ user_name [ Minimum no of days between password change]
# chage □ –M □ (day) □ user_name [ Maximum no of days between password change]
# chage □ –W □ (day) □ user_name [Set Expiration warning days to WARN_DAYS]
# chage □ –I □ (day) □ user_name [Set password inactive after expiration to INACTIVE]
# chage □ –E □ (day/month/year) □ user_name [ Set account Expiration date to EXPIRE_DATE]
# userdel □ user_name [Delete a user without home directory]
# userdel □ –r □ user_name [Delete a user with home directory]
#cat □ /etc/passwd [Container of User’s information]
#cat □ /etc/shadow [Store of User’s Password]
Group:
Syntax-
#groupadd □ group_name [Create a new Group]
#id □ –g □ group_name [For see Group ID]
#groupmod □ –g □ (ID no) □ group_name [Change the Group ID]
#groupmod –n (new_g-name) (old_g-name) [For Group rename]
#groupdel □ group_name [For delete a Group]
#cat □ /etc/group [Container of Group’s information]
User & Group:
Syntax-
# usermod □ –G □ group_name □ user_name
#usermod □ –G □ groupname1, groupname2 □ user_name
Monitoring
# vi □ /etc/service [For see all port number]
# nmap [For see who protocol open ]
Sudo Configure: