Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
adam jensenCourses Plus Student 8,652 Points
What is the difference between !! (bang) compared to using the UP arrow to scroll through previous commands?
Any explanation would be apprciated..
Gavin Ralston28,770 Points
One doesn't require your hands to leave the home row, where some smaller keyboards have the arrows in different spots, making running the previous command easier with !! than an up arrow.
Edgar Lopez3,003 Points
What people are missing is that !! gives you the ability to run an altered version of the previous command. Like in the example of running a command that needs sudo, but you forget to type it. you then type: sudo !!
and that runs the previous command with the "sudo" preceding it.
hitting up would just give you the same previous command, that did not run the last attempt
ian sobo3,851 Points
I think the !! command is useful because you dont need to move your cursor all the way to the beginning to add sudo, for example, as well as being convenient to add another command onto one you've just typed.