how can I zip a file in bash?
- User
how can I zip a file in bash?
- Assistant
To zip a file in bash, you can use the
zipcommand, which is standard on many Unix-like operating systems. If it's not installed, you can usually add it via your package manager.Here is a simple example of how to zip a file using the
zipcommand:-
Install zip (if not installed):
On Ubuntu or Debian:
sudo apt-get install zipOn CentOS or Fedora:
sudo yum install zip -
Zip a file:
To compress a single file:
zip compressed_file.zip original_file.txtIn this command:
compressed_file.zipis the name of the resulting zip file.
-