I'd like to achieve this: 1) When user (anybody) logs in to tty1, then some specific command(s) will run automatically. 2) When user (anybody) logs in to other tty, then no command(s) will run automatically.
For example: When I log in to tty1, free
command will run.
I put the commands into .profile
file, but it applies to all tty.
Is there any solution how to make this possible?
Thank you
Best Answer
Use a simple condition to determine which tty you are logging into:
also if you want to your command get run for all users, instead of
.profile
put it into/etc/profile
.