g.gisenv(1grass)
π g.gisenv β the GRASS User's Manual page, but make it cute β¨
okay bestie, this is g.gisenv(1grass) and it's genuinely iconic. she handles all your GRASS variable settings, and she's been doing it since forever. let's get into it π«Ά
β¨ NAME β¨
g.gisenv β outputs and modifies the user's current GRASS variable settings.
And if you give her literally no options at all? She prints all the defined GRASS variables. main character behaviour, no notes π
π 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")-nβ do not use shell syntax--helpβ print usage summary--verboseβ verbose module output--quietβ quiet module output--uiβ force launching GUI dialog
Parameters πΈ
get=variable[,variable,...]β the GRASS variable you wanna getset="variable=value"β the GRASS variable you wanna setunset=variable[,variable,...]β the GRASS variable you wanna unsetstore=stringβ where the GRASS variable is stored- Options:
gisrc,mapset - Default:
gisrc
- Options:
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 variable settings. When a user runs GRASS, certain variables get set that specify the GRASS data base, project, mapset, peripheral device drivers, etc., being used in the current GRASS session. These variable name settings stay 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's low maintenance like that.
If you run her with no arguments, g.gisenv lists all of the user's current GRASS variable settings. Results go 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. Which variable names are possible depends on the user's system β see the variables list for details. Note that the variable names are case-insensitive. so don't stress about the caps, she's not gonna clock you π
While other variables may be associated with each GRASS session (e.g., GRASS_GUI, GIS_LOCK, and other variables), the ones stated below are essential.
GISDBASEβ TheGISDBASEis a directory in which all users' GRASS data are stored. Within theGISDBASE, 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., thecell,cellhd,vector, etc., directories) in which GRASS data files are actually stored. it's giving nesting dolls fr πͺ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 variableLOCATION_NAME. TheLOCATION_NAMEis 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 currentGISDBASE. Each "project" directory can contain multiple "mapset" directories (including the special mapsetPERMANENT). Maps stored under the same GRASSLOCATION_NAME(and/or within the sameMAPSET) 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 theLOCATION_NAMEdirectory in which it appears. EachLOCATION_NAMEcan contain multiple mapsets. (Mapsets which fall under the sameLOCATION_NAMEall contain data geographically relevant to theLOCATION_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 byMAPSET, and is a subdirectory ofLOCATION_NAME. During a single GRASS session, the user can use available data in any of the mapsets stored under the currentLOCATION_NAMEdirectory 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 variableMAPSET). read-only everywhere else, bestie, that's the rule π
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. β οΈ
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 if you're on some wild exotic shell, that's a you problem, no shade π
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. 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)
Latest change: Friday Aug 08 09:39:19 2025 in commit: ed72c71d8580e872cd6fd345c84a15c324764465
Main index | General index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
and that's the whole page, bestie π ty for reading this far, you're literally the moment. GRASS 8.5.0, reference manual energy, Β© 2003-2026 GRASS Development Team, last touched Friday Aug 08 09:39:19 2025 in commit ed72c71d8580e872cd6fd345c84a15c324764465. slay, go set your MEMORYMB π
β¨
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms