I am currently trying to execute a script on CentOS.That runs every time a terminal is opened by any user. I tried placing the script in /etc/profile.d and editing ~/.bashrc. Didn't work properly. It only executes the script for only that particular user (root in my case) and not all users? What am I doing wrong here?

  • Try adding it to the users ~/.bash_profile instead of ~/.bashrc
    – ryekayo
    Sep 29, 2016 at 13:48

2 Answers 2


Add your script or command to the end of:


That will make it take effect for all users at session open.


You mentioned you would like to execute new command when terminal was opened.

Follow this step : In terminal, Edit > Preferences > Tab Title and command > Run a custom command of my shell.

Or gnome-terminal --tab -e "your command" to open a new tab.

This will make your application run when any user will execute opens up the terminal.

You must log in to answer this question.

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