My 5 Favorite Linux Shell Tricks for SPEEEEEED (and efficiency)
HTML-код
- Опубликовано: 2 июн 2018
- My favorite tricks for becoming a Linux Shell Speed Demon (this assumes Bash/readline)
1:04 - sudo !! - re-run previous command with 'sudo' prepended
1:53 - ctrl-k, ctrl-u, ctrl-w, ctrl-y - cutting and pasting text in the command line
3:24 - practical kill/yank example
4:04 - use 'less +F' to view logfiles, instead of 'tail' (ctrl-c, shift-f, q to quit)
6:25 - ctrl-x-e - continue editing your current shell line in a text editor (uses $EDITOR)
7:54 - alt-. - paste previous command's argument (useful for running multiple commands on the same resource)
9:18 - reset - resets/unborks your terminal
My step-by-step project-based Linux course for beginners: www.udemy.com/course/hands-on...
Free Linux Sysadmin Course Playlist: • The Linux Basics Cours...
DigitalOcean referral link: m.do.co/c/0380a1db56a6
Patreon: / tutorialinux
Official Site & e-mail list: tutorialinux.com/
Twitter: / tutorialinux
Facebook: / tutorialinux
Podcast: kernelpanicpodcast.com - Наука
~~~ Timestamps to specific sections are in the description! ~~~
ctrl+a and ctrl +e goes to the start and last, I find myself using this most
Thanks for tips! Few more useful commands. The easiest way to create empty file is typing >filename
I also often need to convert unix timestamp to hooman readable form, "date --date=@your_date_in_unix_format" does the job.
i literally screamed when i learned the kill / yank
Becoming proficient in emacs makes the editing commands second nature. 🙂
@@planktonfun1 but why? your keyboard also doesn't have home and end keys? much easier than some ctrl combinations.
i really love the fact that you wrote exactly what you are going to explain in the description with timestamps!
Yeh, same, I was prompted to subscribe as my patience run out not because I should definitely learn the rest of the content but because,"ADHD," 🤣, prompted straight to subbing and turning notification on, lamo.
> Bang bang
> password shot me down
> Sudo .. BANG BANG
"Torvald Sinatra"
BANG BANG rather reminds me of "Rammstein - Feuer Frei"
@@karlheinzneugebauer hey thanks thats a great way to remember that!
Nancy Sinatra :) ?
@@hayksk Had to google who that is. Appears to be the daughter of Frank. Interesting.
@@karlheinzneugebauer Yes, she is.
"Alt + backspace" is more useful than "ctrl + w" in my oppinion. While the latter only stops at whitespaces, the former also stops at special characters, e.g. slashes, so you can edit your way to parent directories much faster.
Solid advice! Will try to re-wire my brain to try it out.
Both are useful but for different cases. Clear entire arg or go word by word. Personally I use both depending on the case.
I use a Mac terminal and there is no Alt key, but ^w works just fine enough for me
@@richardcampbell2438 On the Mac I think you need to use Escape instead of Alt
@@richardcampbell2438 dump Ur mac if ur using Linux !
Actually anything is fine ...depends on the person !!!
VERY useful tips here, I plan to start using them regularly. You’re proving to be my most useful resource on YT in my Linux journey. Also enjoying your sysadmin series.
Instead of you can also just use !$ the same way you used !! in the first tip. There's actually a lot of notation for this which is terminal agnostic and supported in zsh as well as bash and probably others. For instance !-2 gives you the command before last, !-3 the one before that etc. $ on the end gives you the last argument of that command. !^ gives you the first argument, !:2 or !* gives the second argument. All of these things can be combined too, for instance !-3:2-$, which gives the second to last argument of the third-last command or !-3:2-3 which gives the second and third arguments to the third last command. Hard to keep straight at first but a very powerful way of getting around once you jam it into your head.
Huge Thanks for the 2 shell videos you've made. Been using CLI over a decade but did not know any of these tricks and have always found it slow and clunky when compared to the gui. Well no more, not after these massive quality of life improvements... Been 6 months since I watched these videos but I still think of you and smile the endless times a day I use these tricks!
I've been programming professionally for 40 years, most of that in the Linux world, and it's amazing the learning process never ends.
Yeah, I’ve used less a ton but not with other flags. I tried less +F but didn’t work.
Do you still love programming ?
@@allen_joji Yeah, I do. I'll eventually retire, but it's unlikely I'll ever stop programming. I'll do my own projects is all.
My opinion about careers: you should find something you can be passionate about, that you want to do even if you weren't being paid. We spent far too much of our lives at our jobs, and do you want it to be soul-sucking?
The last people I want to work with: the ones who see it as a job. They're only there for the paycheck. Yeah, if I won the lottery, I'd quit the day job. But I'd still program. I'd just get to pick what I work on.
i could definitely have a beer with this guy.
Yeah, he seems like a cool guy
Just came across this channel and I love it!
Thanks for showing us how wonderful Linux can be and how to use it.
11 minutes later and I don't know how I survived without these tricks for so long. Great stuff man
Nice work, dude!
I love your videos, keep it up :D
Holy cow, it's been 12 years since the last time I used Windows on my home PC, and I do use the CLI a lot, yet I didn't know some of those tricks. Great work!
Thank you so much Dave for sharing your knowledge, looking forward for future videos. Keep it up mate!
Great video! I consider myself a seasoned shell user since I've been doing this stuff for 30+ years but you've taught me some new stuff. Two things to add though to fix a borked terminal is "stty sane" and "echo ctrl-v ctrl-o". Excellent tutorial!
Fantastic post Man! Wanted some Ninja tricks to share with my Students tomorrow and these are perfect! Thanks so much!
Love these hints and tricks, I'm probably pulling at least a few into daily life - Shot dude!
Another nice trick worth mentioning is reverse search (Ctrl + r), where you can type a part of your command and it'll bring on the last command entered with the expression in it. You can see older/newer commands by pressing Ctrl+r and Ctrl+R respectively.
It's a bit more common so maybe not really a trick, but still some people might not know about it.
you had me at `sudo !! `
shaking my head at the amount of time i've wasted not knowing about this...
Realy cool shortcuts. It helped me a lot. You are great!
Some of those I didn’t know. You saved me loooots of minutes for sure.
Thanks!
I already know I'm going to use that command line yanking so much, thank you!
Great video! What I use probably the most is Ctrl+r to quickly search the command history. By using Ctrl+r you can go to the next hit and with Ctrl+R to the previous.
thanks
try fzf, it makes ctrl-r a dropdown list (i think it opens a tmux pane on the fly iirc) and lets you search in a fuzzy manner. And also search for files like that, I can't live without it anymore..
@@frydac yes, fzf is really awesome in various regards :)
Thank you!!! This video should never die!
I remember a while back you saying your co workers would give you a hard time about using advanced commands... I can see why , I have watched a lot of tutorials , some of the things you do I haven't seen ANYWHERE else. I like this channel because even if I go way back in your history everything is still relevant and useful. I've been subscribed but I forgot to hit the bell icon , so I didn't even know you were back. Glad to hear it though.
These videos are great! Looking forward to more and more in-depth practical and theory based tutorials.
Yeah, I've got some advanced ones coming -- in-depth systemd tutorials, compiling a kernel, writing your own syscalls. Woohoo!
How did I not know about less +F? This literally changes everything in my job!
Maybe it's overkill, but I always just use vim. It loads very quickly and gives me the ability to search all around any log, jump to the bottom, etc. vim logfile, shift-g to get to bottom, :q to exit. Done.
@@nonconsensualopinion But does it follow?
If you ever need to purposefully mess up a terminal like for 9:47, I've found the command "sleep 1 | vim" will do that consistently on any terminal.
Can't believe I just upvoted a guy for messing up my terminal... XD
could not confirm:
root@debootstrap:~# sleep 1 | vim
-bash: vim: command not found
root@debootstrap:~#
/s
Vim is seriously the best text editor
It does not happened to me. Maybe because I have Neovim installed
@@iam3377 laughs in nvim
I was expecting to be disappointed (didn't notice who published it before I clicked watch, lol) but I didn't know a single one of these, thank you! All of your videos are great.
Thanks for the video. Although I am using GNU/Linux for more than 15 years, I forgot about !! and I didn't know about C-x-e.
Thanks.
Great tips, thanks for sharing! I'm proud that I knew a couple already but most are new to me. I'm going to incorporate these into my day to day for sure. The comment section is gold too.
Thank you for sharing information which is immediately effective and useful.
first useful shell video tutorial I ever ran into
Quick note on the keyboard shortcuts: These are default Bash terminal commands, which are based on Emacs commands; however, you can also add "set -o vi" to your .bashrc to set Vi mode, and then you can use Vi shortcuts instead. Since one of the big things that keeps Vi[m] competitive with Emacs is the power of its navigation commands, this can make you even more efficient, though the learning curve is pretty severe if you're not already used to navigating in Vi, so obviously this is only something to do if it's already your preferred editor.
Thank you for all the work putting this together, and for teaching all us terminal plebs how to kick ass at terminal lol.
Again, thank you!
Your awesome channel popped up in my recommendations. Subscribed!
Loved the "BONUS ROUND!" :)
Thanks for the tips! When I saw the alt+f/b, I realized how annoying it is without it.
About less +F, it's great for one logfile, but I can do tail multiple logs with tail, which is sometimes useful: tail -f /var/log/something/*.log
Super !! Thank you a lot!!!
These were very useful tips.
Nice tips and clean explanation. Thank you
wow this is just wonderful, especially the reset command for me cos lately I have been using a remote shell and it usually gets weird after a while, but I tend to just manage...so this definitely works and I will be using it from now on, thanks!
BONUS tip was the best.
I have the issue all the time especially after using gdb ...
Thank you sir, U've earned a Subscriber
Less +F is brilliant! That will be quite useful for me, thanks.
Sudo!!
I hit the ground
Sudo!!
That awful sound
Sudo!!
My baby shot me down
Awesome vid!! Very helpful!
very informative, i often use for example "ssh " to repeat the last ssh ... command
Nice collection. Thanks for the video!
fabulous presentation - muchas gracias
Thank for the video, I already know someone of this tricks, but others were new.
Fyi, another nice thing about using less over tail is that you can put in some search terms before kicking on the live tail mode and they'll be highlighted.
Ex.
put in a /error|warning|critical
then hit shift+F and as things scroll by, error, warning, and critical will be highlighted.
You can even use & interested of / to filter what you like to see.
| ccze --mode ansi
also does that
I wonder if there is a way to get automatic highlighting like with bat.
Great tut. Very useful
Very handy tips. Appreciated.
Thank you! Very informative.
These are veeeeeery helpful!! Thanks bro :D
cool video bro. 2 min in and I already liked!
Thanks for all your free content :)
Nice examples! Did learn something new! Thank you! I would also mention "Ctrl - r" for searching in .bash_history. Something I use often...
Good work, guy!
Alt . is a winner! Thanks for the vid and the timestamps ^^
The ctrl-x-e trick is great for small modifications to commands from your history as well. You can up arrow, or bang or history | grep or whatever to a previous long gnarly command, then hit ctrl-x-e to make easier surgical modifications to it.
Thanks a lot for these tricks.
Thanks!! really helpful commands!!
Very nice tutorial, thanks
Awesome tips, thanks a lot!
Thanks for 'less +F'. There's also a program called multitail which I have been installing on servers I manage for quite a while. It lets you follow multiple log files at once, also colors.
try using tail -qf foo.log bar.log and it will show new lines to both files ordered, and if one rotates and goes away but appears later keep tailing it, all as if it was just one file
very good tutorial, powerful commands, thank you.
I actually found the --curses tangent to be useful. I have cursed ubuntu myself when it popped up in a gui. Great tips keep up the good work.
extremely helpful! thanks for the great video
Thanks for posting the Cheat Sheet; These things are soo handy for me.
nice vid man, thanks for the tips and keep it up ! :)
Just Wao, I am gonna use em. Thanks Dude!
I thought I knew a lot.... Great video... Thumbs up
You are a blessing, man. Thanks!
Thx for the ctrl-k, ctrl-u, ctrl-w, ctrl-y tip. I didn't know that one. Even works in Zsh.
These were great, thank you.
Helpful man. Thank you.
Thank, I really appreciate less command explanation and would love to see more videos.
bro at first i thought you are gonna say some interesting but not useful stuff, but it was great. Thanks for Sharing , Keep up
Sudo bang bang !
Something can never be forgotten 😂❤
Awesome video man, thank you :)
Thanks for the video. Love it!
Perfect tricks. thank you so much!
great one !!!...thanks for the video 😄
Great idea with the less +F , I prefer using regular old less then pressing shift+G, it takes you to the bottom of the file and you can scroll up without gluing.
Excellent video!
awesome vid man !!!
These tricks saved my day
Great tips. Thanks!
Great vid bro. Thanks!
Really cool! Thanks!
Awesome stuff! Thank you very much :)
I did not know less' +F option. Thanks a bunch, I'm sure that'll come in handy.
This is awesome linux tips.
Good stuff! Also in addition to alt+. you can also do alt+# (as in 1 or 2, not pound) then alt+. and you'll get the next to last argument for 1, second to last argument with 2...and so on.
Dude I'm watching this in 2021 and this super helpful. Kinda regretting went RUclips didn't recommend earlier
haha! thats you! my favorite devtips blogger! i recognize you after singing))))
Nice, subscribed immediately when I saw that Alt-. shortcut
Thanks i learned about ctrl + x + e and less +F.
8:52 LOL "Dammit Ubuntu. Ruin even..." Now I know you're a command-line warrior.
Thanks, man. Good video.
Thanks for sharing!