L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h


Viewing and Modifying Environment Variables


Download 7.3 Mb.
Pdf ko'rish
bet78/115
Sana27.10.2023
Hajmi7.3 Mb.
#1728481
1   ...   74   75   76   77   78   79   80   81   ...   115
Bog'liq
linuxbasicsforhackers

Viewing and Modifying Environment Variables
You can view all your default environment variables by entering 
env
into 
your terminal from any directory:
kali >env
XDG_VTNR=7
SSHAGENT_PID=922
XDG_SESSION_ID=2
XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/root
GLADE_PIXMAP_PATH=:echo
TERM=xterm-256color
SHELL=/bin/bash
--snip--
USER=root
--snip--
PATH=/usr/local/sbin :usr/local/bin:/usr/sbin:/sbin/bin
--snip--
HOME=/root
--snip--
Environment variables are always uppercase, as in 
HOME

PATH

SHELL
, and 
so on. These are only the default environment variables that come on your 
system. A user can also create their own variables, and as you will see, we 
need a different command to include those in the output.
Viewing All Environment Variables
To view all environment variables, including shell variables, local vari-
ables, and shell functions such as any user-defined variables and command 
aliases, use the 
set
command. This command will list all environment vari-
ables unique to your system, which in most cases will give you an output so 
long you won’t be able to view it all on a single screen. You can request to 
view each variable, line by line, in a more accessible fashion using 
set
and 
piping it to the 
more
command, as follows:
kali >set | more
BASH=/bin/bash
BASHOPTS=checkwinsize:cmdlist:complete_fullquote:expand_aliases:extglob.....


Managing User Environment Variables
73
BASH_ALIASES=()
BASH_ARGC=([0] = "0")
BASH_ARGV=()
--snip--
Now the list of variables will fill up one screen, line by line, and then stop. 
When you press 
enter
, the terminal advances to the next line, taking you 
to the next variable, so you can scroll through by pressing or holding 
enter

As you might recall from Chapter 2, whenever you use the 
more
command 
for output, you can enter 
q
to quit (or exit) and return to the command 
prompt.

Download 7.3 Mb.

Do'stlaringiz bilan baham:
1   ...   74   75   76   77   78   79   80   81   ...   115




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling