Linux - The Productive Programmer's Best Friend | Bogdan Vaida | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Linux - The Productive Programmer's Best Friend

teacher avatar Bogdan Vaida, I teach students how to become their own teachers!

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

31 Lessons (2h 31m)
    • 1. Linux - The Productive Programmer's Best Friend

    • 2. Introduction to the course

    • 3. Terminator: the ultimate terminal

    • 4. Guake - not Quake!

    • 5. ClipIt: copy-paste at its finest

    • 6. Pre chapter: Vim

    • 7. Oh-my-zsh: Your terminal never felt this good before!

    • 8. Basic regular expressions

    • 9. Pipes and subshells: your shell's salt and pepper

    • 10. Shell scripting for fun and profit

    • 11. Shell scripting libraries

    • 12. Supercharging vim

    • 13. Keyboard kung fu

    • 14. Plugin steroids for vim

    • 15. Vim password manager

    • 16. Extra: fast configuration restore

    • 17. Sed: one-liner productivity treasure

    • 18. You can run, but you can’t hide… from “find”

    • 19. Tmux: Virtual consoles, background jobs and the likes

    • 20. Network: Who’s listening?

    • 21. Autoenv: Set a lasting, project-based habitat

    • 22. Don’t rm the trash

    • 23. On the spot webserver

    • 24. Shrinking spells and other ImageMagick

    • 25. Go with the Git flow

    • 26. Merge Git conflicts with ease

    • 27. From localhost to instant DNS

    • 28. JSON jamming in the new age

    • 29. No more mister nice guy

    • 30. Terminal art

    • 31. Closing chapter

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

Our mission is to save Linux users from their unproductive habits.

And in this online course, you will learn:

  • What’s one of the best terminals to use (just a hint: you need that split screen functionality).
  • How clipboard managers memorize the things you copy, so you don’t have to.
  • How to use the greatest/biggest/most intelligent :)) console editor since humankind appeared. Yes, it’s Vim. And we’ll dive deep into its usefulness.
  • Zsh and it’s awesome oh-my-zsh framework featuring over two hundred plugins for developers and productivity seekers.
  • Extensive lessons on terminal commands: how to find and replace text, parts of text, tiny bits of text … or even non-text.
  • How to use pipes and subshells to create customized commands that automate day to day tasks.
  • And much much more.

All of this, plus:

  • The repository where you have all our scripts.
  • And an eBook containing not only all the examples mentioned but our very words and explanations (yes, including all the bad grammar you may notice through the lessons).

Jokes aside, this course is for all the programmers that are new to the Linux environment.

But who are we?

Petru: the infamous coder with many years of Linux experience. He types like crazy, loves doughnuts and has Linux wired in his brain! After discovering Linux and switching through a different distribution every week, annoying his girlfriend with tons of geeky stuff, now he annoys everybody with geek talks and the latest news in the tech world.

He spends his time coding frontends… backends… databases… Linux servers and clouds.

Bogdan: the desertor! He went through more than 20 Linux and Unix distributions including Plan 9, HP-UX and all of the BSDs. But after his girlfriend left him because he spent way too much time in front of the computer he… switched to Mac.

Now he spends his time teaching over seven thousand six hundred twenty four student in his 8 online courses.

And we are here to help you double your terminal productivity!

If you don’t know how to use sed, if you’re not that used to pipeing commands, if you use the default terminal and if you are still using BASH then this course is for you.

Join us now and double your terminal productivity!

Meet Your Teacher

Teacher Profile Image

Bogdan Vaida

I teach students how to become their own teachers!


Bogdan Vaida burst onto the training scene in 2009 using extremely old Powerpoint presentations. Luckily, 2 years later he switched to experiential trainings and learning by doing, methodologies that he practiced devotedly into all of his trainings. Known for his no-nonsense approach to getting results, Bogdan has been told that he helps participants get their own "insanely practical insights".

What does he do? He travels around the world doing experiential trainings in fields ranging from time management to personality typologies and trainer training.
While doing this he also manages his online courses that have over 7624 students from all over the world.

In 2015 he beat the record for total time spent in airports.

If you want to see what he is teaching just d... See full profile

Class Ratings

Expectations Met?
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Linux - The Productive Programmer's Best Friend: a long time ago in a shell far, far away in a place for common users faced common problems. You know, distribution appeared Oneto. Yet the problems remain. Never mind the picture. Our mission is to save Lennox users from the unproductive habits. We are better the in famous coder with many years off limits experience. He types like Rosie, loves doughnuts and has a Lennox wired in his brain after discovering the looks on switching through a different distribution every week, annoying his girlfriend with tons of geeky stuff. Now he annoys everybody. We give talks and the latest news in a deck world it's He spends his time coding front beckons dot of it, the servers on plants, both down the deserter. He went for more than 20 Windows and UNIX distributions, including bland nine hp ux and all of the beauties. But after his girlfriend left him because while he spent way too much time in front of the computer, he switched back. Now he spends his time teaching over 7620 a lot of students in his eight and growing online courses, and we are here to help you double your terminal productivity because in these online course you will learn what one off the best terminals to use, just a hint. You need that split screen functionality. How green bore managers memorizing things you copy so you don't have to How to use the greatest, biggest, most intelligent, consolidated or scenes humankind appeared. And also since Monkey Kind appeared. Yes, it's vim and real life deep into its usefulness Ze s age and it's awesome. All my see such framework featuring over 200 progress for developers and productivity seekers, extensive lessons on terminal commands, how to find and replace text, parts of text, any bits of text or even non text. How to use pipes and sup schist. Create customers, commands that automate date they desk and much, much more. All of this, plus the repository where you have all our script on an e book containing not only all the examples mentioned, but they're very words and explanations. Yes, including all the great grammar you may notice through the plastic ducks aside, these scores is for all the programmers that are you totally looks the environment, if you don't know how to use, said if you're not that usedto packing commands. If you use the default terminal And if you're still using bash, what then he scores is for you. Join us now and double your third productivity and double your turning productivity and double your terminal brother activity super. 2. Introduction to the course: Are you ready in the following chapters will dive deep into the Lennox environment. Giving you tips and tricks to increase your productivity make you more comfortable with the command line at automated tests. Yeah, the course was created on a boon. Totally knocks Version 16 04 which is the latest long term support version. We chose a bundle because it's the most commonly known distributional there. It's really simple to use, has a lot off graphical tools, and you can find a huge online community ready to answer all of your questions. And, most importantly, it's the most supported the exhibition. This means that companies that produce softer, especially when it comes to graphical software if they offer softer for renews the for distribution that is supported is usually boom. That makes it super easier for us to use tools like Skype slack or visual studio code. Although the course was built on Bhutto, most of the commands are not a boon to relate it so it can easily use another distribution and applied the same lessons. A large part of the course can even be applied to Mac users because we can have the same Thursday start on Mac Bash, Zs age. They all work the same way across the nose and Mac. And with the new release of Windows, stand back support is building. So tours like CSH and we can easily being start and used before we understand the North was like chicken that we let use the limits command line in a Windows environment we re command . You watch this course with an open mind and terminal so you can execute commands and check their results before we start. You might want to download all the source files from our git repository located here. The course is spitting from RT perception. In Section one, we'll explore a new terminal and show you how to configure any started section toe concentrates on configuring your show, adding plug ins, understanding regular expressions and working with pipes and assumptions. Everything is then coagulated into a shell scripting lesson in section free will work with him, our recommended editor from configuring it to learning keeper shark cuts, installing plug ins and even using it as a password manager. There are even more videos waiting for you in the next sections. Just check the curriculum on. If you have any questions, Do not hesitate and ask us. We're here to help. Also, if you're interested in more videos on a specific topic, police tells we'd love toe Abdi the course based on your needs. See you inside. 3. Terminator: the ultimate terminal: first thing you need to do in order to become productive is to have a good terminal. During the course, we will be working mostly in the common line, which means that the primary piece off softer we will be using is our terminal. A great terminal that we recommend is called Terminator, which can be installed from the software center. Let's go to our launcher and click on the software center I could. After it opens, click on the search input and right Terminator. It will probably be the first in the least off results. Then Greek install after is selling its a good idea to drag its icon to the launcher. For this, you just open the dash by hitting the windows, keep right dominator and drag and drop its I can do the launcher. All right. Now, let's click on the icon to get started. I'll maximize the window toe, have more space to play around, and what you're actually seeing right now are the default settings. Let's go into the preferences menu and see what we can update. First of all, let's hide the title bar because it doesn't bring us that much information, and it's always a good idea to have as much free space as possible and with us your distractions as possible. Now let's look at some other preferences. Let's change. The fund for our video will make it a bit larger than usual so that it is easy to read. Let's go with Mata Space 60. You also want to have good contrast so that it's easy to distinguish the letters. And for this video, we will choose a black on white color theme. It's also a good idea to enable, if in its girl, because you don't want your terminal output to be trimmed after the 500 line. A lot of times you just want to scroll and see the previous outward. Also, why scrolling? If there is a lot of text, you probably don't want to be brought back to the bottom of the page. So uncheck the scrolling output option and viola. This is our newly configured terminal. Now let's look at some of its useful features and their cable shortcuts. Split Screen Contra shift oh, for horizontal split counter shift E for Vertical spit is probably the coolest feature off Terminator, and the one we will be using the most ah, lot off times. It is really helpful to see multiple pains and toe easily switch between them. You can split the screen any number of times in any combination you want. Resi screen with contra shift arrow or just drunk and drop easily. Moved between windows with Contra el close screen using contra shift W or control T create tabs with contra shift T. This is for when you don't have any more space to split the screen. Texas all with contra plus and control minus, which is useful for when you need to present or when you have a person with bad site near you. Off course, you're never a person with but site wearing glasses and everything. As we said, being able to divide the screen in order to arrange the terminal in agreed and being able to split, switch and recites pains with keyboard shortcuts are the biggest advantages off Terminator one big productive killer that a lot of people don't realize is reaching between using a mouse on using the keyboard. And although most people before using the mouse, we suggest using the keyboard as much as possible and learning the keyboard shortcuts off your commonly used computer programs. Being productive ultimately means having more time to focus on the things that are really important instead of wasting time struggling to use the computer has terrorist a terminal welcome Terminator. 4. Guake - not Quake!: Terminator is very good for all sorts of tasks, especially when working long sessions on multiple items. But sometimes there are scenarios where you need to quickly access a terminal in order to run a command jack a status or around the tasking foreground for a long time. All of these without opening to money types. Wake is excellent in these situations. It is a handy, quick to use terminal that you can open on any work space on top of your existing windows. By pressing after 12 we really started right now with the command stood opted stall Wake Act is the new package manager that Mobuto has launched with version 16 04 and is meant to be an easier to use version off the APP. Get command with some added eye candy. Now that great is installed, we will go to the dash and open it. To do this, we just press after wealth and once it is running against identification on the top, right side off the screen, just like with Terminator, we will check its preferences. First of all, go to show and enable open your tap in current directory. I believe you can guess what this does, then go scrolling and insert a really big number like 99,999. Also, make sure scroll output is unchecked again, we will change the fourth phone, Toby Mono Spaced 16 said the cursor bling moto off and hit close. If you want, you can play around with the default settings to see what suits you best. We can use Quake in full screen by hitting F 11 and we can also resize it by dragging the margin. Greg does not start automatically when Abu entry boots so we will have toe add it to our start up application for that to the least, open the dash again type start of obligations and just weeks ahead, just like quake in all three fields. Add on clothes. What makes it so handy is the fact that you can open it on top off your current windows at any time, quickly type of command and re open it again later to check the status off the command. What I actually do is also make it a little be transparent so that when it opens on top of a webpage, where I have some command written I can still read the content on the page and typed the command as I read without switching windows. This is yet another awesome productivity did. 5. ClipIt: copy-paste at its finest: We believe that one off the greatest inventions off mankind is copy paste. The ability to take a piece off text from some random place and inserted toe. Another not surrender in place is a huge time saver. Mankind would still be ages behind if computers wouldn't have this feature. Just imagine having to type every command every Ural, every block off God you read. It would be a huge waste off time. And so, being such an important feature, copy Paste deserves a tool of its own for managing all important text. You cop it. These types of tools are called clipboard managers. There are lots of options for every operating system and one good 31 for Bhutto. He's called Creep it and it can be stalled with Sudo apt install Clip it. Ah, good scenario for using wake if to run cleated in it by default clip it occupies a terminal window. But with the help off quake, we just hide it. No way. The tool is automatically added to the start of applications, so it will start the next time you're a boot. In order to evoke, clip it hit control all h or click the clipboard manager in the Manu Bar the first time it starts, It wants you that it stores data in plain text, so it might not be safe to use if other users use your account. Currently, it contains only the latest clipboard in Element. Let's do a quick example off its usage. We cut the content off the dot profile file and let's say we want to copy some lines of text and run them in another terminal, for example, we might want to update the path variable, then to source the dot bash her see file and then toe update the path variable again. Instead of copying the content again from our file, we just hit control held each and choose what we want toe based from our clipboard history . This is a very basic example clip. It mostly comes in handy when you work long hours on your computer and need to pay something that you copied from ah website hours earlier. It comes with a default history size off 50 items, and it will show you the less than items in your floating window. You can increase these limits in the settings with clip it. You can copy and paste as many times as you want without losing a need data. It's like a time machine for your clipboard. 6. Pre chapter: Vim: in the chapters to come. We will be editing files, so we'll need to choose a file editor. There are a bunch of options, but considering that the fastest way to edit files is off course without living the terminal, we recommend them. Women is an awesome editor. It has a lot of configuration options. Ah, huge community, which has produced lots of plug ins and beautiful dreams. It also features advanced text editing, which makes it ultra configurable and super fast. So let's proceed so the APP install them when he is renowned for its exotic keyboard controls. And a lot of people avoid using it because off this, But once you get the basics, it's super easy to use. Let's start him with no arguments. This is the default screen. You can see the version on the second light to start editing text press insert. This will take us toe insert mode where we can start typing. We can see we are in insert mode at the bottom of the screen. Press insert again. Togo to replace mode where we override diced press, ESC, toe exit, insert or replace press. Why y took up your line? Peter Baseline did he toe cut the line, Kahlan W toe Save what? You changed until now. Optionally specify. Find him in our case. Vim dot txt Call on cue to exit him. Okay, Now let's open the file again and do a small change, then Colin W Q right and exit at the same time. And Kahlan que onda exclamation mark to exit without saving. After learning this commands, we can do basic file anything directly from the command line. This is the bare minimum that anybody needs to know when working with them. And we will use this knowledge in the chapters to come. We will also have an entire section about him where we will go more in depth about being productive in the coolest terminal editor today. 7. Oh-my-zsh: Your terminal never felt this good before!: cash is probably the most commonly used to shell. It has lots of features and powerful scripting capabilities. But when it comes to user interaction that shell is better. Most of its power comes from the awesome framework. Oh my sexual. In this chapter, we will be e stalling sexual with the oh my sexual framework, and we will be looking at some basic configuration options to its. Does that show use Sudo Apt. He stole that show. After is selling it? Go to the link on the screen on followed instructions for installing the oh my sexual framework. The installation process is a one line command with curl or double you get. So let's run the Kirkman. And as we can see, the command is giving an error. Sorry, saying that get is not installed, So we need to install that. Also like money. Simple. So the captain still get notice how easy it is to install softer in a bone toe. This is also a big productivity booster. Every common, softer package we might need is already prepackaged in the remote, softer repo story, and it takes us just one command toe. Add new, softer to our computer Now that we have getting stalled, let's run the command again. We can see that this time it's successful and it's bringing us to our next show, Dar Nu Shell. Oh my! That shall also changes the default shell toe sexual. So after is selling, the first thing to do is to go pick up him to see all available themes. Run this command. Also, we can go in the jittery apple and check out the teams together with their screenshots. For the purpose of the course, we'll use the candidate. I'm because it has a lot of useful information. Your prompt user name host named Time Folder and did branch or status time can be very useful. For example, if you want to know how longer common took to execute and you didn't use the time utility to measure your commands total type, then you can also check out the prompt and see the time when the command started and the prompt when it finished, and thus you can calculate the total time to change the dream, open the configuration file and modify this variable, saved the file and open a new terminal window. Let's initialize an empty git directory so we can see how the problem looks. You can see here we are on the master branch. Let's get the file. Say read me dot MD The Asterix in the prompt shows the directory is not fooling. We can verify this with its status. Okay, After we clean up the directory, the Asterix is gone. If we change the branch, the prompt shows that we are on the new bridge. Let's quickly create a demo Run! Get branch test! Get check out test and you can see the branch naming the prompt Other cool features Come on , completion Start typing for example I P and press tab and we can see all commands that start with I P and we can hit tab again to start navigating through the different options. You can use the arrow keys to navigate and hit. Enter for the reserve command perms completion, for example Allies on and the minus sign and tap and we can see here all the options and a short description for each step again to start navigating through them and enter to select history navigation are upto search in history filtering by the string that is written before the car, sir. For example, if I type them and are up, I can see all the fights open with them in my history, history, search, control, air and start typing and controller again to search the same occurrence, the same occurrence in history. For example, Tilda and control Air to see all commas that have started that have Tilda actually in the string. Oh, right. Navigating control plus arrow left or right to jump one word or controlled up value to deal it one word or control you to delete the whole life city. Ah, change directory complaint. Completion that this case insensitive. For example, City dock Well explaining to city documents with big uppercase city directory completion. If we are lazy and want to specify only a few kill letters in a path we can do that to. For example, CD slash us slash as harsh slash that US plus stab will expand into a CD slash user slash share Slash Is that Oh, my God, This is so smart. Kill completion. Just kill and tap And you will see a list of Pete's to kill Gen. John Completion Captain Joan and Tab to see a list of users to change owner Asterix for arguments. Expansion type ls Asterix and Hit Tab. You see the Asterix expanded toe all files and folders in the current directory for a subset type allies do Asterix and stab. It will only expand toe documents. Andi downloads. That shall also adds a lot off. Alice is just type yes to see a full list. Some very useful ones are the dot to go up one folder dot a dot to go up to Fullers to see a list of shortcuts. Ron Bind Key The terminal is one of the places where we spend a lot of time. So it's really important toe master our shell and use it as efficient as possible. Now, in good shortcuts and viewing, relevant and condensed information such as our prompt can make our job much easier. 8. Basic regular expressions: you have a problem and you want to solve it with regular expressions. Now you have two problems. This is just one of the many regular expression jokes from the Internet. In this lesson, you will learn how regular expressions work as we would be using them in the next chapters . We have prepared a file for our playground, and if you want to try the grab commands on your own, you can take it from the get hub repository. Let's start by opening our text file so we can see its content and then splitting up the screen. So I guess it both the file and a command side by side. First of all those symbols and probably most common regular expression, is to find a single word for this. We will use the command grap joe file dot txt Joe is a string were searching for and file a txt is the file where we perform the search. You can see that grab printed the line that contained our string and the world is highlighted with another color. This will only much the exact case off the world. So if we use lower case G, this rag X will not work anymore to do a case. Insensitive search Grap has an minus E option grab minus E joe file dot txt If we don't exactly know what characters are in our string, we can use the dot Asterix toe match any number of characters, for example to find a sentence beginning with word and ending with day we used the full in command. The dot matches any character and the Asterix after dot matches the previous character multiple times. So any character, multiple times here you can see that it matched the first line in the file. Ah, very common scenario is to find empty lines in a fight. For this we use grab carrot will grab double coats, carrot back slash s dollar sign double coats file a txt where backslash as stands for space carrot for the beginning, off the line and the dollar sign for its ending. These are called anchors. We have to empty lines with no space. If we're the space on the lines, it will match the lines containing one space grab Can do. Ah, neat little trick to count the number off matches for this we use the C parameter to find all the lies that have only letters and space use Grab open codes carrots, dollar from the beginning, off the line to the end, Dub square brackets and Asterix Too much a specific specific characters any number of times and A to Z It was a lower case for any upper and lower case letters. If we're run the command, until here we get only the first light. If we had zero tonight, any number we much another other two lines. So if we and also if we add backslash s we also match any space. We also much the empty lies and the old caps line Here is the command. Oh my God! It's so interesting to read. I don't know how this would sound. Try to read it. Sometimes we need to search for something not in the string. In which case disco man would find old lines that do not have Onley numeric characters, square brackets and after them. The carrot sign means that to match all characters that are not inside those brackets in our case and you know number it matches any known number. Okay, The square brackets are markers in our regular expression if we want to use them in our search string, we have toe escape them. So in order to find lines that have content between square brackets do execute these common . This means any line that has characters in square brackets. The same goes for the exclamation mark toe. Find all lines that have the characters X. The exclamation marks executes this command. Now let's have a look at Basic said. Fine and replace said double codes as slash joe slash hole. Such G double codes find out txt. This will replace every occurrence off the string job with a string, all we will go into more details about said in its own chapter. Regular expressions, just like him, are one of the things a lot of people are afraid off because it seems complicated to learn in the beginning. Although they might seem cryptic, once mastered, regular expressions come to be a handy companion. They are not limited to our show because the syntax is very similar in most programming languages, databases, editors and any other place that includes searching for strings. We will go into more details about regular expressions in the chapter dedicated to said 9. Pipes and subshells: your shell's salt and pepper: in this lesson, we will be looking at ways to improve your productivity using your shell. The linens common line is great because it has a variety off tools we can use. But what makes it even greater is the fact that we can change those tools together toe for greater, more powerful tools that would make us even more productive. We will not get into basic shell commands, and instead we will be looking at some cool pipe and sexual combinations that can make our life easier. Let's start with a basic pipe, for example, counting the length off the current path. PWD Vertical bar W C minus E B W D. As you probably know, stands for print Working directory. The vertical bar is the pipe symbol, and what it does is send the output off the command on the left, to the command on the right. In our case, PW D is sending its output toe W C minus E, which counts the number off characters workout. The cool thing about pipes is that you can create a chain off any number of pipes. Let's do another example for finding used space on a drive. This is the command. Oh, my God. Okay, so the first part before the first pipe gives us the disk usage in a human readable format that's minus age. What minus h stands for actually? Okay, then after the pipe, it's the grab slash home, which shows only the home directory. Then it's TR, which substitutes multiple spaces for just one space, and the cut command, in the end, selects the second column using space as the deli di limiter has the deal emitter, something I get thank you English speakers for correcting me in your mind. As you can see, the command pointed out, 173 gigabytes. It's the size off the home partition. This is a common use case off chaining when training multiple commands, each command reducing the output until we get the desired information and nothing else. In our case, the used disk space, all right to come all the directories in a folder we can use the following command. The basic idea is to count all the lines that end in slash, and here we can see we have only one directory. Pipes are a great option to find and kill processes. Say we want to find the process idea off now the loose and kill all running instances. For this we use disclose the first part before the pipe prince all processes with bid. The second part. Find the ones matching Nautilus. The 3rd 1 inverted grab. It's an inverted grab to exclude the grab process. The Force one. It's to select the Second World in the line, which is the pain and the last one. Eggs are eggs is used to distribute each big toe a kill command. Basically, it is used for commands that do not read arguments from standard input. And now we've killed no twos. This was purely a demonstrative example. There are other ways of doing this. If you want toe better, understand this command just right. The first part. See what happens then The force part pipe. The second part. See what happens until the full command? No, let's open ordinance again and send it to the background by hitting contra set, followed by the background command. Then we Ron big rap now to lose to see all the pits off Nautilus and be killed Nadia's to send a kill signal toe all those processes. Now it's time for some networking. You probably know the if Conflict Command, which is used to print information about the network interfaces to get the I. P. Address of a specific interface. In our case, the wireless interface. Run this command The first part prince Networking information from the interface. The 2nd 1 gets the line with the AP addressing the 3rd 1 Select the second word in the line . We could have also used cut. Then last one got toe only print the second word. And now we see on the screen are private iPad hours. A common use case that might also arise is counting the word frequency in a fight we have here a standard Durham IPSUM text contained in file dot txt. In order to get the word frequency, we use the full in command. And if you want appear smart, just try to read it. So the first part, we get the file The 2nd 1 we transform each space into a new line character. Third, eliminate empty lines force eliminate the Kama and the dot to select only the words tiffs, sword. The result alphabetically. Sixth only show unique lines on last, but yet last actually sort them by numerical value. Good. Now a band grab minus W i d to find the frequency off the word I D or grab w minus w for to see all words that appear four times. Now let's move onto our first sexual example. Sectionals can be written by either enclosing them in dollar parentheses or using back ticks. Back ticks are usually found under the escape key on your keyboard and during our examples , who will be using the first for? Because it's easier to read. Our first example is listing all the folders in our current further a less dollar parentheses. Rs close Brandy's the LS Up Shal returns the files and folders in the current directory and the LS from outside the sexual release those individually showing additional details. Another example is counting all fights and directories in the current directory. Given the fact that dot and the DOT are Hard Ling's that marked the current and parent directory. We need to count all entries minus these tow. This can be done with the following command here. The sexual returned the number off entries in our case. Five. The number we're looking for is the number off entries. Miners. The special folders dot and dot dot notice that the sexual contains a pipe. The great thing is that we can combine pipes and sup sh als in any way in order to obtain the desired result. Imagine pipes and sub shells as Lego pieces for your shelf. They expand way beyond its capabilities and enable you access to new possibilities with infinite combinations. In the end, it all depends on your imagination and how well you learn to use them. 10. Shell scripting for fun and profit: pipes and sub Sal's are one way of expanding the capabilities of our shell. The ultimate way is by writing shell scripts. These scenarios must be taken into consideration when dealing with complex tasks that can't be automated with a one line command. The good news is that almost any task can be automated with use off shell script. We won't go over on introduction to Shell script Andi. Instead, we will be looking at some more advanced use cases for writing them enough talking. And let's start our journey in tow, shell scripting first thing that open a file called Script Up s Age and split the screen so that you can test while writing. Every shell should start with the she Blankman, which is which are dis characters and followed by the interpreter. It will our show Skip will use. We will be using Bash as our default interpreter, and it's a good idea to use Bash because it's a common interpreter that comes with mostly distributions on also are six. So she banged being bash. Let's start with a simple use case reading the arguments passed into the command line. We will assign the value off the first are command line argument dollar one toe a variable called arc and then printed back to the screen. Let's save our script and the sign it execution permissions and then run it with one argument. As you can see, the default value test is printed back to the screen. In some cases, we want to assign default values. Two variables. In order to do this ad, the stood the valuable assignment, followed by the default value. Now, if we re run the script, we can see that passing. No argument will accord the default value default value. Actually on. Just like pipes, we can change multiple default value assignments. Together, we can define another variable ox, assigned the value 123 and use the same syntax to assign its value to the Ark Variable. Before you think the default value script, like so in this case are will always receive 123 as its default value. Now let's look at string selectors to select the sub string, use the Cullen, followed by the starting position, followed by another Cullen, followed by how many characters like this. In our case, we will be selecting for characters starting from character. Five. After running the script, we can see that the for the value long printed to the screen. Most shell scripts are designed to be run from the come online and receive a variable number off arguments in order to read command line arguments without knowing the total number of arguments will use a wife statement that checks the first argument to not be now using the minus that conditional expression, which means it will not be equal to zero in the while. Loop. Let's recall the variables value and run shift, which shifts command line arguments. One position to the left. If we run our script with the arguments ABC, we can see that our while loop through the parameters and pretty each one on a separate line. Now let's extend our clear arguments sparser and at the case statement for interpreting the argument. Let's assume that our script will have ah help option Plastic Standard recommends doing long arguments version with minus minus and short version with only one minus. So both H and help will bring the health message. Also, it is recommended toe always 74th case and print a message when the user sends Evelyn Options and then exit with a non zero exit that if you run our script with the minus h option, we can see the health message printed. CMAs minus minus help. If we run, describe it. Any other option the invalid option Texas printed and the script exits with the exit code. What to get the exit code off the last command Use dollar question mark for your echo. Now let's look at basic functions in chill. The syntax is pretty similar to other programming languages. Let's right the function called Print I P that will print the I P off the interface specified as the first argument. And we will use US sexual and assigned the value toe variable cold I p. I already have the full command inside Arc report. It's the same one we saw in the lesson about pipes. Now let's add another case stores which statement for the minus sea or minus minus a P option. The option will be followed by the name off the interface, which will then pass to the principal function. Having to arguments for one option means we need to call the shift command twice. Let's do and if conflicto get the name off our wireless interface. And now let's run the following command, okay? And we can see the I p address. This is a very basic use case where we can see how command line arguments can be passed. We can add a limited options torque a statement, defined functions for handling the arguments and even change multiple options together to form complex scripts and received well structured information s command line arguments. Being effective means running tasks fast, really fast. And when it comes to speed, Bash is not really the first choice in terms off script interpreters. Luckily, we still have some tricks up our sleeves. So if a shell script needs to run multiple independent tasks, we can use the and symbol to send the process in background and move forward to the next command. That's great to functions. Long running Task one and do and sleep come on inside to simulate a long running task. The first long running task function will be sleeping one second and the next will be sleeping two seconds. Then for testing purposes. Let's add another case star switch statement called minus B or minus minus barrel and run the to long running tasks. Now, if you run this command, it will take a total of three seconds for the script to finish. We can measure this with the time utility. If you run both functions in the background, we can reduce the running time to the longest running time off both functions because of the weight when running long running tasks, we probably want the script wait for the longest running task to finish in our case. Task to We can achieve this by grabbing the peed off the second task. Here we use the dollar exclamation mark toe grab the peed off the last friend command. Then we used the weight built in command toe. Wait for the execution toe finish after running the script again with the time utility we can see takes us a total off two seconds to complete the task. Who would have thought we can DeParle processing in Shell in the case that the executions take a longer time, we can add a notification when the script finishes. Not if I sent script that a sage execution finished. This way we can start the script, work on some other tasks and receive a notification. When the script finishes, you can let your imagination go wild on the things you can achieve with barrel processing and notifications. Through this lesson, we have seen some common show pre defined variables. They were this for first argument for this returns the coat off the last command, and this is the peed off the last man drunk. Other commonly used to shell pretty find variables include the number off parameters, the least off parameters. All the perimeter is done. Name off the shelves, creep or descript, and the pit of the current running shell bash has a lot off features, and we recommend going Streets Man page to get more information about them. Shell scripts are amazing when used the right way. They can find you in system commands like we saw in our example when we got only the I P address without the whole if conflict output well and much, much more. You, as a pragmatic terminal user, should identify what tasks you most commonly do in the command line and what can be automated using shell script. You should create your own collection off shell scapes and add them to your path so that they are easily accessible from any directory 11. Shell scripting libraries: to really take advantage off automating tasks using shell scripts. It's important to organize all common tasks in the reusable commands and to have them available in the path to do this. It's a good idea to create a BIN folder inside the Home Directory for the Scripts and the Beast. Actually, Folder four Story in common pisses off code When working with lots off shell scripts, it's important to reuse large pieces off functionality. This could be achieved by writing library functions for your shot scripts, functions that you can call from multiple places. Here we will create a library script called Util, not shh, which will be sourced in other scripts. By sourcing the script, we get access to functions, and variables from inside the library script were started by adding the print I P function from a previous script. Now we will add another function called Get Arg, which will be used by other scripts for reading command line arguments and values. We were simply pasted from our Cleber history using clip it to select it on. You can learn more about clip it by checking our clipping video. This is just a simple function that will receive a perimeter name as the first argument, the least offscreen arguments as the second argument, and it will search inside the list offically arguments to find the perimeter name. We're also see it in action later on the last function, we're going to create its cold Get public i p. It is similar in terms of functionality with the print I P function only that it will be used to print the computers public i p. That means that if you are connected to a wireless router and you access the Internet, you will get the I p off the router, as in J. P. That the other site C the print API function, just shows the I P address from the private submit. The command is already copied in the clipboard. It's called Dig, and we're using it to access open DNS dot com. In order to read the public AP, you can find more information about it in its man page or by Googling it. Now that we have our library functions in place, let's go and create our productivity booster script. Let's get the script called type you tills, where we will add some common tasks for reading I P addresses. We'll start by adding the she bank, followed by neatly the trick for making sure we are always in the same folder as the executed script. We'll be using the bash source variable to determine the value off the current working directory you see here were using nested sub SOLs in order to achieve this. Next, we resource, though you till script so that the library functions are exported into memory. Then we can ask them from the current script. Let's add the simple cult or get ARC function using a sexual and search for the command argument. Also, let's echo what we found so that we can test our script. The next thing we need to do is to give the script execution rights using the change Mint Command. Also, in order to run the skipped from anywhere, the bean folder must be in the same path. Variable. I could've variable and check that the BIN folder is there and if not, update the variable in the sexual configuration file. All right, let's does the script by reading a command line perimeter with the get arc function, and I can get if you're searching for the I. POTUS commanded a terminal using tap for auto complete, and the command doesn't seem to exist. That is probably because you need to tell sexual to reload. It's bath argument to do this. Issue the rehash command now around this command. This should work from within any folder, and it should print. I pee on the screen Now that we verified, Everything is all right. Let's write some code for our command line argument. If you run the script with the command I p flags with the Scripture, print that on the screen this can be done with the already familiar case statement here. We also want to pass in another argument he face to get the interface that's needed for printing Gay P. It's also would practice toe add default case and eco message, saying Invalid argument saved the script. And let's test it for thing. Let's get the interface name from the life of conflict common. And then let's go and test the script. We can see it's sprinting are private. I pee on the screen. Now let's add our last command to the script public. I peep for this. We just called Get public I'd be function from over utility, lib, save, end, run and received that the command worked our public eyepiece printed on the screen. In this video, I've shown you how to create shell scripts that automate a lot off tasks that you come on the use. The eye beautiful script can also be used as a library script in other scripts because, well, because why would you write the same code twice? Now? What I recommend is that you identify what tasks you come on, the execute and you automate them so that you can do your job as quickly and as efficiently as possible to give you an example. A while ago, there were a bunch of articles on the Internet about this guy who used to automate everything that required him more than 90 seconds to do. He wrote scripts like ordering the coffee machine to start making a lot so that by the time he gets there from his desk, the latter will be finished and he doesn't need to wait. The guy also wrote one script that sent the text message late at work to his wife and automatically picks reasons from a priest. At least when there was activity with his logging on the company's servers after nine PM off course, this example is a little bit extreme, but in the end, it's all about your imagination. Well, within automation, scripts can export your routine work and leave you to explore your creative potential. 12. Supercharging vim: when it comes to being productive in the terminal. One important aspect is to never relieve the terminal and when getting stuff done, a lot of the time we find ourselves having to advise and opening on external green editor Bad move to double our productive ity We need to leave those days behind and together Job done right there in the terminal without opening full fledged. It does just toe added one simple line off text. Now there is a lot of debate going on about which is the best text editor for your terminal , and each one has its pros on cons. We recommend them. An editor, which is ultra configurable and once mastered, can even out much on either. The first thing we need to do in order to kick start our Vimpel activity is toe have a well configured configuration file. Let's start by opening a new hidden file in our home folder, and this is the same configuration friend and there were based a few lines. Now let's close and reopen the file. We can see that already the configuration took effect. Let's go into a little more detail regarding some of the options. First of all. As you've probably guessed, the lines, starting with double coats are comments so they can be ignored. Lines 56 and seven Tell them to always use spaces instead of tabs and to set up size to four spaces. Line 10 to 12 tells them toe always open a fine and said the cursor in the same position as the last time the file was open. Syntax on enables syntax highlighting, so it is easier to read, Code said No based said no based mode, which means you can paste coat without having him tried to guess how to format. It said Number tells him to always show the line. Numbers set on the levels equal. 1000 tells them to remember the last 1000 changes we made to the file so that we can easily undo and redo. Now most of these features can be easily turned on or off. Say, for example, we want to copy paste some lines from a file opened in him, do another fight. With this configuration, we are also going to paste the line number. What we can do very quickly is toe switch off the line number by typing set no number. Or if the syntax is annoying, we can easily switch it off by running syntax off. Another common feature is the status line, which can be configured by basting these options. Close the file and open it again. Now we can see at the bottom of the page a status line with extra information. This is also will try configurable so we can put a lot of different stuff. East site. This particular status bar contains the name off the file, the current directory, the line and column numbers and also the basement on or off to set it on. We use, said based, and the change will show up in our state status line. We've also has the option of changing the color scheme. To do this, we goto this directory and choose a color scheme from there. Let's choose desert. Remember, it's not deserved its desert. Okay, close and reopen the fight. You will see it's not a different from the previous color them. If we want a more radical one, we can set the color them toe blue, which will drastically change the way it looks. But during the rest off discourse, heuristic toe desert, not dessert. Them can also be supercharged with the help off external tools in the world. Off programming we often find ourselves at things son files and that can have a very diff can be a very difficult task. If the juice on file is not indented, there is a python module that we can use toe automatically in. Then Dizon files and Dream can be configured to use it internally. All we need to do is open the configuration file and based in the following line. Essentially, this is telling them that one in visual mode if pressing J it would call Python with the selected text. Let's manually right there is your son String Goto Visual mode. By pressing V said that the text using our arrows and hit J and with no extra packages we added urges son formatting shortcut. We can do the same thing for XML files, but first we need to install it to for working with them. Easy to adopt the stall, the example to minus it deals To install the XML utility package, we must add the following line Tore configuration file the Rome It maps the Elke when in visual moat toe exam a wind. Let's write a small HTML, which is actually a valid example. File hit V for visual mode. So the tax on price l these types of extensions and also spell checkers. Linder's dictionaries and much more can be brought to him and be instantly available to use . A well configured VIN file can spare you a lot of time in the command line, although it might take some time in the beginning to get things set up and to find a configuration that is right for you. This investment can pay off big time in the future as time passes and we spend more and more time in vim. Ah, lot of times we don't even have the luxury off opening agree editor like Oh, when working remotely, it was as his hash session. Believe it or not, command line editors are life savers, and productivity is hard to achieve without them 13. Keyboard kung fu: Now that we have them all set up, it's timeto learn some workmen line shortcuts. The first thing we will be looking at is indentation. Indentation can be done in vain by going in visual mode and typing V for selecting portions off text or uppercase V for selecting full lines. Fold by greater than or less than to invent right or left afterwards. Price dot to repeat the last operation. Any operation can be undone by hitting you and then can be redone by hitting Controller is in undo and redo. This is the equivalent off controls set and Contra shifts that in most popular editors. When in visual mode, we have the option off changing the case off letters by hitting big you toe make whole text upper case or small you for lower case until there for reverting current case. Other handy shortcuts are uppercase Jeep Goto and a fight DJ. Good game. No, no, really, Except for the gamers out there, G means Goto start of file and select all this is not really a sure cut, but the combination off commands G uppercase v uppercase G as in Go to start the file, select full line and move to the end. The team also has a handy shortcut for opening man pages for the word under the cursor Just heat uppercase que and the man page will show up for that specific word. If there is one that is, finding text in vim is as easy as heating slash just type slash blast. The text to find and hit enter to start surging them will go to the first occurrence off that text hit and for next occurrence and uppercase and for previous occurrence, our favorite editor has a powerful find and replace feature similar to the set command. Let's say we want to replace all occurences off the string CWD with the string the are for these just type the following command. So the first part until before the S its start from line one until the end of the fight. Then it's us that comes from substitute slash cwd slash gear slash to replace. Sit up. You deal with deer and small G for a global to replace all currencies. Let's do another common example that often comes up in programming commenting lines of code . Let's say that we want to comment, outline stand to 20 in a shell script. To do this, just type the following command. This means substitute the beginning off the line with hash and space for deleting lines off text type the following command. This will delete everything from line 30 until the end. More information about regular expressions can be found in the chapter dedicated to regular expressions. Also, check out the chapter on said for more text manipulation. Examples. These commands are some of the longest in vim and often times we get them wrong to edit the command we just wrote and run it again. We can open the command he studied by hitting Cure Cullen Andi navigate to the line containing the command toe edit, then press insert AB deadline, press escape and enter to run the command. It's a simple as that another operation that is often useful is sorting. Let's get a file with unsorted lines off text from the classic Lauren Ipsum text Open sorted out Txt and Ron Colin Sort. We see that the lines are all sorted alphabetically. Now let's move forward to window management. Them has the option to split the screen for things. Files in parallel just right, Colin split for horizontal spit and Cullen split for vertical split. When Jim splits the screen, he took miss the same file in the other pain toe open. Another file just hit Cullen It then I think here is that we have auto complete, so you can just hit up. And dreamer, start writing file names for us. If we don't know what files we want to choose, we can just run any arbitrary shell command directly from them and come back once we've finished. For example, when you type this command, the shell opens. Shows us the output off the common and wait until we hit Enter to come back to the fight. When he split mode press control W toe move between windows to close a window. Press Cullen que If you want to save a file under a different name, think off the safe ask amount from other editors. Just hit Colin W followed by the new file name. Say my copy dot txt. We also has the option off opening multiple files at once. Just specify a list of files after the Vim command. After the fights are open, Use Colin Bientot move to the next fine and to close all the fights. Heat Colin Q. A Dream also has an Explorer built in. Just opened him and hit, Gone and explore. After this, we can navigator the directory layout and open new fights. It also has a diff option. Let's open a file, delete one off the lines and save it under a new name Exit and opened the toe files with the gift. Now we can see the differences between them. Visually, this applies to all sorts of changes and is always better than the plain old dif command outward keyboard shortcuts really make a difference and open a whole new world of possibilities when using him. It's kind of hard to remember in the beginning, but once you start using them, it will be a simple as creating a bottle. 14. Plugin steroids for vim: in this chapter, we will be looking at how we can add external plug ins to him. Jim has its own programming language for writing plug ins, which we saw a glimpse off when writing the vim configuration fight. Luckily, we won't have to learn all of that because most of the stuff we can think off already has a plug in over there to manage. Begins let you start the plug in manager pathogen. We open the site and followed installation instructions. As you can see, it's a one line command and after it finishes at pathogen toe the same configuration. Fine. Okay, most either. Zschau a three layout off the folder structure in parallel with the open files. Vim can do this also, and the simplest way to achieve this is by installing the plug in named nerd three. We opened this site and follow the instructions for installing it. Now we should be all set. Let's open a file and type in artery on. We see here a tree like structure off our current folder, where we can browse and open your fights if you want them to replace, are either. This is certainly a mandatory plugging another awesome plug in that comes in really handy is called Snip Made, and it's used for writing code snippets to install it. We go to the link on the screen, earned followed instructions as we can see before he starting Snip mate. There is another set off plug ins that need to be installed. Um, if we take a look at the read me, we can see on example for CIF Ice, which has auto completion for the four key Ward. Let's open if I with a see extension type before and hit up, we can city auto complete working. We have also installed the teams Need Mate package, which comes with lots off snippets for different languages. If we take a look in its directory, we can see lots off snippet files. Let's check the JavaScript one. And here we can see all the snippets available, like fun and hit tab for the function auto complete. There are lots of plug ease out there. People made all sorts of plug in packs that are guaranteed to put your vim on steroids. One called Project is this one. It's nicknamed the ultimate of implied impact, and it basically has plug ins and keyboard shortcuts for everything. This is for the more advanced users, so be sure to understand the basic concepts before jumping to plug in packs. Remember, the best way to learn is to stop against manually and play with them one by one. 15. Vim password manager: vim can also be used to safely store information by encrypting text files with different creep methods to see the cream. I thought that vim is currently using type this command we can see in our case it zip, which is not actually crypto method and does not offer much in terms of security. To see what different alternatives we have, we can type the following command. A page describing the different encryption methods comes up. We can, just from zip blowfish on blowfish to the most secure and recommended one is off course. The last one Blowfish to to change the encryption mattered type duh following calm mind. This can be also added toe the same configuration file so that it becomes the default encryption. Now we can safely encrypt files using them. A common scenario would be storing a passport file. Let's open up off new file called passwords dot txt at some dummy passwords, decide and save it. Our next step is to include the file with the passers on. For these with type colon uppercase X, Wim will prompt you for a passport twice if you exit without saving the file, encryption will not be applied now encrypted again safe and exit the fight. When we reopen it, women will ask for the same passport. If we get this wrong, Wim will show some random characters that come from the failed description Onley. If we type the correct password, will we get the actual file content saving encrypted files with him? Combined with backing up the file, places like a private get repository or a private Dropbox folder can be ineffective way off storing your passwords. And it has the benefit that it's sort of a unique method off storing passwords compared to using a light services that are pretty standard and might get compromised. This can also be referred to as security through obscurity. 16. Extra: fast configuration restore: The configuration we have seen during this chapter might take some time to set up manually . But once everything is configured, we can create a script that we restored the same configuration instantly. For this, we based all the commands issued until now in tow a bash script which can be run to bring them to the exact same configuration. All that is missing from this script is the Dream configuration file from the Home folder, which we can also restores for technical. Here docks just get ready directed outward Bovim conflict to have in configuration file and use your dog as input delimited by. And the fight here Docks is a common technique for manipulating large chunks off text inside bar scripts. Basically, it treats a section of a code like a separate file in our case, everything after the cat on until the and the fight With the script, we can restore all the vin configurations we have done, and we can also run it on any different computer we work on so that we get our team set up in no time. You can find the full script on the get hub repository together with all the course. Resource is if you haven't already. Clown did check the link in the description. We have reached the end of the Vim chapter. Ah, friend of mine used to say I've been using them for two years now, mostly because I can't figure out how to exit it. This is a joke. Off course. Lots of people find him hard to use because of its exotic able sure cuts and commands. But once you get the hang of it, it helps to become very productive. This doesn't mean you should just go and replace your favorite vim now. But for most off the common tasks that need to be completed from the terminal them is an ultrafast option that gets the job done. We hope you have enjoyed this video and see you in the next one. 17. Sed: one-liner productivity treasure: if a picture is worth 1000 words then, said one, liners are definitely worth 1000 lines off code one off. The most feared commands in the Lenox qui is you guessed, it said. It's been feared by programmers, and system means everywhere because of its cryptic usage. But it can serve as a very powerful tool for quickly editing large amounts off data I have created five files toe help demonstrate the power off this awesome, too. The 1st 1 is a simple file containing the humble line off text. Orange is the new black Let's start by creating a simple set command to replace the word black with white. The first argument, off said, is the replaced command. It's divided into three parts by three dashes. The first part is us for substitute. The second part is the words to be replaced black in our case, and the third part is the replacement word white. The second argument is the input in our case off five. Okay, now the result will be printed on the screen, and you can see the word black has been replaced by White. Our second example contains yet another line off text this time with the word black in both upper on lower case. If we run the same command using this new file, we will see that it replaces only the world that matches the case. If we want to do a case in sensitive replace, we will add two more characters to the end of our side. Command G and Big G means global replace. It's used for replacing all the occurrences in the file. Without this, it will only replace the first argument. B means case insensitive search. Here it is. And as you can see, both words have been replaced. If we want to save the results in our file instead of printing to the screen, we use the e argument, which stands for in line replace in some scenarios, we might also want to save our initial files, just in case we have an Aurora in the said command. To do this, we specify a suffix after E, which will create a backup file. In our case, we will use the daughter back suffix. If we check the content off the file, we can see that the initials file contains the updated text and the back of file contains the original text. Now let's look at a more practical example. Let's say we have a shell script that contains multiple variables, and we want toe surround our variables with curly brackets. In order to do this, we will, right? As for substitute G for global meaning, replace all occurences found dollar slash dollar actually match bolstering starting with the dollar sign here, dollar needs to be reaped. Escaped so that it's not confused with the start off the row anchor. So it's slash dollar. We will enclose the string following the dollar in parentheses so that we can reference it in the replace part of our command square brackets for specifying a range of characters. A to Z to match all uppercase characters 0 to 9. Too much old numbers underline though my choo underline search plus, which means I need character in the square. Brackets must appear one or multiple types in the replace part. We use the dollar sign escaped the curly brackets we want to add, and the stream that was previously matched in the paren thesis seems like in our example, we forgot the opening parentheses. Other common scenarios are replacing content in XML or HTML fights here we have a basic HTML file with a strong text inside. Now we know that the strong text has more semantic value for search engine optimization. So maybe we want toe make our strong tax be a simple, be bold and manually decided the strong words in the page. For this, we say substitute the actual text you're searching for. This will be used again for selecting a piece off dice that would be headed back. This means any character found any number of times we want to select everything between the starting strong and the end strong. Closing off the tag This we want to keep intact and just add BB and the text do previously found in the parent is okay. It seems as a foreign language at first. But with time, you will understand still need We need to fix a small typo. Yes, here and as you can see, the text was updated correctly. The red class still applies to the new attack on the all taxes still contained between our tags, which is exactly what we wanted. Besides, replacing said can also be used for deleting lines off text. Our five dot txt file contains all the words from the Lauren Ipsum text. If we wanted to delete the third line of text, we would issued the command said Line E three d five point txt. Oh, my God, I'm not going to repeat them again Now. We loved the file in them and we see that the word is no longer there. If, for example, would want to delete the 1st 10 lines off the file with, simply run this command, Okay, Now we see that the lines are no longer there. And for our last example, if we scroll down, we can see multiple empty lines off text. These can be related with the following command, which stands for beginning off line anchor and off line anchor and do it. We load the file and you see that the lines are no longer there. Now, as you can imagine, these have only been some basic examples. The power off said is much greater than this, and there are way more possibilities off using it than what we have seen today. We recommend that you gain a good understanding off the features presented here today as these are the features you will probably use the most. It's not as complicated as it may seem at first, and it really comes in handy in lots off scenarios. 18. You can run, but you can’t hide… from “find”: tens off projects, hundreds of folders and thousands off files. Does this scenario sound familiar? If the answer is yes, then you probably found yourself more than once in a situation where you couldn't find a specific fight. The find command will help us locate any file in our project and much more. But first, for creating a quick playground. Let's download the Electron Open Source project for these views Git, Clone and now a city into it. Change Directory. We see here lots off different files and folders, just like in any normal sized software project. In order to find a particular file, let's say packaged package dot Jason. We will use this command. The first argument is where should find search in this case in the current fold. And the second argument is the filing to search for And of course, the finding. If we were to look for all really read me files in the current project, the previous command format is not helpful. We need toe issue are case insensitive find for demonstration purposes. We will also create a REIT me dot MD five. We touch it, innards created and use this argument for case insensitive search. Okay, You see here that both read me that Andy and big upper case with me that they have been found. Now, if we were to search for all JavaScript files we would use find with these arguments. And as you can see, there are quite a few results for narrowing down our results. Let's limit the find to the default up folder. Okay, As you can see, there are only two Gs five in this folder. And if we were to find all five that are not javascript just at an exclamation mark before the name argument like this, you guess. See, here. All fives that thought Don't end their name. We'd shall a script if we were to look for all the nodes in the directory which are off type file would use. These are and in the same way with this one, we find all directories in a specific location. Find can also locate files based on time. Identify IRS, for example in order to find all files in the U user share directory that were modified in the last 24 hours. Issue the following command and on my computer at the time of this recording. I have quite a big list. Using anti modified time broadens the least even more. If we were to find, for example, all the files modified in the last hour, we can use modifying minimum 60. I mean, it's like this. Ah, good Father to search is slash local slash share. If we use MMI modified minimum 90 minutes, the least broadens again. Find can also show us the least off fights access in the last 24 hours by using the access time minus one argument. Like so, while working with lots of project files, it is sometimes the case that some project remains empty and we forget to delete it in order to locate all empty files. It just do a find minus empty. And as we can see, Electron has a few empty fides. Find will also show us empty directories or links. Removing empty fights will keep our project clean, but when it comes to reducing size, we sometimes want to know which fights are taking up most of the space. As we said in the beginning, Find can do much more than locating files in our project, using the exact argument it can be combined with almost any other command, which gives it almost infinite capabilities. For example, if we want to find all JavaScript files that contain the text manager, we can combine find with grab like so this will execute the grab command on all fights returned by find. That's also search inside the file, using them so that we've verified. The result is correct. As you can see, the text manager appears in this fight, moving on with the practical examples. Let's say you have a folder where you want to remove all the fights modified in the last 100 days, we can see our default APP folder contains such files. So if we combine, find with remove like so we can do a quick cleanup find can be used for smart backups. For example, if we were to back up all just sown files in the project, we would combine find with the Scipio Backup utility using a pipe and a standard output redirection sound sounds complex, but it is just like this command Scipio sounds like Star Wars snake. We can see that in this command. We created a backup dot Scipio file off type Scipio and Archive now, This could probably have been written with exact also. But it's critical, you understand that pipes can be can also be used in these type off scenarios together with a red erect. When you doing reports, you may have toe count the numbers off lines return. In order to do this, we combine find with work count. Thank you. This will give us all JavaScript funds and the number off the lights. We can fight this to cat. Here we go toe on, Lee out with a number off lines and then pipe to the base command. We do this. This will march all our lines with a plus sign as a day limiter. This off course can be translated toe on aromatic operation, which we can calculate using the binary calculator. Here we go, Long life and this last command will tell us how many lines our javascript files contact off course. These are not actual lines of code as they can be empty lies or comment for a precise calculation. Off lines off code. You can use the Slovak utility in orderto master name files like changing the file extension named toe note for all justifies. We can use this command. You can see the rename syntax. It's quite similar to said, and there are no more justifies left because they have all been renamed to the so fixed note. Some softer projects require all source code files to have a copyright header as this is not required in the beginning. Oftentimes we can find ourselves in the situation that we have to add copyright information in the beginning off all our files. In order to do this, we can combine find, Witt said. Like this, while this is basically doing, is telling the computer to find all node files and at the copyright notice in the beginning , off each file, followed by a new life, we can check one random fight and yes, the copyright notice. If there, as you can imagine, find, has lots off use cases. The examples I've shown you are only the first piece off the pie learning find along with said, and the Jit Creek can set you free from your either when it comes to finding re factoring or working with it, which means you can more easily switch from one either to the other, because you don't have to learn all the features. You just use your friendly Klay tools 19. Tmux: Virtual consoles, background jobs and the likes: In this video, we will be looking at another great tool called Tim Oakes. Tim Oakes especially, comes in handy when working in remote secure shell sessions because it gives you the ability to continue your work from where you left off. It can also replace some of the features in Terminator. If you are working for example, on Mac and you can't install Terminator to get started with the marks on the bone toe, we first need toe. Install it. So apt. Install Tim Oakes. Then just run the command Timex and you will find yourself inside a brand new little consult for demonstration purposes. We will open up on your tab and here you can see the list off open sessions with the Monarchs. Ls that start a new Timex name session Here We can see that opening a team accession maintains the current directory to least and switch Dimock sessions inside the MCs hit Contra B s. We can see that we can switch to another team accession, execute commands inside and switch back to our initial session. If we want toe to the touch, meaning to live, ah, session running and go back to the normal terminal hit control B D. Now we can see we have two sessions opened to attach to a session. We used this gun. All right, This scenario comes in handy when you log into remote server and want to execute a long running task, then leave and come back when it doesn't. We will replicate this scenario with a quick script called infinity dot s h. We were executed. It's writing to the standard outward. Now let's detach for from Tim Books on. If we look at the script, it's just a simple while loop that goes on forever. Printing text each second. Now when we come back to our session, we can see the script with running. While we were detached from the session and it's still out putting data to the consult, I will menu stop it by heating controversy. All right, let's go to our first team accession and close it in order to manual Akilah team accession used the following Conned. This will kill the running session. If we switch over to our second tub, we can see that we have been locked off the marks. Let's also close the Terminator tab and open a brand new Dimock session. The marks gives you the possibility to split the screen, just like Terminator. This is how we can do it. Hurry centrally, Andi, this is how we can do it vertically. After that, use country the arrow to navigate between pains. You also have the possibility to create windows off so called steps. Here is how we create how released on how we do it. These last functionalities are similar to what Terminator offers you. Can Houston books in situations where we want toe have two or more pains or even tubs in your remote, secure social connection. But you don't want to open multiple secure shelled sessions. You could also use it locally as a Terminator replacement. But the keyboard shortcuts are much harder to use, Although they can be changed, you will lose the possibility to use the mooks remotely because opening a Tim accession another thing session is discouraged and configuring Nimal Notimex. Keeper's shortcut might make Tim looks a bargain when working on lots of servers do do the shortcut differences 20. Network: Who’s listening?: When working with network applications, it comes in handy to be able to see open ports and connections and to be able to interact with ports on different hosts for testing purposes. In this lesson, we will be looking at some basic a month for networking, and in what situations they might come in handy. The first command is net stop. This will show all open ports on our host. You see, here we only have one open port on a default, a Boon toe desktop application, which is sport 53. We can look this up in the special file ethical services, and this file contains all basic port numbers for programs and protocols we see here. Port 50 Street is the DNS server. Just by analysing the outward, we cannot determine which program is listening on this sport. That is because this process is not owned by our current user. That's why the beads slash program Name column. It's empty. If you run the same command again with pseudo, we see that this process is named Dennis Mosque, and if you want more information, we can look it up in the man page. It's a lightweight. The HCP and cashing Guinness server. Other useful information we get from these commands are the program protocol in this case, the HCP total bytes not copied. Total bytes not acknowledged. Local and foreign address and port. Getting the port is the main reason we're using this command. This is also important for the term meaning if the port is open, just a local host or if it's listening for incoming connections on the network, the state off the port. Usually this is listen the bid and program name, which helps us identify which program is listening. What port Now if you're on a program that is supposed to be listening on a certain port and we don't know if it's working, we can find out with nest that let's open the most basic. Http server By running this command, as you can see from the output, it's listening on port one, about 8000 on interface. You don't get host. If we open a new pain and run the nets that command, we will see the open port and the PD slash Nate. You probably already know this, but just to be on the safe side, we will be looking at different host names Aesthetic Dennis Andries on our machine. This is helpful when developing applications that need to connect to servers and the servers change their I p address or when you want to emulate a remote server on local machine. For this, we type the following command. You can quickly understand the format of the file from the existing content. Let's add on Alias for our local host so that we can see under a different name really command using non existing top level domain names for local house such as the local or death. And this is to avoid overriding any existing address because at the hosts takes precedence . Indiana's resolution. Now, if we open the address in the broth sir on Port 8000 were see our local bison server running and serving conduct. The next command is them up. As you can see, it's not installed on default on a boat, so let's go ahead and install it by they typing sudo Apt. Installing them up. No map is a command use for checking all open ports on a remote toast, also known as a port scanner. If you run them up on our network, Gateway which in our case, is this API. We get all of the open ports on the gateway. As you can see, there is again the Deanna Sport open the http and https servers, which are used as a webpage for configuring the router and port for the 9152 which at this time is not specific toe any common protocol. And that's why it is marked as unknown. No map does not know for sure that those specific programs are actually running on the host . All it does is verify what ports are open and write a default application that usually runs on that port. If we are not sure what server we need to connect to or if you want to know how many servers are in our current network, we can run them up on the local network address specifying the network of mask as the destination that we get this information from if config If r I p address is this one, and our net or mask is this one. That means the command will look like this for the slash 24 which means that basically, the network we have eyepiece ranging for 192.168. 00 to 192. That what 168.0 dot 255 we see here we have three active hosts, and it even gives us the late INSEE so we can determine which hostess closer. No map is helpful when developing client server applications. For example, when you want to see what ports are accessible on the server, however, loom up might meet application. Specific ports, which are known standard toe, actually connect to a given port we will be using Tell it, which comes preinstalled on Born to this stuff to see if a particular port accepts connections. Just type the host name, followed by the port. If the port is listening and accepts collection, telnet will output the message like this one. This means that you can also connect from your application. So if you are having difficulties connecting, it's usually a client problem. The server is working fine to get out off helmet. It's dis command full by contradict also, in some cases, we need to get the I P address of a particular hosting the simplest way to do this is to use the host command post were born to dot com. Today, we've learned on Lee the basics, the minimum elements you need in order to start working with host names and ports for a deeper understanding off networks and package traffic. We recommend checking out courses on Van Interational testing on that traffic, analyzing tools such as wire shark. 21. Autoenv: Set a lasting, project-based habitat: objects are different from one another. And so our environments, we might be developing an application on our local machine with certain environment variables like the bug level, a pinkies or memory size. Then we want to deploy the application to a staging or production server, which has other values for the same environment. Variables. A tool that comes in handy for loading environments on the fly is auto. To install it, we go to the official, get her page and follow the instructions. First, we were cloned the project in our home directory. Then we had this line to our conflict file, so that every time is that shall starts. Auto is loaded by default. Now let's get an example workplace with two imaginary projects, particularly and protect toe. We open on environment file in Project one, and let's imagine that protect one uses a new environment variable, cold and which we will set toe death. Now let's do the same thing for project, too, but with a different value for em to a save and close Both fights. And now we city in the project folder and we see the following message. Oh yeah, hit yester load the file, and this happens every time a new environment file sourced. Now, if we grab the environment for the end variable, we can seat present and with a value off death. Now let's change the directory to Project Toe. We see that the same warning message is issued, and when we grab for the and variable, we now see that it's value ISC way. If we leave this folder, the environment variable is still defined and will be defined under some other script Overrides it or when the current session is closed, the end file is sourced. Even if we see the in tow a directory deeper inside. Protect what? Now? Let's look at a more complex example for Project one. Let's say we want to get the version from package just, and you also want to use a variable called composed file that will specify different file for Docker. Compose Dr Users know what it's all about, but if you don't, we'll go time. And for this to take effect, we need to first copy a package. Tucson Fine and test that the cat command works. Everything seems fine, so let's sit in tow our folder and as you can see the environment. Variables have bean set auto M can really come in handy, and it's not limited to just exporting environment variables. You can do stuff like issue reminder when entering a certain project or running a get pull over updating the look and feel off the terminal so that a distinct feel is given for each project. 22. Don’t rm the trash: commands can be categorized as harmless or harmful. Most commands full in the first category, but there is one that is very common and that has been known to produce a lot of damage in the world. Off computers, the dreaded command is removed, which has wiped out numerous hard drives, making precious volumes off data inaccessible. The Lenox desktop has borrowed the concept off trash from other desktops and the default action. When deleting a file, he's sending it toe the trash sending files. There is a good practice so that no unintentional removing is done. But this trash is no magic location. It's just a hidden folder, usually located in homes. Lash that local. In this lesson, we will be looking at a utility tool designed to work with trash. We really started. These were installed multiple commands. Let's look at our current directory that contains quite a few files. In order to remove a fire, we will use Strache filed a txt. There is a separate command for working with a trash. We'll rehash to reload our past. We list all the trash commands on the command for listing The trash content is trash list. Here we see the files that are in our trash. It is only showing the fights that were put there with the trash command. We can see the date when they have been deleted the hour and exact location. If we have had multiple times with the same name and path, they would have been listed here and we could have identified them by the coalition date. In order to restore file from trash, we'll use the command restore trash. It will show us a list of options and ask for a number responding to the file that we want to restore. In this case, we were selected, meaning we want to restore the just some fine. We opened the file and we can see that the content has was not altered in the process. In order to remove all the files in the trash we used trash. This is the equivalent off doing drama in the first place. Now, if we leased the trash again, we see it doesn't have any content. Although the Internet is full off these types of jokes, this is actually a serious issue that can cause headaches and with the time trying to restore the damage cost. I do it. Don't type that command. It will erase everything. If you have been using rumor for a long time and can get in the habit off using trash, we suggest adding an alias for removed toe actually run the trash. Common is that in this case it's a good idea to pile up stacks off files in trash, then to risk removing a file that might that might be needed before commit, or even removing the whole root partition. Don't do that. 23. On the spot webserver: when it comes to http servers, there are quite a few choices out there. Some even have their own books on configuration options. But sometimes we just want toe quickly. Open a bare minimum. Http. Server toe test a piece off JavaScript code we just wrote in this lesson, we will see how we can do exactly that. We have prepared a basic demo html file that contains a button a Dave query for helping us to some Ajax schools and the script that will try to load static content from our server and put the content inside the diff. The script is trying to love the file on the disk such file, which is nothing more than a simple text file. If we open this file inside our browser, we can see our page conduct. Clicking on the button generates a JavaScript error. It is telling us that we want to do across origin request which is not allowed by default by the browser. This is to prevent cross site scripting attacks. What we need to do in orderto test our Jascha code is to serve this file in our http server In order to start the http server in the same folder as the file. We typed the command on the screen. This is a basic python module that open sport 8000 on local host serving Onley static content. So no, you can't use it for PHP. Let's open the address in the browser, take on the button. We see that our file content was loaded in the dif beneath the button, which means the browser is no longer blocking us because we are issued requests but the same host using the same protocol. Looking at the output from our Python server, we can see all the requests the browser has made to the server. We can see it's requesting by default off african dot icon file, which doesn't exist, and it's giving back ah, four or four status code. You can find the files used in this project on the get help project bait. Also, if we stopped a server and go one level up and fire it up again, we can use it as a Web deaf server, having the possibility to navigate through the files in the current directory. We could, for example, give access to a folder on our local machine toe remote user and allow him or her toe access it through a page in the browser, eliminating the needs to install Fiserv. 24. Shrinking spells and other ImageMagick: In this chapter, we learn how to process images from the command line. We'll start with the most complex and widely used image command line interface processing to Kid called Image Magic in order to install it. Run Sudo Update. Stall Image Magic, as you can see already have it installed. Now let's find some images to process. Let's use the default open toe backgrounds that can be found in user share. Background. Let's copy the backgrounds to another location so that we don't alter our default ones. Let's take a look at the first image in our list. We can see from Dallas that it is a JPEG image off 1.6 megabytes toe. Open it and see how it looks. Let's use the elk I off gnome image viewer. The first and most important part in knowing how to process an image is knowing what that image actually is. To find the South image Magic comes with a tool called Identify. In its simplest form, you have to feed it on image name, and it will output information like the following. We can see that the file is a JPEG image off 1.6 megabytes on most importantly its size. Is this be yes, it's so huge. If we look at the party final Boone toe, we see that the outward format is pretty similar. We see that the size and resolution are higher and that the image format is B N G. Let's see how it looks. PNG images usually take more space than jetpack ones. If you don't have transparency, it is recommended to use Agent back in order to convert from one type to the other. We use the image Magic Convert Command. We took parameters. It would find him on output. Filing the format off the outward image will be deduced by convert from the final extension . As you can see, the output is a super gimme two with the same resolution, but with a much, much smaller size than the A. P and G version 180 kilobytes instead, off 2.6 megabytes. And if we open the image, we can't see any noticeable differences. This is a big thing when it comes to Web development, because if we were to use this picture on a webpage, it would load even 15 times faster than the PNG version. If you want to crop a region off the image, we can do that with convert. For example, if you want to cut of 500 by 500 piece off the image. Starting according it's 101 100 would use the command on the screen. As you can see, the awkward image is at the resolution requested, but it has a much lower size off only 2.5 kilobytes. Usually analyzing the images, we can see that a cropped one is a region off the big picture. Normally, you wouldn't want to guess pixels in the command line, but would use an image processing software like gimp or Jim actually to do the work for you so that you can visually select and crop portions off the images. But when developing software applications, it is often the case that you have to programmatically crop images, in which case this comes in handy. Convert is also good at creating images. If you want to create an image from a text string, we could use the following command. This will create our JPEG image off size eight pictures containing the text specified in this case, the string 123 we can see the outward it is, ah, 3.4 kilobytes image, and if you look at it visually, we see the text one toe. Three. This can also come in handy in different scenarios where you need toe programmatically generate readable images like doing capture softer or generating before profile images with the users initials. Now let's look at some image shrinking tools outside off image magic. The 1st 1 is a PNG shrinking tool called PNG Quint. We will install it by typing Sudo Apt Install BNG Quint. Now let's try to shrink the large PNG image that we were looking at earlier. If supposedly, the image contains transparency and it needed to stay in the PNG format, we could just call PNG want with this image name by default, it outputs of fire with the same name and then added extension of state. We can see the difference in size is also noticeable. It's smaller by one megabyte, which is almost half the original size, and if we visually compared the images again, we won't be able to spot any differences. All right, now, let's try and do the same thing for JPEG images for this we stalled equivalent off Pangea quant with cheese JPEG. Opt in. So Dr Stylish, we will call it the same way, and we're just giving it a command line argument, which is the file to shrink. Let's pick some random images to try and see if we can reduce their size. As you can see from the output it is saying skipped. That means the image was already shrunken, probably the guys at open toe or using the same tool before submitting the image. Also, if it right on the JPEG produced by image magic, you can see that it also it is also skipped. Image. Magic already uses the minimum necessary for it. The image processing tools come in handy, especially when it comes to Web development, where lots of images need to be used and their size needs to be as small as possible. Common lentils are especially useful because they can be used toe automate tasks. Image shrinking is usually added to build tasks where production versions off websites are prepared. The image magic talk. It comes with a lot more tools than the ones we have seen today, so feel free to explore other handed commands from the toolkit. Also, when it comes to graphically processing the images, there are some great open source tools like Jim and Escape. That can really help you get your jump down and also save a lot off my 25. Go with the Git flow: it is by far the most popular version control system out there. In this chapter, we will be looking at a plug in for Get Cold get Flow, which proposes a branching model for softer projects. This branching model doesn't offer much help when it comes to small projects, but medium size and large projects have a lot to benefit from it. We'll be looking at a variation off the get flow plug in cold blood Flow a V Age, which had extra functionality like get hooks to install it. We will follow the instructions on the page we are on a boon to so we will follow the installation instructions for lyrics. We can see that it can be directly installed from with the Apt Command. But usually up does not contain the latest version of the software. So today we will do a manual installation. We want to pick the stable version and use the one line command. Let's get an empty directory and initialize it as a get reports story. Basic it use. It is not the purpose of discourse. We are assuming that you understand the basics, a good way to get started with get flow is to read the Excellent Cheese created by Daniel Coomer. This provides the basic tips and tricks to get you started quickly with a program. So the first thing that should, she suggests, is to run, get float in it to configure it. We actually answer a bunch of questions about what names the branches should have in it flow. And what is the version? Tack Graphics and Hooks directory. Let's just leave the defaults in. All right, If we run, get branch, we can see that we are now on the developed right, So no more developing on the master branch. This helps us have a stable master, while not so stable features are kept on the development break. If we go back to the church, it we can look at the first item, which is feature branch feature. Branches are useful when developing a specific part of functionality or doing re factoring . But you don't want to break the greasing functionality on the develop bridge two Great ah feature branch. Just run, get flow feature. Start feature one. Now This is not the most intuitive description of the feature, but it's good for demonstration purposes. Get flow will also show us a summary of actions once the future branch is finished. This has created a new branch called Feature Slash feature what based on Develop bridge and has switched us toe that branch against also CDs from or Handy Natural Prompt Let's open up a file added on Save It it started. This command will tell us that we have an uncommitted fight. Let's go ahead and commit it. Now Get committed using the Nano editor for editing the commit message. Since we prefer him, let's go ahead and change the default editor today. All we need to do is to at this time in our shell conflict file and reloaded Export Ritter Equality. Now when we do ah, get commit, vim opens up, shows us the summary off the commit and closes. Now let's assume that we're refinished. Adding on your feature, it's time to merge the future branch back to develop with get flow feature finished feature one again to get the summary off actions, the future branch was marched back to develop. Then the future branch has been deleted. Then the current branch was B s reached back to develop. If we do, uh ls we see the file from our branch present on the develop brunch. Looking at the teach it. We see a graphical representation off this process. Next up is starting a release release. Branches are good for stopping the incoming features and Buck's buck fixes from the developed Runge and testing the current version, submitting back 50 seize on it and releasing it to the general public. As we can see, the syntax is similar. The president's similar. The develop is branch toward list branch on when it comes to finishing the branch. The features are also marched to the master branch and the bag is cut from this bridge. Time to see the inaction. Okay, this is which is us over to release slash 1.0 point. Oh, Branch, let's add our release knows about txt toe show what has changed in this release? I okay, I didn't more bugs. Hopefully not. Let's go meet the fight. This is usually the case when you start to run your integration and stress testing to see if always good and no bugs were found After the testing is finished, we go ahead on and finish our release branch. This will prompt us for a series of release messages where we will go with the default. Checking out the summary. We can see that the release branch was merged into a master attack was cut from master with the release version. That tag has also been merged in to develop. The release branch has been debated and you're back on the developed branch. If we go get brunch, we see the only two available branches are master on develop. Did tag tells us that there is a one point open. Oh, thank cut. We can't see that the branch now contains toe files from the March of the Future and release branch. Andi, if you also switch toe the master branch, we can see that at this point, Master is an exact replica. Off develop, get flow. What has more work flows than the ones presented? We won't go through all of them today. We're gonna add extra information by visiting the Cici page or by reading the instructions on the get ha pidge get Flow also comes with Annan has hoax functionality. If you read the documentation, we can see all the possible hooks in the Hooks folder. Let's add a get hook that will be executed before every hot fix branch. For this, we just opened the template. Copy the content and basted toe a fine with the name Creflo Hot fix Start in our hooks directory. Let's just simply equal message with the version and origin. If we look at the hot fix flow, we can see they are created from the master branch and marched back toe master and develop with a tag on master. Let's try and see how it works. Apparently not something went wrong or strip was not executive and we need to delete our bridge. Then we just don't get flow. Hot chick Still it branch? No, I'm analyzing the get hooks directory. We see that our who does not have execute permission after adding exactly permissions on running the get hooked command again, we can see our message on the top off the hot picks outward. Let's finish this hot fix with get floor finished 101 Okay, as you can see the monster pretty straightforward. There is also on Oh my that shell plug in that you can activate toe have come online completion. As we said in the beginning, this is a plug in suitable for teams off developers working on multiple features, fixing bugs, releasing hard fixes all of these in the same time, Get flow is really simple to learn and helps teams have a correct workflow, where they can easily prefer patches for production coat without worrying about the extra functionalities developed on the master branch, you can tweet the conflict as you like. Some people prefer toe Place the Hooks folder in a different place so that it is committed on the triple, and they don't have to worry about copying the fight's over. Others continue to develop on the master branch and use a separate branch like customer for the production code. 26. Merge Git conflicts with ease: Now let's look at another improvement we can bring to get. Most tasks are easy to executive from the command line, but some tasks, like merging, require a specialist's eye for understanding that the former let's open the future fight from our previous chapter ended at a new line and save it. The git diff command will show us a color text. Explain the differences between the get file on the modified file, but some people find this format hard to understand. Luckily, we can tell get to use external tools when it comes to March and one external tool that we can use its cold melt. But first, let's install it using pseudo opt install melt. After this, we can run the command, get the FDLE. This will ask us if we want to launch Mel. There's an external program for viewing the fight. It's also giving us a list off tools it can use for displaying that. If yes, Dorman Mel now we can easily see that a fight side by side and see the differences between them. We can see that one has been changed to two, and a new line has been added. Based on these output. We can easily decide if you want Toe added or not. Let's go meet the file as it is next, we will look at March conflict. Let's manually create a branch called Test and added the same file committed and then switch back to the developed branch. Let's update the same file committed and then try to merge the test branch and off course. There is a much conflict for resolving the conflict. We will use get March tool which again offers toe open melt and in mild we can see this. REFILES left is the file from our current branch. Right is the file from the Mod Brandt Middle is the resulting file that will be created. Let's say that we decide the correct version for the future is for and that we also want toe add some text, save, define and come it. Okay, you can see the pre defined commit message on Don't forget to remove the temporary file that was created at the mark. In general, most mother leaders offer plug ins for working with get, including merging and ifs. We recommend that you get more acquainted with the command line tools because then you don't need to learn a new get plug in when switching from one, either to another. The get command works the same way across the looks. Mac on Windows. It is definitely a toll The developers use a lot, and being fluent in it will certainly boost your productivity. 27. From localhost to instant DNS: in a lot of cases, especially when working with other people or when developing integrations with online services, we have to make our computer accessible from the World Wide Web. This information could be obtained from our trusty rotor, but wouldn't it be easier if he just had a tool that makes our computer port publicly available? Luckily for us, there is such a tool, meat and broke, the versatile one line command that makes you forget about router configuration and continuous redeploys. And Brock is a simple tool that exposes a port from our computer toe. Unique domain name publicly available on the Internet. How does it do it? Well, let's see it in action. Go to the website, click on the download button and choose your destiny. In our case, our destiny is the lyrics package in 64 bit. That's go to the terminal, unzip the file and copy it's contents to the being fuller. Now do worry Hush on DYP and Growth. Http 80 We can see that port forwarding for ports 18 443 is running on our local 80 port at a custom and broke sub domain name. We can also see the region off the server, which by default is located in the U. S. If you are in a different region, we can set this with an agro Ph. D. P. 80 that the sh region you. And now we can see that the end broke server is located in Europe in order to test our and broke server. Let's use our trusty pythons server to show a simple HTML page for this, issued a command on the screen, then restart and grope with, though it's DB traffic forwarded from Port 8000 the default fightin Web server port. Now click on the link provided by N Broke and we will see our webpage accessible to the World Wide Web. That's it. No configuration, no account, no headaches, just a simple 19 commands that we can run from anywhere. The sub domain provided by an group is a generated one and will change every time we restart and broke. We have the option off using our custom domain name like Lennox start and grow up dot com, but only after acquiring a paid account. And Rock also has a Web interface at our local host Port for 1000 for I think, where we can see statistics and locks, power comes from ease off use and and grow provides us with that power. Here are some specific scenarios for using this powerful tool when testing integrations with online services that require a cold back girl like Ohio with logging and online payment when developing mobile applications that connect a local service when we want to expose on ASIS H port, where we want to give our clients access to a webpage on our laptop to show them some code , maybe it Joey. 28. JSON jamming in the new age: Nowadays, Jason is everywhere in Web puppies in configuration fights, even in logs. Jason is the default format used to structure data, and being so common means that there will certainly be times when we will need to process. Jason from the command line. Could imagine doing this with Grab said or other conventional tools. That would be quite a challenge. Luckily for us, there is a command line tool called geeky JK Jake you dick you that we can use to query Jason Files. It comes with its own language syntax, as we'll see in just a few minutes. But first, let's install Jake you with the following command, so they wrapped nostalgic you. Now let's use an example. File dummy Access log in Jason Format access That log, which we can also find in there. Get Hub Report story off the course. Let's start with some simple queries. Jake you dot accident log. I will bring this common will print the Jason objects back to the screen in a pretty former . If you want to grab the request mattered from it. Request we run discount. This will bring the request method from each Jason object that is the double codes around each method if one to use the output as input toe. Other script. We probably don't want the double coat. And that is where, um, that are Earl. Output comes in handy, so we use discomfort. Take you is often used for big data queries at a much smaller scale. Say, for example, if we want to calculate a statistic Greek off request matters on the lock file, we would run the following command. Now we can see account off, get put post and delete request. If you want the same type off calculation for another field, say upkeep. We can run the next command Notice the syntax for accessing a nested fields is to just use the dot as the de limiter between them. Centimeter, Did you meet her? The limiter? Yeah, that is the limiter. Also notice that we are using single codes instead of double coat toe mark. Our query as a string and off course not is that I'm learning to speak proper English. As you probably know, the difference between single and double codes in shell scripting is that double coated strings will try to expand variables. Why single coated string will be treated as a fixed string to a query for very older request bodies. We can use this con, but as we see from the output even seem empty. Request bodies are logged and will be printed by Jake You to skip printing empty bodies. We can use chick use query language to select all documents without on empty body like this . If we want to refine our search even more and, um, only bring the first element in the that outs object off the request body. We used the following command. We can't even perform aromatic operations with the return value suggest implemented it. With this common, there are many more examples and use cases for Jake you. But for them, just go to the official Jake you page and visit the editorial there. 29. No more mister nice guy: the Colonel and command line in Lenox are stable and powerful. Their reliability has been proven throughout the years, with mother legends about little servers running for multiple years in a row without restarting. However, graphical interfaces are not the same, and they sometimes fail or become on responsive. This can become annoying, and it's always good to have a quick way off. Feeling unresponsive windows not feeling but killing Whoops. Prepare to meet EC skill. First, let's replicate on unresponsive window. Go to the terminal. I start G edit, then heat controls that these were. Son jetted the background while the window is still visible trying to create inside the window. A couple of times will tell a bone so that there is no process handling this window anymore . And Oborne toe will make it gray to avoid the process off, grabbing for the bid off the window and then killing that process. We use a little trick, go to the terminal and run X killed. And now we see that the most pointer has changed toe an X, be careful not to click on anything. He felt up to bring back the G edit window and then click it. Yeah, that window you can click other windows, do not click X Skill will find and kill the process off the window We just clicked on, so he's like a Terminator two. This three can be used on any type off window. It's like shooting your window is OK, but what happens if the whole system becomes a responsive and I can type anything in the common line? And that might happen, especially on older systems? You can hit the off button on your laptop or server, but in some circumstances that cannot be possible. What are you going toe do? And what I am going to show you now is an old trick kept secret by Lennox girls for a very long time. Nobody really talks about it because it's so powerful it can do damage in the hands of the wrong people. It's like Star Wars, my friend, And please make sure you save all your work and close all the programs before trying the Fattal cable shortcut that will force restart your renouk system. Hold on out plus print screen and at the same time type ray sub, and if you've tried it, it means that your computer is started and you had to come back to the scores and when he knew where you left off, whom I can read to try can toe right practice disc ammand with great caution. And please don't use it to restart your computer on a regular basis. Use it only when the graphical user interface the grape is not responding. Another three. If the goal is not responding on, do you have unsafe to work? You can recover some of it from the command line by accessing one off Lenox Vettel terminals. We're going to start by the folds. Seven vehicle terminals and the graphical user interface start internal seven. That's is any of the seven terminals used. Control F one to F seven. A prompt will appear asking you to log in on after logging in. You can run some commands, toe close processes and safe work before exiting. To get back to the user interface. Heat control of seven 30. Terminal art: all work and no play makes Jack a dull boy. Even though the command line seems boring to a lot of people, it can actually become really fun. It all comes down to your imagination. Ever heard of fortune cookies? Do you want to get them without getting fat? Just run the following up. Come on to install duty. It is that we will be using in this chapter so adopting stall fortune cow, say See metrics followed by fortune. And when running this command, you get fortunes, coats and jokes in random order. And if we combine it with cow, say fortune pipe cow, say we will get the same fortunes they differed by cow drawing. And to make this recurrent we can include include, as the last line in our is that she'll RC file the configuration file. Then every time we open in a terminal window, a car will deliver a fortune to us. Now, this may not be useful, even though it's kind of fun. So let's do some productive wizardry through a little bit. Let's predict the weather. All you need is a curl command and you should these Come on. This will show you in a nice format. A three day weather forecast for the specified city in our case, London And now, with our newly learned skills, let's put together a shell script that gives us the weather forecast open bean WTT are and type thes these lines now we give it execution right now. If you'd run WTT are we get a weather forecast for London and if we re run w er paris so we get the weather forecast for Paris, working in the common line for the first time may seem like the metrics. And if that's the case, why not create this environment? How do we do it? We type C metrics. And now let your friends be amazed off the complicated stuff you're doing in that cryptic terminal. Terminals are not boring. They have beautiful colors, easy to read output, and they display compact information that puts users in control off their own system. Terminals carry customized and interacted with, and the increase your productivity while leaving your mouth to sleep. The under sleep off inefficiency off course. All of the skills don't come overnight, and they require careful tweaking from each user in order to be tailored to one's taste and way of thinking. But after that they fit like a tailored suit, becoming an extension to your way off work and sometimes even doing your job. We hope you've enjoyed all the tips n tricks we've provided and had fun learning them. And remember that education is a continuous process. So don't stop there. Stay hungry and served Internet to keep track of the latest tools and techniques that will transform you in tow. Productivity beast, yeah. 31. Closing chapter: congratulations. You've made it to the end. We hope you have injured our videos at least as much as we've enjoyed making them feel free to tell us what you think about this course what part you like or didn't like. And if you feel something is missing, ask us to create a for we're constantly opted in the course so your content might get online sooner than you think. In the description of the course, you can find an e book with the course content, which you can use as a quick reference. And if you haven't done this already, go to the guitar repository and down on the code used throughout this course. Thank you again for joining. And remember, knowledge is power. So be sure to only use your newly acquired powers superpowers for good. And don't let your partition