
Command Line Tricks With Caret And Exclamation DistroTube
video description
Date: 2022-03-30
Related videos
Comments and reviews: 6
Jimmy
ctrl + l clears the terminal
ctrl + u and ctrl + k cut the text before and after your cursor
ctrl + w cuts the word behind your cursor
ctrl + a moves your cursor to the start of the command line
ctrl + e moves it to the end of the command line
ctrl + r does the same as !command except you can press ctrl + r again once you type something to go back to the second last time you entered a command with that substring in it, you can keep pressing ctrl + r to keep going back in your command history for as many commands you have saved in your command history. If you get to the command you want with this and want to make a small modification, just hit escape, this takes the command you just searched and enters it into your command line rather than execute it.
reply
ctrl + l clears the terminal
ctrl + u and ctrl + k cut the text before and after your cursor
ctrl + w cuts the word behind your cursor
ctrl + a moves your cursor to the start of the command line
ctrl + e moves it to the end of the command line
ctrl + r does the same as !command except you can press ctrl + r again once you type something to go back to the second last time you entered a command with that substring in it, you can keep pressing ctrl + r to keep going back in your command history for as many commands you have saved in your command history. If you get to the command you want with this and want to make a small modification, just hit escape, this takes the command you just searched and enters it into your command line rather than execute it.
reply
Gianluca
This is a bit pedantic but it's not quite correct that !! --runs-- the last command. It just expands to it. Now, if you place !! on its own it will expand to the last command and the shell will run it because that's what the shell does when you simply type a command. However, if you type -echo !!- it will print the last command back at you because, like I said, it's merely text substitution.
reply
This is a bit pedantic but it's not quite correct that !! --runs-- the last command. It just expands to it. Now, if you place !! on its own it will expand to the last command and the shell will run it because that's what the shell does when you simply type a command. However, if you type -echo !!- it will print the last command back at you because, like I said, it's merely text substitution.
reply
Ben
This is a brilliant video! Really useful tidbits about string replacement that I need to make sure to use from now on :) very cool!
Also love the !-2 and !-X stuff that's cool and I didn't know about that.
You can also get argumenta from the previous command by using !:2 or !:X
So echo this is a test
= this is a test
Then run
echo !:1
= this
Use that one all the time -
reply
This is a brilliant video! Really useful tidbits about string replacement that I need to make sure to use from now on :) very cool!
Also love the !-2 and !-X stuff that's cool and I didn't know about that.
You can also get argumenta from the previous command by using !:2 or !:X
So echo this is a test
= this is a test
Then run
echo !:1
= this
Use that one all the time -
reply
Technekey
For me, -foo-bar-:& changes only TWO of foo! That means... echo foo foo foo and then -foo-bar-:& ---> returns echo bar bar foo ---> What's wrong?
reply
For me, -foo-bar-:& changes only TWO of foo! That means... echo foo foo foo and then -foo-bar-:& ---> returns echo bar bar foo ---> What's wrong?
reply
Terminalforlife
Here's another neat one: Ctrl + V then period. Either that or escape then period. Can't remember exactly. -_- But it's awesome.
reply
Here's another neat one: Ctrl + V then period. Either that or escape then period. Can't remember exactly. -_- But it's awesome.
reply
Tuncay
That does not work in Fish. So these commandline tricks are features of Bash. I think it would be a nice to mention that.
reply
That does not work in Fish. So these commandline tricks are features of Bash. I think it would be a nice to mention that.
reply
Add a review, comment
Other channel videos















