I want the Xfce terminal to run a command when it is turned on, for example print a welcome message or some system stats. I want this message to be printed only on the Xfce terminal emulator when it starts, not on some other terminal emulators. Can I achieve this effect by modifying the file terminalrc? How?

2 Answers 2


If you absolutely want to do this, I see two approaches:

1) Make a bash (or whatever shell you use) profile script that gets the parent PID to see if it is running under xfce4-terminal, and, if so, prints your message.

2) Something like this (note you may have to re-run it after OS upgrades, or it may even befuddle your package manager into not working properly anymore):

W="$(which xfce4-terminal)"
sudo cp "$W" "$W".orig
sudo tee "$W" <<EOF
#!/usr/bin/env bash
exec ${W}.orig -e 'sh -c "echo this is xfce4-terminal ... ; bash"'
sudo chmod a+x "$W"
  • 1
    That is one ugly hack. I haven't tried it but I suppose it probably works. Your first choice would probably be nicer. Commented Dec 30, 2016 at 7:14

I found the solution. I added this code to the .bashrc file.

if [ $COLORTERM == "xfce4-terminal" ]
   echo "Welcome to the Xfce4 Terminal"
  • 1
    Why you used $COLORTERM? I think that could be sufficient write if [ "xfce4-terminal" ] Commented Sep 13, 2017 at 9:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .