g.filename(1grass)
โจ g.filename โ the manual page, but make it cute โจ
okay bestie, welcome to g.filename from the GRASS User's Manual (that's g.filename(1grass) if you're being formal, which likeโฆ we are not ๐
). It prints GRASS data base file names. That's the whole job. She's simple, she's reliable, she's giving quiet competence. ๐
๐ธ NAME ๐ธ
g.filename โ prints GRASS data base file names. literally that's it, that's her whole personality and we stan ๐ซถ
๐ฆ KEYWORDS ๐ฆ
general, map management, scripts
iykyk โ this is the scripts girlie. she exists to serve your shell scripts. ๐
โจ SYNOPSIS โจ
g.filename
g.filename --help
g.filename [-c] element=string file=string [mapset=string] [--help]
[--verbose] [--quiet] [--ui]
๐ Flags ๐
-cโ Create element directory in the current mapset. If the element directory for the database file does not exist, create it. โจ--helpโ Print usage summary. your lil bestie when you're lost ๐ฅบ--verboseโ Verbose module output. she talks more ๐ฌ--quietโ Quiet module output. she talks less ๐คซ--uiโ Force launching GUI dialog. for the visual learners ๐ฅ๏ธ
๐ Parameters ๐
element=string[required] โ Name of an element. (yes. required. no skipping ๐)file=string[required] โ Name of a database file. (also required, also no skipping)mapset=stringโ Name of a mapset (default: current). if you don't say, she assumes current ๐โโ๏ธ
๐ DESCRIPTION ๐
g.filename is designed for Bourne shell scripts that need to know the full file name โ including its path โ for mapset elements. And bestie, "elements" here is a whole squad: raster, vector and site maps, region definitions, imagery groupsโฆ the whole friend group. ๐
The list of element names to search for is not fixed. any subdirectory of the mapset directory is a valid element name. so like, she's not gatekeeping, she's flexible. ๐
However! The user can find the list of standard GRASS element names in the file $GISBASE/etc/element_list. This is the file which g.remove/g.rename/g.copy use to determine which files need to be deleted/renamed/copied for a given entity type. so it's kind of the โจmain characterโจ file for element lore. ๐
๐ OUTPUT ๐
g.filename writes one line to standard output:
file='full_file_pathname'
The output is a /bin/sh command to set the variable specified by the file name to the full UNIX path name for the data base file. This variable may be set in the /bin/sh as follows:
eval `g.filename element=name mapset=name file=name`
yes it's a backtick eval. it's giving oldschool slay. do it exactly like that. ๐ง
๐ NOTES ๐
This module generates the filename, but does not care if the file (or mapset or element) exists or not. And honestly? that's the feature. This allows shell scripts to create new data base files as well as use existing ones. she's manifesting. ๐ฎ
If the mapset is the current mapset, g.filename can automatically create the element specified if it doesn't already exist when the -c flag is used. This makes it easy to add new files to the data base without having to worry about the existence of the required data base directories. ๐
โ ๏ธ BUT. This program will not create a new mapset, however, if that specified does not currently exist. so don't come for her about mapsets, that is not her department ๐ซ
Also, this module should not be used to create directories which are at the level of what this module refers to as files, i.e., a directory which carries a name specified by a user (such as vector map directories) should not be created using this module. Standard library functions coming with any given language are a more appropriate tool for that. don't make her do a job that isn't hers, bestie, that's rude ๐
The program exits with a 0 if everything is ok; it exits with a non-zero value if there is an error, in which case file='full_file_pathname' is not output. so if you got nothing, check your exit status. ๐
๐ SEE ALSO ๐
g.findfileg.gisenv
go read those next, they're her friends ๐ซถ
๐ AUTHOR ๐
Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
respect the OG ๐ซก
๐ SOURCE CODE ๐
Available at: g.filename 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
okay that's the whole page bestie, no cap, every flag and path exactly where it belongs ๐
and for the lil sign-off: this was GRASS 8.5.0, from the 2003โ2026 GRASS Development Team era of the reference manual, footer and all โ she said g.filename(1grass), periodt. ๐โจ๐
๐ฆ 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