shell
Get count of lines in scripts (shell)
2015/10/15
If you have tried to get the count of lines in file, the you would know about “nl” or “wc -l”. But as you are aware these give you number of lines with other details as well and you need to post …
bash – refer the first parameter from last command quickly
2014/09/22
To refer to first parameter from the last command quickly, you can use !^ Note: This can also be referred as “!!:1“
bash refer parameters from the current command
2014/09/15
In bash you can use !# to refer to any parameter from the current command, example:
bash debug – log all executed commands
2014/02/03
Whenever I am writing a script in perl or bash, I always wish that there was some way to have all the commands logged or output to screen. I know there is “set -x” option to have debugging enabled, …
bash – using the vi mode more effectively.
2013/11/22
You can first set the bash mode to vi. This will enable some vim like features to bash. So, add this to .bashrc : set -o vi Once, you have done that then its time to get more out of the vi mode. …
Shortcut to run current command with sudo in bash
2012/09/20
For me, I mostly forget to add “sudo” to the command until the time I am actually supposed to run it. Also sometimes, on some systems, bash completion does not work as expected with “sudo”. With these …
Array of all possible colors in bash script
2012/05/07
Sometime back, we had looked at using colors in bash script and here is a way to create a array of all the colors. #!/bin/bash - …
colors in bash scripts
2012/04/30
I have been trying to understand the color codes for bash for a pretty long time, but somehow never got time to understand this clearly. So this time around when I was writing a script to analyze some …
bash prompts — some good links
2012/03/08
Here are some pretty good links on the subject. Since there are already so many blog posts, does not make sense to add one more 🙂 http://tldp.org/HOWTO/Bash-Prompt-HOWTO/c816.html …
15 Linux Bash History Expansion Examples You Should Know
2012/03/02
Here is a nice link on BASH History Expansion. There are lot of examples in this page and some of them might be quite useful. But here are my list of favourites: !! This is probably the most used one …
some interesting alias
2011/09/27
For this time, I will just give you a link to to bashrc file. http://hayne.net/MacDev/Bash/aliases.bash Head over there and see some very interesting aliase’s.
better bash debugging
2011/09/16
I was trying to debug some bash scripts yesterday and learnt something new 😉 There are lot of things in bash that you can use to debug and to start with you can enable xtrace mode as follows: set -x …