Posts Tagged ‘linux’

How to Exit Vim released

Sunday, January 15th, 2017 | Books, News

Today is the day: How to Exit Vim is now available to buy.

Vim is a command-line text editor in Linux. It is notoriously difficult to get out of it once you have gone in. So, I have written a book about how to do it. It does not cover anything else: the only stuff in there is about how to quit Vim. It has 19 chapters.

Granted, the chapters are not very long. I have broken down each scenario and the correct command to use for each. That means it has nearly as many chapters as it does pages. But who really wants to trawl through 400 pages? When you are stuck in Vim, you want an answer and you want it fast. This book gives you exactly what you need; no fluff.

This is the blurb:

This book does not cover anything except how to exit Vim. It has 19 chapters.

Have you ever found yourself trapped in the command-line text editor Vim? If so, this book could save you from tearing your hair out. It breaks down each situation you may find yourself in, and the correct exit command to get you to safety.

Without it, you may find yourself losing work, overwriting critical data, getting lost in a sea of tabs, or worst of all, looking stupid in front of the stern-looking system administrator standing behind you.

With it, people will think you are a wizard. Finally, a way to unlock the mysteries of quitting Vim without leaving a trail of destruction behind you.

Sounds awesome, right? But it gets better. Because the best part about it is the value: I’ve priced it really low. It’s £2.99. When people give away books for free, they charge $7 shipping. This is half the price of a free book.

Look, I am not saying that if you know all of these Vim commands, more women will have sex for you. Even though, most of us who work in IT suspect that is true. That may not interest you. You may, for example, be a straight woman. In which case, I am not saying that knowing all these commands will get you a job as a Google engineer. But…

Finally, one last point from me. Take a look at the cover:

That is a cover that says “this book is amazing”. Why? Because the cover is so basic. It is called sated strength. Other books, inferior books, come up with hugely flashy covers because they know that is the only way they are going to sell. A cover like this says “wow, this book is good it does not even need a professionally designed cover”.

It is available now from Amazon and iBooks.

The maze is solvable, by the way. Here is a bonus activity: if you take it into Paint, draw the correct route through it, and send it to me within the next week, I will send you a copy of the book completely free.

New book alert: How to Exit Vim

Thursday, January 5th, 2017 | Books, News, Tech

It has been a writing-heavy month over at the Worfolk household. On Saturday, I am going to be announcing my new restaurant book. But, between finalising that and sending it to the printers for proofing, I have finished another, and I am announcing that one today.

The title is How to Exit Vim.

For months I have been joking that what would be really useful is a book on all the different ways there are to exit Vim. For those not in-the-know, Vim is a command-line text editor for Linux. It is notoriously difficult to exit once you enter the program.

The truth is, though, that book would be genuinely useful. So I have written it. It comes out on 15 January. You can pre-order it now from Amazon and iBooks.

Get your default gateway from the terminal

Wednesday, June 22nd, 2016 | Tech

If you are inside a Vagrant box and want to SSH to the host machine, you will need to get the default gateway. Or, maybe you just need the default gateway for a completely different reason. Either way, the following command should do it.

netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10

This is really useful if you don’t have ifconfig installed.

Symlink Git on cPanel

Sunday, May 10th, 2015 | Tech

These days cPanel comes with Git. However, it is not available as a command by default but is instead hidden away in cPanel’s usual obscure location.

However, you can make it accessible using a symlink.

ln -s /usr/local/cpanel/3rdparty/bin/git /usr/local/bin/git

That will allow you to use the git command as normal. The version you get is likely to behind the current version of Git though.

SSH tunnel command just logs you in

Friday, April 26th, 2013 | Tech

If you’re trying to create an SSH tunnel, you may find that running the command just logs you into the remote server.

ssh -L 27017:somehost:27017 user@examplehost.net

To solve this, you need to use the -N flag.

ssh -L 27017:somehost:27017 -N user@examplehost.net

This will then just set up the forwarding, and not run the command.

Error resolving hostname on SSH tunnels

Saturday, April 20th, 2013 | Tech

Lets say you are trying to create an SSH tunnel.

ssh -L 27017:somehost:27017 you@examplehost.net

You may get the following error message.

ssh: Error resolving hostname \342\200\223L: nodename nor servname provided, or not known

This is caused by using the wrong kind of minus symbol. If you have copied and pasted the command from somewhere, this is probably the case. This is easy to fix – simply paste the command into your terminal, then go through it, remove the existing minus symbol and put a new – in.

Speed up really slow SSH connections

Monday, April 8th, 2013 | Tech

Sometimes, you might find that when you try and SSH into another server, it seems to hang, but then after around 30 seconds or so, will suddenly start working again. You can diagnose where it is stopping by using verbose mode.

ssh -vv user@example-server

If you find it is to do with GSS API, you can disable this in your SSH configuration.

cd ~/.ssh/
vim config

Add the following to it.

GSSAPIAuthentication no

This should then speed the login up.

Screen resolution drop on Ubuntu

Wednesday, March 27th, 2013 | Life, Tech

If you find your screen resolution suddenly drops too 800×600 on Ubuntu 12.04, the following set of commands may help you resolve it. First, stop the graphical environment.

sudo service lightdm stop

Now remove all the Nvidia packages and reboot the system.

sudo apt-get purge nvidia*
sudo reboot

This will reset you to the default video driver. You now need to reinstall the Nvidia driver, which you can do by going to System settings > Additional Drivers and selecting the top option with the following name.

NVIDIA binary Xorg driver, kernal module and VPDAU library

Select this and click activate. Now reboot your system again and the Nvidia drivers will be re-installed and hopefully working again.

Gnome fails to start after switching Nvidia drivers on Ubuntu

Thursday, March 21st, 2013 | Life, Tech

If you’ve tried to switch to a different Nvidia graphics driver on Ubuntu and suddenly found that X / Gnome will no longer load and all you have is a command line, you can fix it by switching back to the original driver.

jockey-text -l
jockey-text -e xorg:nvidia_current

These commands will show you a list of drivers available, and then activate the standard Nvidia driver.

Installing Imagick on Ubuntu 12

Sunday, February 10th, 2013 | Programming, Tech

To install Imagick, you would normally do this via PECL.

sudo pecl install imagick

However, when trying this on Ubuntu 12.04 LTS, you may get an error similar to the following.

checking ImageMagick MagickWand API configuration program...
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program

You can resolve this by installing a few extra packages.

sudo apt-get install libmagickwand-dev libmagickcore-dev

Now try re-running the original command and it should be successful.