So I am taking this course from FrontEndMasters and I’m already pretty familiar with linux but I wanted to use this course to fill in any gaps in my knowledge. If I find something that I didn’t know I will share it here.
Things I learned
I did learn about CTRL-R which is really nice for searching through your bash history.
CTRL-N and CTRL-P aren’t mentioned 🙁
Adding the feature to the site through a github pull requestb
I noticed that he mentioned using arrow keys to scroll through previous shell commands. I much prefer using CTRL-P and CTRL-N to do this instead.
Imagine having to move your fingers all the way over to your arrow keys. CTRL-N and CTRL-P are much nicer.
I also decided that this is so useful that I should try to get it added to the course website. This will also help me learn how to contribute to a project on github.
First I found the Repo: https://github.com/btholt/complete-intro-to-linux-and-the-cli
Gotta fork it and use my own repo then clone it
I’m going to follow this as a guide: https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project
Just gonna put it in \Documents\github-projects
git clone https://github.com/fosteeco/complete-intro-to-linux-and-the-cli
Now I gotta cd into the directory and checkout a new branch to make this change to
git checkout -b up-down-trick-update
Then I add the text to the Up and Down section
Another way to do this is with CTRL-N and CTRL-P. You may find this more convenient to type and it's easy to remember, just think control next and control previous.
Then I have to add a commit message:
git commit -a -m "Adding CTRL-N and CTRL-P shortcuts to tips-and-tricks"
Then I push my changes:
git push origin up-down-trick-update
Now I can see a compare and pull request on my github repo at https://github.com/fosteeco/complete-intro-to-linux-and-the-cli :
I clicked that and created a pull request message:
This was a lot of work to go through to add a small message to this project. There’s a way that requires less work by clicking the “Edit the file in your fork of this project” button that I’ve circled in red:
But it was nice to see how you would make a change for a more complex project. If the file has complex syntax using the UI on github may make it harder to edit the code. Whereas downloading your fork it and opening it in your favorite editor will give you syntax highlighting, error checking, formatting, snazy shortcuts, etc…
Seeing as the project has 28 open pull requests I don’t think I’ll see my changes in the project. But hey this was a good learning experience.
Standard out and standard error
In GNU/Linux you can write to files using > >>. > will overwrite while >> will append it to the file. If you put a 1 in front it will write the standard output. If you put a 2 it will write standard error.
So I never really got into a lot of bash scripting. But it seems interesting. Back when I was a linux enthuisist and running arch w/ i3wm some of this stuff would’ve been good to know. I did find the variable setting interesting. In one of the scripts someone asked why the variable didn’t have a $ in front of it when setting the variable to whatever the user input with read -p.
let my_var = "something";
I defined this with let so I can change the variable. When I reassign it later, you don’t write:
let my_var = "a new thing";
Instead I write:
my_var = "a new thing";
The crontab stuff is pretty neet. Learning it doesn’t seem to useful though because you can use a tool like https://crontab.guru/ which will help you create cron schedules with less hassle.
This course would be great for beginners. I enjoyed it and learned a bit of history about the tools in linux. Learning where vim came from was pretty cool. Maybe I’ll go full vim at some point but VScode is pretty nice right now and has a lot of features.