convert seems works not very well when merging PDFs. The quality is low. Any other better methods to merge multiple PDF files to a single PDF on Linux? ghostscript works the best for me on merging PDFs: gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=out.pdf in1.pdf in2.pdf in3.pdf merges in{1..3}.pdf to out.pdf.
Tag: Linux
How to avoid mounting failures blocking Linux booting?
Posted onSome entries in /etc/fstab may not not critical for booting Linux or even not available until Linux has booted. How to avoid the failures or unavailability of some mounting entries in /etc/fstab blocking the boot process of Linux? Please check the tutorial at Controlling Filesystem Mounting on Linux by Playing with /etc/fstab: Allow non-root users
Read more
how to skip mapper function in hadoop
Posted onIn hadoop I need to skip mapper function and directly execute the reducer function. We doing this to improve hadoop performance, if the hadoop framework is used to analyze same data sets, then mapper’s output will be same for different kind of jobs. To save the redundant computation for same results, I am planning to
Read more
How to make Linux automatically reboot after a kernel panic?
Posted onAfter a kernel panic, it is impossible to remotely connect to the Linux server to reboot it by SSH. How to make the panic kernel automatically reboot itself? Linux kernel has a nice feature that reboots itself after a timeout when a kernel panic happened. Usually, it is disabled by default. To turn it on,
Read more
How to add a crontab entry from a shell script on Linux?
Posted oncrontab -e will start an editor to edit the crontab entries. But how to add a crontab entry from a shell script on Linux without interaction from users? You can try this piece of script: (crontab -l; echo “@reboot echo “rebooted””;) | crontab – Note that the update by this line of script is not
Read more
How to make CentOS 6.6 power off the console screen automatically?
Posted onOn CentOS 6.6, I find that it can make the screen (console, not X) blank after a while. However, it does not power the screen off. This usually work on Fedora or other releases. I guess this is caused by some configurations specific in CentOS 6.6. How to make CentOS 6.6 power off the console
Read more
How to set replication factors for HDFS directories?
Posted onIs it possible to set the replication factor for specific directory in HDFS to be one that is different from the default replication factor? This should set the existing files’ replication factors but also new files created in the specific directory. This can simplify the administration. We can set the replication factor of /tmp/ to
Read more
How to get files without certain strings in their files names (reverse of *string*) on Linux?
Posted onTo get files with certain string in their file names, it is quite straightforward: ls *string* However, how to do the reverse one: how to get files without certain strings in their files names on Linux? You can get a list of file names by a combination of find and xargs as follows: find .
Read more
Deleting a Specific Line From a Text File in Command Line in Linux
Posted onOn Linux, how to delete a specific line from a text file in command line? For example, to delete the 4th line from a file aaa bbb ccc ddd eee ffffff You can use the “stream editor for filtering and transforming text” sed. With GNU sed: sed -i ‘4d’ ./file Here, -i means edit the
Read more
How to enable RPM Fusion for CentOS 6.6?
Posted onHow to enable RPM Fusion for CentOS 6.6? Enable RPM fusion on RHEL 6 or compatible like CentOS: su -c ‘yum localinstall –nogpgcheck http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm’ It will install https://fedoraproject.org/wiki/EPEL. If it fails to install EPEL automatically, you will need to install it manually. Reference: http://rpmfusion.org/Configuration
How to install vbetool on CentOS 6.6?
Posted onI found CentOS 6.6 does not ship vbetool in its default repositories, EPEL or RPMfusion. How to install vbetool on CentOS 6.6? First, download the source package from http://www.codon.org.uk/~mjg59/vbetool/ and unpack the package. Second, install needed packages: # yum pciutils-devel pciutils-devel-static libx86-devel During the building, it will try to find the libpci.a in a different
Read more
How to install musl libc on Fedora 21 Linux?
Posted onIt seems Fedora 21 does not ship with musl-libc. How to install musl libc on Fedora 21 Linux? First, download musl libc source package from its download page: http://www.musl-libc.org/download.html . Here we use 1.1.5 as the example. After unpacking the source package, configure and build it by $ ./configure $ make Then, install it by
Read more
How to convert .pptx slides to .jpg or .png images on Linux in command line?
Posted onHow to convert .pptx slides to .jpg or .png images on Linux in command line? This following method works best for me. First, convert .pptx file to .pdf using libreoffice: libreoffice –headless –convert-to pdf file.pptx –headless makes libreoffice run in batch mode and not start the GUI. The pdf file will be named file.pdf by
Read more
How to convert between Simplified Chinese and Traditional Chinese characters in text files on Linux?
Posted onHow to convert between Simplified Chinese and Traditional Chinese characters in text files on Linux from command line? You can use opencc to convert between Traditional Chinese and Simplified Chinese: https://github.com/BYVoid/OpenCC For example, to transfer a file in simplified Chinese sc.txt to traditional Chinese: opencc -i sc.txt -o tc.txt -c zhs2zht.ini The authors also provide
Read more
How to make dd faster on Linux?
Posted ondd seems slow when I use command like # dd if=/dev/sda2 of=./sda2.bak How to make it faster? You can make dd faster by specifying a good bs like # dd if=/dev/sda2 of=./sda2.bak bs=8192 8192 is a magic number. There are may be other good sizes for bs for different systems. But 8192 works pretty well
Read more
How to merge git branches quickly and correctly
Posted onSuppose I have following branches harryxiyou@common_vm ~/forest/sqle/sqle/scripts $ git branch * dev-harry master rc After I did some changes on dev-harry branch, I wanted to merge dev-harry into rc branch. 1, git checkout rc 2, git merge dev-harry References:http://stackoverflow.com/questions/24147169/merge-two-remote-branches-in-githttps://www.atlassian.com/git/tutorials/using-brancheshttp://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging I usually add –no-ff during git merge to force git to add a commit for the
Read more
How to build mplayer with libdvdnav on Linux?
Posted onI find the mplayer from rpmfusion does not contain libdvdnav. How to build mplayer with libdvdnav on Linux? I did this on Fedora 21 to build mplayer with libdvdnav: Download mplayer src from http://www.mplayerhq.hu/design7/dload.html and extract the tarball. Install needed packages (you will need more if you need more features): # yum install gcc make
Read more
How to display chinese character in lxterminal
Posted onDo you know how to display chinese character in lxterminal? I tried to install lxterminal on my workstation and it seems display Chinese characters well: FYI, my Linux system is Fedora 21. The lxterminal version: $ rpm -q lxterminal lxterminal-0.1.11-10.fc21.x86_64 Not sure what’s the reason why it does not work for you. You may check
Read more
How to list all running system service on Linux Mint 17.1?
Posted onHow to list all running system service on Linux Mint 17.1? You can use initctl to list all services: initctl list
Basic iptables configuration for Linux
Posted onWhat is a good basic iptables config? Basic rules needed: Allow incoming TCP to 22 for SSH but blocks all others. Allow outgoing TCP/UDP connections. You may consider using the following rules as a start: for tables in iptables ip6tables ; do # Flush existing rules $tables -F # Default policy $tables -P INPUT DROP
Read more