image
Repeat as Root
Repeat as Root
Difficulty
Beginner
Duration
7h 28m
Students
389
Ratings
3.5/5
Description

In this course, you will learn how to install a Linux system and connect to it, whether that be on Mac or Windows.

Transcript

If you ever forget to run a command with root privileges you can simply repeat it by using sudo, space, exclamation mark, exclamation mark. Let's say if we were to add a user and we get a permission denied error. That's because we need to run it with super user privileges. We can run sudo, space, exclamation mark, exclamation mark. Or as I like to say, sudo, space, bang, bang. And then you can see that Sam was added.

Here's another example. This exclamation mark syntax that I'm using is called an event designator. An event designator references a command in your shell history. Bang, bang references the most recent command. But one of my favorite uses of the event designator is to run the most recent command that starts with a given string. For example, if we run a few commands, and we want to run the previous command that starts with u, we could type bang u and hit enter. So we can also do this with sudo. Sudo, bang, w. And it shows that we're running with root privileges.

You can also use the su command. So let's do this. And my root password here. And then we'll get rid of this user using this way as well.

About the Author
Students
44102
Labs
168
Courses
1754
Learning Paths
45

A world-leading tech and digital skills organization, we help many of the world’s leading companies to build their tech and digital capabilities via our range of world-class training courses, reskilling bootcamps, work-based learning programs, and apprenticeships. We also create bespoke solutions, blending elements to meet specific client needs.