Check out a free preview of the full Full Stack for Front-End Engineers, v2 course:
The "Bash History Tips" Lesson is part of the full, Full Stack for Front-End Engineers, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Jem returns back to the server history, and shares new Bash commands to access the server log.

Get Unlimited Access Now

Transcript from the "Bash History Tips" Lesson

>> Jem Young: Mm, you know what we haven't done? And this is a bit of a side quest. But we haven't looked at our op log in a while. Let's see what's going on there, I just want to see what's happening. Apologies for the shift, but it's just interesting to me.

[00:00:17] So let's say cat /var/log and then, look at the authlog and it's going to deny me, so I'm going to sudo bang bang. What's going on here? Anything interesting? Anything interesting? Yeah, it's a lot of people trying to connect to my computer again. Later, yes?
>> Speaker 2: I noticed you're using the history shortcut, you haven't mentioned that.

>> Jem Young: The history shortcut, did I not yesterday? Hmm, the history shortcut, so you can go up, and you're just traversing.
>> Speaker 2: Bang bang.
>> Speaker 3: Yeah, the pseudo bang bang.
>> Jem Young: I mentioned that yesterday, yeah. Just in case you didn't know. If you wanna run the last command, so I'm gonna run this again, which won't work without sudo.

[00:01:08] But if I run sudo bang it's gonna replay what I want and it's gonna see the last command but with sudo. So we're just replaying the history with the sudo command and then it works again. If you didn't catch that, that is something that will save you a lot of time.

[00:01:20] The other one I did was reversing my bash history, so I can go up, down. If you wanna find something in your bash history, control R, say log and it will look through all of your bash history. These are super useful. They're nice shortcuts. And the good thing is they work on your Mac too, if you do a lot of command line programming, using control R, going up through history going back.

[00:01:45] Again, it's this common platform that makes these things powerful because, yes, while OS X is a BSc and this we're using Ubuntu, which is a different Linux distribution or different distribution. They still work the same cuz we're still using bash which is this common program that works over all of them.