Redhat 6 vs Redhat 7 distribution Commands
Date Posted: 28-03-2017
In this post, we gonna explain difference between Redhat 6 vs Redhat 7 distribution Commands, files,etc., These are basic commands which we may use in our day today activities on redhat 6 distribution.
List All Services:
Redhat 6:
chkconfig --list
ls /etc/init.d
Redhat 7:
systemctl -at service
ls /etc/systemd/system/*.service
Start/Stop Service:
Redhat 6:
service name start #To Start the service
service name stop # To Stop the service
Redhat 7:
systemctl start name.service # To Start the service
systemctl stop name.service # To Stop the service
Enable/Disable Service:
Redhat 6:
chkconfig name on # To enable the service on boot
chkconfig name off # To Disable the service on boot
Redhat 7:
systemctl enable name.service #To enable the service on boot
systemctl disable name.service # To Disable the service on boot
Verify service status:
Redhat 6:
service name status # To Check the service status
Redhat 7:
systemctl status name.service # To Check the service status
Check whether service enabled or not:
Redhat 6:
chkconfig name
Redhat 7:
systemctl is-enabled name
Create new service file:
Redhat 6:
chkconfig --add
Redhat 7:
systemctl daemon-reload
View Run Level:
Redhat 6:
runlevel
Redhat 7:
systemctl get-default
Shutdown System:
Redhat 6:
shutdown #To shutdown the machine
Redhat 7:
systemctl shutdown
Poweroff System:
Redhat 6:
poweroff
Redhat 7:
systemctl poweroff
Reboot Machine:
Redhat 6:
reboot
Redhat 7:
systemctl reboot
Get runlevel
Redhat 6:
cat /etc/inittab
Redhat 7:
systemctl get-default
Set Run Level:
Redhat 6:
vi /etc/inittab # Edit Run level on this file
Redhat 7:
systemctl set-default name.target #Replace name with run levels
You can view available run level targets using below command.
systemctl list-units --type target --all
GRUB Loader File configuration:
Redhat 6:
/boot/grub/grub.conf
Redhat 7:
/etc/default/grub
Configure Firewall:
Redhat 6:
iptables
To view iptables rules,
iptables -nL
Redhat 7:
firewall-cmd
To view all firewall rules,
firewall-cmd --list-all
Future post will be added on entire firewall command list.
To Set Hostname:
Redhat 6:
To Set hostname, open the file /etc/sysconfig/network and add Hostname
vi /etc/sysconfig/network
HOSTNAME=hostname.domain.tld
Restart the network service
service network restart
Redhat 7:
To verify current hostname
hostnamectl status
To Set new hostname
hostnamectl set-hostname
View network interface:
Redhat 6:
ifconfig
Redhat 7:
ip addr
View Ports/network Sockets
Redhat 6:
netstat -plan
Redhat 7:
ss -tlp