How to attach and mount Xen DomU’s disk partitions on Linux without Xen? You can use kpartx to create devices from the VM disk image (say, ./vmdisk0). To activate all the partitions in a raw VM disk image: # kpartx -av ./vmdisk0 This will output lines such as: add map loop1p1 (253:8): 0 497664 linear
Read more
Category: QA
Questions and answers.
How to get a script’s directory reliably in Bash on Linux?
Posted onHow to get a script’s directory reliably in Bash on Linux? For example, to get the directory of the executing script $0. dirname can give you the directory name from the absolute path. You can get the absolute path of the script by readlink -f to handle symbolic links (consider a symbolic link ./run.sh linked
Read more
How to use the xargs argument twice in the command on Linux?
Posted on`xargs` passes the argument once to the utility command specified. For example, xargs cat will cat every line passed to xargs. But how to use the xargs argument twice in the command on Linux? For example, to rename file to file.bak where file is from the stdin. One solution is to write a small script like
Read more
Why does ; after & lead to unexpected token error in bash on Linux?
Posted onThe command using ‘;’ after ‘&’ like ssh host1 hostname &; ssh host2 hostname & Leads to error like bash: syntax error near unexpected token `;’ Why does ; after & lead to unexpected token error in bash on Linux? And what’s the solution? The fix The quick fix is to change your command to
Read more
How to add Google as the search engine in Firefox on Linux Mint?
Posted onIn Firefox on Linux Mint, Google is not in the list of search engines supported. How to add Google in Firefox on Linux Mint? Check this tutorials to add Google in Firefox on Linux Mint: How to Add Google to Firefox in Linux Mint as Default Search Engine
How to install Windows from USB drive?
Posted onI have downloaded the iso file of Windows 10 installation disk from https://www.microsoft.com/en-us/software-download/windows10ISO . But I do not have a DVD R/W drive. Whether and how to install Windows from a USB drive? You can use the Windows USB/DVD Download Tool to make a USB from the Windows ISO. Download and install the Windows USB/DVD
Read more
How to manually kill HDFS DataNodes?
Posted onstop-dfs.sh report that there are no datanodes running on some nodes like hdfs-node-000208: no datanode to stop However, there are DataNode process running there. How to clean these processes on many (100s) of nodes? You may use this piece of bash script: for i in `cat hadoop/etc/hadoop/slaves`; do echo $i; ssh $i ‘jps | grep
Read more
How to extract images from PDF on Linux?
Posted onI have a PDF file that has some images in it. How to extract the images out (not snapshot/screenshot of the page areas) from PDF on Linux? 2 tools that I usually use for extracting and saving images from PDF files: pdfedit and libreoffice. You can open the PDF file by the tools, right click
Read more
iOS contacts searching does not work showing “No result”
Posted onAfter upgrading to iOS 9.1, my iPhone contacts searching does not work showing “No results”. How to fix it? The trick is to create a group in your contacts. However, you can not do it on your iPhone. But there is a method: Sync your iPhone contact with iCloud (so you will need to enable
Read more
Firefox: how to sync bookmarks saved on iOS devices to Firefox on PC?
Posted onFirefox on iOS can view bookmarks from PC. But how to sync the bookmarks made on iOS to PC? It seems the bookmarks made in Firefox on iPhone is local only. No, you can’t yet. Bookmarks saved on your iOS devices will not sync to your PC at current (by Nov. 25, 2015) version of
Read more
Where to search and download free images?
Posted onWhere to search and download some free and nice images to be used on my websites? The best one for searching the free images is still Google. Google Image Search has a “Advanced Image Search” where you can choose the usage rights. Choose the “free to use, share, or modify, even commercially” option will lead
Read more
Maximum number of mmap()’ed ranges and how to set it on Linux?
Posted onWhat’s the maximum number of mmap()‘ed ranges that a process can makes and how to set the limits on Linux? I have a program that mmap()s and mprotect()s lots ranges. After allocating many ranges, mprotect() starts to fail with ENOMEM error number. From the man page, ENOMEM means 2 possible problems: ENOMEM Internal kernel structures
Read more
How to disable laptop’s internal keyboard on Linux?
Posted onI connect a USB keyboard to my laptop so the internal keyboard is not used anymore. But I may press some keys by accident. How to disable the laptop internal keyboard? I am working on Linux. This post introduces how to disable laptop’s internal keyboard on Linux: How to Disable and Enable Laptop Keyboard in
Read more
How to watch a directory size in Linux Shell
Posted onHow (only) to show the size of the directory. LS command may show more trivial infos I don’t need. DU command can do it. DU is “du – estimate file space usage”. Users could use ‘–max-depth=N’ parameter to print the level of information. One example is as follows. $ du -h –max-depth=0 hummer-svn 11G hummer-svn
How to configure ifcfg-eth0 network scripts on Fedora/RHEL Linux?
Posted onHow to configure the ifcfg-* network script files under /etc/sysconfig/network-script/ on Fedora/RHEL Linux? Following is a very typical ifcfg-eth0 file setting static IP/gateway/network mask: DEVICE=eth0 BOOTPROTO=none ONBOOT=yes NETMASK=255.255.0.0 IPADDR=192.168.1.151 GATEWAY=192.168.1.10 USERCTL=no More options are supported, here you can find a reference: Interface Configuration Files (a easier to read PDF from F15 doc).
How to keep master thesis safety and availability on Windows
Posted onWhen you write your master thesis (in Chinese) on windows, you may have following worries. a, Be afraid your master thesis is lost (or can not be accessed) when hard disk/udisk is broken (or something other viruses). b, Keep master thesis availability (7×24) and safety. c, Do not want anyone else to access it before
Read more
How to merge sam files on Linux?
Posted onThe samtools merge can merge bam files while it can not work for sam files. How to merge sam files on Linux? According to the sam format specification, header lines start with @, while alignment lines do not. So you can use grep to merge sam files as follows efficiently. Assume the header is from
Read more
How to convert tiff images from RGB color to CMYK color on Linux?
Posted onI have a poster to be submitted to the publisher which requires image files in CMYK color. The file I already have is in RGB color. How to convert it on Linux? The convert tool from ImageMagick with option -colorspace to alternate image colorspace of images. The plain output with colorspace is quite large. So
Read more
How to change the DPI of tiff images exported by PowerPoint?
Posted onThe DPI of the tiff images exported by PowerPoint seems 96. For posters, larger DPIs like 150 or 300 are needed. Is it possible to change the DPI of tiff images exported by PowerPoint? In the options of PowerPoint, there is a setting for choosing DPIs. However, it have no effect. Check the post on
Read more
Free VNC server software on Windows
Posted onRealVNC only gives free version to personal usage of their server software while it limits the functions. Could you suggest some good free VNC server software with full functions? TightVNC is an open-source software for VNC with servers and clients. You can download the server software for Windows from TightVNC download page: http://www.tightvnc.com/download.php The software
Read more