Command Line Interface
Removing Control Characters From a Text File in Linux
A few weeks ago, I had a text file generated in widows, and it had the “^M” control character at the end of each line. I had to compare it with a similar file generated on my Linux machine (using diff), and because of these control characters it failed diff.
The first step was to check why diff failed. Normally, you cannot see these control characters, and one might be surprised that the comparison fails thought the files are exactly the same. In order to see these characters, one should use “-A” flag with the cat command:
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:
Command Line Tools I Like
Though my love with Linux started because its GUI, especially compiz fusion, I discovered through time that Linux’s power is in its command line, almost every thing can be done from there, easily, clean and fast.
Here is a list of the command line tools I use most of the time:
Twitter from the Command Line
This simple but not perfect script will let you twit easily from the command line.
Open a new file with your favorite text editor, and add this:
1
2
3 #!/bin/bash
curl --basic --user USERNAME:PASSWORD \
--data status="$*" http://twitter.com/statuses/update.xml -o /dev/null;
Save the file as twit (or any other name you choose).
Of course, we don’t like our password inside an accessible plain text file. So this is what I did:
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 | 30 |
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)
