Shell Scripts
Make Shell Scripts Executable By Default
If you use vim to write shell scripts, you might want to save the “chmod +x” command after saving the script.
By adding the following line to your vimrc file (typically, it’s located at ~/.vimrc), scripts will automatically become executable.
au BufWritePost * if getline(1) =~ “^#!” | if getline(1) =~ “/bin/” | silent !chmod a+x <afile> | endif | endif
(meaning, if the file includes #! with “/bin/” in the path, apply “chmod a+x” on this file).
via shell-fu.
Have fun
Go Up As Much Directory Levels As You Need – Easily
This neat and brilliant script by shell-fu allows you to go up as many directory levels as you want.
For example, instead of typing
cd ../../../..
You’ll be able to type the following and get the same functionality:
cd .. 4
Get Examples for Random Bash Commands
Following my post about a script to query bash commands from shell-fu, here is another script, which queries shell-fu for examples of a random bash command:
The script is not bullet-proof and might fail if the guys at shell-fu decide to change the website’s layout, but it works for now, and this is good
Get Examples for Bash Commands in Your Terminal
This one is by the great shell-fu, a website with many bash examples.
The following script is a powerful enhancement for the bash experience, and a great addition to the manpages, it allows you to query shell-fu for examples about almost any bash command you might want to use.
A Bash Script To Decode TinyURLs
This is a simple bash script, intended to decode tinyurl URLs, i.e. to revret a tinyurl into the original URL.
It’s always a good practice checking where a URL will send you to before actually visiting it.
For the implementation, I the “Preview” service supplied by tinyurl themselves.
A Bash Script To Watch Live TV Streams
Hi,
In this post I’ll introduce a very simple and basic Bash script, which uses VLC and a plain text file to let you watch Live TV streams of your favorite channels.
First of all, make sure you have VLC installed in your system.
Playing With Youtube Videos in Linux
In this short post I’ll introduce a csh script I wrote recently. I wrote it for a certain purpose and it’s definitely not “general purpose”. I’m posting it here so you/I can use it as a reference.
The script uses these programs:
1. youtube-dl (In ubuntu, you can get it by typing : sudo apt-get install youtube-dl).
2. ffmpeg (Again: sudo apt-get install ffmpeg)
3. avimerge (part of the transcode package: sudo apt-get install transcode)
Query Google Finance From the Command Line
This is a one line bash script I wrote to query a stock’s price from Google Finance. It uses wget to get the HTML page from Google Finance and then grep and cut to extract the stock’s price. The script is based on the current HTML format of the Google Finance pages and might not work if Google decide to change this format (It’s easy to modify, though).
To have the script:
Open your favorite text editor (mine is vim), and type/paste this:
Take Screenshots in Linux with “scrot”
I have found this tool recently, and I have no idea how I was able to manage without it before.
This tool allows you to capture any region of your screen, by selecting it with your mouse, clicking on the title-bar of a window and other methods. It’s very flexible and contains many options.
To download the program in Ubuntu:
sudo apt-get install scrot
Now, open a new text file and type this
Todo.txt – A simple yet powerful todo manager for Linux
Recently, I discrovered todo.txt, a great todo list manager for people who feel comfortable with Linux’s command line.
The greatness of this tool is in its simplicity: the whole todo list is saved as plain text, and operations like adding/removing/prioritarizing/modifying/listing items are done through a very simple command line interface supplied in a bash script.
About Me
Tags
Categories
- Algorithms
- Bash
- BlackBerry
- Collaboration
- Command Line
- Cool Tricks
- Easter Eggs
- Ebooks
- Firefox
- Hardware
- Humor
- iPhone
- Linux
- Linux Development
- Linux Kernel
- Networks
- Open Knowledge
- Other
- Productivity
- Programming
- Regular Expressions
- Science
- Security
- Shell Scripts
- Short Posts
- Social Networks
- Thoughts
- Tools
- Vim
- Web Development
- Websites
Popular Posts
Calendar
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Sep | ||||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | |||
Archives
- September 2010 (2)
- August 2010 (2)
- July 2010 (5)
- June 2010 (1)
- May 2010 (1)
- April 2010 (3)
- March 2010 (1)
- January 2010 (1)
- December 2009 (2)
- September 2009 (13)
- July 2009 (1)
- June 2009 (6)
- May 2009 (4)
- March 2009 (18)
- February 2009 (10)
- January 2009 (10)
- December 2008 (7)
- November 2008 (8)
- October 2008 (1)
- August 2008 (1)
- July 2008 (1)
- June 2008 (1)
