Making `fdisk -l` display partition sizes by GB/MB

Posted on

How to make fdisk -l display partition sizes by bytes instead of sectors? fdisk does not have such options as far as I know. However, good news is that you can use parted: # parted -l It will print partition info like # parted -l Model: Linux device-mapper (linear) (dm) Disk /dev/mapper/fedora_vm235-swap: 2164MB Sector size
Read more

How to disable auto mounting on Linux Mint Cinnamon?

Posted on

I prefer Linux Mint (I am using Cinnamon) not automatically mounting a portable storage such as USB disk or iPhone for me and I would like do the mounting manually if I need it. The default behavior of Linux Mint is to automatically mount the disks. How to disable this? The auto mounting on Linux
Read more

How to dynamically attach a disk to running DomU in Xen?

Posted on

I want to attach a disk to a DomU. The Xen DomU is running and should not be rebooted. Hence, changing its configuration file is not an option. How to dynamically attach a disk to running DomU in Xen? To attach phy:vg_xen/vm-228-large to vm-228 as xvdb, run this on Dom0: # xl block-attach vm-228 phy:vg_xen/vm-228-large
Read more

How to remove AdSense ads for mobile devices while keep them for desktops?

Posted on

I want to add adsense ads to be shown to visitors on desktop only. How to remove AdSense ads for mobile devices? You can achieve this through using “Responsive ad unit” of AdSense. The support article Create a responsive ad unit from AdSense discusses this and gives an example. Check the “Hiding an ad unit”
Read more

Simple and Basic Image Editor in Linux

Posted on

Which simple and basic image editors are good on Linux like the paint program on Windows? GIMP is great but too high weighted for normal usage like resizing, cropping, image annotation with text. Pinta is a free and open source drawing/editing program that is easy to edit images. It is available on many Linux distros.
Read more

How to resize a batch of images on Linux?

Posted on

Resizing images on Linux with gThumb is easy. However, I have a batch of images inside a folder. Manually resizing them will consume too much time. How to automatically resize them on Linux with a script? You can use convert from ImageMagick together with bash script to resize images inside a directory. mkdir resize; IFS=$(echo
Read more

How to add a new HDFS NameNode metadata directory to an existing cluster?

Posted on

We have a running HDFS cluster. Currently, the NameNode metadata data directory has only one directory configured in hdfs-site.xml: <property> <name>dfs.namenode.name.dir</name> <value>file:///home/hadoop/hdfs/</value> <description>NameNode directory for namespace and transaction logs storage.</description> </property> We would like to add a new directory for dfs.namenode.name.dir to make replicas of the metadata on a separated disk for higher data reliability.
Read more

How to suppress “Entering/Leaving…” messages when invoking make recursively?

Posted on

The “Entering/Leaving…” messages when invoking another make by a make is kind of annoying. Is it possible to suppress these messages and how to suppress them? For GNU make, it is controlled by options: -w, –print-directory Print a message containing the working directory before and after other processing. This may be useful for tracking down
Read more

How to add a “status bar” to screen on Linux?

Posted on

I noticed that some guys’ screen console has a status bar with tab numbers. That will be very useful for 1) know you are using screen rather than a normal terminal. 2) which tab you are working in. Below is my ~/.screenrc: hardstatus alwayslastline hardstatus string ‘%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]’ It
Read more

Fixing “Remote Host Identification Has Changed” Error When SSH to a Server

Posted on

If you encounter an error message like the one below when attempting to SSH to a server: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has
Read more