Linux shell magic tricks 🪄

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 122

  • @BreadOnPenguins
    @BreadOnPenguins  2 дня назад

    Part 2 is here: ruclips.net/video/c0Q887QsiJU/видео.html&lc

  • @victorramos3110
    @victorramos3110 24 дня назад +8

    I use linux since 2017 and you make me feel I've been using it for couple weeks

    • @BreadOnPenguins
      @BreadOnPenguins  24 дня назад

      There's always more to learn, every so often I read or see something that makes me feel the same haha

  • @matthieujoly
    @matthieujoly 22 дня назад +3

    Discovered recently the "^" trick, I already use some few ones, yet it's always a good thing to have a reminder and to discover another !
    Thanks, great vid !

  • @motokokusanagi2675
    @motokokusanagi2675 24 дня назад +6

    Another one related to braces that I find useful is, let's say you need to create 50 text files inside a folder for any reason, you could run: touch file{1..50}.txt, so in your example it could be: mkdir -p mydir2/dir{1..5}

  • @SlyEcho
    @SlyEcho 14 дней назад +2

    Learned a couple things, definitely!

  • @awauser
    @awauser 24 дня назад +16

    These tips are incredible!
    Here is a cool trick I use:
    As you may know, the pwd command returns the $PWD enviromental variable, but also there's a $OLDPWD variable that stores the previous directory the user was on. That one is parsed by "cd -", as shown on the video. With that, what you can do is use the trap command (or any another) to save $OLDPWD to a file upon exiting the shell session, and then restore it and change directory into it in initialization of new sessions (Note: $OLDPWD gets wiped on exiting). I personally configure those settings on my bash init scripts
    Hope someone finds it useful!

    • @BreadOnPenguins
      @BreadOnPenguins  24 дня назад +2

      Thanks for sharing! That's actually a very good idea, I might use that myself :)

  • @AshesWake-sf7uw
    @AshesWake-sf7uw 24 дня назад +6

    Using Tmux is a great way to save time too and just fly through your work, when working on the terminal! I can't imagine working without tmux now 😂
    Awesome video as always

    • @BreadOnPenguins
      @BreadOnPenguins  24 дня назад +4

      I'll have to cover tmux, definitely one of those must-know-about programs. Thanks! :)

    • @Greenmarty
      @Greenmarty 23 дня назад

      Yep, all Tmux needs are three basic plugins resurrect, continuum and sensible for sessions to survive server reboots and community accepted basic config.

    • @chrisalupului
      @chrisalupului 23 дня назад +1

      Yup this, and switching some keybinds from ctrl+b to like ctrl+a and switching panes with ctrl+arrow keys was mind blowing when I added this lol

  • @KM-sv4dh
    @KM-sv4dh 21 день назад +2

    Nice tips, thanks. I'm saving this video until I get home and experience some of these shortcuts myself.

  • @whiskeylinux
    @whiskeylinux 2 дня назад +1

    Very cool tips. Been watching your catalog, great stuff! Wish you all the best.

  • @callimas
    @callimas 24 дня назад +8

    I've been using bash since 2000, and some variant of the Bourne shell since the early 90s, though I've never been a power user, and several of these were new to me. I've been using Emacs-style motion/editing key bindings for so long that I could not live without them now. In addition to C-a (control+a), C-e, C-w, and C-k, there's also M-b ("Meta b" = alt+b) to move backward one word, M-f = forward word, M-d to kill (cut) the word to the right, C-y to yank (paste) the thing you most recently killed (cut), M-y to cycle through the kill ring, i.e., successively paste all the things you cut in previous steps......etc.

    • @BreadOnPenguins
      @BreadOnPenguins  24 дня назад

      It makes sense to set bindings to whatever you're already used to - far faster to take a few minutes to set up, than to try to commit new motions to memory.
      I'll likely make some additional videos going over more common shortcuts and tricks for shell.
      Thanks for commenting!

    • @SlinkyD
      @SlinkyD 23 дня назад

      Same but I keep forgetting Meta, not Ctrl cus I don't use 'em a lot.

    • @HaukeLaging
      @HaukeLaging 18 дней назад

      @@BreadOnPenguins I often fail at remembering key bindings I rarely need. The simple solution is e.g. a shell function "h" which prints a short help text (whatever you need) or a static key binding: If I press F1 in my bash then readline inserts and executes this dummy command:
      start cmd:> : "
      cont. cmd:> # set-mark (C-^ SPACE)
      cont. cmd:> # exchange-point-and-mark (C-^ x)
      cont. cmd:> # kill-region (-)
      cont. cmd:> # complete-filename (M-/)
      cont. cmd:> # complete-username (M-)
      cont. cmd:> # complete-variable (M-$)
      cont. cmd:> # complete-hostname (M-@)
      cont. cmd:> # tilde-expand (M-&)
      cont. cmd:> # history-expand-line (M-)
      cont. cmd:> # glob-list-expansions (C-^ l)
      cont. cmd:> # shell-expand-line (M-C-e)
      cont. cmd:> # edit-and-execute-command (C-^ e)"

  • @andresmartinez-sj7ui
    @andresmartinez-sj7ui 16 дней назад +2

    This is fantastic, definitely helpful.
    I'll share these ones with my peers.
    Much appreciated 👍🏽

  • @MarkieAurelius
    @MarkieAurelius 19 дней назад +1

    that last command one is sick, will definitely use it

  • @tylower
    @tylower 18 дней назад +2

    DT sent me. Nice channel. Subbed. Good luck!

  • @aelhamamy
    @aelhamamy 22 дня назад +2

    Great video, thank you so much. Some of the best things that helped me as well was having .inputrc file, makes using the shell must easier! like auto completion, history, and so on.
    This is my .inputrc file: cat .inputrc
    set completion-ignore-case on
    set show-all-if-ambiguous on
    set colored-completion-prefix on
    set colored-stats on
    "\e[3~": delete-char
    "\C-h": backward-delete-char
    "\C-?": backward-delete-char
    "\e[A": history-search-backward
    "\e[B": history-search-forward
    set skip-completed-text on
    set bell-style visible
    set show-all-if-unmodified on

    • @BreadOnPenguins
      @BreadOnPenguins  22 дня назад

      Thanks very much for sharing! I'll likely make a vid talking about setting up rc files

  • @paulhbartley8030
    @paulhbartley8030 22 дня назад +2

    Not sure if this was mentioned, but alt+. is a handy way of quickly retrieving the argument from the last command.

  • @breaddyPL
    @breaddyPL 21 день назад +1

    Even tho i have been using Linux for only 3 months Im very happy to see some new Linux content creators! Great Video, keep going :] !

    • @BreadOnPenguins
      @BreadOnPenguins  21 день назад +1

      Welcome to Linux! Thanks so much - will do :)

  • @texaslinux
    @texaslinux 23 дня назад +1

    Awesome tips! I've been using Linux since 2001 and didn't know about the args tricks you showed, wow! You rock.

    • @BreadOnPenguins
      @BreadOnPenguins  23 дня назад +1

      Thanks! Glad I was able to show even a seasoned user something new.

  • @shadowfan1999
    @shadowfan1999 24 дня назад +4

    new vid bros lets go, happy halloween btw

  • @mauriereed3875
    @mauriereed3875 24 дня назад +2

    Great video! I’m in for more tips ‘n’ tricks videos.

  • @gamerscodex5454
    @gamerscodex5454 24 дня назад +2

    Kick ass video and channel, you came outta nowhere and drop content like nobody's business!

  • @TrustJesusToday
    @TrustJesusToday 15 дней назад +1

    Cool tools! Thanks.

  • @cybernit3
    @cybernit3 23 дня назад +2

    Thanks for teaching some tricks, I knew about !! and ctrl-l; but that the !:1 or cd -. Oh ya, instead of cd there is also z (zoxide). Instead of nano text editor there is micro text editor which is easy to use; I just wish LSP client worked on it so you get parameter hints when programming.

    • @BreadOnPenguins
      @BreadOnPenguins  23 дня назад

      No problem. I might check out zoxide for a vid at some point. Thanks for commenting!

  • @rony9225
    @rony9225 24 дня назад +4

    Yay another bread video!🎉

  • @jack-spade5647
    @jack-spade5647 8 дней назад

    . ...is this the Hyprland experience video? . ...you are saving years of lifespan with all this magic.

  • @infinitivez
    @infinitivez 21 день назад +1

    Not sure if I should be embarrassed, having never known these in my years of linux, or happy I know them now?
    I'll pick the latter. Please bring me part 2! ngl, !#: is likely to save me tons of headache

    • @BreadOnPenguins
      @BreadOnPenguins  21 день назад +1

      Definitely the latter! I frequently learn things that make me question how I didn't know them before :)
      Will do!

  • @zestynotions
    @zestynotions 5 дней назад +1

    zoxide and yazi are the greatest timesavers for me

    • @BreadOnPenguins
      @BreadOnPenguins  5 дней назад

      Thanks for mentioning! I'll probably make a vid about zoxide at some point :)

  • @aldrikcorbe9605
    @aldrikcorbe9605 24 дня назад +1

    Simple and useful, great video.

  • @ANDROTOP
    @ANDROTOP 21 день назад +1

    new sub here, coming from dt video, keep it up!

    • @BreadOnPenguins
      @BreadOnPenguins  21 день назад

      Hey thanks for checking out my channel! I really appreciate it - will do :)

  • @PrzemekPr
    @PrzemekPr 24 дня назад +1

    Hi, I'm sure this is great video, but i really write to say that thumbnail look very cute. Thank you for great work on those materials

  • @hiryu76
    @hiryu76 23 дня назад +1

    "Yer a wizard, Bready!" 😑 Sorry.. Informative as always. Also I really love your wallpapers!

  • @dunkelskrue
    @dunkelskrue 15 дней назад +1

    -heard something about uparrow for previous cmd. Ctrl-p for cycling backwards through history is a bit more convenient for lazy people like me who doesnt want to move my hand so much. By far most used daily is ctrl-r for backwards cmd search and alt-dot for cycling through last arguments on prev cmds. Can also use for instance holding down alt through pressing 3 and dot for 3rd arg on prev cmd line. Instead of the version with typing it out with ! Colon etc

    • @BreadOnPenguins
      @BreadOnPenguins  14 дней назад +1

      Thanks for commenting - that's a fair point! I'll be making a part 2 to this video soon, so I'll include those tips

  • @VioletJewel1729
    @VioletJewel1729 23 дня назад +1

    yayyy I learned something. Forgot about ^replace^. Woooo good video hehe ^_^

  • @etcher6841
    @etcher6841 24 дня назад +3

    Bread is awesome

  • @n3ev
    @n3ev 20 дней назад +1

    nice, more videos like this plz :D

  • @pxldi
    @pxldi 22 дня назад +1

    Great videos, where do you get your wallpapers from though? Love them

    • @BreadOnPenguins
      @BreadOnPenguins  22 дня назад

      Thanks! Recently I've just been looking up landscapes from painters I like. But in general, everything from gallery sites to stock sites to /wg/
      Artist & title is in the description :)

  • @armanism24
    @armanism24 15 дней назад +1

    great

  • @etcher6841
    @etcher6841 24 дня назад +5

    You forgot $_ and co mate, now you gotta make another video on this

    • @BreadOnPenguins
      @BreadOnPenguins  24 дня назад +2

      True plenty more to cover, I'll definitely make a part 2 lol

  • @klashe1977
    @klashe1977 21 день назад +2

    Came here from the distrotube recommendation video. Great content. Now I'm off to bork these shortcuts and accidentally copy some pictures into my systemd service directory. :)

    • @BreadOnPenguins
      @BreadOnPenguins  21 день назад

      Thanks so much for checking out my channel! Hahaha it happens

  • @zerotheory941
    @zerotheory941 22 дня назад +2

    in my .bashrc file i've placed `set -o vi` to enable vim bindings for command line editing. It defaults to insert mode so you don't notice it unless you tap esc and go to command mode where you now have vi to edit the lines or move up and down in history.

    • @BreadOnPenguins
      @BreadOnPenguins  22 дня назад

      Great setting if you find vim bindings easier to use. Thanks for mentioning!

  • @karshPrime
    @karshPrime 19 дней назад +2

    Penguins have a unique feather structure that helps to keep them warm in cold water

    • @BreadOnPenguins
      @BreadOnPenguins  19 дней назад

      They have blubber, too! Especially given the regions many species are in, they really have to stay warm lol

  • @techmouse.
    @techmouse. 2 дня назад

    Without any arguments passed, cd will always take you back to home. So the tilde in "cd ~" isn't necessary.

    • @BreadOnPenguins
      @BreadOnPenguins  2 дня назад

      That's true - bad habit, but I've luckily dropped it. That's one of the first things covered in my pt2 of this vid :-)

  • @jkf114
    @jkf114 23 дня назад +2

    To get to your home directory you don't actually need to put the tylda there, just run cd with no arguments
    And also you can use the "-" trick with git switch, very useful if you have long branch names

    • @BreadOnPenguins
      @BreadOnPenguins  23 дня назад

      Thanks for mentioning both of those!

    • @HaukeLaging
      @HaukeLaging 18 дней назад

      The real trick for handling directory changes is pushd / popd (in bash)

  • @KavusHabibi
    @KavusHabibi 19 дней назад +1

    hello, how did you change terminal theme and color and font?
    and what is the desktop enviorment? is it xfce4?
    can you make a video about this , please? it is very beautifull

    • @BreadOnPenguins
      @BreadOnPenguins  18 дней назад

      Hello, my terminal is st, and default font and colors are set in its config. I actually use pywal for dynamic colorscheme generation though.
      I've several videos about how I configure my window manager! It's dwm, with dwmblocks for status bar :-)

  • @bennockley
    @bennockley 20 дней назад +1

  • @Jackovasaur
    @Jackovasaur 24 дня назад +2

    Noob question but what version of linux is this? It looks so clean i want it lol

    • @BreadOnPenguins
      @BreadOnPenguins  24 дня назад +2

      No worries, I'm using Arch with dwm (dynamic window manager), and dwmblocks for my status bar.
      I've got a couple videos going over my setup as well as a long Arch install guide :)

  • @ishak_arif
    @ishak_arif 20 дней назад +1

    What do you use to make your videos? I mean screen recording, editing, making thumbnails, etc

    • @BreadOnPenguins
      @BreadOnPenguins  19 дней назад

      Hello, I use ffmpeg for recording, virtually no editing but splicing scripts if ever needed, and I've actually made a video talking about image editing programs. :-)

    • @ishak_arif
      @ishak_arif 19 дней назад +1

      @ Ahh I see. Thank you for your reply. Could you some time perhaps make a video on ffmpeg, and also those scripts?

    • @BreadOnPenguins
      @BreadOnPenguins  19 дней назад

      @@ishak_arif Sure I can do that at some point :)

  • @boredsherbet
    @boredsherbet 23 дня назад +2

    just gonna be straight up honest now. I've usenvim for the past 4 months, and I'd like to say I'm not particuarly inapable. this video has left my jaw gaping open. I feel like an idiot. thank you, finlly"

    • @BreadOnPenguins
      @BreadOnPenguins  23 дня назад

      Well I'm glad you learned something from the vid! :D

  • @xcoding7513
    @xcoding7513 18 дней назад +1

    I hope you are doing well, I need just to learn Linux Terminal to use in Windows I already set up the WSL with ubuntu, How can N learn using the linux terminal in windows, could you provide me with a road map or a book or a full detailed palylist.

    • @BreadOnPenguins
      @BreadOnPenguins  17 дней назад

      Hello, likewise! I've made several videos covering an intro to the Bash shell, if that's what you'll be using :-) If you're trying to learn scripting, I've found the book "bash Cookbook" to be helpful.

  • @sqlexp
    @sqlexp 22 дня назад +1

    How can I actually search back in the history for a command that starts with a particular prefix? For example, I want to find a previous cd command, but I don't want the last cd command. I can only use the up key to go through all commands in the history. I want a way to show only commands that start with cd when I press the up key.

    • @BreadOnPenguins
      @BreadOnPenguins  22 дня назад

      You can use ctrl + R (that's the default at least) and then search. Far better searching experience if you install fzf (fuzzy finder) as well :)

    • @HaukeLaging
      @HaukeLaging 18 дней назад

      In bash / readline you can do this:
      # : non-incremental search for the same beginning of a command line
      bind '"\e[5~":history-search-backward'
      # : non-incremental search for the same beginning of a command line
      bind '"\e[6~":history-search-forward'
      Typing "cd ......" then scrolls forth and back through all history entries which start with "cd "

  • @takennmc
    @takennmc 24 дня назад +2

    what do you use for that output for mv and cp

    • @BreadOnPenguins
      @BreadOnPenguins  24 дня назад +1

      It's just an alias for forcing mv & cp to use the -iv flag, set up in the shell config
      cp="cp -iv"
      mv="mv -iv"
      :)

  • @BrokenKanuck
    @BrokenKanuck 24 дня назад +1

    Love these videos! 🙂 I have my sudo !! aliased as "f*ck"

  • @Ozzymand
    @Ozzymand 23 дня назад +2

    i thought i was the only one that aliases v as neovim, happy to hear other people do that too.

    • @BreadOnPenguins
      @BreadOnPenguins  23 дня назад +1

      💯 The shorter and easier an alias, the better

  • @notafbihoneypot8487
    @notafbihoneypot8487 24 дня назад +1

    Watching this from the term rn 🗿

  • @jellyfishdemo
    @jellyfishdemo 9 дней назад +1

    So cool! I can't tell you how many times I have wanted to cd to the dir I was just in and manually typing out the path multiple times to go back and forth or hope my history has a recent cd to that dir. Now I can just cd - like a wizard. (∩`-´)⊃━☆゚.*・。゚

  • @swagmuffin9000
    @swagmuffin9000 23 дня назад +1

    How's that wm? Kinda done with full DEs

    • @BreadOnPenguins
      @BreadOnPenguins  23 дня назад +1

      I made a video going over basics of dwm, and why I prefer tiling WMs - title starts with Arch+dwm
      But for a tl;dr, dwm is very minimal out-of-the-box, and allows for complete customization with patches. I prefer that approach, since you don't end up with any extra features you don't need. So I'd definitely recommend it if you're ready to get your hands dirty with setting up a WM :)

    • @swagmuffin9000
      @swagmuffin9000 22 дня назад

      @ awesome thanks, I'll check out that video

  • @Rudolfucius
    @Rudolfucius 20 дней назад

    I bet Luke SMITH found her during his trip to eastern europe
    He tough her linux and english

  • @lel7531
    @lel7531 23 дня назад

    Zsh ? Rookie mistake