DEV Community

Linux Tips And Tricks

Arpit Mohan on August 23, 2018

It seems that publishing a post of Linux tips & tricks is a rite of passage that all engineers must go through. More importantly, it's a bookma...
Collapse
 
polyluxus profile image
Martin Schwarzer

While the list is quite nice, and I couldn't agree more about vim, these are all standalone programs, not limited to bash.

Maybe worth to mention that you don't need the command colon in less, a simple button press should do in most cases. Also I believe pressing v, should open vi directly from the file. That makes it convenient to just preview, find stuff, and edit right away.

Collapse
 
mohanarpit profile image
Arpit Mohan

Crap, I never realized that I didn't need the colon in the less command. Always used it like vi (muscle memory) and never bothered to check on this. Thanks! #TIL

Collapse
 
polyluxus profile image
Martin Schwarzer

You should see it like this: the Devs of less were clever enough to not make the colon a problem for vi. Probably because they were using vi ;)

Collapse
 
ferricoxide profile image
Thomas H Jones II

I literally cringe every time I see the -exec flag used with find. Pipe your find to xargs. Your system will thank you. :)

Collapse
 
mohanarpit profile image
Arpit Mohan

One of the reasons that I like -exec is that it makes the find command complete in it's own right.

Also, using the syntax find -name "*.java" -exec grep Main {} \+ is equivalent to xargs in terms of performance. Also it's shorter to type as compared to find -name "*.java" -print0 | xargs -0 grep "Main"

Collapse
 
ferricoxide profile image
Thomas H Jones II

I'm an old guy. Even in the early 2000s (nearly 10 years into my career), using find with its -exec flag — rather than piping things through xargs — was a great way to bring a system to its knees. Between the slowness of storage and blowing out the process-table space on the much lower memory systems, at the time, you kind of habituated to shuddering at just the thought of someone using -exec. Painful memories die hard, even when you know the apparent cost barely registers, any more.

Collapse
 
pkristiancz profile image
Patrik Kristian

I didnt know about entr command, i am looking forward to try it. Thank you! :)