Bash Story - 1
While I could probably go on and on about each small command I’ve picked up, this will be more of a list. But, you can’t stop me ranting about the pain behind learning each. In related news, I’m up to 200(give or take) unique bash $ commands
! I know… impressive right?
Gone groping… I mean dig
in
The ‘domain information groper’ is as the name suggests, a tool to query DNS servers. If there’s anything that has been a source of frustation for me over the last month is getting my custom domain working with github pages. The usage you’ll find in github’s troubleshooting guide is:
$ dig www.ngarindungu.me.ke +nostats +nocomments +nocmd
I used this command as is for 61 times before I realized that I was using it wrong!
Needless to say, I kept getting frustrating results. My site seemed to have magical powers. Now you see me, now you don’t.
Turns out I need to pass the nameservers to query. This defaults to localhost, which of course means that if my browser hasn’t already found my site, dig
won’t.
Lesson learnt:
man [whatever-command]
should be my first go-to guy!
I don’t like that we’re diff
erent. How about a patch
?
I will admit that git is still not a language I speak fluently. Case in point, while I was testing my places page, I created a separate HTML project for it. After hacking and feeling comfortable with the extended map code I had, it was time to bring the .js file back into my repository. Comparing two files side-by-side and making manual edits is of course boring so…
$ man diff
$ man patch
These two commands work together to show the diff
erences between two files and update(patch
) an older file to match the newest version. Tutorial here.
Get this, git
that
While not the first time using “the stupid content tracker”, I find that I am far from understanding its potential.
I’ve issued the git [something]
command a total of 229 times. Makes sense, assuming a normal add > commit > push
workflow, and throwing in the occassional log
, branch
and checkout
commands.
Jekyll
is here to serve
If I wasn’t seeing my changes locally while writing this, the site would be (insert expletive here). The command is:
$ bundle exec jekyll serve --drafts
Well, at least you know that I check my work kidogo.
I will be watch
ing you
watch - execute a program periodically, showing output fullscreen
Now, why would i want to do that? My desktop is failing. Shutting down on me without the slightest hint of courtesy. Stupid computer! I suspected that my processor may be overheating, and needed a way to check the reported temperature at intervals until it shutdown.
$ watch -n 60 'sensors | cat >> temps.txt'
This command will run the sensors
command every 60 seconds and pipe the output to temps.txt. I realized(just now) that piping to cat was a very uninformed idea, but hey, am learning!
The numbers
While writing this I thought that it would be nice if I had a way of knowing how many times I have run a command. I am sure there are far better shell commands I could run to do this, but since am learning python, I gave it a swing.