This is my first post since I started learning on HackTheBox. I began with the basics, even though I had a foundation, before moving on to advanced career paths like penetration testing and red teaming to ensure I didn't miss out on anything. I want to journal my daily learnings to keep track of what I’ve learned and to showcase my newfound skills to the world. I will highlight the insights that resonated with me the most and will not go into too much detail. The internet is filled with information, and I do not wish to add to it. So here we go.
Bash prompt generation
To show customized descriptions in the command line prompt, such as the date, git branch name, or username for every new line, one can use special characters and variables in the shell’s configuration file (.bashrc for the Bash shell).
For example
PROMPT_COMMAND='PS1_CMD1=$(ip route get 1.1.1.1 | awk -F"src " '"'"'NR == 1{ split($2, a," ");print a[1]}'"'"')'; PS1='${PS1_CMD1}/\d\t/\w>'
will show in the terminal as
192.168.1.100/Fri Apr 1112:52:54/~/bin>█
As it is hard to remember all of the parameters, one can use bash-prompt-generator and powerline to generate the prompt script for you.
This setup is useful and saves time for a security professional to know the system information each time you use the terminal.