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


Filtering for Particular Variables


Download 7.3 Mb.
Pdf ko'rish
bet79/115
Sana27.10.2023
Hajmi7.3 Mb.
#1728481
1   ...   75   76   77   78   79   80   81   82   ...   115
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 >HISTSIZE=0
Listing 7-1: Changing the value of HISTSIZE


74
Chapter 7
Now, when you try to use the up- and down-arrow keys to recall your 
commands, nothing happens because the system no longer stores them. 
This is stealthy, although it can be inconvenient.

Download 7.3 Mb.

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




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