Shell Scripting Crash Course - Beginner Level

Sdílet
Vložit
  • čas přidán 13. 06. 2024
  • This is an intro to shell scripting with Bash. We will learn what shell scripting is and create a cheat sheet with things like variables, conditionals, loops, functions, etc. We will also do things like rename multiple files.
    Cheat Sheet Gist:
    gist.github.com/bradtraversy/...
    Command Line Tutorial:
    • Linux Tutorial - Basic...
    💖 Become a Patron: Show support & get perks!
    / traversymedia
    Website & Udemy Courses
    www.traversymedia.com
    Follow Traversy Media:
    / traversymedia
    / traversymedia
    / traversymedia
  • Věda a technologie

Komentáře • 532

  • @oosmanbeekawoo
    @oosmanbeekawoo Před 3 lety +265

    For those in a hurry!
    Till 6:13 he explains what is Shell Scripting and how it's done: In Windows, you create .bat files with a command on each line in the file so CMD executes one-by-one. In Linux, we don't use .bat but .sh, and also, we specify a Shebang so Linux knows what interpreter to use (the default is Bash)
    Till 7:45 he explains Variables (i.e x = "Text") and how to make Bash distinguish between letter 'x' and our Variable 'x'
    Till 8:49 he tells how we can prompt the user for input with command 'read'. Terminal pauses, until data is input. To display a specific message before the blinking cursor use 'read -p ["TEXT: "]'. (-p displays the "TEXT" you provide before it collects input.)
    To store the data input in a Variable write the name of the Variable at the end of the command:
    'read -p ["TEXT: "] VAR'

    • @smitmangukiya
      @smitmangukiya Před 3 lety +2

      Thanks

    • @stuffandymakes1648
      @stuffandymakes1648 Před 3 lety +18

      Technically speaking, in Unix/Linux/macOS, the file extension on the file name of the script is irrelevant. People can be opinionated about using it, but it truly is only a convention. What makes your script file an executable script in Unix-like operating systems is setting the execute (x) permission on the file. Then, the shebang line (#!) tells the system what type of file it is. The first two characters (sometimes they are each 16-bit) or bytes are called the file signature or magic numbers. The shell is using the exec() system call, which uses the magic numbers to determine how to launch the file as a new process: Binary file (run the machine code inside, depending on the OS) or text file (launch an interpreter as a new process and pass it the text to interpret).

    • @realkarthiknair
      @realkarthiknair Před 2 lety +2

      @@stuffandymakes1648 yep u dont even need an extension

    • @idk-jb7lx
      @idk-jb7lx Před 2 lety

      bash scripts are more similiar to powershell scripts than they are to batch files to be completely fair. sure you can use them like you would use batch files in Windows but they're way more powerful than that since they're actual programming scripts and not just a set of instructions.

    • @maindepth8830
      @maindepth8830 Před 2 lety

      Thank u

  • @icon458
    @icon458 Před rokem +4

    I have a test in 3 hours' time and this guy just explained a whole chapter with 98 pages in 32 minutes.
    Thanks, man keep the videos coming💝

  • @raghulbaskar7746
    @raghulbaskar7746 Před 3 lety +121

    echo "Awesome Content!!!" >> Traversy Media

    • @Skeleton-wn2zu
      @Skeleton-wn2zu Před 3 lety +11

      NAME="Raghul Baskar"
      echo "Nice comment ${NAME}!" >> $NAME

    • @KangJangkrik
      @KangJangkrik Před 2 lety +4

      while 1; do echo 'Hello everyone!'; done

    • @yersonlasso9754
      @yersonlasso9754 Před 2 lety +2

      Not to be that guy but... file has no extension

    • @hxz2776
      @hxz2776 Před 2 lety +3

      @@yersonlasso9754 file extensions are not really required much outside of Windows

    • @adefioyes5692
      @adefioyes5692 Před 2 lety

      Nailed it fr

  • @aprilmintacpineda2713
    @aprilmintacpineda2713 Před 6 lety +7

    Thanks Brad, I really appreciate you doing these tutorials. I think CZcams should have more people like you.

  • @madferit1987
    @madferit1987 Před 6 lety +24

    Have I ever told you I love you man? Just what I needed

  • @origamicaptain5664
    @origamicaptain5664 Před 4 lety +1

    I'm so happy that you aren't being condescending, but friendly as well. Clear, concise language. Much appreciated.

  • @manish-mk
    @manish-mk Před 6 lety +132

    It's always so interesting to learn from you.
    You are great teacher.
    I have huge respect for you

  • @technofool3
    @technofool3 Před 6 lety +3

    Thank you for taking the time to put this together. I learned so much from this, I really appreciate everything you put out.

  • @NikhilMoreBCSE
    @NikhilMoreBCSE Před 3 lety +4

    This is the best tutorial for bash scripting covered in such a short time. You really saved me

  • @omarsuriel1112
    @omarsuriel1112 Před 3 lety +6

    I can’t think of a more deserving person for all the success he’s got

  • @cherrydrop7025
    @cherrydrop7025 Před rokem +1

    Revisiting for a great refreshah. I remember watching this at random when I started at a startup based in Boston... gave me the full MA experience. Love the accent.

  • @rambo9769
    @rambo9769 Před 3 lety +2

    This tutorial is timeless. Wonderful and relevant after 2 years too.

  • @mikeigoe
    @mikeigoe Před 6 lety +60

    Bookmarked - use Linux all the time in a job I'm now 3 years into and never bothered to learn this stuff when moving over from WIndows, even though I swapped out cmd for git bash a few months back on all my PCs. I don't have time to watch your CZcams videos anymore - that MERN course is taking up all my free time :D - great course btw: you have a wonderful, natural teaching style.

    • @priyakdey7891
      @priyakdey7891 Před 5 lety

      Dude is the MERN from Traversy ? which one and where it is ?

    • @omarislearning3329
      @omarislearning3329 Před 4 lety

      honest question, did you come back to it after you bookmarked it or nah? i am just wondering since i seem to never do when i bookmark stuff.

    • @insideTheMirror_
      @insideTheMirror_ Před 4 lety

      plus he's a hottie ;)

    • @navjotsingh2251
      @navjotsingh2251 Před 4 lety

      omarislearning I do come back to things I book mark. I’ve book marked a python cheat sheet, bash cheat sheet, calculus book and a data structures/algorithms website. I’m constantly going back to them sites, so having them bookmarked is helpful.

  • @naqeebghazi9412
    @naqeebghazi9412 Před 7 měsíci

    One of the best beginner videos for shell scripting. Doesnt over-explain. Great stuff!

  • @Ahmed-sv9sy
    @Ahmed-sv9sy Před 4 lety +2

    Amazing video man !
    I learnt so much from you by following along on my computer and I can definitely say without a doubt that I'm more comfortable with bash scripting basics after I watched your video.
    Thanks for the educational content
    Keep up the good work !

  • @JimHenderson19
    @JimHenderson19 Před rokem +1

    Great content! I like the pace, just right. Keeps you interested without overwhelming. Easy to follow along. I subscribed!

  • @CreativeJE
    @CreativeJE Před 4 lety +1

    brad your tutorials are simple straightforward thanks for making everyone's life easier thank you

  • @amirnazari6427
    @amirnazari6427 Před 3 lety +1

    One of the best shell scripting videos! Coherent, Informative, right into the point, and time-saving.

    • @fxstreamer238
      @fxstreamer238 Před 3 lety

      please tell me you know the WHILE loops in other programing languages right? and how on earth this while loop that he just read and wrote from his script doesnt need any explanation of what -r is? and what the condition of the while loop is? how is this choherent and time saving? I assume you are a programmer like myself

  • @CYB3RC0RP
    @CYB3RC0RP Před rokem

    Probably the best video I've found on the subject so far.

  • @yesoreyeram
    @yesoreyeram Před 6 lety

    OMG.. the quality and the content diversity of the channel getting improved in every video. Hats off to you.

  • @nafeemhaque3357
    @nafeemhaque3357 Před 6 lety +5

    You are awesome dude ! Thanks for making the world a lot easier.

  • @aisaacbruno9660
    @aisaacbruno9660 Před 4 lety

    it's refreshing to watch a 30 min video that I actually wanna watch, thanks for this video, I'll have a job interview about shell today :)

  • @fvgoya
    @fvgoya Před 6 lety +1

    This is a really GOOD content. Thanks Brad! It is always good to learn more about something that I know. Always learn more.

  • @masihsadri
    @masihsadri Před 5 lety

    Thank you, Brad.
    You are definitely the best teacher in the world.

  • @edilsonrj
    @edilsonrj Před 5 lety +31

    Waiting for the intermediate and the advanced one! AMAZING!

  • @charlescai236
    @charlescai236 Před 2 lety

    thanks Brad. This is really a short and sweet piece of video and one of my best used half an hour.

  • @kevinzhang8974
    @kevinzhang8974 Před 6 lety +1

    simple and very practical .... you have covered top common syntax .... thank you!

  • @rokzabukovec4685
    @rokzabukovec4685 Před 6 lety +74

    Just in time Brad! I got a paper due on sunday on bash scripting :)

  • @dineshkumarthirugnanam1301

    You just made things simple. Not confusing by putting too much into it. Got it what's needed.👍

  • @notgate2624
    @notgate2624 Před 6 lety +2

    This was great and I'm happy with you changing up the material a bit. I've been wanting to learn more about System Administration and IT. I know this stuff is basic but it's still a good intro.

  • @evilmorty-tv1xs
    @evilmorty-tv1xs Před 6 lety

    Been waiting for this. Great tutorial Brad!!! Very useful especially since I use a arch distro

  • @fayfaytu
    @fayfaytu Před 2 lety

    This is really a great video! It has everything for a beginner to know. Concise and useful!

  • @GurcharanDhillon
    @GurcharanDhillon Před 3 lety

    Thank You Sir, the way you explain is awesome. It directly goes into mind. I learnt a lot from your tutorials.
    Much respect.

  • @lee_johnson
    @lee_johnson Před 2 lety

    Your teaching style is awesome man

  • @heikokraemer2735
    @heikokraemer2735 Před 3 lety +1

    On point, very compact video. Thanks a lot for this great source for a start into bash scripting!

  • @flankattack5426
    @flankattack5426 Před 4 lety

    Fantastic session - thank you Brad! This is very helpful.

  • @mohammadumair7778
    @mohammadumair7778 Před 5 lety

    AWESOME TUTORIALS... Thank You so much for Uploading the Lesson!!

  • @coreyaudet9656
    @coreyaudet9656 Před 3 lety

    There is so much Love and appreciation here, I was just poking around and was overcome with positivity.(I was losing all hope for humanity just prior) I'll be camping out here until I can reach an understanding of Bash without BashING something in the process. Thank you all for making it possible to enjoy learning and by supporting one another, we can all get the skills it takes to BASH Bash!

  • @legendplonski8758
    @legendplonski8758 Před 2 lety

    Just listening to this man speak calms me down. You get my like sir.

  • @helaolange
    @helaolange Před 2 lety

    Uploaded 3 years ago...
    Brad, you are the best🐐

  • @Alessandro-nq3tm
    @Alessandro-nq3tm Před 6 lety +2

    Amazing Brad! More on bash scripting please!!

  • @deadscenedotcom
    @deadscenedotcom Před 6 lety

    This provided a couple options and commands I haven't used yet. Thank you!

  • @manueljordan317
    @manueljordan317 Před 4 lety

    Huge thanks for this video, simple and powerful to learn quickly!

  • @zacharymiles4300
    @zacharymiles4300 Před 4 lety

    Great video. Your teaching is very easy to follow.

  • @aylliumrin7861
    @aylliumrin7861 Před 6 lety

    Awesome vid. I like the idea of the channel branching out. There is so much stuff out there and it keeps things fresh.

  • @ssaran2
    @ssaran2 Před 5 lety

    Thanks Brad. I was always scared of learning bash scripting until I watched your video. Subscribed :)

  • @sreemathir5194
    @sreemathir5194 Před 3 lety

    The BEST tutorial for beginners! Thank you!!

  • @joseluisbeltramone599
    @joseluisbeltramone599 Před 2 lety

    Loved this tutorial! Basic as you say, but super useful. Thank you very much!

  • @leosmilesu2
    @leosmilesu2 Před 4 lety

    God bless you, Brad@Traversy Media. Thank you.

  • @robertofolikwei23
    @robertofolikwei23 Před 6 lety

    just in time, towards my preparation towards my eCPPT certification.....simple and understanding ...big thanx

  • @jackjax5606
    @jackjax5606 Před 5 lety

    Good stuff Brad...You always know some good content is coming up once that transition music starts. And you never dissapoint. Big up on the new content, i've always enjoyed your tutorials. And i cant wait for the JAVA stuff...lookin forward to it

  • @Mohamed-uf5jh
    @Mohamed-uf5jh Před 3 lety +1

    Great Job , easy to follow and very helpful

  • @daoviettu2334
    @daoviettu2334 Před 2 lety

    Very practical! Every basics are all here!

  • @asuezeigwe9381
    @asuezeigwe9381 Před rokem

    I was so lost watching other content on this topic as I'm a newbie
    You just saved me

  • @volder1995
    @volder1995 Před 4 lety +1

    I hope this helps me pass my exams at Shell,great tutorial!

  • @ruchiradhar1589
    @ruchiradhar1589 Před 3 lety +4

    This is honestly one of the best Shell Scripting tutorials out here. Thank you so much for this amazing video, it really helped me a lot!

  • @abdullahahmed8468
    @abdullahahmed8468 Před 2 lety

    i have loved this Crash Course video because it has rich content with real case examples

  • @adriantan1134
    @adriantan1134 Před 2 lety

    Thanks. Very good and straight to the point tutorial.

  • @foodums
    @foodums Před 4 lety +3

    Every time I click on Brad's videos I like it before the intro even plays.. Here in 2020

  • @ericedlund3140
    @ericedlund3140 Před 2 lety

    You just saved me a $20 course online, thank you.

  • @mdullash2116
    @mdullash2116 Před 4 lety

    i don't feel bored any time of learning from your channel...

  • @snxexwinterx5570
    @snxexwinterx5570 Před 4 lety

    Thanks for making this man..been looking for a good beginner bash tutorial.

  • @anshajlogan1040
    @anshajlogan1040 Před 2 lety +1

    You save my system design lab
    The teacher take four months for this
    You nailed it on 30 mins🤪🎉❤️

  • @user-di4bt7qu2i
    @user-di4bt7qu2i Před 2 lety

    Great video, thanks for posting. As usual, lots of good info to get me started and point me in the direction to advance. Thanks man!

  • @mblackonline1059
    @mblackonline1059 Před 2 lety

    Thanks so much for making this! The examples were very helpful.

  • @ReliableRandy
    @ReliableRandy Před 3 lety +19

    "I let my accent slip out a little too much there" HAHAH love it 19:57

  • @BobTrieste
    @BobTrieste Před 2 lety

    Brad all of your videos are great ! Thank you

  • @Jerry-fy2gc
    @Jerry-fy2gc Před 2 lety

    Thanks buddy. It's short video but much tought must of basics in very clear way. Thanks a lot

  • @alphaomega4434
    @alphaomega4434 Před 3 lety

    This was really good, I appreciate it you branching out

  • @ralnou
    @ralnou Před 5 měsíci

    Thank you very much! Excellent explanation ❤

  • @vishnusk7017
    @vishnusk7017 Před 2 lety

    This is a very useful tutorial.... and ur presentation skill is awesome.
    Thanks

  • @carloszetula2307
    @carloszetula2307 Před 6 lety

    Thanks man! I really need this information, I’m new to bash but I know a little about old ms-dos

  • @gabriel_felippe
    @gabriel_felippe Před 6 lety

    Hey Brad, thank you! Hope to see these new tutorials!

  • @khalidelgazzar
    @khalidelgazzar Před 4 lety

    Awesome refresher. Thanks Brad

  • @EddyVinck
    @EddyVinck Před 6 lety

    I recently learned how to setup my own VPS with NGINX and Node on it so this couldn't have better timing, will watch it soon. Thanks Brad.

  • @sfutrell2339
    @sfutrell2339 Před 3 lety +1

    Thank you! I am cramming for my Linux +exam and this helps a lot!

  • @kauthamkrishnan982
    @kauthamkrishnan982 Před 2 lety

    This is so helpful for a beginner. Thanks!

  • @oranbenavi8105
    @oranbenavi8105 Před 3 lety

    GREAT TUTORIAL !!!!!!! Thank you very much

  • @derekbaker2099
    @derekbaker2099 Před 2 lety

    Really enjoyed this and it was super helpful! Thank you

  • @digitaloneup290
    @digitaloneup290 Před 4 lety +1

    This is the video I've been looking for! Totally have been needing a good CLI shell script video. Thank you!

  • @santiagohernandez6615
    @santiagohernandez6615 Před 2 lety

    You are a awesome, I understood everything perfectly, thank you.

  • @nacdan6451
    @nacdan6451 Před 6 lety +4

    Great video as always. I'd love to see some C++ tutorials!

  • @MarkJay
    @MarkJay Před 6 lety

    thank you for making this Traversy Media!

  • @Super_Cool_Guy
    @Super_Cool_Guy Před 6 lety +25

    HI Brad , great video , will there be anymore videos on shell scripting ? we would like to see more from basic to advance levels .. thanks man ! 😊

  • @emmanuelmnzava8966
    @emmanuelmnzava8966 Před 3 lety

    This will help me automate lots of my work

  • @simonkalu
    @simonkalu Před 6 lety

    Brad, man on fire... keep radiating - we shall soon hit 1m subs.

  • @alihejazi6345
    @alihejazi6345 Před 3 lety

    Good quick tutorial. Thanks

  • @siddharthsoni1862
    @siddharthsoni1862 Před 5 lety

    This is an awesome tutorial. Thank you so much.

  • @ericjaniak1015
    @ericjaniak1015 Před 2 lety +1

    Much respect to you, you give me a lot of useful tech.

  • @eoussama
    @eoussama Před 6 lety

    Just when I wanted to get into bash, nice tutorial Brad.

  • @anggasukmabahari6342
    @anggasukmabahari6342 Před 4 lety

    Amazing video. Thank you sir, so helpfully!

  • @alfredwilliams8609
    @alfredwilliams8609 Před 2 lety

    Very helpful for beginners.

  • @AyushKumar-yk9fw
    @AyushKumar-yk9fw Před 3 lety +1

    Awesome tutorial! Nailed it! 🤩

  • @dadev3668
    @dadev3668 Před 6 lety

    Great crash course this just help alot of people

  • @user-vw3pr5gq9g
    @user-vw3pr5gq9g Před 2 lety

    awesome content which really helps me a lot , big thanks

  • @rauljg143
    @rauljg143 Před rokem

    This was fantastic, thank you!

  • @karamveersinghrathore6218
    @karamveersinghrathore6218 Před 11 měsíci

    Thanks Man for this video, I have my lab exam in 3 hours and this video helped me alot

  • @demetter7936
    @demetter7936 Před 2 lety +1

    My name is also Brad so for a split second it freaked me the hell out when you said it.

  • @AniBOTSBrothers
    @AniBOTSBrothers Před 5 lety

    This was really cool!I hope you do more videos on this!

  • @bittersweet1940
    @bittersweet1940 Před 2 lety

    Really helpful video, thank you!