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 su doesn't.

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?

  • Just run 'env' instead of 'echo $USER'
    – njboot
    Feb 4, 2016 at 6:57

1 Answer 1


su gives you root permissions but it does not change the PATH variable and current working directory. so you can't execute files in /usr/sbin folder.

su- changes the PATH too... and root's home becomes your current working directory. you become proper root and can execute all commands.

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