How do you check Linux is CentOS or Ubuntu?

How do you check Linux is CentOS or Ubuntu?

So, here are some approaches you can use:

  1. Use /etc/os-release awk -F= ‘/^NAME/{print $2}’ /etc/os-release.
  2. Use the lsb_release tools if available lsb_release -d | awk -F”\t” ‘{print $2}’

How do you check the commands run on Linux?

Check running process in Linux

  1. Open the terminal window on Linux.
  2. For remote Linux server use the ssh command for log in purpose.
  3. Type the ps aux command to see all running process in Linux.
  4. Alternatively, you can issue the top command or htop command to view running process in Linux.

How to check and list installed packages in CentOS Linux?

Hence, to lists installed packages on CentOS, type the following yum command: sudo yum list –installed. sudo yum list –installed | more. List all installed packages in CentOS Linux using yum. One can use the grep command as filter too. For example, find out if nginx installed or not: sudo yum list –installed | grep nginx.

How to check if Python is running on Ubuntu?

So my recommendation is to use this command instead: python platform module will work on both systems, the rest of the command will check if Ubuntu is returned by python and run apt-get else yum.

How to know if the running platform is Ubuntu or CentOS?

The following script should tell if it is Ubuntu. If it is not and the only other option you have is CentOS, you should have it in an else clause: dist=`grep DISTRIB_ID /etc/*-release | awk -F ‘=’ ‘ {print $2}’` if [ “$dist” == “Ubuntu” ]; then echo “ubuntu” else echo “not ubuntu” fi

What are the commands of Linux and Unix?

Conclusion Category List of Unix and Linux commands Disk space analyzers df • ncdu • pydf File Management cat • tree Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHE Network Utilities NetHogs • dig • host • ip • nmap