My 5 Favorite Linux Shell Tricks for SPEEEEEED (and efficiency)

  Рет қаралды 647,811

tutoriaLinux

tutoriaLinux

Күн бұрын

Пікірлер: 732
@tutoriaLinux
@tutoriaLinux 6 жыл бұрын
~~~ Timestamps to specific sections are in the description! ~~~
@planktonfun1
@planktonfun1 6 жыл бұрын
ctrl+a and ctrl +e goes to the start and last, I find myself using this most
@chaoswires2734
@chaoswires2734 6 жыл бұрын
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.
@noele2980
@noele2980 6 жыл бұрын
i literally screamed when i learned the kill / yank
@DaleHawkins
@DaleHawkins 6 жыл бұрын
Becoming proficient in emacs makes the editing commands second nature. 🙂
@priit7777
@priit7777 3 жыл бұрын
@@planktonfun1 but why? your keyboard also doesn't have home and end keys? much easier than some ctrl combinations.
@hellangel28
@hellangel28 6 жыл бұрын
i really love the fact that you wrote exactly what you are going to explain in the description with timestamps!
@weasel6205
@weasel6205 3 жыл бұрын
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.
@whiskeytuesday
@whiskeytuesday 6 жыл бұрын
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.
@jplflyer
@jplflyer 3 жыл бұрын
I've been programming professionally for 40 years, most of that in the Linux world, and it's amazing the learning process never ends.
@JerryPenna
@JerryPenna 3 жыл бұрын
Yeah, I’ve used less a ton but not with other flags. I tried less +F but didn’t work.
@allen_joji
@allen_joji 2 жыл бұрын
Do you still love programming ?
@jplflyer
@jplflyer 2 жыл бұрын
@@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.
@ernestogutierrez7877
@ernestogutierrez7877 3 жыл бұрын
you had me at `sudo !! ` shaking my head at the amount of time i've wasted not knowing about this...
@GBGSK
@GBGSK 6 жыл бұрын
> Bang bang > password shot me down > Sudo .. BANG BANG "Torvald Sinatra"
@karlheinzneugebauer
@karlheinzneugebauer 3 жыл бұрын
BANG BANG rather reminds me of "Rammstein - Feuer Frei"
@vass0922
@vass0922 3 жыл бұрын
@@karlheinzneugebauer hey thanks thats a great way to remember that!
@hayksk
@hayksk 3 жыл бұрын
Nancy Sinatra :) ?
@karlheinzneugebauer
@karlheinzneugebauer 3 жыл бұрын
@@hayksk Had to google who that is. Appears to be the daughter of Frank. Interesting.
@hayksk
@hayksk 3 жыл бұрын
@@karlheinzneugebauer Yes, she is.
@mostafafarzan5363
@mostafafarzan5363 3 жыл бұрын
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.
@Barbarian.Streisand
@Barbarian.Streisand 4 жыл бұрын
i could definitely have a beer with this guy.
@cgme7076
@cgme7076 3 жыл бұрын
Yeah, he seems like a cool guy
@momashi69
@momashi69 6 жыл бұрын
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!
@joachimjohansen5796
@joachimjohansen5796 6 жыл бұрын
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.
@elijah11162
@elijah11162 3 жыл бұрын
11 minutes later and I don't know how I survived without these tricks for so long. Great stuff man
@jony7779
@jony7779 6 жыл бұрын
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.
@SeanNicholsEh
@SeanNicholsEh 6 жыл бұрын
Can't believe I just upvoted a guy for messing up my terminal... XD
@tobiaskrischer9950
@tobiaskrischer9950 6 жыл бұрын
could not confirm: root@debootstrap:~# sleep 1 | vim -bash: vim: command not found root@debootstrap:~# /s
@iam3377
@iam3377 4 жыл бұрын
Vim is seriously the best text editor
@aeelinnannelie5651
@aeelinnannelie5651 4 жыл бұрын
It does not happened to me. Maybe because I have Neovim installed
@twb0109
@twb0109 3 жыл бұрын
@@iam3377 laughs in nvim
@HenrikAlsingFriberg
@HenrikAlsingFriberg 6 жыл бұрын
"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.
@tutoriaLinux
@tutoriaLinux 3 жыл бұрын
Solid advice! Will try to re-wire my brain to try it out.
@sarthaks95
@sarthaks95 3 жыл бұрын
Both are useful but for different cases. Clear entire arg or go word by word. Personally I use both depending on the case.
@rcatyvr
@rcatyvr 3 жыл бұрын
I use a Mac terminal and there is no Alt key, but ^w works just fine enough for me
@novimartyn
@novimartyn 3 жыл бұрын
@@rcatyvr On the Mac I think you need to use Escape instead of Alt
@ernestdesouza8888
@ernestdesouza8888 3 жыл бұрын
@@rcatyvr dump Ur mac if ur using Linux ! Actually anything is fine ...depends on the person !!!
@ChunkyDrew33136
@ChunkyDrew33136 5 жыл бұрын
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.
@tobiassinghania3698
@tobiassinghania3698 6 жыл бұрын
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.
@josephknightcom
@josephknightcom 6 жыл бұрын
thanks
@frydac
@frydac 3 жыл бұрын
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..
@tobiassinghania3698
@tobiassinghania3698 3 жыл бұрын
@@frydac yes, fzf is really awesome in various regards :)
@DDBAA24
@DDBAA24 5 жыл бұрын
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.
@AleksandarBosakov
@AleksandarBosakov 6 жыл бұрын
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!
@AndrewDeFaria
@AndrewDeFaria 3 жыл бұрын
Good video. I learned a couple of new tricks! One trick I knew already and always use is the Alt- thing. I describe it to others this way - Alt- brings up the last "word" of the previous command. Think of it as an object. So you do ls /tmp/file. Now /tmp/file is the object. Want to know more about the object? Type ls -l Alt-. Contents? - more (or less) Alt-. File's junk - rm Alt-. But what's more is say you have this in your history: 501 touch /tmp/file 502 ls /tmp/file 503 echo file? 504 uname -a 505 history Typing Alt- at the command prompt will bring forth "history". But typing another Alt- will bring up "-a". Another one and you get "file?". One more and you get "/tmp/file". So if you want that Alt- object because it was say a filename object but it was not the last word of the immediately preceding command then keep hitting Alt- until you get back that file object.
@locusinbloom
@locusinbloom 6 жыл бұрын
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.
@TheDave000
@TheDave000 6 жыл бұрын
How did I not know about less +F? This literally changes everything in my job!
@nonconsensualopinion
@nonconsensualopinion 3 жыл бұрын
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.
@SJmurov
@SJmurov 3 жыл бұрын
@@nonconsensualopinion But does it follow?
@edgarbonet1
@edgarbonet1 5 ай бұрын
I learned about `less +F` by reading `man less`. I may be a weirdo, I read man pages. ;-)
@EdselAdap
@EdselAdap 3 жыл бұрын
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!
@KirtFitzpatrick
@KirtFitzpatrick 3 жыл бұрын
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.
@tildessmoo
@tildessmoo 6 жыл бұрын
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.
@IRgEEK
@IRgEEK 6 жыл бұрын
Fantastic post Man! Wanted some Ninja tricks to share with my Students tomorrow and these are perfect! Thanks so much!
@vrvrvr81
@vrvrvr81 6 жыл бұрын
first useful shell video tutorial I ever ran into
@felaflame
@felaflame 6 жыл бұрын
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.
@donaldwebster2866
@donaldwebster2866 3 жыл бұрын
If your terminal is really borked, you may need to use Ctr-J (before and after reset) instead of as in: reset. Also, G and 1G in less are super useful, being go to the end or beginning of a file. I like Alt-. I might start using that instead of !$ The other bang command is ! which is insert the last command that starts with . In you one example, if find wasn't the previous command, you could have run "sudo !find" or what I do many times is "!le" to run my last less command; likewise "!ls"
@AjitV
@AjitV 3 жыл бұрын
BONUS tip was the best. I have the issue all the time especially after using gdb ... Thank you sir, U've earned a Subscriber
@Colony28
@Colony28 5 жыл бұрын
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
@ryanbard3560
@ryanbard3560 6 жыл бұрын
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.
@beeeeep
@beeeeep 6 жыл бұрын
You can even use & interested of / to filter what you like to see.
@ALTracer
@ALTracer 5 жыл бұрын
| ccze --mode ansi also does that
@KirtFitzpatrick
@KirtFitzpatrick 3 жыл бұрын
I wonder if there is a way to get automatic highlighting like with bat.
@RedStefan
@RedStefan 5 жыл бұрын
Sudo!! I hit the ground Sudo!! That awful sound Sudo!! My baby shot me down
@zerbitx
@zerbitx 3 жыл бұрын
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.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 3 жыл бұрын
4:51 A few further tips with less: * I like to add the -i and -X options. -X stops it clearing the screen when it exits, and -i means searches are case-insensitive. In fact, I like to have the alias “more='less -iX'” defined, since I don’t see the point in the standard “more” command. * The +F option corresponds to pressing F while already in less. This is true of all the options beginning “+”: they correspond to keystrokes you type within a less display. Another useful one is +G, to start viewing the file from its current end.
@sarundayo
@sarundayo 6 жыл бұрын
Just came across this channel and I love it! Thanks for showing us how wonderful Linux can be and how to use it.
@kleetus88
@kleetus88 6 жыл бұрын
as an adjunct to !!, I find I use !$ A LOT. This handy thing refers to the last argument on the last command. e.g. mkdir -p /home, then cd !$. This will be equiv to cd /home.
@jonatansmithtubed
@jonatansmithtubed 3 жыл бұрын
Try 'ESC + .'
@KirtFitzpatrick
@KirtFitzpatrick 3 жыл бұрын
@@jonatansmithtubed What's esc + do?
@jonatansmithtubed
@jonatansmithtubed 3 жыл бұрын
Kirt, it is "ESC" and the "." (dot) Repeat last argument
@aronhegedus
@aronhegedus 4 жыл бұрын
I already know I'm going to use that command line yanking so much, thank you!
@htl2001
@htl2001 6 жыл бұрын
less -n helps a TON on large files (doesn't count line numbers). -S can be useful in logs as well (no wrap)
@codeman99-dev
@codeman99-dev 3 жыл бұрын
I almost always use `less -FRS` -F will "quit if one screen" or "there is no need for scrolling" -R will allow correct width calculation of control characters. Especially useful if you are piping a command and still want the color output.
@JerryPenna
@JerryPenna 3 жыл бұрын
Ok I’ve been using less longer than I want to admit. Will try “less -FRS”. 😂
@Breemskin
@Breemskin 2 жыл бұрын
Less +F is brilliant! That will be quite useful for me, thanks.
@dukercs
@dukercs 3 жыл бұрын
Thank you!!! This video should never die!
@codenamelambda
@codenamelambda 6 жыл бұрын
My recommendation for vim users: add ```set -o vi``` (or something like that, too lazy to look it up) to your bashrc, and use your favorite vi-keybindings in your shell (press esc to get into normal mode)
@uniquechannelnames
@uniquechannelnames 3 жыл бұрын
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!
@imansh6995
@imansh6995 3 жыл бұрын
bro at first i thought you are gonna say some interesting but not useful stuff, but it was great. Thanks for Sharing , Keep up
@jefferytownsend7787
@jefferytownsend7787 3 жыл бұрын
That Ctrl + K and Ctrl + Y is legit. Thanks.
@Albertux
@Albertux 6 жыл бұрын
One thing to mention, keyboard shortcuts are using emacs key bindings bash, you can run "set -o vi" to have vi key bindings
@tutoriaLinux
@tutoriaLinux 6 жыл бұрын
Yep, I mention that in the basics tutorial linked at the beginning of the video -- but it's useful to have here as well. Thanks!
@davidmaxwaterman
@davidmaxwaterman 6 жыл бұрын
Yeah, it seems really odd to see him use Emacs on the command line but then use vi for editing. Better to be consistent one way or the other, imo.
@bloodgain
@bloodgain 6 жыл бұрын
Well, it's not technically emacs bindings, but readline bindings, which were based on emacs since it was written first. Since it's so ubiquitous in GNU shell apps, it's a good idea to be relatively familiar with it, no matter what your favorite editor is. Using it every day in your shell is a good way to remain familiar. It also means you can walk up to an unconfigured shell (e.g. someone else's) and function normally. Plus, modal editing makes a lot of sense for a file, but less so for your command line, until you need to edit a complicated multi-line command. So I leave my bash settings at the readline default, and just fire up Vim with Ctrl-x,e when I need it -- best of both worlds.
@thomasmarshall4472
@thomasmarshall4472 6 жыл бұрын
bloodgain , I just love that people seem to be re-"discovering" vi{m} again for text editing. Keeping your hands on the primary keys is SUCH a win over getting emacs-pinky and/or lifting your hand up to jump to the arrow keys. Been using it since the 80's, and if only the "vi-like" plugins for IntelliJ and Netbeans worked as well.
@bloodgain
@bloodgain 6 жыл бұрын
Thomas Marshall The Vim plugin for IDEA-based editors like IntelliJ is pretty decent, but I agree that in general they leave a lot to be desired over native Vim. I'd much rather see Vim integrated as an editor. That's not too difficult with emacs, but it's much harder with Vim. I think Neovim is trying to address that; let's hope they succeed! Anecdotally, I find that the kind of people who are lifelong learners tend to take quickly to Vim once they get a taste of modal editing. I'm helping a PhD engineer learn it at work now, and he mostly writes Matlab for us (though he's falling in love with Python, as you might expect).
@awuma
@awuma 6 жыл бұрын
Many thanks! On linux since 1995, yet most of this was new to me.
@sashamc309
@sashamc309 6 жыл бұрын
awuma whoah! you really should have known about !! or Ctrl+W. I'm working on the terminal for 3 years and I knew most of this.
@stefan_dobre
@stefan_dobre 6 жыл бұрын
@@sashamc309 congrats
@JerryPenna
@JerryPenna 3 жыл бұрын
1999 abs same feeling.
@ShamanRing
@ShamanRing 4 жыл бұрын
7:30 for those who got confused on how to leave vim, he hit ESC then hit ":" and type wq then enter.
@leteveryoneknow
@leteveryoneknow 6 жыл бұрын
Thank you for sharing information which is immediately effective and useful.
@CoreDump07
@CoreDump07 6 жыл бұрын
very informative, i often use for example "ssh " to repeat the last ssh ... command
@ManishKumar-uy5io
@ManishKumar-uy5io 3 жыл бұрын
Dude I'm watching this in 2021 and this super helpful. Kinda regretting went KZbin didn't recommend earlier
@simonleonard4084
@simonleonard4084 3 жыл бұрын
I liked the less +F tip, but Ctrl-x-e is what made me follow you
@nnionline
@nnionline Жыл бұрын
Great video even after 4 years. What I learned couple of days ago which is imho really helpful is ALT+#. This adds # at the beginning of the line. It is helpful if you want to keep this line for later without executing it.
@tutoriaLinux
@tutoriaLinux Жыл бұрын
Love it, thanks for sharing! I didn't know about that, and manually do this all the time (ctrl-a to go to beginning of line, then #, then enter). I'll start using that right now.
@toncho1986
@toncho1986 6 жыл бұрын
Nice work, dude! I love your videos, keep it up :D
@dylanwestphal3582
@dylanwestphal3582 3 жыл бұрын
Love these hints and tricks, I'm probably pulling at least a few into daily life - Shot dude!
@aemonge88
@aemonge88 6 жыл бұрын
This works for a chosen default input method. Bash auto set the option "set -o emacs", so you can move in the line like you would move in emacs. For VIM input method like you can set it to vi "set -o vi", then you can move vi style. Important to remap you esc key to some key which is more near to your fingers ( like blocCaps ), since vi heavelly relays on the esc key to switch from and to visual and insert modes
@osquigene
@osquigene 6 жыл бұрын
For tip 5 you can just do "mtr !$" (last argument) or "mtr !*" (all arguments) which both have the advantage of not being terminal dependent (just relies on history). I think even without history "mtr $_" would work. Or you can even have a bit of fun "^ping^mtr^"
@osquigene
@osquigene 6 жыл бұрын
Yes, if you want the detail of that you can refer to 9.3.1 and 9.3.3 in bash manual. You can do stuff like, creating a file: touch A/B/C/d.txt then moving to the directory: cd !$:h # h: Remove a trailing pathname component, leaving only the head. You'll also see: ^string1^string2^ Quick Substitution. Repeat the last command, replacing string1 with string2. Equivalent to !!:s/string1/string2/. Similar things exists for parameter substitution (which I personally only use for file names/paths manipulation): www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion www.tldp.org/LDP/abs/html/parameter-substitution.html You have an example in the documentation that shows how this can be used: www.gnu.org/software/bash/manual/bashref.html#A-Programmable-Completion-Example
@pianochannel100
@pianochannel100 3 жыл бұрын
One of the best projects we had in university was building our own copy of bash (stripped down a bit obviously) from scratch in C. Even though I have built my own, I learn new stuff everytime i see videos like these.
@sampathkumar2506
@sampathkumar2506 5 ай бұрын
I love the content in bash programming playlist🙂..It was really helpful to know the basics in bash programming..!!!
@asanz1665
@asanz1665 6 жыл бұрын
Some of those I didn’t know. You saved me loooots of minutes for sure. Thanks!
@walkerneo
@walkerneo 2 ай бұрын
Great video! Clear, concise, and useful. Learned a few things from it
@stephanerolland9800
@stephanerolland9800 3 жыл бұрын
instead of your suggestion Ctrl + U type sudo Ctrl Ctrl + Y, I would prefer Ctrl + A type sudo then Ctrl + E if I ever have to continue to add stuffs. thanks fro your tip. !! definitely is super useful.
@dawidpomioto1595
@dawidpomioto1595 5 жыл бұрын
Realy cool shortcuts. It helped me a lot. You are great!
@TomGrubbe
@TomGrubbe 3 жыл бұрын
Thx for the ctrl-k, ctrl-u, ctrl-w, ctrl-y tip. I didn't know that one. Even works in Zsh.
@christiansmyth1466
@christiansmyth1466 3 жыл бұрын
some alternatives, if you are old-school (or just old like me) and use "set -o vi"... 1. kisudo 2. D or d0, u to undo 2a.
@rikfomiharbi6077
@rikfomiharbi6077 3 жыл бұрын
Sudo bang bang ! Something can never be forgotten 😂❤
@KingstonFortune
@KingstonFortune 2 жыл бұрын
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!
@neloangelo__13
@neloangelo__13 6 жыл бұрын
Thank you so much Dave for sharing your knowledge, looking forward for future videos. Keep it up mate!
@vincentdeo5740
@vincentdeo5740 6 жыл бұрын
kudos for sudo !! However, I'm reluctant with the ctrl+u, type 'sudo ', ctrl+y. I have the right hand always pretty close to home and end keys. So i'll do home, type in my sudo, then end. Less keypresses !
@DarrensTechTutorials
@DarrensTechTutorials 6 жыл бұрын
sudo !! is the handiest thing ever! Thanks for sharing :)
@sakishrist
@sakishrist 6 жыл бұрын
Why would that be handy? It's the same as up->home->sudo ... I really don't get it
@DarrensTechTutorials
@DarrensTechTutorials 6 жыл бұрын
Just fine it easier to type that rather than up -> home -> sudo, each to their own though :)
@tutoriaLinux
@tutoriaLinux 6 жыл бұрын
I think the advantage is that your fingers don't need to leave the home row, and you don't have to look away from the screen. It seems minor but makes a noticeable difference at higher typing speeds.
@brinckau
@brinckau 6 жыл бұрын
It's handy to know !! because it can be used in any bash command. It has nothing to do with sudo, it's interpreted by bash.
@cupajoesir
@cupajoesir 6 жыл бұрын
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.
@firexfly
@firexfly 6 жыл бұрын
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.
@shanecole401
@shanecole401 3 жыл бұрын
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
@nissieln
@nissieln 3 жыл бұрын
Alt . is a winner! Thanks for the vid and the timestamps ^^
@eduardosanchez9245
@eduardosanchez9245 6 жыл бұрын
Loved the "BONUS ROUND!" :)
@MmmBopsPops
@MmmBopsPops 6 жыл бұрын
Another really handy one is "fc -s PAT=REP" ... if you fat-finger and put: ls /var/log/syslog but you really meant to CAT or LESS it, just type fc -s ls=cat it'll replace the previous command "ls" with "cat", making it: cat /var/log/syslog can be a little dangerous, but a big saver for me - even more-so than sudo !!
@0Hasaname0
@0Hasaname0 3 жыл бұрын
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!
@BibleBeltPearlist
@BibleBeltPearlist 6 жыл бұрын
One that I recently learned that helped a bunch was "~ ." after you lose connection to a remote ssh session. Basically your terminal becomes useless you can't type anything and nothing is happening...press ~ then period and you have your shell back...can't remember if you already mentioned this or not somewhere else.
@tutoriaLinux
@tutoriaLinux 6 жыл бұрын
I LOVE this one, and manage to forget it every single time I actually need it. Should get that tattooed on my hand or something...
@ionsquare
@ionsquare 6 жыл бұрын
One note, it needs to be after a newline, if it doesn't work try pressing enter first. Also if you're connected to another host over ssh and you're using tmux and connecting to other hosts (like two ssh jumps), you can still use this trick to kill the remote ssh sessions by using tmux send-keys. `ctrl+b :` and then at the tmux prompt type `send-keys "~."`
@BantuTu
@BantuTu 3 жыл бұрын
Enter ~ Ctrl-z Suspend an ssh session. Use this alot when doing things on the phone with termux.
@raghavrao5221
@raghavrao5221 3 жыл бұрын
@@BantuTu super useful thanks. I use termux launcher
@yonatanbenporat4889
@yonatanbenporat4889 3 жыл бұрын
Hey It doesnt work for me over putty if I do "~ .", I know that there is a shortcut for that with ~ but I can't find in the internet... Can u say what am I doing wrong?
@LycoLoco
@LycoLoco 6 жыл бұрын
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.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 6 жыл бұрын
8:46 That’s actually a readline feature. ALT-. is the default keybinding for “yank-last-arg”. See the bash docs for other useful readline commands you can bind to keys.
@TimStCroix
@TimStCroix 3 жыл бұрын
My candidate for number 6 would be ^^^ Replaces with in the previous command. Ex: #sudo apt update #^date^grade^ For something this simple you can omit the final ^, so #^date^grade
@fbicknel
@fbicknel 3 жыл бұрын
Try: set -o vi ... vim commands work on the command line rather than trying to remember all the ^stuff control sequences. But ^xe was interesting!
@shanebagel
@shanebagel 2 жыл бұрын
Best channel on KZbin
@RowlandOConnor
@RowlandOConnor 4 жыл бұрын
Enable VI mode in BASH and leverage your existing VIM skills. Save time learning yet more key bindings.
@TheThagenesis
@TheThagenesis 6 жыл бұрын
less will also re-load a file when you press "end" on the keyboard so you can follow at your own pace and not have stuff scrolling by that you can't even keep up. I use F a lot but sometimes this manual refreshing is more appropriate. also: you want to install mtr-tiny instead of mtr on Ubuntu/Debian-based systems
@Tomab89
@Tomab89 6 жыл бұрын
Very handy tips. Appreciated.
@apmechev
@apmechev 6 жыл бұрын
Heads up, ctrl+W uses spaces to delimit words only if your $IFS is equal to [SPACE]. It's the variable (bash) uses to determine what separates bash keywords
@EbonySeraphim
@EbonySeraphim 11 ай бұрын
If you're a capable vim user you should do the following: 1. set -o vi # in your shell (not sure what it is outside of bash) 2. Remap your CAPS LOCK key to CTRL. 3. Understand that you can get to normal mode in your shell by pressing CTRL+[ instead of ESC so you don't have to lift your hand to get there or stretch your left pinky. There ya go. Fast access to command history, with vim motions to edit your command input. Pretty much erases the need to jump into my editor to manage a command.
@WaichiTsang
@WaichiTsang 3 жыл бұрын
These tricks saved my day
@abzs5811
@abzs5811 10 ай бұрын
Some people just aren’t cut out to be teachers Now Colt Steele is a natural born teacher right there.
@xn--nxa
@xn--nxa 6 жыл бұрын
Thank you for CTRL-y. Alt- Alt-. or ``!!:`` is also useful when you need to insert a non-final argument of a previous command.
@tutoriaLinux
@tutoriaLinux 6 жыл бұрын
Ooo, didn't know that; thanks!
@ChrisCox-wv7oo
@ChrisCox-wv7oo 8 ай бұрын
The less instead of tail tip is great.
@rapier992
@rapier992 3 жыл бұрын
ctrl Z suspends the execution of a program example: ./slow_program ctrl+Z # program is suspended, you are back into your shell Now, you can do either fg => brings back the program into the foreground bg => let the program run again in the background, as if you ran ./slow_program & initially you can suspend multiple processes like this, and list them by using the following command: jobs and then use fg 1 for example (pasta@nanotrasen)[21:47:29] ~ $> ls -R / >/dev/null 2>&1 ^Z [1]+ Stopped ls -CF --color=auto -R / > /dev/null 2>&1 (pasta@nanotrasen)[21:47:42] ~ $> jobs [1]+ Stopped ls -CF --color=auto -R / > /dev/null 2>&1 (pasta@nanotrasen)[21:48:05] ~ $> emacs file.txt ^Z [2]+ Stopped emacs file.txt (pasta@nanotrasen)[21:48:11] ~ $> jobs [1]- Stopped ls -CF --color=auto -R / > /dev/null 2>&1 [2]+ Stopped emacs file.txt (pasta@nanotrasen)[21:48:19] ~ $> fg 1 ls -CF --color=auto -R / > /dev/null 2>&1
@joeleenkado5761
@joeleenkado5761 5 жыл бұрын
Thanks for posting the Cheat Sheet; These things are soo handy for me.
@ojkolsrud1
@ojkolsrud1 3 жыл бұрын
ctrl+x+e That was a *really* nice trick. I didn't know about that one! I think it would also be very useful when you're testing things. At least that's my workflow - I'll write my program, but need to test a specific command or something. I then go to just a shell and experiment. I could write a temporary script that does this, but to drop into a temporary file like that, directly from the shell, is probably much nicer.
@hayksk
@hayksk 3 жыл бұрын
Super !! Thank you a lot!!! These were very useful tips.
@TesserId
@TesserId 3 жыл бұрын
8:52 LOL "Dammit Ubuntu. Ruin even..." Now I know you're a command-line warrior.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 6 жыл бұрын
7:38 If you try examining what was entered into your command history, you will see that the 3 lines have been turned into 1 line, with semicolons inserted to separate the statements.
@tomwimmenhove4652
@tomwimmenhove4652 3 жыл бұрын
I did not know less' +F option. Thanks a bunch, I'm sure that'll come in handy.
@mr.w4ttz
@mr.w4ttz 3 жыл бұрын
I like that we almost got to see your auth.log
@bassam.2023
@bassam.2023 3 жыл бұрын
ctrl-k, ctrl-u, ctrl-w, ctrl-y Game changers for me. Thanks!
@marcfoll4348
@marcfoll4348 3 жыл бұрын
less -n tells less to not count lines, makes +F quick on large files. less -j20 tells less to highlight search results 20 lines below the top, gives you context for the results. My default less invocation is less -nj20, never hurts.
@tutoriaLinux
@tutoriaLinux 3 жыл бұрын
These are awesome, thanks for contributing and explaining them!
@cdnuzzo
@cdnuzzo 6 жыл бұрын
These videos are great! Looking forward to more and more in-depth practical and theory based tutorials.
@tutoriaLinux
@tutoriaLinux 6 жыл бұрын
Yeah, I've got some advanced ones coming -- in-depth systemd tutorials, compiling a kernel, writing your own syscalls. Woohoo!
Top 10 Linux Job Interview Questions
16:04
tutoriaLinux
Рет қаралды 2,4 МЛН
Xargs Should Be In Your Command Line Toolbag
16:24
DistroTube
Рет қаралды 102 М.
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
18 Commands That Will Change The Way You Use Linux Forever
29:50
Akamai Developer
Рет қаралды 1,3 МЛН
Vim Basics in 8 Minutes
8:57
tutoriaLinux
Рет қаралды 539 М.
EVERYONE Needs to Learn a Little Bit of AWK!
16:29
Gary Explains
Рет қаралды 400 М.
Why I Switched Back to Bash, And Why You Should Too
10:42
The Linux Cast
Рет қаралды 46 М.
Linux Sysadmin Basics 04 -- Shell Features -- Pipes and Redirection
17:47
A Beginner's Introduction to BASH Shell Scripting
44:24
Joe Collins (EzeeLinux)
Рет қаралды 292 М.
How Do Linux Kernel Drivers Work? - Learning Resource
17:02
LiveOverflow
Рет қаралды 563 М.
Linux Command-Line Tips & Tricks: Over 15 Examples!
31:37
Learn Linux TV
Рет қаралды 222 М.
Become a bash scripting pro - full course
36:00
CODE IS EVERYTHING
Рет қаралды 72 М.
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН