Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 10:01 am on April 13, 2015 Permalink | Reply  
    Categories: Announcements, Linux ( 7 )

    LAMP Stack for Humans – now available on Amazon 

    Lampstack-SoftcoverMy book LAMP Stack for Humans is now available on Amazon. It this 284 page guide I’ll walk you through the process of turning an old laptop into an always-on server. You can use it to run web applications in the comfort of your own home or office – no “cloud” required.

    Together we will configure the entire server: you will learn how to install CentOS, Apache, PHP and MySQL (or MariaDB) and WordPress. I will show you how you can reach your server from other computers on the network and how to create regular backups.

    Perfect for the Linux newbie and those who want to get started with web applications without spending money “in the cloud” (in my opinion THE WORST expression for describing remote computers).

    If you’re an avid reader of this site and have always wished that some instructions would be presented in a more cohesive form rather than in snippets, then LAMP Stack for Humans is perfect for you.


    Grab your free sample today, or read the entire book for free via Kindle Unlimited!


    • Falkon 2:28 am on October 21, 2015 Permalink | Reply

      Hi Jay
      I have a question regarding WP adding a Landing page for an existing site, meaning to add a new page which only displays a big logo in the start and be able to make that logo a roleover logo, and then the click would navigate a user to the main ( index page) if you will. i am new to WP and PHP wise I am still learning so I would not know how to add an extra page as the index page and the first index page turns say into a home.html. How would you do that? I trying to learn PHP and WP to what I work with in HTML & CSS and front end designs.
      Beforehand allow me to thank you for you time, help and assistance,

      Best Regards

      • Jay Versluis 2:55 pm on October 21, 2015 Permalink | Reply

        Hi Falkon, that’s a VERY off-topic question for this post…

        WordPress does have a way to display a static page as front page, instead of the default blog posts. You can change it like this:

        • for the blog, create a new page with a title (no content is necessary)
        • head over to Settings – Reading
        • under Front Page Displays, select your pages
        • hit Save and refresh the front page

        As for the roll-over image: insert an image into your static front page, then link that image to wherever you want (you can do that with Add Media from the page creation dialogue).

        Hope this helps!

  • Jay Versluis 12:01 pm on June 18, 2017 Permalink | Reply

    Categories: Linux ( 94 )

    How to exit VI with or without saving 

    Although many alternatives exist, I like using vi for all my command line editing needs. To save changes, I usually use SHIFT + Z + Z, exiting vi under most circumstances.

    But sometimes, this trick doesn’t work because of write permission problems. In such cases, vi doesn’t close with the above command. Instead, we must either stash our changes in another file, or quit the session without saving. Here’s how to do that.

    Quit vi without saving:

    Save current file under a different name:
    :w newfile

  • Jay Versluis 4:36 pm on June 17, 2017 Permalink | Reply

    Categories: Linux ( 94 )

    How to read command line parameters in BASH Scripts 

    Shell Scripts (BASH Scripts) can access command line parameters using the the variables $1, $2, $2 and so forth, up to $9. In fact, more parameters can be accessed by using curly brackets, like ${10}, ${187} and so forth.

    Here’s an example:

    if [[ $1 == "x" ]]; then
      echo "Statement is true"
      echo "Statement is false"

    If we run the script with like this x

    it will tell us the statement is true. Otherwise, it’ll tell us the opposite.

    Note the whitespace around the evaluation: [[ ]] is actually a command (much like the == operator) and therefore needs to be surrounded with whitespace.

  • Jay Versluis 3:10 pm on June 17, 2017 Permalink | Reply

    Categories: Linux ( 94 )

    How to read command line parameters in PHP Shell Scripts 

    We can access parameters passed via the command line in our PHP shell scripts. Those are stored as an array in the variable $argv. Consider this:

    echo var_dump($argv);
    echo "\n";
    if ($argv[1] == 'x') {
      echo "The parameter is x.";
    } else {
      echo "The parameter was something else.";

    The first part of the script prints out all parameters that have been given, while the second part checks if the parameter was “x” or not. Note that the first item in the array ($argv[0]) will be the the first item on the command line, i.e. the file name and path to this very script. $argv[1] is the first parameter, $argv[2] the second, and so forth.

    We can call the script with

    script.php x

    to give it one parameter, or with

    script.php x y z

    to give it three parameters.

  • Jay Versluis 11:29 am on June 17, 2017 Permalink | Reply
    Tags: tar   

    Categories: Linux ( 94 )

    How to extract files from a bz2 archive in Linux 

    If you’ve ever tried to decompress a file that ends in tar.bz2 using the tar command with the standard -x option, you’ll have noticed that it doesn’t work. That’s because some versions of tar don’t understand the bzip2 codec used in these archives.

    However, you can tell tar to use this option by specifying the -j parameter, like so:

    tar -xjf yourfile.tar.bz2

    If this still doesn’t work, we can use the dedicated bzip2 command like so:

    bzip2 -d yourfile.tar.bz2

    The -d switch stands for “decompress”. Notice that this will extract all files and delete the original .bz2 file by default. Very convenient indeed! If you’d like to keep it, just pass the -k switch (for “keep”), like this:

    bzip2 -dk yourfile.tar.z2

    Checkout man bzip2 for more details, or pass the –help for as quick overview.

  • Jay Versluis 8:47 am on May 7, 2017 Permalink | Reply  
    Categories: Windows ( 20 )

    How to start a Windows app with arguments from a shortcut 

    1. create a shortcut for your app somewhere
    2. right-click on the shortcut and head over to the Shortcut tab
    3. under Target, add your argument(s) after the closing quote
    4. hit OK, then double-click the shortcut
  • Jay Versluis 9:11 am on May 4, 2017 Permalink | Reply

    Categories: Linux ( 94 )

    How to remove duplicate packages with yum 

    I’m working on a handful of servers that all have the same problem: when running yum, an error message appears that tells me a package called ntpupdate needs to be upgraded, but somehow this doesn’t work and the package is being skipped. Then follows a huge list of duplicate packages that are installed on those systems (probably installed by the automatic package updater within Plesk).

    Let’s see how we can fix such issues. (More …)

  • Jay Versluis 6:10 pm on April 30, 2017 Permalink | Reply  
    Categories: How To, Mac OS X ( 30 )

    How to mount and unmount drives in macOS and OS X from the command line 

    Unmounting external drives on a Mac is usually done quick and simple by either dragging drive icon to the trash, or by using the eject symbol in a Finder window. Mounting usually happens automatically when a new drive is inserted into a USB port or SD card slot.

    However, there is a way to do this via the command line, of which I am a big fan. Fire up a Terminal session and see how to do it.

    Listing available drives

    To see what’s currently attached to your Mac, let’s use the diskutil command, followed by the word list. You’ll see output like this:

    diskutil list
    /dev/disk0 (internal, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *512.1 GB   disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2:                  Apple_HFS Macintosh SSD           511.3 GB   disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
    /dev/disk1 (internal, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *1.0 TB     disk1
       1:                        EFI EFI                     209.7 MB   disk1s1
       2:                  Apple_HFS Mac HDD 1TB             999.9 GB   disk1s2
    /dev/disk2 (external, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:     FDisk_partition_scheme                        *1.0 TB     disk2
       1:                  Apple_HFS VM Drive 

    Attached drives are listed with their physical locations on the left (i.e. /dev/disk0, /dev/disk1, etc), as well as with their respective partitions if available on the right (like disk0s1, disk1s2, etc). Make a mental note of the latter: you’ll see that we have a physical disk (like disk0), on which several partitions may have been created. It is those partitions we’ll mount and unmount, NOT the physical drive.

    Unmounting an attached hard drive

    On my system I have two internal hard disks (disk0 and disk1), and one external USB drive (disk2). Let’s unmount that USB drive now:

    diskutil unmount /dev/disk2s1
    Volume VM Drive on disk2s1 unmounted

    Note how we use the unmount command. We need to specify the location of the partition with its full path (i.e. /dev/disk2s1).

    Mounting an attached hard drive

    To mount the drive again, without having to take it out and plugging it in again, I can issue this command:

    diskutil mount /dev/disk2s1
    Volume VM Drive on /dev/disk2s1 mounted
  • Jay Versluis 6:02 pm on April 14, 2017 Permalink | Reply
    Tags: EFI   

    Categories: Bookmarks, Linux, Windows ( 18 )

    Format a Linux system drive on Windows 

    The other day I tried to format a USB drive for use with Windows. I had previously tried this on my Mac to no avail. But now even Windows was telling me that it too could not format my drive.

    I was stumped! I had in fact never seen anything like it before. Was that USB drive broken? Had I turned stupid overnight? Well perhaps… but more importantly, it dawned on me what I had used this USB drive prior to this formatting nightmare: it was a Linux installation that could run directly from the stick.

    This is important, because as part of the installation, a protected EFI system partition is installed. This is used for booting if I understand correctly, and hence rather important. So important in fact that the ordinary user tools in both macOS and Windows do not allow us users (even Administrators) to erase such partitions.

    Lucky for us, the friendly folks at WinAbility have provided a detailed guide on how to remove such a protected partition on Windows. Enjoy the article!

  • Jay Versluis 5:54 pm on April 12, 2017 Permalink | Reply

    Categories: Linux, Mac OS X, Windows ( 94 )

    What’s the difference between the Logitech M325 and the M325c 

    The Logitech M325 and M325c are both wireless USB mice. Their design appears to be identical (except for the various colourful variations of course), and their prices vary from anything between $12 and $60 – depending the layout and seller. Even the packaging is identical.

    So what’s the difference between these two models? Is it precision? Is it the build quality? Is it the year of production? Is it something else?

    Actually no, the two mice are absolutely identical and both work with Windows, macOS and Linux. The only difference is in the wireless receiver that Logitech give you with each model.

    The difference is the wireless receiver

    The M325 comes with a Logitech Unifying Receiver. You can tell by the little “sunshine” logo on the side. This type of receiver allows us to use the Logitech Unifying Software to operate several devices over a single receiver (say a mouse and a keyboard). It’s a little clunky to setup more than once device, but it certainly saves valuable USB slots on our machines.

    Note that for this to work, all decides must be Logitech unifying devices, and all must display that little sunshine logo.

    The M325c on the other hand does NOT come with a unifying receiver, and instead comes with a standard USB receiver. Only this one device will work with said receiver. As you can imagine, the receiver does not bear the unifying logo on the side. Therefore you may find the M325c a little cheaper than the M325.

    Note those that the M325c mouse itself IS a unifying device, and it DOES bear the unifying logo on the underside. Hence you can use the M325c mouse with another unifying receiver just fine.

    So there you have it – that’s the big secret difference between these two mice. I have both, and I couldn’t tell the difference at first. Just in case it too drives you crazy 🙂

    • me 6:32 pm on May 26, 2017 Permalink | Reply

      thank you for this simple and complete explanation

      • Jay Versluis 4:28 pm on May 27, 2017 Permalink | Reply

        You’re very welcome – it has been bugging me too 🙂

  • Jay Versluis 11:51 am on April 8, 2017 Permalink | Reply
    Tags: ,   

    Categories: Linux, Windows ( 94 )

    How to check which web server is running on a domain 

    Sometimes we must know what web server is running on a particular domain. Usually web hosts should be able to tell a client this, but if the client is afraid to ask, there is a way to ask the web server directly for this information.

    Just to clarify: the web server is the process that serves files (HTML, PHP, ASP, images, etc) from a remote machine to your local web browser. The most likely choices in this day and age (2017) are Apache, NGINX or IIS. The latter is used by Windows servers, and the two former are used by Linux servers. There are other web servers too, such as lighttpd, but they’re used less commonly.

    By asking the web server for this information, we can tell exactly who’s serving those files.

    How to ask the Web Server

    Let’s open a Terminal or Command Line Prompt window and utilise the good old fashioned Telnet protocol. Replace with the actual domain in question: (More …)

compose new post
next post/next comment
previous post/previous comment
show/hide comments
go to top
go to login
show/hide help
shift + esc