Script to start apps in shell:
#!/bin/bash
# Open Google Chrome with specific tabs
google-chrome "https://www.google.com" "https://www.stackoverflow.com" "https://www.github.com" &
# Open Visual Studio Code
code &
# Open a new terminal window and navigate to the ./Work directory
gnome-terminal -e "bash -c 'cd ./Work; exec bash'"
# or if you use zsh: gnome-terminal -- zsh -c "cd ./Work; exec zsh"
To add the script to startup using the 'systemd' method:
-
Create a new service file in the /etc/systemd/system directory. You can name it anything you want, but it must end with .service. For example, you could name it my_script.service.
sudo nano /etc/systemd/system/my_script.service
-
In the service file, add the following content and replace /path/to/your/script.sh with the actual path to your script:
[Unit] Description=My Script [Service] ExecStart=/path/to/your/script.sh [Install] WantedBy=default.target
-
Save and close the file and enable the service to start at boot:
sudo systemctl enable my_script.service
-
If you want to run it:
sudo systemctl start my_script.service
To stop the script from running at startup, you can disable the systemd service. Here are the steps:
-
Disable the service:
sudo systemctl disable my_script.service
-
Stop the service:
sudo systemctl stop my_script.service
After running these commands, your script will no longer run at startup. If you want to run the script again at startup, you can enable the service again with the sudo systemctl enable my_script.service
command.