Empty a file
This one is for those who know the “touch” command. Hope all of us do not follow a command just because it is on one of the popular site without trying to understand the command and the output.
Continue readingThis one is for those who know the “touch” command. Hope all of us do not follow a command just because it is on one of the popular site without trying to understand the command and the output.
Continue readingToday I was working on a bash script written by someone else. And the script was maintained since long and had actually become quite big and there was no indentation followed. So, you can understand how difficult it was to understand the script. So, I set my foot forth to first find a beautifier for the bash script before I fixed it and my search ended here.
Continue readingMake any command read line enabled (on *nix)
1
|
Enable readline even if the command line application is not using it.
* View this command to comment, vote or add to favourites * View all commands by pykler
commandlinefu.com
by David Winterbottom (codeinthehole.com)
URL: http://feedproxy.google.com/~r/Command-line-fu/~3/mKEgYoyHCMA/make-any-command-read-line-enabled-on-nix
Broadcast your shell thru port 5000
1
|
run
1
|
elsewhere will produce an exact same mirror of your shell. This is handy when you want to show someone else some amazing stuff in your shell without giving them control over it.
Continue readingfunction for copy files with progress bar (using pv – pipe viewer)
1
|
dont have to type new file name (it copy file under same name) and dont have to use ‘/’ in the end of destination folder (but you can if u want, its idiot proof)
Continue readingPrint all environment variables, including hidden ones
1
|
This uses some tricks I found while reading the bash man page to enumerate and display all the current environment variables, including those not listed by the ‘env‘ command which according to the bash docs are more for internal use by BASH. The main trick is the way bash will list all environment variable names when performing expansion on ${!A*}. Then the eval builtin makes it work in a loop.
Continue readingCouple of days back, I had posted a command to display a stop timer with bash and echo. There I had also put the following gif file:
<img class="size-medium wp-image-2555" title="bash screenshot for the script output" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/09/temp-300x170.gif" alt="bash screenshot for the script output" width="300" height="170" />
Here the tricky part was to capture the jpg’s to create the gif file.
Preparation:
Rename the terminal to aka – amit-capture
Execute the command once with the import command and check the output and jpg’s
Continue reading