how to know status psql in linux

C++
sudo service postgresql status
# To know the status of  postgresql
Source

Also in C++: