Redhat: Enterprise Linux

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 21

redhat Enterprise

Linux By: Muhammad Shahzad Jaffar


DIRECTORY STRUCTURE OF LINUX
Basic commands for linux
1. pwd 15. touch
2. ls 16. cat
3. cd, cd.. 17. locate
4. cp 18. echo
5. mv 19. sudo
6. mkdir 20. df –m
7. rmdir 21. du
8. uname 22. ping
9. rpm 23. poweroff, halt, init 0
10. chmod 24. reboot, init 6
11. useradd 25. chown
12. hostname 26. chgrp
13. kill, killall 27. updatedb
14. passwd 28. nslookup
Package Management
• RPM (Red Hat Package Manager) is the default package
management utility
• It works in RHEL, CentOS and Fedora.
• The Tool Allows to install, update, uninstall, query, verify and
manage packages.
• The RPM file, that includes compiled software programs and
libraries needed by the packages.
• RPM keeps the information of all the installed packages
under /var/lib/rpm database.
Basic modes for RPM command
Install : It is used to install any RPM package.
Remove : It is used to erase, remove or un-install
any RPM package.
Upgrade : It is used to update the existing RPM
package.
Verify : It is used to verify an RPM packages.
Query : It is used query any RPM package.
RPM commands
INSTALLING AN RPM
rpm –ivh pidgin-2.7.9-5.el6.2.i686.rpm
CHECK DEPENDENCIES of RPM
rpm –qpR bittorrent-5.2.2-1-Python2.4.noarch.rpm
INSTALL an RPM Without DEPENDENCIES
rpm -ivh –nodeps pidgin-2.7.9-5.el6.2.i686.rpm
CHECK an INSTALLED RPM
rpm –q bittorent
LIST all FILES of an INSTALLED RPM
rpm –ql bittorrent
LIST RECENTLY INSTALLED RPM
rpm –qa --last
RPM commands
LIST ALL INSTALLED RPM
rpm –qa
UPGRADE A RPM PACKAGE
rpm –Uvh pidgin-2.7.9-5.el6.2.i686.rpm
REMOVE A RPM PACKAGE
rpm –evv pidgin
REMOVE AN RPM WITHOUT DEPENDENCIES
rpm –evv –nodeps pidgin
QUERY A FILE THAT BELONGS WHICH RPM
rpm –qf /usr/bin/htpasswd
QUERY INFORMATION OF INSTALLED RPM
rpm –qi vsftpd
NETWORK CONFIGURATIONS
IMPORTANT CONFIGURATION FILES
File Description
/etc/resolv.conf List DNS servers for internet domain name
resolution.

/etc/hosts Lists hosts to be resolved locally (not by DNS).

/etc/nsswitch.conf List order of host name search. Typically look at


local files, then NIS server, then DNS server.

/etc/sysconfig/network Specify network configuration. eg.


Static IP, DHCP, NIS, etc.
/etc/sysconfig/network-scripts/ifcfg-device
Specify TCP network information.
NETWORK CONFIGURATIONS
COMMAND LINE CONFIGURATIONS
• ifconfig //shows interface configurations
• ifconfig –a //shows all interfaces configurations
To assign ip address to an interface use this command
• ifconfig eth0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255
• ifup eth0 // To Enable an interface, use this command
• ifdown eth0 // To disable an interface, use this command
• Service network start, stop, restart // for service operations
• system-config-network //GUI tool system-config-network
NETWORK CONFIGURATIONS
OTHER IMPORTANT NETWORK COMMANDS

Dig
(domain information groper) query DNS related information like A Record, CNAME, MX
Record etc. This command mainly use to troubleshoot DNS related query.

nslookup
command also use to find out DNS related query. The following examples shows A
Record (IP Address) of tecmint.com. e.g nslookup www.tecmint.com

host
command to find name to IP or IP to name in IPv4 or IPv6 and also
query DNS records. e.g host -t CNAME www.redhat.com
NETWORK CONFIGURATIONS
OTHER IMPORTANT NETWORK COMMANDS

hostname
Execute hostname command to see the hostname of your box. You can set hostname
permanently in /etc/sysconfig/network.

telnet
connect destination host:port via a telnet protocol if connection establishes means
connectivity between two hosts is working fine.

netstat
command allows you a simple way to review each of your network connections and open
sockets.
NETWORK CONFIGURATIONS
OTHER IMPORTANT NETWORK COMMANDS

scp
allows you to secure copy files to and from another host in the network.
Ex: scp $filename user@targethost:/$path

w
w prints a summary of the current activity on the system, including what each user is doing,
and their processes. Also list the logged in users and system load average for the past 1, 5,
and 15 minutes.

nmap
is a one of the powerful commands, which checks the opened port on the server.
Usage example:nmap $server_name
USERS/GROUPS MANAGMENT
IMPORTANT USER MANAGEMENT COMMANDS

adduser/useradd
• It edits /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow files for the newly created
User account.
• Creates and populate a home directory for the new user.
• Sets permissions and ownerships to home directory.
• Examples:
• [root@tecmint ~]# useradd tecmint
• [root@tecmint ~]# passwd tecmint
USERS/GROUPS MANAGMENT
IMPORTANT USER MANAGEMENT EXAMPLES
[root@tecmint ~]# useradd -d /data/projects anusha //assign home directory
[root@tecmint ~]# useradd -u 999 navin //user-id
[root@tecmint ~]# useradd -u 1000 -g 500 tarunika //user-id and group-id
[root@tecmint ~]# useradd -e 2014-03-27 aparna //account expiry
[root@tecmint ~]# useradd -e 2014-04-27 -f 45 tecmint //password expiry
[root@tecmint ~]# chage -l aparna //varify acount age details
[root@tecmint ~]# useradd -c "Manis Khurana" mansi //with comments
[root@tecmint ~]# useradd -G admins,webadmin,developers tecmint
//assign multiple groups
[root@tecmint ~]# useradd -m -d /var/www/ravi -s /bin/bash -c "TecMint Owner" -U ravi
//Add a User with Specific Home Directory, Default Shell and Custom Comment
[root@tecmint ~]# cat /etc/passwd | grep anusha //user details
USERS/GROUPS MANAGMENT
USERMOD EXAMPLES
the command ‘usermod‘ is used to modify or change any attributes of a already created user account via command line. The command
‘usermod‘ is similar to that ‘useradd‘ or ‘adduser‘ but the login granted to an existing user.
Options of Usermod
The ‘usermod‘ command is simple to use with lots of options to make changes to an existing user.

-c = We can add comment field for the useraccount.


-d = To modify the directory for any existing user account.
-e = Using this option we can make the account expiry in specific period.
-g = Change the primary group for a User.
-G = To add a supplementary groups.
-a = To add anyone of the group to a secondary group.
-l = To change the login name from tecmint to tecmint_admin.
-L = To lock the user account. This will lock the password so we can’t use the account.
-m = moving the contents of the home directory from existing home dir to new dir.
-p = To Use un-encrypted password for the new password. (NOT Secured).
-s = Create a Specified shell for new accounts.
-u = Used to Assigned UID for the user account between 0 to 999.
-U = To unlock the user accounts. This will remove the password lock and allow us to use the user account.
FILE PERMISSIONS MANAGMENT
FILE PERMISSIONS:
FILE PERMISSIONS MANAGMENT
FILE PERMISSIONS:

Number Permission Type Symbol

0 No Permission ---

1 Execute --x

2 Write -w-

3 Execute + Write -wx

4 Read r--

5 Read + Execute r-x

6 Read +Write rw-

7 Read + Write +Execute rwx


FILE PERMISSIONS MANAGMENT
FILE PERMISSIONS:

Number Permission Type Symbol

0 No Permission ---

1 Execute --x

2 Write -w-

3 Execute + Write -wx

4 Read r--

5 Read + Execute r-x

6 Read +Write rw-

7 Read + Write +Execute rwx


FILE PERMISSIONS MANAGMENT
FILE PERMISSIONS:
FILE PERMISSIONS MANAGMENT
FILE PERMISSIONS:
FILE PERMISSIONS MANAGMENT
FILE PERMISSIONS:

You might also like