I would like to play a video file in full screen and automatically make it keep playing during an exhibition. On Linux, how to do it with MPlayer? You can use this command mplayer -fs -loop 0 video.mp4 Here, -fs make it fullscreen and -loop 0 makes it loop infinitely. For more usage of mplayer,
Read more
Author: Eric Ma
Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.How to make journalctl faster?
Posted onOn Linux, I check system logs by journalctl. But it is soooo slow. How to make it faster. By default without any options, the journalctl is indeed very slow. But usually, we are only interested in some logs and can use options to specify the logs that we are interested to check. This will make
Read more
How to sort lines by length in Linux?
Posted onI have a text file with many lines of text. In Linux, how to sort the lines by their length? You can make use of awk together with the sort program like awk ‘{ print length(), $0 | “sort -n” }’ /path/to/text/file Here, we use awk to calculate the text length and sort -n to
Read more
How to remove trailing / in path in Bash?
Posted onI am writing a Bash script accepting input of a path from the user. I want to make the path have no trailing ‘/’, such as ‘/path/to/dir’ instead of ‘/path/to/dir/’. However, as the input is from the user, the input could be ‘/path/to/dir’. My script is intended to handle this. The question is: how to
Read more
How to do “contains string” test in Bash?
Posted onHow to test whether a string $str contains another string $needle in Bash? You can use this piece of Bash script: [[ “$str” == *”$needle”* ]] A usage example: $ str=”abcde hello” $ needle1=”deh” $ needle2=”de hello” $ [[ “$str” == *”$needle1″* ]] && echo “matched” $ [[ “$str” == *”$needle2″* ]] && echo “matched”
Read more
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 attach and mount Xen DomU’s disk partitions on Linux without Xen?
Posted onHow 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
Why are keys overlap in SST files at Level 0 in LevelDB system?
Posted onAs is known, keys may be overlap in SST files of level 0 in LevelDB. I am wondering why it needs to be overlap? An sstable is read-only after being written to the disk from a memtable. Accumulated K/Vs in the log up to a certain size are organized as a memtable and written 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
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 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
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
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 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
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
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
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
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
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 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).