Command comparison CentOS vs Ubuntu
Refer below the basic commands comparison of centos and Ubuntu which can be run on basic machine without and further installations
General
Basis of comparison
|
centos
|
Ubuntu
|
To check the version
|
cat /etc/centos-release
|
lsb_release -a
|
To check the os release
|
cat /etc/os-release
|
cat /etc/os-release
|
To check the hostname
|
hostnamectl
|
hostnamectl
|
To set the hostname
|
hostname HOSTNAME
|
sudo hostname HOSTNAME
|
To check the status of any service
|
systemctl status mysql
|
systemctl status mysql
|
To start any service
|
systemctl start mysql
|
systemctl start mysql
|
to stop any service
|
systemctl stop mysql
|
systemctl stop mysql
|
To see units of particular file
|
systemctl –t service
|
systemctl –t service
|
To show all installed units of files
|
systemctl list-unit-files
|
systemctl list-unit-files
|
To install any package
|
yum install package
|
sudo apt-get install package
|
To update any package
|
yum update package
|
sudo apt-get update package
|
to remove any installed package
|
yum remove package
|
sudo apt-get remove package
|
File creation
Basis of comparison
|
centos
|
Ubuntu
|
To create any file
|
mkdir
|
mkdir
|
To copy any file
|
cp
|
cp
|
To remove any file
|
rm
|
rm
|
To remove any directory
|
rm -rf
|
rm -rf
|
to edit any file
|
vi
|
vi
|
To change directory
|
cd
|
cd
|
To quit any file
|
q or q!
|
q or q!
|
To save any file
|
wq or wq!
|
wq or wq!
|
To check inside a directory
|
Ls, ls –l , ls -a
|
Ls, ls –l , ls -a
|
Disk usage and processing
Basis of comparison
|
centos
|
Ubuntu
|
To check log in status
|
last
|
last
|
To check the system logs
|
cd /var/log
|
cd /var/log
|
To check memory usage
|
vmstat -s
|
vmstat -s
|
To check memory in detailed
|
vi /proc/meminfo
|
vi /proc/meminfo
|
To check processor info
|
vi /proc/cpuinfo
|
vi /proc/cpuinfo
|
To check processor activity
|
top / htop *3
|
top / htop *3
|
To check disk usage of set of files
|
du –h *4
|
du –h *4
|
Networking
Basis of comparison
|
centos
|
Ubuntu
|
to check the ip address
|
ip addr
|
ip addr / ifconfig
|
to do ping
|
ping 8.8.8.8
|
ping 8.8.8.8
|
To do telnet
|
telnet 8.8.8.8
|
telnet 8.8.8.8
|
To do trace of an ip
|
tracepath 8.8.8.8
|
tracepath 8.8.8.8
|
To check the status of firewall
|
systemctl status firewalld
|
sudo ufw status
|
To check the selinux status
|
sestatus
|
sestatus *1
|
Network-manager
|
nmtui
|
nmtui *2
|
to check tcp/ip port/process listening to a port
|
netstat -tulnp
|
netstat -tulnp
|
Check the listening process, ready to accept packet
|
ss -tulnp
|
ss -tulnp
|
To check the information about Ethernet card
|
lshw -class network *5
|
sudo lshw -class network
|
To check the ip route
|
ip route
|
ip route
|
To check the ip address
|
ip addr
|
ip addr
|
To set an interface down
|
ip link set eht0 down
|
sudo ip link set eht0 down
|
To set an interface up
|
ip link set eth0 up
|
sudo ip link set eth0 up
|
To change the ip address
|
vi /etc/sysconfig/network-scripts/ifcfg-eth0
|
vi /etc/network/interface
|
*1 sudo apt install policycoreutils
*2 sudo apt install network-manager
*3 sudo apt install htop
*4 du –help for more info
*5 yum install lshw