Docker is a convenient tool to quick create containers from different Linux images. If we use the common way to start a docker container like docker run image bash, after the the process exists, the container is still stored there. That is, the docker container persists after it has exited. Sometimes, we would like to
Read more
Tag: Bash
3 Ways of .odt to .txt File Conversion in Command Line in Linux
Posted onThe Open Document .odt files can contain rich formats for the content. However, some times a plain text file is more handy. We may convert .odt files to plain text files for such needs. In this post, we discuss 3 ways of how to convert .odt files to .text files in command line in Linux.
Read more
Release Notes For Linux v0.95a
Posted onThis is the release notes for linux release v0.95a (source code: linux-0.95a.tar.gz) with format adjusted by removing/replacing tabs/spaces/new lines. This notes document can give us an understanding of the early development of the Linux kernel. The the formatted version of the referenced RELNOTES-0.95 can be found at Release Notes For Linux v0.95. The original ASCII
Read more
Release Notes For Linux v0.95
Posted onThis is the release notes for linux release v0.95 (source code: linux-0.95.tar.gz) with format adjusted by removing/replacing tabs/spaces/new lines. This notes document can give us an understanding of the early development of the Linux kernel. The original ASCII formatted version is at the end of this post. RELEASE NOTES FOR LINUX v0.95 Linus Torvalds, March
Read more
Release Notes For Linux v0.12
Posted onThis is the release notes for linux release v0.12 (source code: linux-0.12.tar.gz) with format adjusted by removing/replacing tabs/spaces/new lines. This notes document can give us an understanding of the very initial development of the Linux kernel. Also check Notes for linux release 0.01. The original ASCII formatted version is at the end of this post.
Read more
Release Notes For Linux v0.01
Posted onThis is the notes for linux kernel release 0.01 (source code: linux-0.01.tar.gz) with format adjusted by removing/replacing tabs/spaces/new lines. This notes document can give us an understanding of whether the Linux kernel started with its very first release. The original ASCII formatted version is at the end of this post. Notes for linux release 0.01
Read more
Clearing Git History in Local and Remote Branches
Posted onGit tracks changes as commits. This makes it possible and convenient to check the code change history in a repository. However, this also has side effect. The history consumes storage and the whole repository including the current version of the code files and all the previous changes may be quite large. This is especially a
Read more
Change Another Process’ Environment Variables in Linux
Posted onEach process has its environment variables in Linux. But is it possible to change another process’ environment variable from another process in Linux? If it is possible to do so, how to do it? There is a trick which can work for some scenarios. First, find out the process ID, then start gdb and attach
Read more
Add Inline Comments for Multi-line Command in Bash Script
Posted onIn Bash script, it is common that multiple small commands run together connected by pipes (|) and the whole command is quite long. For clarity, we may write the command in multiple lines. How to add comments for these long multi-line commands? In Bash, the content after # in a line is the comment. Using
Read more
How to Install Hyperledger Fabric 2.0 in Ubuntu 18.04
Posted onHyperledger Fabric is a consortium blockchain system. It’s performance is relatively good and its modular architecture enables it to be usable in many scenarios. Hyperledger Fabric itself has rich documents and samples of test networks. For beginners, deploying a new network for trying and testing still consumes quite some time. In this post, we will
Read more
Grep 2 Lines using `grep` Command in Linux
Posted ongrep is excellent to match patterns from STDOUT/text files in command line or scripts. It’s handy. Sometimes, our problem is more complex than finding a keyword from a file. On a first thought, it may sound impossible using grep for such complex problems. But grep can be quite powerful than we thought. Today, let’s check
Read more
Bash Learning Materials
Posted onBash (GNU Bourne-Again SHell) the default shell for many Linux distributions. It is very common for scripting languages in Linux. Bash is easy and straightforward for writing small tools. However, as most tools, it has its grammars that could easily cause bugs if they are not used correctly. Here I summarize a list of good
Read more
How to detach a docker container to be a running daemon?
Posted onIf I quite a docker instanced (invoking /bin/bash) by Ctrl+d, the docker container is closed. How to detach a docker container to be a running daemon without closing it? Docker has a detach sequence, which, by default, is Ctrl-p + Ctrl-q. If the docker detach sequence is overridden by the –detach-keys=”<sequence>” flag, you need to
Read more
How to test a file or directory exists in Go?
Posted onHow to test a path (a file or directory exists) in golang? In Bash, the [ -e ] tests can test whether a file or a directory exist. What are the corresponding Go ways for the test? You can use the `os.Stat()` and `os.IsNotExist()` standard libraries functions together to test whether a file or a
Read more
How to test a file or directory exists in C++?
Posted onHow to test a path (a file or directory exists) in C++? In Bash, the [ -f ] and [ -d ] tests can test whether a file or a directory exist. What are the corresponding C++ ways for these tests? To test whether a file or dir (a path) exists, you may call stat()
Read more
How to test whether a file exists and is a block special file in Python on Linux?
Posted onBash has a -b test to test whether a file exists and is a block special file. -b file True if file exists and is a block special file. How to do this in Python? Python’s stat module provides the similar functions for the C standard APIs and macros underlining such as stat() and S_ISBLK().
Read more
How to escape special characters in a Bash string in Linux?
Posted onThe problem is with ssh that makes a quoted string to more than one if there are spaces. For example, ssh user@host cmd “my string” The cmd on host will be executed like cmd my string rather than cmd “my string” It will only work if the string is escaped like ssh user@host cmd my
Read more
How to search history commands very effectively in bash shell command line?
Posted onHow to search history commands very effectively in bash shell command line? Just enter CTRL+r The function of above is: (reverse-i-search)`’: It is very fast and efficient.
Why I cannot login remote server with its root
Posted on# ssh root@192.168.122.96 root@192.168.122.96’s password: Permission denied, please try again. Do according to [1]. NOTE: on Ubuntu, remember to restart ssh service like this “sudo restart ssh”. [1] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/v2v_guide/preparation_before_the_p2v_migration-enable_root_login_over_ssh
How to judge whether its STDERR is redirected to a file in a Bash script on Linux?
Posted onWithin a Bash script, how to judge whether its STDERR is redirected to a file in Bash on Linux? For example, ./script.sh /tmp/log 2>&1 Can script.sh detect that its STDERR is redirected? Knowing the destination file is better. To test whether a script’s STDERR (or STDOUT) is redirected to a file, check by [[ -f
Read more