In Linux. using SSH, you can zip an entire directory and it’s contents quickly using the following command:

zip -r myfiles.zip mydir

Example – You’d like to zip up a directory located at:

/var/www/html/sitename

Login via ssh and navigate one level up:

cd /var/www/html

From here just run the zip command:

zip -r sitename.zip sitename

There are several reasons this can come in handy:

  • You don’t have GUI access to the server and downloading individual files could be very time consuming via FTP client
  • You need to take a quick backup
  • You do have GUI access to the server, but the utility for zipping up the files there may not be efficient depending on your tool

Leave a Reply