Last updated on January 22, 2020
A Russian translation of this post is available here.
~/.inputrc is the user configuration file of GNU readline (), which provides customizable command line user interfaces for many important interactive programs, such as Bash and Python interactive shell. However, many of its useful features are disabled by default. In this post, we will walk through a decent
~/.inputrc file to release the power of readline.
Last updated on September 18, 2017
ls command is a command to list files on a UNIX-like system. It is probably one of the most used command. However, a plain
ls command without any polishing may look really “plain”. Here, we will slightly configure this command to make it more usable:
- More colorful output
- Automatic pagination for long file lists
- File type indication
- Human readable sizes
- Natural ordering of files
ls before configuration
ls after configuration
Last updated on December 10, 2016
In both bash and zsh, there are multiple methods to check whether a command exists. In this post, a set of speed tests will be performed on them to find the fastest way in each of the two shells (NOT to compare the two shells). We will test 5 different methods (
foobar is the command to test for existence in the list):
type foobar &> /dev/null
hash foobar &> /dev/null
command -v foobar &> /dev/null
which foobar &> /dev/null
(( $+commands[foobar] )) (zsh only)
All the methods listed above will have a return status of zero if the command
foobar exists, otherwise non-zero. That is, after replacing
testing-command by any of the commands listed above, you can test the existence of the command
foobar by executing
testing-command && echo exist || echo non-exist.
Throughout this post,
ls will be the command that is used for testing existence, which does exist on the system which runs the tests. The test environment is Debian Jessie with bash 4.3.30 and zsh 5.0.7 on Intel Xeon processor E3-1240 v3 (8 MB Cache, 3.4 GHz). The test scripts are also available at the end of the post.