Whenever I login to my Linux server I'd like to have several commands run automatically (set some variables, change location, etc.)
This needs to be done on user login, not on system start.
How can I set it to do this?
migrated from stackoverflow.com Nov 8 '11 at 7:12This question came from our site for professional and enthusiast programmers. |
|
|
Put the commands in If you need commands to only run when logging in via ssh (but not when logging in physically), you could probably test for the presence of the |
|||||||||||||||||||||
|
|
Just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:
|
|||||||||||||||||||||
|
|
Alternatively, you can specify a command to be run during the invocation of
The last command in the list should start an interactive session in your preferred shell. If you have a lot of commands to run, consider creating a script file on your SSH server. |
|||
|
|
man bash). – Andrew Schulman Nov 8 '11 at 9:39