treckstar

Zipping, Transferring Linux CentOS files via ZIP, SCP, UNZIP

Jul 3rd, 2018
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.46 KB | None | 0 0
  1. ## Here are a bunch of useful Linux commands for transferring files:
  2. cd /var/www/stage/wp-content
  3.  
  4. ## Zip up the plugins folder
  5. zip -r plugins-2018-07-03.zip plugins
  6.  
  7. ## This will show you the zip file exists
  8. ls -l
  9.  
  10. ## Transfer the zipped file
  11. scp plugins-2018-07-03.zip [[USERNAME]]@[[IP.ADDRESS]:/home/[[ USERNAME]]
  12.  
  13. ## You can now open another terminal window and log into the dev server, and cd ~ (home directory)
  14. ## This will show you the newly transferred zip file when it is complete
  15. ls -l
  16.  
  17. ## This will create a directory called "plugins" at /var/www/[[WORDPRESSPATH/wp-content/, so you will need to change the path to wherever the sites are all located/whichever Virtual host you are using
  18. sudo unzip plugins-2018-07-03.zip -d /var/www/[[WORDPRESSPATH]]/wp-content/
  19.  
  20. ## Other Commands
  21. ## If you ever need to run a SQL file via terminal:
  22. mysql -u root -p[[PASSWORD]] < /var/www/scripts/[[SCRIPTNAME]].sql
  23.  
  24. ## Change ownership to apache for uploads (fixes permsision errors)
  25. sudo chown -R apache:apache /var/www/stage/wp-content/uploads
  26.  
  27. ## Set all folders & files permission for owner write only
  28. cd /var/www/stage
  29. find . -type d -exec chmod 755 {} \;
  30. find . -type f -exec chmod 644 {} \;
  31.  
  32. ## More permissive/gives group write access (useful for allowing WP to install/update plugins & FTP access)
  33. cd /var/www/stage
  34. find . -type d -exec chmod 775 {} \;
  35. find . -type f -exec chmod 664 {} \;
  36.  
  37. ## Restart Apache on CentOS 7
  38. sudo systemctl restart httpd
Advertisement
Add Comment
Please, Sign In to add comment