Category: How-To

  • How to easily find the full path of a command in Ubuntu

    How to easily find the full path of a command in Ubuntu

      If you’re writing scripts or making cron jobs you will need to know the full path of the commands you’re using; rather than just being able to use “ls” you would have to use “/bin/ls” instead. You could use the find command here but there’s a quicker and more elegant way: which. Use it…

  • Using rsync with a non-standard SSH port

      There are many reasons you may be using an SSH port other than 22; perhaps you changed it as a security measure, or perhaps you have multiple machines behind your firewall which you are port forwarding to and thus have to use other ports in addition to 22. Rsync is an extremely powerful file…

  • ESXi: Entering and exiting maintenance mode via command line

      Following on from yesterday’s post, here is how to enter or leave maintenance mode on an ESXi host via SSH:   vim-cmd hostsvc/maintenance_mode_enter   to go into maintenance mode – and to leave it:   vim-cmd hostsvc/maintenance_mode_exit   If you’re interested in other useful commands, you can see more hostsvc options by running:  …

  • ESXi: Determining maintanance mode status from the command line

      If you need to know if a host is in maintenance mode via the command line, SSH into your server and run the following:   vim-cmd hostsvc/hostsummary | grep -i maintenance   This will return the following line (in this example the host is NOT in maintenance mode):    inMaintenanceMode = false, To see…

  • How to find which version of ESXi you’re running from the command line?

      If you’re remotely logging in to a server to apply the latest patch but can’t remember whether you’re running 4, 4.1, 5.0 or 5.1 – and it can certainly happen when you’re managing quite a few of them remotely – there is a handy command to see which version and build number you’re actually…

  • ESXi: Accessing datastores via web browser

      This is one that a lot of people don’t seem to be aware of – did you know you could access your ESXi server’s datastores via a browser? It’s a convenient way of grabbing copies of ISOs or patches stored on your server for burning or use elsewhere. It’s set up automatically with ESXi…

  • Ubuntu: Clear terminal screen

    Ubuntu: Clear terminal screen

      Sometimes you may wish to clear the terminal window, whether it be to hide what you’ve just done, clear some irrelevant/distracting output or any other reason. The best command to do this is simple:   reset   This completely clears the output shown in your terminal window but doesn’t log you out. If you…

  • How to change a user’s password in Mediawiki

    If you have a wiki you may need to change a user’s password from time to time; you can do this from the back end quite easily. First, access mysql:   mysql -u root -p   Log in using your root password. Next, list your databases:   show databases;   On our test system this…

  • Ubuntu: How to create a file or folder using today’s date

    Ubuntu: How to create a file or folder using today’s date

    This is a useful little trick to use in your scripts – particularly for things like periodic backups.   For a file:   touch $(date +%F)   creates the file 2012-11-18   For a folder, let’s add the time after the date:   mkdir $(date +%F-%H:%M)   creates the folder 2012-11-18-09:00   We can use…

  • How To: Export all mysql databases for backup

    This is a handy command for anyone using multiple mysql databases – it produces a single file which you can easily back up to elsewhere.   mysqldump -u root -p –all-databases > databasesBackup.sql   Note the two hyphens before “all”. This command creates the file databasesBackup.sql which contains the contents of all of your databases.…