• Changing Variable Values for a Session
  • Filtering for Particular Variables




    Download 7,3 Mb.
    Pdf ko'rish
    bet87/125
    Sana14.05.2024
    Hajmi7,3 Mb.
    #232858
    1   ...   83   84   85   86   87   88   89   90   ...   125
    Bog'liq
    linuxbasicsforhackers

    Filtering for Particular Variables
    Although using 
    set
    with 
    more
    gives more manageable results than looking 
    through the huge chunk of variable names you get with 
    set
    alone, it can still 
    be rather tedious if you’re looking for a particular variable. Instead, you can 
    use the filtering command 
    grep
    to find your variable of interest.
    Let’s use the variable 
    HISTSIZE
    as an example. This variable contains 
    the maximum number of commands your command history file will store. 
    These commands are any ones you’ve previously typed into your command 
    prompt in this session and can be recalled with your up- and down-arrow 
    keys. Note that 
    HISTSIZE
    doesn’t store the commands themselves, just the 
    number of them that can be stored.
    Pipe your 
    set
    output with 
    grep
    to find the 
    HISTSIZE
    variable, like so:
    kali >
    set | grep HISTSIZE
    HISTSIZE=1000
    As you can see, this command finds the variable 
    HISTSIZE
    and displays 
    its value. The default value of this variable is probably set to 
    1000
    on your 
    system. This indicates that the terminal will store your last 1,000 commands 
    by default.
    Changing Variable Values for a Session
    Now let’s see how to change a variable’s value. As noted, the 
    HISTSIZE
    variable 
    contains the value of the number of commands to store in the history file. 
    Sometimes, you won’t want your system to save past commands—perhaps 
    because you don’t want to leave any evidence of your activity on your own 
    system or a target system. In that case, you can set the 
    HISTSIZE
    variable to 
    0
    so the system won’t store any of your past commands. Because this variable 
    has a single value, to change it, you assign it a new value in the familiar way 
    shown in Listing 7-1.
    kali >

    Download 7,3 Mb.
    1   ...   83   84   85   86   87   88   89   90   ...   125




    Download 7,3 Mb.
    Pdf ko'rish