← All commands
Topic hub Terminal & Shell Scripting
Windows Linux Terminal & Shell Scripting Expanded guide Terminal

Windows set equivalent in Linux

Lists or modifies environment variables available in the current session.

Windows set
→
Linux equivalents
Debian/Ubuntu same command
export / env
Fedora same command
export / env
Arch same command
export / env

Overview

What this command does

On Windows, "set" is used to view or set environment variables. On Linux, the closest practical mapping shown here is "export / env". Lists or modifies environment variables available in the current session. This reference is grouped under Terminal & Shell Scripting → Terminal.

Migration tip: Variables set with <code>export</code> are <strong>only available for that session</strong>. To make them permanent, add the export line to <code>~/.bashrc</code> or <code>~/.profile</code>.

Windows → Linux context

What changes when you use this on Linux?

Equivalent task, different tool

Windows set maps to export / env for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.

Portable across the compared distros

The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.

Practical tasks

Common use cases

View or set environment variables

Lists or modifies environment variables available in the current session.

env

List all current environment variables

printenv VAR

Print a specific variable's value

export VAR=value

Set a variable for this session

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

env
printenv HOME
export MYVAR="hello"
echo $MYVAR
echo 'export MYVAR="hello"' >> ~/.bashrc

Walkthrough

Examples with explanations

# Windows: set  (list all variables)
env                            # list all environment variables
printenv HOME                  # show specific variable

# Windows: set MYVAR=hello
export MYVAR="hello"          # set for this session
echo $MYVAR                  # use it

# Permanent — add to ~/.bashrc:
echo 'export MYVAR="hello"' >> ~/.bashrc

Reference

Common options and variations

Command or optionUse
envList all current environment variables
printenv VARPrint a specific variable's value
export VAR=valueSet a variable for this session
echo $VARDisplay a variable's value
unset VARRemove a variable

Distro differences

Debian/Ubuntu vs Fedora vs Arch

Debian/Ubuntu, Fedora and Arch all use "export / env" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu same command export / env Same command on this distribution.
Fedora same command export / env Same command on this distribution.
Arch same command export / env Same command on this distribution.

Keep learning

Related Terminal & Shell Scripting commands