Learn to temporarily change users at the Linux command line.
Linux su command summary with examples (3:12)
Videos can also be accessed from the YouTube Playlist.
Our seventy-eighth word, or command to memorize is
su from our category
su allows you to temporarily
Recall from the previous four videos (tutorials) we tackled file permissions and ownership, now we'll attempt to login as another user, say to perform a task.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s).
su command has
5 options, and the argument is the User ID (name)
you'd like to use temporarily.
Like most commands, help is available with double-dash
-l option logs in as if you were the
-p keeps your own shell, ignoring
that person's startup scripts and environment variables.
So why is
su an important command?
Well, many administrative commands like seeing log files, installing
programs and modifying configuration files can only be accessed with
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. In the time we have, let's keep it very simple. Start with
su jennifer, enter her password and
pwd from video (tutorial)
6 to see where we sit.
So we switched to her home directory.
Then, let's run a
whoami, from video
And notice how I've taken the identity of Jennifer.
And last, enter the
id command from
video (tutorial) 77 for Jennifer's group memberships.
And then to leave her account we'll need to type
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
command. So I touched on passwords a second ago, which we'll tackle
right after one more related and important command.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Please join our growing community on YouTube. It's easy subscribe here.
idcommand, hit Back.
sudocommand, click Next.