Following a shell to achieve this goal
#!/bin/bash
# Loop over all environment variables
for var in $(compgen -v); do
# Print the variable name and its value
echo "$var=${!var}"
done
Please be cautious about where and when you run this, as it could expose sensitive data in your environment variables.