Auto start script when I open Terminal
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
Auto start script when I open Terminal
Hello, I tried looking for this type of thing I want to do but the ones I find tend to be more for multiple scripts at one time. So what i want to do is run a script every time I open terminal. The script isn't anything special, its just a saying that I like to see when I open terminal. Just seeing if anyone can help me with this.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
-
- Level 4
- Posts: 443
- Joined: Fri Sep 23, 2016 10:19 am
Re: Auto start script when I open Terminal
I think what you want is something like .profile in your home directory -- it gets executed when you log in with the default shell, I believe. If you happened to change to csh, use .login instead. Just add the script(s) to be executed at the end of .profile
Re: Auto start script when I open Terminal
This varies according to your mint install.
Post back results of terminal inquiry:
You can make a launcher to do this, or you can do this with a custom keyboard shortcut.
Explain more of what you wish to accomplish.
Post back results of terminal inquiry:
Code: Select all
inxi -S
Explain more of what you wish to accomplish.
Everything in life was difficult before it became easy.
Re: Auto start script when I open Terminal
Just put it in the file
For example this is the welcome message code that I have in my .bashrc file:
On one line it displays your kernel version, systemd version (if using systemd), and what desktop session you are running and its version and if known the session type (X11 or Wayland). inxi can probably do something similar but I like my own output here and use it across most of my systems.
.bashrc
in your home directory. Anything you put in there is run when you open a new shell session (what happens when you open a terminal).For example this is the welcome message code that I have in my .bashrc file:
Code: Select all
echo -n "$(uname -sr | cut -d'-' -f1) $(uname -m)"
type -P systemctl >/dev/null && echo -n " / $(systemctl --version | head -n1)"
case "${XDG_CURRENT_DESKTOP}" in
GNOME)
echo -n " / $(gnome-shell --version)" ;;
KDE)
echo -n " / KDE Plasma $(plasmashell --version | cut -d' ' -f2)" ;;
XFCE)
echo -n " / Xfce $(xfce4-session --version | head -n1 | cut -d' ' -f2)" ;;
X-Cinnamon)
echo -n " / Cinnamon $(cinnamon-session --version | cut -d' ' -f2)" ;;
MATE)
echo -n " / MATE $(mate-session --version | cut -d' ' -f2)" ;;
*)
;;
esac
[[ -n ${XDG_SESSION_TYPE} ]] && echo -n " / ${XDG_SESSION_TYPE^}"
echo