0
0
Linux CLIscripting~10 mins

su (switch user) in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to switch to the root user.

Linux CLI
su [1]
Drag options to blanks, or click blank then click option'
Aroot
B-
C-l
D-c
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' alone switches to root but requires a dash after su.
Using '-c' runs a command, not switch user.
Using '-l' is for login shell, not username.
2fill in blank
medium

Complete the command to switch to user 'alice' with a login shell.

Linux CLI
su [1] alice
Drag options to blanks, or click blank then click option'
A-
B-s
C-l
D-c
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-c' runs a command instead of switching shell.
Using '-s' specifies shell, not login.
Using '-l' requires no username after it.
3fill in blank
hard

Fix the error in the command to run 'ls' as user 'bob'.

Linux CLI
su bob [1] ls
Drag options to blanks, or click blank then click option'
A-l
B-
C-s
D-c
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-l' runs a login shell, not a command.
Using '-' switches user but does not run command.
Using '-s' specifies shell, not command.
4fill in blank
hard

Fill both blanks to switch to user 'carol' and run the command 'whoami'.

Linux CLI
su [1] [2] whoami
Drag options to blanks, or click blank then click option'
A-c
Bcarol
C-l
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of username and option.
Using '-l' instead of '-c' to run command.
Omitting the username or command option.
5fill in blank
hard

Fill all three blanks to switch to user 'dave' with a login shell and run 'env'.

Linux CLI
su [1] [2] [3] env
Drag options to blanks, or click blank then click option'
Adave
B-l
C-c
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing order of options and username.
Using '-' instead of '-l' for login shell.
Omitting '-c' when running a command.