for z in *.txt; do zip "${z%".txt"}.zip" "$z"; done
Where “txt” can be replaced by any other extension, so file1.txt will be zipped to file1.zip, file2.txt will be file2.zip etc.
And to unzip all the files you can use the following:
for z in *.zip; do unzip "$z"; done