HISTSIZE=1000
kali >
export HISTSIZE
This code snippet will set your
HISTSIZE
variable’s value to 1,000 and
export it to all your environments.
Managing User Environment Variables
75
Changing Your Shell Prompt
Your shell prompt, another environment variable, provides you with useful
information such as the user you’re operating as and the directory in which
you’re currently working. The default shell prompt in Kali takes the follow-
ing format:
username@hostname:
current_directory
#
If you’re working as the root user, this translates to the following
default prompt:
root@kali:
current_directory
#
You can change the name in the default shell prompt by setting the
value for the
PS1
variable. The
PS1
variable has a set of placeholders for
information you want to display in the prompt, including the following:
\u
The name of the current user
\h
The hostname
\w
The base name of the current working directory
This is very useful if you happen to have shells on multiple systems or
are logged on as multiple accounts. By using the
\u
and
\h
values, you can
tell at a glance who you are and what your current system is.
Let’s have a little fun and change the prompt in your terminal. For
example, you could enter the following:
kali >
PS1="World's Best Hacker: #"
World's Best Hacker: #
Now, every time you use this terminal, you’ll be reminded that you are
the “World’s Best Hacker.” But any subsequent terminal you open will still
have the default command prompt, because the
PS1
variable only holds val-
ues for your terminal session. Remember, until you export a variable, it is
only good for that session. If you really like this new command prompt and
want to continue to use it, you need to export it, like so:
kali >
export PS1
How about a little more fun? Say you really want your terminal to look
like a Windows
cmd
prompt. In this case, you could change the prompt name
to
C:
and keep the
\w
to have the prompt show your current directory, as
shown in Listing 7-2.
|