Vim: List All Matching Lines

1. vimgrep (Error List) 1:vimgrep pattern % To open the list of matches in a buffer: 1:copen On the list, navigate normally, and use <Enter> to select a match. 2. lvim (Location List) 1:lvim pattern % To open the list 1:lopen Navigation is similar with vimgrep. 3. Global Search1 1:g/regular-expression/p Note that …

Create a Minimalist `Chroot` Environment

Learnt from this article by Dave McKay . Create the root directory of the chroot environment if it doesn’t exist. 1chr=/home/ricky/testroot 2mkdir -p $chr Create necessary directories and then get into the environment. 1mkdir -p $chr/{bin,lib,lib64} 2cd $chr Copy the binaries we need for surviving on this …

Linux 中查看某程序的路径

查看一个程序的完整路径,除了可以了解其是否存在及所处的位置,还有更重要的作用:当系统中有多个同名程序安装在不同目录下时,检查程序的完整路径可以帮助我们确认其是否为我们想要执行的那个。在 Linux 系统中,我习惯使用 which 或 whereis 来查看一个命令的完整路径。 1$ which gcc 2/usr/bin/gcc 但有一天,我遇到了一个情况:程序明明可以在 Bash 里执行,但 which 就是找不到它。后来搜索到这条回答 才了解到,对路径中可能带有的一些特殊符号(如常用的 ~)而言,Bash 会在执行前解析并替换它们;而 which 却不会。因此,若是在 .bashrc 中写入 1export …

"Universal Reference" and Reference Collapsing

This post is just to note down an interesting talk: Universal References in C++11 , presented by Scott Meyers at C++ and Beyond 2012 . The talk shares a good method to understand (or memorize) the rvalue reference and reference collapsing rules in modern C++, with the help of his self-created concept called Univeral …

About Initramfs

1. What is initramfs? It is ramfs that serves as an initial rootfs. It contains a complete set of directories that you would find on a normal root filesystem. It is bundled into a single cpio archive and (optionally) further compressed by one of the common compression algorithms like gzip or xz. 2. What is it used for? …