0

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 '16 at 13:48
0

Add your script or command to the end of:

/etc/profile 

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

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.