• Viewing All Environment Variables
  • Viewing and Modifying Environment Variables




    Download 7,3 Mb.
    Pdf ko'rish
    bet86/125
    Sana14.05.2024
    Hajmi7,3 Mb.
    #232858
    1   ...   82   83   84   85   86   87   88   89   ...   125
    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.
    1   ...   82   83   84   85   86   87   88   89   ...   125




    Download 7,3 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Viewing and Modifying Environment Variables

    Download 7,3 Mb.
    Pdf ko'rish