Create Windows 10 bootable USB on Linux

The following commands install the WoeUSB program used to create a bootable USB stick for the installation of Windows 10.

First add the repository (assuming Ubuntu or Linux Mint OS)

sudo add-apt-repository ppa:nilarimogard/webupd8

sudo apt-get update

sudo apt-get install woeusb

The WoeUSB GUI can be found in your Applications Menu but I don’t recommend it. The likelihood is, you’ll run into the problem described here

Using gparted, create a NTFS partition on your USB stick – you may need to install ntfs-tools from your repository to do this.

Create the USB stick using the following command

sudo umount /dev/sdb1

sudo woesub –target-filesystem NTFS –device Win10_1809Oct_EnglishInternational_x64.iso /dev/sdb

Download the Windows 10 ISO from Microsoft here

image_pdfCreate PDF of this post...
Facebooktwittergoogle_plusredditpinterestlinkedinmail

Make bootable USB from .iso in Linux

The following command will write a downloaded .iso file of your favourite distro to a USB stick.  You can then boot off it and install to hardware.

sudo dd bs=4M if=./manjaro-xfce-18.0-stable-x86_64.iso of=/dev/sdb status=progress

Note that in my example, there was no partition on the usb stick to start with.  I’d removed it using gparted (not necessary though).

image_pdfCreate PDF of this post...

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Conky

One of my first ever posts was about conky and wbar on crunchbang linux.

Crunchbang has since been replaced with a community led fork, Bunsenlabs, and it’s well worth checking out.  I’m so impressed with it that it’s my laptop OS of choice, giving me very little grief installing onto my disappointingly-not-particularly-linux-friendly Dell XPS 15, unlike other popular distros.  Suffice to say, Bunsenlabs has saved my XPS15 from the financial damage limitation exercise known as ebay.

In any case, I thought I’d include a link to my own .conkyrc file.  It’s simple and neat, nothing too fancy.

The download file is called conkyrc.  Once downloaded, just rename it to .conkyrc i.e. put the dot in front (hidden file and the conky default), and copy it to your home directory, remembering to back up any existing .conkyrc file already in your home directory first.

If you want to edit yours to make it your own, the man page for conky is very good, but I find this better.

image_pdfCreate PDF of this post...

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Linux disk space consumption analysis.

Desktop distro’s have wonderful graphical disk space analysis programs such as Baobab (KDirStat), QDirStat, xdiskusage, duc, JDiskReport and with your desktop distro being connected to the internet, even if you dont already have them installed, installing them from your repositories is easy.   You can quickly drill down using these treemapper programs and find the culprit for filling your disk up.

In the datacentre, things are never so easy.  You have no internet access, and no local repository configured, and even if you did, you have no change control to install it on a live system, and even if you did, no GUI to view it. All you have is a production problem, a stressed out ops manager and a flashing cursor winking at you -oh and native tools.

Sure, you can use the find command to go looking for files over a certain size,

find ./ -type f -size +1000000M -exec ls -al {} \;

removing a zero and re-running as required until it starts finding something, but you’ll fight with the find command syntax for 15 minutes trying to get it to work, only to be unconvinced of the results.  As good as find is, it’s not exactly easy trying to put together a command that does something that should be simple.

Here is a much simpler solution.  Just use du.  In particular…

du -h –max-depth=1

This will summarize the size of the top level sub-directories underneath your present working directory.  You then cd in to the biggest one, run it again and repeat until you basically end up digging down and arriving at the largest file on disk – in my case a 32GB mysql database in /var/lib/mysql/zabbix.

So there you go.  Have a play with it and you’ll see what I mean.  It’s my favourite way of finding out what’s eating all my disk space.

image_pdfCreate PDF of this post...

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Stopping and Disabling Services in Linux

Things are a little different between Centos/RHEL6 and Centos/RHEL7 when it comes to starting and stopping services.

Having grown up on /etc/init.d/ scripts, it’s enough of a challenge using service blah stop instead of /etc/init.d/blah stop, but I guess service blah stop was added to Centos/RHEL6 to simplify things.

And then systemd comes alone they go and change it.  Way to go in terms of keeping things simple – even though it does bring some consistency across redhat and debian based distros going forward tbf…

Now it feels like every time I try to do something as simple as start and stop a service on a redhat based distro, Sod’s Law kicks in and I always get the command wrong, making me feel like a total noob, despite having rocked the command line for over 20 years.

As you can probably gather, I’m not a fan of the landscape changing (which is what drove me away from Windowz and into Linux in the first place – the longevity of the marketable skills set was better).  In my defence, Linus Torvalds isn’t that happy about it either.

Hence this little post.  A quick reminder on which command to use.  Now I’ve written it, I won’t need it of course.  Funny how the brain works, eh?

RHEL/CENTOS 6
chkconfig | grep zabbix – lists all services in all runlevels
chkconfig zabbix-agent off – toggle it on/off at startup
service zabbix-agent stop   -stop the service

RHEL/CENTOS 7
chkconfig
systemctl status zabbix-agent.service
systemctl disable zabbix-agent
systemctl stop zabbix-agent.service

 

image_pdfCreate PDF of this post...

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Retro Terminal

This is just too good.

image_pdfCreate PDF of this post...

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Firefox Bookmarks location (Linux)

At some point you may find yourself wishing you could get your firefox boomarks from another user home directory on your laptop or on backup.

I want to be able to find them, and restore them into Firefox in my new profile.

This is the location in the filesystem where the Firefox bookmarks are kept.  Firefox appears to retain backups of the bookmarks on its own, which is very convenient indeed.

/home/matt/.mozilla/firefox/n5ufmg0e.default/bookmarkbackups

Simply copy the most recent file to the same location in your new profile.  The filename is fairly cryptic looking, e.g.

‘bookmarks-2018-09-13_15_AWyxn1GRB8WngmWVnMswTg==.jsonlz4’

so my advice would be to not change it at all, just copy it as it is into the same location in your new profile.

You’ll need to restart firefox before you’ll see it as a recoverable item in  the Firefox Bookmarks, Show All Bookmarks, Backup and Restore dialog.

In newer versions of Firefox, the menu bar and bookmarks toolbar are missing by default (I hate all this modern minimalism as it smacks of form over function) but you can enable it again by right clicking on a blank bit of GUI and selecting Menu bar and Bookmarks bar (Highly recommended).

image_pdfCreate PDF of this post...

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Firefox Bookmarks location (Windows)

At some point you may find yourself wishing you could get your firefox boomarks from an old profile still resident on your laptop, but no longer the one that you’re logging into.

For example, I have an old profile here for user matthewbradley, but upon getting my account reactivated, I’m now finding myself logging into matthewbradley.UK – i.e. same human, different local profile on the laptop.

The frustrating thing is that all my bookmarks are in Firefox in my old profile and I want to be able to back them up and restore them into Firefox in my new profile.

This is the location in the filesystem where the Firefox bookmarks are kept.  Firefox appears to retain backups of the bookmarks on its own, which is very convenient indeed.  You should be able to access it via Explorer or Cmd console.

C:\Users\matthewbradley\AppData\Roaming\Mozilla\Firefox\Profiles\jrc8wnze.default\bookmarkbackups\

Note that AppData is a hidden folder so if you’re using Explorer, you’ll need to change the View options to show Hidden Items before you’ll see it.

Simply copy the most recent file to the same location in your new profile.  The filename is fairly cryptic looking, e.g.

bookmarks-2018-09-13_15_AWyxn1GRB8WngmWVnMswTg==.jsonlz4

so my advice would be to not change it at all, just copy it as it is, into your new profile.

You’ll need to restart firefox before you’ll see it as a recoverable item in  the Firefox Bookmarks, Show All Bookmarks, Backup and Restore dialog.

In newer versions of Firefox, the menu bar and bookmarks toolbar are missing by default (I hate all this modern minimalism as it smacks of form over function) but you can enable it again by right clicking on a blank bit of GUI and selecting Menu bar and Bookmarks bar (Highly recommended).

image_pdfCreate PDF of this post...

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Simplify linux find command using shell functions

Do you need to find a file and then perform some action on it and get caught up in curly brackets, back slashes and syntax errors when you could swear “this command worked in the past?”.  It’s one of the joys of Linux I guess, but quickly becomes tedious when you’re working against a problem and are under stress.

Here is a reference find command that works.  I hope it helps.  It’ll no doubt help me at some point (the entire purpose of my blog is to actually remind myself how to do half of this stuff from time to time).

sudo find ./ -name *.mkv -exec ls {} \;

Something I like to do is create shell functions in the .bashrc file in your home directory to simplify commonly used commands that are long to type and quite syntax sensitive.

#SHELL FUNCTIONS FOR .bashrc
f() { find . -name “*$1*”; }

This is a nice useful one that can be used to find any files that have the specified string anywhere in the filename.  Just type f All  to find any files with the word All occurring anywhere in the filename.

You could create other versions such as this one, that will find and remove files with a specified string in the filename – but I’d really not recommend it.

fr() { find ./ -name “*$1*” -exec rm {} \; }

Be sure to run man fr first to check that your shell function name isn’t the name of an existing binary on the system!

image_pdfCreate PDF of this post...

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Dropbox alternative for Linux users

With the recent announcement that Dropbox is dropping its support for linux filesystems (other than ext4) in November, you’ll no doubt be searching for an alternative cloud storage provider that supports linux file system synchronisation.

Look no further than MEGA.

50GB for free, local filesystem synchronisation, download and retain your own private key,  a great, easy to use web browser client.

File system sync client: https://mega.nz/sync

image_pdfCreate PDF of this post...

Facebooktwittergoogle_plusredditpinterestlinkedinmail