export $(grep -v '^#' .env | xargs)

Category: Web App Development

export $(grep -v '^#' .env | xargs)

Load .env variables into the current shell

Reads .env, skips comment lines and exports every KEY=value pair into the current shell session. The command substitution runs grep and xargs, whose output becomes the export arguments. Values with spaces break the parsing, so prefer direnv for complex files.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.