1

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?

A.Cho
  • 469

1 Answers1

3

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.

msc
  • 537