Hello Linux users!
When I’m doing my job I’m trying to set my working place as efficient and useful as it’s possible. Bash terminal is my main everyday program I’m using that’s why I decided to improve it a little.
Let’s start from the list directory contents (ls) command. As you know simple ls command is just showing us files without any additional information like privileges or types.
After that kind of output it’s often needed to repeat ls with the keys, for instance ls –lh.
It’s quite annoying to do it every time that’s why I propose to automate it. Let’s make an alias.
There are two ways. The first one (not so good) – just write an alias in the bash.
The second one (and is more preferred) is to change the .bashrc file. Open the file, find the aliases strings and uncomment/write the command.
The next stuff I’d like to add is splitting. What do I mean? Every time you are executing a command, an output is placed on the next string.
It’s not as convenient as I want. So let’s add one empty string between the last output and the upcoming command. All we have to do is to add “\n” (new string) before kali@kali in the .bashrc file.
And try it out…
Yeah, that’s much easier to read.
Ok, what’s next? I propose to add a time stamp (HH:MM:SS). It’s useful because it’s all about the logging and if you’ve launched something big and time consuming you will always know how long has it took.
“\t” will help us in that case.
Good one… but not excellent 🙂 Let’s move further.
Take a look at the Parrot Linux bash output – it’s colorful, multistring and … unfortunately useless (to me*). It was a good idea, but the author did not extend it. I like an idea about multistring, so let’s use it in our case. To do that I will use Box-drawing character which you can easily find via the link -> https://en.wikipedia.org/wiki/Box-drawing_character. Let’s draw a little 🙂
Yeah, almost what I wanted. By the way, I gave a whole string for the working directory on purpose. As you can see there may be a long path and it’s better to change a line to avoid a mess in the one string.
There are plenty of room so let’s use it mindfully. I would suggest to add ip-addresses: inter- and intranet. How can we do that? Bashrc allows to insert scripts into itself with the further exploitation. So let’s add the scripts.
For the intranet we will use the “ip a” command with a filters:
Let’s combine it and add to our script:
I added some checks if the machine is out of the internet.
The last thing we have to do is to update the PS string. The full string is: