Skip to content

Instantly share code, notes, and snippets.

@prithwi
Created January 25, 2022 21:08
Show Gist options
  • Save prithwi/654cdadee26c8925b6c047f700c3d563 to your computer and use it in GitHub Desktop.
Save prithwi/654cdadee26c8925b6c047f700c3d563 to your computer and use it in GitHub Desktop.
List conda environments with creation date.
#!/bin/bash
# ref: https://stackoverflow.com/a/57682857
# uses both system and local conda environment
conda_folders=( `conda info --base`/envs $HOME/.conda/envs )
echo "==> Creation Date <== Environment Name"
echo "#"
for folder in "${conda_folders[@]}"; do
for env_hist in "$folder"/*/conda-meta/history; do
env_prefix=$(dirname $(dirname $env_hist))
echo "$(head -n1 $env_hist) $env_prefix"
done
done | sort -h -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment