Daily Useful Linux Commands

Finding the username from provided hosting service name - /script/whoowns domain_name

Finding the domain name from username - grep username /etc/trueuserdomains

Finding the owner of the account from username - grep username /etc/trueuserowners

Apache Error Log/ checking the live logs on server - tail -f /usr/local/apache/logs/error_log | grep IP_address (IP address of connected VPN or of your local network)

Permission fixer - (Make sure to fire it under public_html)
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Restoring the backup file provided by client under his cPanel - 
/scripts/restorepkg  backup file name with it's path

Copying cPanel access log file in user's home - 
cat /usr/local/cpanel/logs/access_log | grep cPanel_username > /home/cPanel_username/public_html/logs.txt;
chown cPanel_username. logs.txt

File will be accessible from - /home/cPanel_username/public_html/logs.txt or websitename/logs.txt

PHP Version  - phv -v

PHP Module - php -m

Apache Version  - httpd -v
Apache Module - httpd -M 

Checking OS on server - cat /etc/redhat-release

Checking user's running process -  ps -aufx | grep php

Checking the disk usage of account - du -shc * (You'll need to fire the command under the path for which you'd like to check the disk usage)

Checking disk usage with hidden files - du -shc .??* *

Fix Quota - For fixing the account disk usage issue that is if account size is vary in cPanel and shell then you can fire this command - 
/scripts/fixquotas --force
 
Cagefs remount - cagefsctl --remount-all

Check if ImageMagick is installed - /scripts/checkimagemagick  If installed, the output will be “ok”

Install ImageMagick - /scripts/installimagemagick

Checking open ports on server - 
netstat -tulnp | grep port number

CSF (Firewall) related useful commands 

IP table stop/Firewall disable - 

/etc/init.d/iptables stop
service iptables stop
csf -x


IP table start/Firewall Enable-

/etc/init.d/iptables start
service iptables start
service csf restart
csf -e

  • Start the firewall rules - csf -s
  • Flush/Stop firewall rules  - csf -f
  • Restart the firewall rules - csf -r
  • Allow an IP - csf -a IP address ( It will automatically add IP in  /etc/csf/csf.allow )
  • Temporary  remove the IP from ban list - csf -tr
  • Block the IP - csf -d ( It will automatically add IP in  /etc/csf/csf.deny )
LFD Log to check if IP address is blocked in firewall or not - grep IP address /var/log/lfd.log

Exim Commands

Exim restart - 
service exim restart
/etc/init.d/exim restart

Checking the email log for particular email address - grep email address /var/log/exim_mainlog

Checking the mail queue count on server - exim -bpc


Checking the mail queue on server - exim -bp

Checking the logs of particular email address - exigrep email address /var/lo/exim_mainlog

Checking the header of the mail - exim -Mvh message_id

Checking the body of mail - exim -Mvb message_id

Removing the frozen mail on server -  exim -bp | grep "frozen"| awk '{system ("exim -Mrm "$3)}'

Removing the mails of particular email address - exim -bp | grep "email_address" | awk '{system ("exim -Mrm "$3)}'

Checking the mail count of all accounts on server in ascending order - 
exim -bpc;
grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F"cwd=" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -n


Removing blank emails on server - 
exim -bp | grep "<>"| awk '{system ("exim -Mrm "$3)}'

Checking the message size limit - 
exim -bP | grep message_size_limit

CRON Commands

Checking CRON Status -/etc/init.d/crond status
Starting CRON service - /etc/init.d/crond start
Check CRON logs for user - tail -f /var/log/cron | grep cPanel_username
Checking the CRONs for any particular user - /var/spool/cron/cPanle_username
  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

How to install AVG Antivirus scanner on Ubuntu?

AVG free is antivirus which protects from spyware as well malware. It is free to use for private...

How to setup a WordPress website on plain Centos server?

The following steps have been successfully tested on a plain centos server. Now lets start...

How to change the port number of Apache Web Server?

Default port to access the Apache is 80. Secure port for communicating with world for Apache is...

How to install Postfix on CentOS?

Postfix is an open-source Mail Transport Agent (MTA), which supports protocols like LDAP, SMTP...

How to install SOAP on CentOS?

Install SOAP on CentOS 1) Fire below command - yum install php-soap Output will be as follow...

Powered by WHMCompleteSolution