'Script to open terminal in Kali, create multiple new tabs, rename and colour code them
I need help creating a script, bash, python whichever works best within Kali linux.
What I need the script to do is open up the default terminal (ZSH) create the following new tabs - main, msf, nc listener, http server, serachsploit and then colour code them.
Solution 1:[1]
This is the bash script to create the tabs. I am not sure about the colorcoding.
#!/bin/bash
mate-terminal --tab --title="main"
mate-terminal --tab --title="msf"
mate-terminal --tab --title="NC Listener"
mate-terminal --tab --title="http server"
mate-terminal --tab --title="Searchsploit"
Solution 2:[2]
- Write a script:
sleep 1m;gnome-terminal –geometry=150×50 –tab –title="echo" -e "bash -c \"echo "hello";echo "there";exec bash\"" –tab –title="idea" -e "bash -c \"/opt/idea-IU-111.69/bin/idea.sh;exec bash\"" –tab –title="sql" -e "bash -c \"mysql -uroot -pigdefault;\"" –tab –title="firefox" -e "bash -c \"/usr/bin/firefox www.gmail.com;\""
The script above will open a terminal with 4 tabs:
- echo "hello there"
- Idea
- MySql
- Firefox
The script will also set the titles in the terminal for each tab.
One can personalize the above script accordingly.
Description of the script :
sleep 1m : Executes the script after 1 minute so that the system finishes
its startup process.
gnome-terminal : Open a terminal.
-geometry=150×50 : Set screen size for terminal.
–tab : Open new tab
–title : Set title for the terminal
-e : Execute the argument inside the terminal.
exec bash : Starts a new bash after executing all the commands.
This command is required if you do not want to close the current tab.
- Save the script anywhere in the file system and make the file executable using the following command:
$chmod +x file.sh
- Add this file to startup applications :
Go to System > Preferences > Startup Applications
Click on add and in "command" write:
bash path/to/your/file.sh
Close and its done!
Next time when you start your system, all the tasks mentioned in the script will be automated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | z3fq0n |
Solution 2 | pppery |