Zipping and unzipping files using SSH

  1. SSH into your server
  2. Install zip and unzip.
    1. CentOS / Fedora / Red Hat: yum install zip and yum install unzip
    2. Debian / Ubuntu: apt-get install zip and apt-get install unzip
  3. Zip a file: zip file-to-zip
  4. Zip all files in directory: zip *
  5. Zip a directory: zip -r directory-to-zip
  6. Unzip to the current directory: unzip
  7. Unzip to a specified directory: unzip -d /directory-to-unzip-to
  8. List all files in the zip: unzip -l

Leave a Reply

Your email address will not be published.