Skip to main content

RL 01 | I Don't Need to Know How It Works

· 6 min read

My Reading List from July 16, 2022, to July 31, 2022.

Lists

Reading ListInspirationTags
Things I wish everyone knew about Git (Part I)The opposite of git-push is not git-pull.Git
Things I wish everyone knew about Git (Part II)Good advice is commit early and oftenGit
Shell productivity tips and tricksWe will cover some shell features you can leverage to make your shell do more of the work for you.Tips & Tricks
6 deprecated Linux commands and the tools you should be using insteadSwap your old Linux commands for new and improved alternatives that provide the same functionality, if not more.Tips & Tricks

Things I wish everyone knew about Git (Part I)

quote

I don't need to know how it works. I just want to know which commands to run. But with Git, this does not work. ——Mark Dominus

I have been using GitHub for two years. Before the spring this year, what I did most is clicking the buttons in VSCode's Git panel to pull, stage changes, commit, and push to GitHub. These buttons are what "Git everything" means to me.

On October 8, 2021, I was asked a question during a Project Manager interview. The interviewer asked me "What is git rebase?". I know nothing about that command. After the interview, my friend told me that the git rebase is a professional command, and must be used with caution.

From the blog, something interesting about Git is:

  • git-reset does up to three different things, depending on flags. For more details, see git-reset.

  • git-checkout is worse.

  • The opposite of git-push is not git-pull, it's git-fetch.

To learn the Git underlying model, Mark Dominus recommends to read the magic key Git from the bottom up. I have already added the link to my reading list 👀.

quote

It is very hard to permanently lose work. If something seems to have gone wrong, don't panic. Remain calm and ask an expert. ——Mark Dominus

Since my job now is inseparable from Git, I have learned to use high-level or high-risk commands like git merge, git rebase, git reset, git amend, though I still know nothing about Git. You might lose your work if operated incorrectly, but don't panic, just backup before executing high-risk commands and then you can do anything.

Things I wish everyone knew about Git (Part II)

quote

Finding old stuff with git-reflog ——Mark Dominus

Though it is really hard to lose work, git reflog can help you recover some worktree histories. I have not used it before, but I tried it and the command lists the places where HEAD has been, which seems useful to me in the future.

quote

Good advice is Commit early and often. If you don't commit, at least add changes with git-add. Files added but not committed are saved in the repository, although they can be hard to find because they haven't been packaged into a commit with a single SHA id. ——Mark Dominus

Yes, it is necessary to commit often with a meaningful commit message.

Shell productivity tips and tricks

quote

When you are typing in your shell, I suggest you treat the Tab key as a superpower.

Auto-completion is a great feature. I am using Fig to add visual autocomplete to my shell.

This article introduces some keyboard shortcuts when using the shell or vi. With these shortcuts, you can navigate the current line, edit, cut, paste, and control your terminal.

This week, I found the Control+A shortcut which is to go to the beginning of the line I am currently typing on. This shortcut saves me from relying on the ←. Shortly after I used the Control+A, Twitter recommends a tweet below about readline to me.

quote

The shell uses a library called readline to provide you with many keyboard shortcuts to navigate, edit, cut, paste, search, etc. in the command line.

The default shortcuts are inspired by the emacs terminal-based text editor.

emacs isn't the only famous text editor in the history of computers though: another one, dating back from 1976, is vi. vi and emacs are designed in two very different ways, and have two very different logics.

I don't know readline before, and I just want to know which shortcuts I can use. But I still add this pages into my reading list 👀.

quote

While the obvious way to re-execute a previous command might seem to just bash on the ↑ key until you find the command you want, there are faster and smarter ways to accomplish this.

I usually type some commands frequently and use ↑ to find commands. The article introduces the Control+R which helps to navigate through history. This is really useful when API testing 🥳.

6 deprecated Linux commands and the tools you should be using instead

  • To extend regular expression pattern, use grep -E instead of egrep.
  • To search for the specified strings in a file, use grep -F instead of fgrep.
  • To resolve a domain, use dig instead of nslookup.
  • To display network connections, use ss instead of netstat.
  • To get the network interface configuration, use ip instead of ifconfig.
  • To manipulate entries in the kernel routing tables , use ip route instead of route.