What Makes A Good Cli Tool | Prime Explains

  Рет қаралды 67,396

ThePrimeTime

ThePrimeTime

Күн бұрын

Пікірлер: 158
@Anteksanteri
@Anteksanteri Жыл бұрын
It's weird how many developers don't even know how to use the command line.
@CottidaeSEA
@CottidaeSEA Жыл бұрын
It's nice to be among developers who don't know how to use them, because I can basically be a magician who gets information out of seemingly nowhere in an instant. To those who know, I just used grep.
@Beefster09
@Beefster09 Жыл бұрын
it's forgivable coming from a junior dev, but I facepalm in shock when I see it coming from someone who has been in the industry for 20+ years
@ardnys35
@ardnys35 Жыл бұрын
we have been spoiled with fancy graphics and it only gets more and more unfamiliar. plus no one really teaches it.
@CottidaeSEA
@CottidaeSEA Жыл бұрын
​@@ardnys35 I think some people also find it daunting since CLI tools are quite volatile. They do exactly what you tell them to do without questioning anything. That's also why they are great (besides being fast) but you can mess things up if you do the wrong thing. Then again, people seem to be less afraid of SQL despite being able to nuke an entire table by forgetting to add WHERE.
@Euphorya
@Euphorya Жыл бұрын
I die a little inside every time my manager says "that's nice, but does it have a GUI?"
@livingcodex9878
@livingcodex9878 Жыл бұрын
Well that was an epic nugget of knowledge. Can we get more of that please?
@FractalWanderer
@FractalWanderer Жыл бұрын
Agreed!
@hoimar8710
@hoimar8710 Жыл бұрын
Please do the frontend masters course for writing good unixoid CLI tools! Including golden shower tests!
@cg219
@cg219 Жыл бұрын
I want to put in my vote for the Frontend Masters course on this. Thanks!
@fennecbesixdouze1794
@fennecbesixdouze1794 Жыл бұрын
@3:25 You can accomplish the same thing with shell redirections, or *gasp* the dreaded cat piping. All tools should start with stdin and stdout. If you really wanna build in file handling fine, but you don't have to.
@joaomacedo673
@joaomacedo673 Жыл бұрын
Yeah. Moreover, when I heard him say that using files functionality support is cool for integration tests I was wondering "well, but you are not testing stdin input that way". And with pipe redirection you actually can.
@luigidabro
@luigidabro 8 ай бұрын
Never underestimating the power of piping. But specifying stdin to be a file can be useful. On cmd or powershell 1.0, piping removes all non-ascii characters.
@Jmcgee1125
@Jmcgee1125 Жыл бұрын
It's called tee because it makes a T. Data flows across the top of the T (from stdin to stdout), but also gets duplicated out the bottom (to a file). Super useful, and not just for :w !sudo tee %
@xenio8736
@xenio8736 Жыл бұрын
wait wha's the point of :w !sudo tee % ?
@Jmcgee1125
@Jmcgee1125 Жыл бұрын
Save a root-protected file if you opened vim as a normal user.
@sempiternal_futility
@sempiternal_futility Жыл бұрын
very good explanation actually
@theodorealenas3171
@theodorealenas3171 Жыл бұрын
Wait, :w can write into the stdin of a shell command?
@Jmcgee1125
@Jmcgee1125 Жыл бұрын
@@theodorealenas3171 It can! It can even do it for range writes (i.e. writing from visual line mode), if you only want to send a segment.
@Forquare
@Forquare 5 ай бұрын
Please can we normalise man pages with CLI tools - I honestly don't think a tool should reach v1 without a man page. I don't want to figure out what your help flags are and have a ton of scollback maybe printed to stdout or maybe to stderr, I just want to write `man ` and use my favourite $PAGER to browse the options, example usage, etc.
@kc3vv
@kc3vv Жыл бұрын
Thanks to you I recently came to enjoy gnu parallels to parallelise some build scripts.
@thingsiplay
@thingsiplay Жыл бұрын
The Unix philosophy is like functional programming.
@simonfarre4907
@simonfarre4907 Жыл бұрын
It's an apt description, indeed of the Unix philosophy.
@bitti1975
@bitti1975 Жыл бұрын
If I'd categorize it, I'd file it under 'Dataflow programming' but that's a more or less orthogonal concept.
@ripplecutter233
@ripplecutter233 Жыл бұрын
the issue isn't the pipelines, it's all the basic commands you have to learn. takes time to remember them all (the basic ones). but once you know em then yeah it's pretty much functional programming
@simonfarre4907
@simonfarre4907 Жыл бұрын
​@@bitti1975 I think you're misunderstanding / misusing the term orthogonal. Because "dataflow programming" is most certainly a core tenet of FP. Clear input and output. Referential transparency and all. These are not unrelated. But I guess you could say it's a simplified description of FP, instead. That being said, I don't think anybody had FP in mind when the Unix Philosophy was "created" as it were.
@fennecbesixdouze1794
@fennecbesixdouze1794 Жыл бұрын
Yep. UNIX's shell redirects and pipes can be derived formally as an I/O monad. It's not a matter of opinion: it's exactly, formally, provably like functional programming
@notapplicable7292
@notapplicable7292 Жыл бұрын
This is really useful as someone who's recently working on CLI tools.
@JordanShurmer
@JordanShurmer Жыл бұрын
Thanks for sharing this. Imagine reading this tip as an article when you can watch a video instead... oh man
@pbnjdev
@pbnjdev Жыл бұрын
"Command-line Tools can be 235x Faster than your Hadoop Cluster" -Adam Drake
@McHorsesCreations
@McHorsesCreations Жыл бұрын
He didn’t said “-agen” 😭😭😭
@AloisMahdal
@AloisMahdal Жыл бұрын
I believe the right way to call tee(1) is `tee hee`.
@nixoncode
@nixoncode Жыл бұрын
all great developers understand how unix works
@abdelazizlaissaoui9079
@abdelazizlaissaoui9079 9 ай бұрын
Where to learn more about those things???
@barrykp
@barrykp Жыл бұрын
Would love a course on tooling!
@Omikronik
@Omikronik Жыл бұрын
this is the kind of advice I love mr prime for.
@0dsteel
@0dsteel Жыл бұрын
This casual 4 and a half minute vod has more useful information than hours long tutorials
@Jason_Kang
@Jason_Kang Жыл бұрын
PLEASE do a course on writing dev tools! 🙏🙏🙏
@ripplecutter233
@ripplecutter233 Жыл бұрын
a good cli tool can easily integrate into a pipeline.
@JoaoJGabriel
@JoaoJGabriel Жыл бұрын
I'm glad this became a KZbin video-AGEN
@aus10d
@aus10d Жыл бұрын
very helpful tips. thank you prime!
@laughingvampire7555
@laughingvampire7555 Жыл бұрын
gnu parallel is used a lot in bioinformatics or other scientific computing areas, they make a script in python or perl and then gnu parallel.
@eloniusz
@eloniusz Жыл бұрын
C++ has two stream outputing to stderr "std::cerr" and "std::clog". The latter one really makes it clear that this is where the logs should go to (and not to "std::cout").
@dealloc
@dealloc Жыл бұрын
POSIX compliance is a must.
@peteradam4740
@peteradam4740 Жыл бұрын
Please do that course :)
@ShadowKestrel
@ShadowKestrel Жыл бұрын
I'm a little confused on the inclusion of optional file reading/writing - would it not be simpler to only support stdio at the program level, then use angle brackets or cat/tee for if you want files? To me it seems that would also follow "do one thing and do it well", although with how often I see the pattern it seems more likely I'm just missing something here
@kuhluhOG
@kuhluhOG Жыл бұрын
speed/throughput just go and test the difference of: cat some_file | grep some_regex vs grep some_regex some_file
@ShadowKestrel
@ShadowKestrel Жыл бұрын
@@kuhluhOG that's a useless use of cat - of course it's less performant than redirections. I actually see slightly improved performance with redirections instead of file argument, although it's the difference between averaging 1.21s and 1.23s (maybe zsh caching, maybe some reduced syscalls, don't really know why)
@CramBL
@CramBL Жыл бұрын
@@ShadowKestrel point still stands. Maybe you want to run something multiple times on some compressed data, you could use lz4 -d -c | debug-tool or you could decompress to a file first and then save decompression overhead, piping IO overhead (which is very significant), and you enable some really powerful optimizations such as memory mapping or pre-allocation based on file size etc.
@trapexit
@trapexit Жыл бұрын
Because redirection is a function of the shell and not all usage of the tool is within the shell.
@Drummerx04
@Drummerx04 Жыл бұрын
It's useful for a few reasons. Off the top of my head, you can specify multiple input files at once, you give explicit options for anyone using your tool in a script, and the tool would likely behave better when not being launched from a full shell environment.
@Dev-Siri
@Dev-Siri Жыл бұрын
My comment is, I cannot believe prime made this a youtube video.
@gamemoves2415
@gamemoves2415 Жыл бұрын
Please do the course. Would be very happy
@mvargasmoran
@mvargasmoran Жыл бұрын
You said Golden Shower, I google that, it was nothing about software testing. 🥺
@codedbyshoe
@codedbyshoe Жыл бұрын
We need a "last cli class you'll ever need"
@chrisE815
@chrisE815 Жыл бұрын
Lithium batteries, interchangable heads, pulsing and vibration functions, ....Oh sorry I misread the video title .
@trapexit
@trapexit Жыл бұрын
re: tee... yes! or at least write a script which writes data out if not already stored. Too often people try to consume and process data in the same loop and it puts unnecessary strain on the data source and complicates debugging. Just write it out somewhere and use that. I wouldn't call it a "break point" but I understand what is meant by it. It's literally a T... like a pipe T... 1 input and 2 outputs of the same data. The syscall does the same.
@chrissaltmarsh6777
@chrissaltmarsh6777 Жыл бұрын
To learn this, fire up a unix machine from, uh 35 years ago and do some work. Those ideas are utter gold. And have short options. '-v' is a hell of a lot quicker on a 2400 baud VT100 than '--version' (But I am ancient)
@Howtheheckarehandleswit
@Howtheheckarehandleswit Жыл бұрын
I'm always torn on the file escapes thing. Because it does kinda feel like it violates the UNIX philosophy to integrate that into my program when I could always replace "foo --input ./bar --output ./baz" with "cat ./bar | foo > ./baz", but that does also make it kind of a pain to use on files
@joshix833
@joshix833 Жыл бұрын
Cat is for concatinating not for reading single files. foo < ./bar > ./baz
@Howtheheckarehandleswit
@Howtheheckarehandleswit Жыл бұрын
@@joshix833 No one ever bothered to teach me the
@theodorealenas3171
@theodorealenas3171 Жыл бұрын
​@@Howtheheckarehandleswitoof. I felt that one, I started using it after a year of using Linux, or more
@fuutek9171
@fuutek9171 Жыл бұрын
please do a tips n tricks for common cli tools like grep
@benjaminemori9089
@benjaminemori9089 Жыл бұрын
Watching you alone brings me a whole level of inner joy!😂
@ItaloPenna
@ItaloPenna 11 ай бұрын
A good CLI tool also must return a signal. Returning a good defined integer is awesome . Sometimes you don't give a 5hit about strings. ( Windows programmers nowadays have no clue about this.)
@markmcdonnell
@markmcdonnell Жыл бұрын
tee has been my secret sauce since forever
@NicolasRuizX
@NicolasRuizX Жыл бұрын
Please do the course!!!
@sorosbo
@sorosbo Жыл бұрын
Your best video so far ⚒️ thanks
@marlo3898
@marlo3898 Жыл бұрын
The good old Golden Shower Test
@nomomcarver
@nomomcarver Жыл бұрын
good advice
@dtomvan
@dtomvan Жыл бұрын
damn, i knew about tee but never thought of it as a "pipe-breakpoint" I always have to refetch a big pipeline 😔
@breakoutgaffe4027
@breakoutgaffe4027 3 ай бұрын
Yes to more tooling pls
@Keversez
@Keversez Жыл бұрын
make a course on this homie
@Darthtrooper14
@Darthtrooper14 Жыл бұрын
What do I need to do to end up working on stuff like this? I'm really bored at my current job (make one webapp finish next, do it super fast so the project is cheap)
@EivindGussiasLkseth
@EivindGussiasLkseth Жыл бұрын
Do you have a sample repo to look at?
@gabumon9210
@gabumon9210 Жыл бұрын
hey i work as a web dev with 2 years experience. but i feel, im so lack about how actually that thing work or how to make something other than a web server or web client. maybe because i started learning programming trying to build a website. primeagen video appear on my youtube home, and i think he is what we called an engineer or a dev not just 'react dev' or etc. What step should i go to learning this kind of thing ? i mean like memory, gc, and many more i hope you know what i mean I hope anyone here who have lot of experience as 'software engineer' can tell me what should i learn first and the learning path.
@abcdefg-nu4xj
@abcdefg-nu4xj Жыл бұрын
It all comes down to understanding the fundamentals, understanding c, assembly, memory management, compilers and operating systems, even some hardware and cpu architectures, can give you insights about how your browser and JS engine works (both implemented in c++ utilizing many fundamental concepts mentioned above) that the absolute majority of ‘exclusively web devs’ will never try to begin to understand. It can enhance the quality of your code, broaden the things you can do and make it easier and faster for you to learn new technologies. Those who took a CS degree had to go through a few semesters of learning the fundamentals. Prime has a CS degree so he had to go through that too. However a CS degree is absolutely not mandatory to get a deep understanding of fundamentals since everything exists online
@gabumon9210
@gabumon9210 Жыл бұрын
@@abcdefg-nu4xj hey, thanks for the answer ! I think you are right, i lack everything about computer scince since i learn programming not from cs degree I search on youtube and harvard make a video about CS with 24h long. I hope it can help me to learn some computer science. Thank you for your answer 😄
@abcdefg-nu4xj
@abcdefg-nu4xj Жыл бұрын
@@gabumon9210 i would suggest taking it one step at a time, dedicate a few days to learning c well, focusing on pointers and memory. Then maybe try and implement a few data structures (dynamic array, hashtable, red-black tree) and algorithms from scratch with c, then you can go a little lower level and learn assembly , focus on how your C code translates to assembly, this is a great chance to learn about CPU architecture and get a deeper knowledge about memory. The next thing from here is to learn about operating systems, namely linux. First learn how to interact with the OS as a “user” with syscalls to spawn threads, manage memory and IO. Then, with your knowledge of c, data structures and sssembly you can go deeper and learn how central parts of the OS are implemented, how it manages threads, I/O , memory, etc. Each step might take you a few weeks or months to get right but once you’re done you will have a strong foundation to learn about things that build on those fundamentals like networking, compilers, virtual machines, web browsers, etc Anything that interests you Your learning sources should be yt videos, free (or paid) courses and books
@Anton_Sh.
@Anton_Sh. 10 ай бұрын
What is that drawing app he is using?
@xybersurfer
@xybersurfer Жыл бұрын
but where do status updates fit into this?
@TheNewton
@TheNewton Жыл бұрын
what kind of football play is that? 0:22
@seg_fault_jim
@seg_fault_jim Жыл бұрын
@primetime do a video showing this in code - that would help people understand
@Tetsomina
@Tetsomina Жыл бұрын
Someone send this man a weebo tablet for these excalidraw moments 😂
@yaksher
@yaksher Жыл бұрын
Why put in all the effort for file inputs and outputs? Isn't that what redirects are for? And like, sure, redirects don't support multiple files for standard in, but you can just use cat for that, no?
@joshix833
@joshix833 Жыл бұрын
Most of the time yes. But e.g. grep needs file arguments to be able to show source files and lines.
@billeterk
@billeterk Жыл бұрын
Sometimes you do need to seek though
@yaksher
@yaksher Жыл бұрын
​@@joshix833 Sure, but that's an exception; that's not a reason to bake it into most tools
@yaksher
@yaksher Жыл бұрын
@@pineberryfox I suppose it's slightly more convenient with xargs but can't you also just do a cat with xargs? But fair enough
@yaksher
@yaksher Жыл бұрын
@@billeterk If you need to seek then presumably your tool would only take files?
@SimGunther
@SimGunther Жыл бұрын
If only there was a language that outlined CLI commands like this drawing... bash/zsh/csh/fish do not count in this regard for those wondering
@ersstuff
@ersstuff Жыл бұрын
Amazing diagram!
@adjbutler
@adjbutler Жыл бұрын
please do the 'good tools' course... I would pay big dollars for you to do it!!!!
@TorkilZachariassenTZNG
@TorkilZachariassenTZNG Жыл бұрын
Jźzz ... programs read stdin/file and output to stdout/file and stderr. That's what the professor told is in 1982 teaching Pascal and Fortran simultaneously
@4444kik
@4444kik Жыл бұрын
Real talk, how many developers watching this video who have a job didn't know and use parallel and tee at least once already (not necessarily together)? As a Linux guy I know my command line like the back of my hand, but not every developer is a Linux guy. I know 2 other developers personally and one of them is really not familiar with it at all and the other knows enough to get the job done but hates using it, or so he tells me. I'm curious what the demographic here is like.
@NancyPetty-c7n
@NancyPetty-c7n 2 ай бұрын
Gutmann Cliff
@mvargasmoran
@mvargasmoran Жыл бұрын
Teez Nutz
@eqprog
@eqprog Жыл бұрын
Inversed whiteboard
@uuu12343
@uuu12343 Жыл бұрын
I use CLI utilities like there's no believing
@kj_sh604
@kj_sh604 Жыл бұрын
pipe is the only way to pipe
@bicube7529
@bicube7529 Жыл бұрын
ok, i'm too junior to understand, need some code examples. anyone konws a github repo that shows what he said?
@NomadSWE
@NomadSWE Жыл бұрын
Windows Terminal ftw
@adamgrey268
@adamgrey268 Жыл бұрын
lessssgoooooooooo!
@Cammymoop
@Cammymoop Жыл бұрын
I want to write a better cli calculator but i know i shouldn't
@ליעדדמבין-ש8ד
@ליעדדמבין-ש8ד Жыл бұрын
Personally I use python for calculations in the cmd just the standard repl/IPython
@daleryanaldover6545
@daleryanaldover6545 Жыл бұрын
Most languages (php, ruby, python) or frameworks (node, laravel artisan) have interactive shells, just input an expression and voila calculation complete
@Cammymoop
@Cammymoop Жыл бұрын
@@ליעדדמבין-ש8ד I use the python repl too, I just have the craving to make something with a better interface. auto implied last result, proper juxtaposition multiply, lists and automatic mapping of scalar functions, cli option to output a cleaned version of last session, etc Which is why I definitely shouldn't, I don't think I actually have that kind of time
@billeterk
@billeterk Жыл бұрын
Depends on your metrics for good but qalc is pretty awesome for a semi reliable DWIM calculator
@Cammymoop
@Cammymoop Жыл бұрын
@@billeterk That does look pretty darn good, thanks
@joaovmlsilva3509
@joaovmlsilva3509 Жыл бұрын
I feel like I'm missing 90% of the context here.
@Swifter101
@Swifter101 Жыл бұрын
you look a gta character
@thomas-hall
@thomas-hall Жыл бұрын
File in/out is just duplicating stdin/out
@DarrenJohn10X
@DarrenJohn10X Жыл бұрын
git push faster way of doing things into brain MERGE CONFLICT
@zeyadkenawi8268
@zeyadkenawi8268 Жыл бұрын
parallel sucks I use xargs
@eduardocosta9078
@eduardocosta9078 Жыл бұрын
Just dropping a comment to be the first.
@kollpotato
@kollpotato Жыл бұрын
potato
@yusufcansert9276
@yusufcansert9276 Жыл бұрын
You are only talking, code once ıf you can
@tropicaldog430
@tropicaldog430 Жыл бұрын
🥴
@deistormmods
@deistormmods Жыл бұрын
those are most of his videos. he doesn't really do programming and if he does, he's constantly talking to the chat. its a different type of channel and it isn't for everyone.
@c0ldfury
@c0ldfury Жыл бұрын
this is wrong on so many levels. when processing a file, the stdin and stdout IS the file stream. there's no separate channel for files.
The BEST CLI Tool
9:50
ThePrimeTime
Рет қаралды 209 М.
Projects Every Programmer Should Try
16:58
ThePrimeTime
Рет қаралды 516 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 95 МЛН
Увеличили моцареллу для @Lorenzo.bagnati
00:48
Кушать Хочу
Рет қаралды 8 МЛН
Don't underestimate anyone
00:47
奇軒Tricking
Рет қаралды 19 МЛН
9 AMAZING COMMAND LINE TOOLS for Linux
17:09
The Linux Experiment
Рет қаралды 117 М.
Thoughts About Unit Testing | Prime Reacts
11:21
ThePrimeTime
Рет қаралды 234 М.
My Best Decision Professionally
5:40
ThePrimeagen
Рет қаралды 153 М.
7 Amazing CLI Tools You Need To Try
18:10
Josean Martinez
Рет қаралды 393 М.
This may be my favorite CLI tool ever
8:15
typecraft
Рет қаралды 90 М.
Writing a CLI App in Rust! - Part 1
17:44
Let's Get Rusty
Рет қаралды 79 М.
12 GREAT command line programs YOU recommended!
16:25
The Linux Experiment
Рет қаралды 294 М.
Why I Use Golang In 2024
9:21
ThePrimeTime
Рет қаралды 350 М.
7 Essential Command Line Tools (2022)
9:12
Tech Craft
Рет қаралды 222 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 95 МЛН