Currently I’m working on a big server migration. Where a lot of small sites get moved over. And a lot of the domain names are registered and managed at third parties. So after each move I have to check a lot of DNS records to see if the move is final.
Usually I use the mxtoolbox which is great to check DNS records. But I needed a more bulk option for this mass migration.
Enter the dig command
Check A record:
dig example.com A +short
Check AAAA record (ipv6)
dig example.com AAAA +short
dig example.com CNAME +short
Check A, AAAA and CNAME all at once.
dig example.com AAAA example.com CNAME example.com A +short
These commands return very compact ip’s or domainnames. Which are easy to scan.
When I opened the crontab on a new server it opened in vim, I prefer nano. And this isn’t something you need often so I wasn’t about to switch the global editor. The following line will open the crontab in nano without changing any settings.
Only useful for simple onelines. You’re very likely to be better of putting code in a php file and run that script like:
Run PHP with WordPress loaded.
Of course your good old friend wp-cli can help. It can run code with wp fully loaded. So if you add things in the init action or even after the wp_loaded, those plugin/theme functions, posttypes and such are all available.
First off the plain php code execution, with wp eval
Sometimes you just want to copy files from a remote server, and you want it often and quick. Stuff like a DB dump. You could startup your (s)ftp client and browse to it. Or you could just grab it with ssh.
I like doing a lot in one command. Downside it that stuff can get messy. One big line. you can’t easily edit it. A shortcut to make it easier is ctrl-x-e That will open the current command in an editor.
Few thinks to keep in mind.
Multiple lines will work, but it will execute it as separate commands.
using && at the end of lines will fix that.
Which of course means you get it in the bash history at full. This is my main use to chain commands.