Three Amazingly Useful Linux Commands (cmp, diff, tput)

Ғылым және технология

In this video, I will discuss three very useful command line utilities: 'cmp', 'diff' and 'tput'. The 'cmp' and 'diff' commands are useful when comparing two files. The 'tput' command is useful if wanting to add some text formatting to terminal output. For example, maybe you want to change the color of the text in a line of output, or change to bold font.
REFERENCED:
► linux.die.net/man/1/cmp
► linux.die.net/man/1/diff
► linux.die.net/man/1/tput
WANT TO SUPPORT THE CHANNEL?
💰 Patreon: / distrotube
💳 Paypal: kzread.info?even...
🛍️ Amazon: amzn.to/2RotFFi
👕 Teespring: teespring.com/stores/distrotube
DONATE CRYPTO:
💰 Bitcoin: 1Mp6ebz5bNcjNFW7XWHVht36SkiLoxPKoX
🐶 Dogecoin: D5fpRD1JRoBFPDXSBocRTp8W9uKzfwLFAu
📕 LBC: bMfA2c3zmcLxPCpyPcrykLvMhZ7A5mQuhJ
DT ON THE WEB:
🕸️ Website: distrotube.com/
📁 GitLab: gitlab.com/dwt1
🗨️ Mastodon: fosstodon.org/@distrotube
👫 Reddit: / distrotube
📽️ LBRY/Odysee: odysee.com/@DistroTube:2
FREE AND OPEN SOURCE SOFTWARE THAT I USE:
🌐 Brave Browser - brave.com/dis872
📽️ Open Broadcaster Software: obsproject.com/
🎬 Kdenlive: kdenlive.org
🎨 GIMP: www.gimp.org/
🎵 Tenacity: github.com/tenacityteam/tenacity
💻 VirtualBox: www.virtualbox.org/
🗒️ Doom Emacs: github.com/hlissner/doom-emacs
Your support is very much appreciated. Thanks, guys!

Пікірлер: 36

  • @GXShade
    @GXShade Жыл бұрын

    I want to say thank you if it wasn't for you and Chris Titus I would not be running Linux as a daily driver

  • @distant6606
    @distant6606 Жыл бұрын

    Intelligence is the ability to avoid doing work, yet getting the work done - Linus Torvalds Automation really saves you tons of time.

  • @kieferhendricks6680
    @kieferhendricks6680 Жыл бұрын

    Great video, DT! Really enjoyed the demonstration of the functions of these commands and seeing them in action.

  • @Phydoux2112
    @Phydoux2112 Жыл бұрын

    tldr (bonus). Keep the shell utilities coming! These are pretty cool!

  • @valentin-catalin1859
    @valentin-catalin1859 Жыл бұрын

    Worth saying that there is also vimdiff and nvim -d alternatives to diff, which you guessed it, it opens the files in 2 vim panes that you can quickly edit.

  • @1toneboy
    @1toneboy Жыл бұрын

    I know what I like in Linux "content", and this is it.

  • @someonestolemyname
    @someonestolemyname Жыл бұрын

    I didn't know about cmp, but probably didn't have a need for it either as I rarely work with binary files in a script. I usually use git-diff when diffing interactively because it uses a pager if the content is too big and color codes the output for you with an easier to read format. If I am merging files I would use nvim-diff instead. I also do not use tput in my script, I find it no more readable than the ANSI escape codes that I usually put in a variable to use. Maybe it is more portable since I have had trouble porting my prompt from bash to zsh.

  • @glidersuzuki5572
    @glidersuzuki5572 Жыл бұрын

    There's also 'delta' which is kinda like modern replacement for diff. Like 'cat' and 'bat'

  • @noah5592

    @noah5592

    Жыл бұрын

    I love delta from my very limited use

  • @donpeer4477
    @donpeer4477 Жыл бұрын

    Good vid, DT. In the GUI, I find Meld highly usable. It marks differences in each and allows me to move those from one to the other, if I so desire.

  • @DistroTube

    @DistroTube

    Жыл бұрын

    Yea, Meld and other similar tools are just GUI programs that leverage the power of command line tools like diff, sed, etc.

  • @Karla_Finch-Cluff
    @Karla_Finch-Cluff Жыл бұрын

    Thank you for this! I see this being so useful the more I learn about Bash, YaY!

  • @Dr_Dude
    @Dr_Dude Жыл бұрын

    'mmv' is a great command as well for renaming a bench of files in one go

  • @ringo8410
    @ringo8410 Жыл бұрын

    That's great! I've been looking for an easy way to output terminal text in color.

  • @JoePescisAngryCousin
    @JoePescisAngryCousin Жыл бұрын

    I love tldr. It's such a useful command; particularly for quickly checking syntax.

  • @n0kodoko143
    @n0kodoko143 Жыл бұрын

    Cool stuff Derek

  • @SL-xv9io
    @SL-xv9io Жыл бұрын

    I am using Linux since almost 25 years, but I just discovered tldr because of your video. Thank you for showing this little tool!

  • @garciajero

    @garciajero

    Жыл бұрын

    you never used/heard of diff?

  • @SL-xv9io

    @SL-xv9io

    Жыл бұрын

    @@garciajero Of course. I guess everybody knows diff 😉 As I wrote in my post: I never heard of tldr (not talking about diff at all). And I am very happy that DT introduced it in this video (even just with a few words and not in the headline).

  • @anon_y_mousse
    @anon_y_mousse Жыл бұрын

    I kind of like seeing the "quiet" output from diff. Usually when I want to see if two text files are the same I use `diff -saq $x $y`. If I were using it in a script I'd probably just case match on the last word, "identical" versus "differ". Although, admittedly that wouldn't be very fast since the return value from the program is much faster to compare.

  • @blt_r
    @blt_r Жыл бұрын

    Can't you just git clone (or git submodule) those repositories, and then run git pull to update them?

  • @siaal5001
    @siaal5001 Жыл бұрын

    Just a heads up, your for loop could be a lot faster if you replaced it with GNU parallel

  • @chimak111

    @chimak111

    Жыл бұрын

    Thank you!

  • @theodorealenas3171
    @theodorealenas3171 Жыл бұрын

    Wait! I recently found a command that outputs unique lines between files, and I recall it was cmp with no arguments. What was it?

  • @luka6775
    @luka6775 Жыл бұрын

    I wonder when dt will switch to wayland

  • @max_ishere
    @max_ishere Жыл бұрын

    TLDR package sounds more like someone needs to go and add examples section to the manpage

  • @lqlarry
    @lqlarry Жыл бұрын

    Ok, you be first.

  • @starrymohannad
    @starrymohannad Жыл бұрын

    what does nc stands for ??

  • @DistroTube

    @DistroTube

    Жыл бұрын

    "nextcloud" Everything in that directory is synced to my Nextcloud server and I have that "nc" directory on my home computer as well as my office computer.

  • @starrymohannad

    @starrymohannad

    Жыл бұрын

    @@DistroTube Oh... Ok :D I also have a Sync Folder for Syncthing it Helps with Declutering Home :>

  • @wherestheshroomsyo

    @wherestheshroomsyo

    Жыл бұрын

    @@starrymohannad I thought you meant nc as in netcat at first. That's a pretty cool command.

  • @MerkDolf
    @MerkDolf Жыл бұрын

    😅 👌 👍

  • @RafaCoringaProducoes
    @RafaCoringaProducoes Жыл бұрын

    13:00 tput if anyone cares

  • @sergedmytrienko5605
    @sergedmytrienko5605 Жыл бұрын

    cmp file2 file2 && echo TRUE || echo FALSE, if is not needed

  • @garciajero
    @garciajero Жыл бұрын

    you can speed up this greatly instead of `for i in $(find| ls | whatever)` do ` find . | xargs -P100` for example

Келесі