When managing files on an Ubuntu Server – sometimes you need to transfer files to another computer – for example performing an adhoc backup before making changes.
The terminal commands below show how to zip a directory on an Ubuntu Server, using two methods:
- zipping the current directory, and
- zipping the current directory along with all its subfolders.
Pre-Requisites
- An Ubuntu Server
- Access to the terminal
- zip installed
Zipping Current Directory
- Open the terminal on your Ubuntu server.
- Navigate to the directory you wish to zip.
- Run the following command:
zip -r archive_name.zip .
Zipping Current Directory and All Subfolders (Recursive)
- Open the terminal on your Ubuntu server.
- Navigate to the directory you wish to zip.
- Run the following command:
zip -r archive_name.zip ./*