g.gisenv(1)

πŸ’– g.gisenv πŸ’–

okay so like, welcome to the GRASS GIS User's Manual entry for g.gisenv, bestie β€” pull up a chair, we're gonna read this whole thing together and it's gonna be so good 🫢


🌸 NAME 🌸

g.gisenv β€” outputs and modifies the user's current GRASS variable settings. ✨

If you give it no option at all, it just prints, like, every defined GRASS variable. no cap. πŸ’…


πŸŽ€ KEYWORDS πŸŽ€

general, settings, variables, scripts


✨ SYNOPSIS ✨

g.gisenv
g.gisenv --help
g.gisenv [-sn]  [get=variable[,variable,...]]   [set="variable=value"]
        [unset=variable[,variable,...]]   [store=string]   [separator=character]
        [--help]  [--verbose]  [--quiet]  [--ui]

πŸ¦‹ Flags πŸ¦‹

  • -s β€” use shell syntax (for "eval"). it's giving let me source you energy.
  • -n β€” do NOT use shell syntax. the opposite vibe, iconic.
  • --help β€” print usage summary πŸ‘‘
  • --verbose β€” verbose module output (she's chatty, we love her)
  • --quiet β€” quiet module output 🀫
  • --ui β€” force launching GUI dialog πŸ–₯️✨

🌈 Parameters 🌈

  • get=variable[,variable,...] β€” GRASS variable to get
  • set="variable=value" β€” GRASS variable to set
  • unset=variable[,variable,...] β€” GRASS variable to unset
  • store=string β€” where the GRASS variable is stored
    • Options: gisrc, mapset
    • Default: gisrc
  • separator=character β€” separator for multiple GRASS variables
    • Special characters: pipe, comma, space, tab, newline
    • Default: newline

πŸ’œ DESCRIPTION πŸ’œ

g.gisenv outputs and modifies the user's current GRASS GIS variable settings. when a user runs GRASS, certain variables get set specifying the GRASS data base, project, mapset, peripheral device drivers, etc., being used in the current GRASS session. these variable name settings are recognized for as long as the user is running a GRASS session. periodt. πŸ’…


πŸ”₯ OPTIONS πŸ”₯

no prompts are given to the user when running g.gisenv. she just does the thing. no questions asked. 🫑

if you run it without arguments, g.gisenv lists all of the user's current GRASS variable settings. results are sent to standard output, and may look like this:

GISDBASE=/opt/grassdata/
LOCATION_NAME=nc_spm_08_grass7
MAPSET=/user1
GUI=gui

if the user specifies a get=variable_name on the command line

g.gisenv MAPSET

then only the value for that particular GRASS variable is output to standard output. possible variable names depend on the user's system, see variables list for details. and bestie, note that the variable names are case-insensitive. πŸ™ˆ

while other variables may be associated with each GRASS session (e.g., GRASS_GUI, GIS_LOCK, and other variables), the ones stated below are the essential ones. the main characters, if you will. πŸ‘‘

  • GISDBASE β€” the GISDBASE is a directory in which all users' GRASS data are stored. within the GISDBASE, data are segregated into subdirectories (called "projects") based on the map coordinate system used and the geographic extent of the data. each "project" directory itself contains subdirectories called "mapsets"; each "mapset" stores "data base elements" β€” the directories (e.g., the cell, cellhd, vector, etc., directories) in which GRASS data files are actually stored. πŸ“βœ¨
  • LOCATION_NAME β€” the user must choose to work with the data under a single GRASS project (previously called "location") within any given GRASS session; this project is then called the current GRASS project, and is specified by the variable LOCATION_NAME. the LOCATION_NAME is the GRASS data base location whose data will be affected by any GRASS commands issued during the user's current GRASS session, and is a subdirectory of the current GISDBASE. each "project" directory can contain multiple "mapset" directories (including the special mapset PERMANENT). maps stored under the same GRASS LOCATION_NAME (and/or within the same MAPSET) must use the same coordinate system and typically fall within the boundaries of the same geographic region. πŸ—ΊοΈ
  • MAPSET β€” each "mapset" contains a set of maps relevant to the LOCATION_NAME directory in which it appears. each LOCATION_NAME can contain multiple mapsets. (mapsets which fall under the same LOCATION_NAME all contain data geographically relevant to the LOCATION_NAME, and all store data in the same map coordinate system. frequently, maps are placed into different mapsets to distinguish file ownership β€” e.g., each user might have one or more own mapset(s), storing any maps that the user has created and/or are relevant to the own work.) during each GRASS session, the user must choose one mapset to be the current mapset; the current mapset setting is given by MAPSET, and is a subdirectory of LOCATION_NAME. during a single GRASS session, the user can use available data in any of the mapsets stored under the current LOCATION_NAME directory that are in the user's mapset search path and accessible by the user. however, within a single GRASS session, the user only has write access to data stored under the current mapset (specified by the variable MAPSET). πŸ”

each "mapset" stores GRASS data base elements (i.e., the directories in which GRASS data files are stored). any maps created or modified by the user in the current GRASS session will be stored here. the MAPSET directory PERMANENT is generally reserved for the set of maps that form the base set for all users working under each LOCATION_NAME. πŸ’Ύ

once within a GRASS session, GRASS users have access only to the data under a single GRASS data base directory (the current GRASS data base, specified by the variable GISDBASE), and to a single GRASS project directory (the current project, specified by the variable LOCATION_NAME). within a single session, the user may only modify the data in the current mapset (specified by the variable MAPSET), but may use data available under other mapsets under the same LOCATION_NAME. πŸ‘€

all of these names must be legal names on the user's current system. (so like, don't get cute with them, bestie. πŸ™ˆ)

the full path to the current mapset is determined from GISDBASE, LOCATION_NAME, MAPSET variables, in the example above:

/opt/grassdata/spearfish/PERMANENT

the full path can be printed using g.gisenv by providing multiple variables:

g.gisenv get=GISDBASE,LOCATION_NAME,MAPSET sep=’/’
/opt/grassdata/nc_spm_08_grass7/user1

🌟 NOTES 🌟

the output from g.gisenv when invoked without arguments is directly usable by Bash. the following command will cast each variable into the UNIX environment:

eval `g.gisenv`

this works only for Bash, sh, ksh, etc. the format of the output is not compatible with some other UNIX shells. ⚠️ so like, vibe check your shell first, fr fr.

by default the GRASS variables are stored in gisrc file (defined by environmental variable GISRC). if store=mapset is given then the variables are stored in <gisdbase>/<project>/<mapset>/VAR after the current GRASS session is closed. πŸ—‚οΈβœ¨


πŸ“ EXAMPLES πŸ“

🧚 Cache for raster operations

the maximum memory to be used, i.e. the cache size for raster rows, is set to 300 MB by default (GRASS variable MEMORYMB). to speed up raster operations, it is recommended to increase this setting if enough RAM is available. it is important to note that parallel processes will each consume this amount of RAM. 😭 so be careful, she's hungry.

set the maximum memory to be used (in MB), i.e. the cache size for raster rows:

# set to 6 GB (default: 300 MB)
g.gisenv set="MEMORYMB=6000"

🧡 Number of threads for parallel computing

set the number of threads for parallel computing:

# set to use 12 threads (default: 1)
g.gisenv set="NPROCS=12"

πŸ› GRASS Debugging

to print debugging messages, the variable DEBUG must be set to level equal or greater than 0:

g.gisenv set="DEBUG=3"

levels: (recommended levels) πŸ’…

  • 0 - silence
  • 1 - message is printed once or few times per module
  • 3 - each row (raster) or line (vector)
  • 5 - each cell (raster) or point (vector)

to disable debugging messages:

g.gisenv unset="DEBUG"

the variable DEBUG controls debugging messages from GRASS libraries and modules. πŸ”

similarly WX_DEBUG controls debugging messages from wxGUI. πŸ–₯️


🌈 SEE ALSO 🌈

g.access, g.filename, g.findfile, g.mapsets

see also list of selected GRASS gisenv variables πŸ‘‘


πŸ’– AUTHOR πŸ’–

Michael Shapiro, U.S.Army Construction Engineering Research Laboratory


πŸŽ€ SOURCE CODE πŸŽ€

available at: g.gisenv source code (history)

accessed: Saturday Jan 17 05:40:38 2026

Main index | General index | Topics index | Keywords index | Graphical index | Full index

Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual


okay that's the whole thing, you ate it, you read the whole page 🫢 this was GRASS 8.4.2's g.gisenv(1) and honestly? iconic. go set your variables, bestie, and remember: case-insensitive, no cap πŸ’…βœ¨πŸŒˆ

πŸ“¦ where this page comes from