SSH
Backing up Magento2 using command line
To backup your store using the command line please login to your root magento server (SSH), then execute this command
magento setup:backup --code --media --db
How to Display the List of All Jobs in Cron / Crontab
How to view the Crontab list of jobs
To view Root’s Cron Jobs
crontab -l
View a User’s Cron Jobs
crontab -u username -l
Example with user testuser:
crontab -u testuser -l
View Daily Cron Jobs
First view all the daily cron jobs:
Backup and Restore Database SSH
in this wiki we have Backing up and restoring Database from local server and external server,
Backup Database
Backup from local server
mysqldump -u{username} -p{passoword} {database} | gzip > {path}/backup_filename_$(date +%F).sql.gz
Backup from external server
mysqldump -P {port} -h {host} -u{username} -p{passoword} {database} | gzip > {path}/backup_file_name_$(date +%F).sql.gz
Backup specific tables
mysqldump -u{username} -p{passoword} {database} table1 table2 > {path}/table1_table2.sql
How to Disable/Enable Modules in Magento 2.x
Log in to your Magento directory using SSH.
Disable RMA
- bin/magento module:disable Aheadworks_Rma
- bin/magento setup:upgrade
- rm -rf var/cache/*
- rm -rf var/page_cache/*
- rm -rf generated/*
Enable RMA
- bin/magento module:enable Aheadworks_Rma
- bin/magento setup:upgrade
- rm -rf var/cache/*
- rm -rf var/page_cache/*
- rm -rf generated/*
Compress & Extract
To compress one file or folder to a tar file:
tar -cvf xxx.tar file
To extract a tar file:
tar -xvf file.tar
To compress one file or folder to a tar.gz file:
tar -cvzf xxx.tar.gz file
To extract a tar.gz file:
tar -xvzf file.tar.gz
To compress one file or folder to a tar.bz2 file:
tar -cvjf xxx.tar.bz2 file
To extract a tar.bz2 file:
tar -xvjf file.tar.bz2