This question already has an answer here:
- su vs sudo -s vs sudo -i vs sudo bash 3 answers
I am studying the Linux command line. But the book which I'm reading says that
su -l(-) username is starting a new shell session and loading the environment of the user I want to change to, but
When I was root user, I entered the command
su testuser, so I am testuser. But after that, I entered
echo "$USER", and it says
testuser. It means that it loads testuser's environment, doesn't it? Is there something wrong?
And what does "starts a new shell session" mean exactly? Does shell have a mechanism like login, logout?