JoeApple12
New Member
- Messages
- 2
- Reaction score
- 0
- Points
- 0
Commands all cPanel for Linux admins should know
These are common commands that I think all Linux for cpanel admin should know, some are just linux commands but quite handy anyway. Note: Never use the command line unless you know Linux quite well.
Update Awstats and Webalizer for a certain user:
/scripts/runweblogs username
Set all files in a directory recursively to secure permissions. Never do at root level.
find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \;
This corrects file owerships for webusers:
/scripts/chownpublichtmls
Update cPanel via command line:
/scripts/upcp
Edit root cron jobs command line:
crontab -e
Change default linux editor (I selected VI):
VISUAL=vi;export VISUAL;EDITOR=vi;export EDITOR;
Edit commands to run at boot time:
vi /etc/rc.local
Fix cPanel license after hostname change (I run at boot time):
/usr/local/cpanel/cpkeyclt
Clone directory to another directory (Permissions and all):
rsync -rHDgopt --progress /sourcedirectory/* /destinationdirectory
Backup only php files recursively and retain directory structure:
find . -name '*.php' | xargs tar -rf BACKUP.tar;
Import large SQL files faster:
mysql -u db_user_here -p'db_pass_here' db_name_here < Name_Of_Backup_File.sql
Export large SQL files faster:
mysqldump -u db_user -p'db_pass' db_name > Name_Of_Backup_File.sql
Limit webuser resources (cpu / memory / etc):
vi /etc/security/limits.conf
Edit mysql configuration file:
vi /etc/my.cnf
Edit php.ini:
vi /etc/php.ini
These are common commands that I think all Linux for cpanel admin should know, some are just linux commands but quite handy anyway. Note: Never use the command line unless you know Linux quite well.
Update Awstats and Webalizer for a certain user:
/scripts/runweblogs username
Set all files in a directory recursively to secure permissions. Never do at root level.
find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \;
This corrects file owerships for webusers:
/scripts/chownpublichtmls
Update cPanel via command line:
/scripts/upcp
Edit root cron jobs command line:
crontab -e
Change default linux editor (I selected VI):
VISUAL=vi;export VISUAL;EDITOR=vi;export EDITOR;
Edit commands to run at boot time:
vi /etc/rc.local
Fix cPanel license after hostname change (I run at boot time):
/usr/local/cpanel/cpkeyclt
Clone directory to another directory (Permissions and all):
rsync -rHDgopt --progress /sourcedirectory/* /destinationdirectory
Backup only php files recursively and retain directory structure:
find . -name '*.php' | xargs tar -rf BACKUP.tar;
Import large SQL files faster:
mysql -u db_user_here -p'db_pass_here' db_name_here < Name_Of_Backup_File.sql
Export large SQL files faster:
mysqldump -u db_user -p'db_pass' db_name > Name_Of_Backup_File.sql
Limit webuser resources (cpu / memory / etc):
vi /etc/security/limits.conf
Edit mysql configuration file:
vi /etc/my.cnf
Edit php.ini:
vi /etc/php.ini