Linux

Enhance The Experience of Logitech Keyboards and Mice on Linux

Just brought the Logitech Corded Wave keyboard, which is very comfortable and great (As long as one can ignore the ugly windows/internet explorer/msn messenger symbols printed on some of its keys).

The keyboard has many extra keys, like the function keys, a dedicated zoom in/out keys and more. The problem is that they don’t work on Linux (Ubuntu 10.04 in my case) out of the box, which is a little sad.

Fortunately, I found a simple solution in the internet, and now I can use all the features of the keyboard. The following solution can be used for almost all models of Logitech keyboards and mice.

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: ,

Monday, August 30th, 2010 Hardware No Comments

Move Gnome Panel To The Second Monitor – Ubuntu

Say you have two monitors set up as “extended desktop”, and you want to move the gnome-panel from one monitor to the other monitor.

Here is how to do it in Ubuntu (Tested on Ubuntu 10.04):

1. Right click the panel, choose “properties”.

2. In “General” tab, uncheck “expand”.

3. Drag the panel from its left or right edge to the other monitor.

4. Right click the panel, choose “properties”, in “General” tab recheck “expand”.

You’re done. Have fun ;-)

Found the tip here.

Update:

An easier way, is just to hold “Alt” key, and drag the panel from one monitor to the other. No need to play with the “expand” setting. ;-)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , ,

Tuesday, August 24th, 2010 Linux No Comments

NumPad Problems When Using Vim over Tmux

I use vim as my main text editor, and I usually split the screen to edit a few buffers in parallel. To make resizing the windows faster, I mapped the numpad keys “/*-+” to resize the windows (see original vim tip here).

Recently, I started to use tmux, and opened vim, split the windows as usual, and tried to resize them. It didn’t work :)

I use Ubuntu 10.04 (Don’t remember the exotic name..), and I found that the latest tmux package in their repo is 1.1-1.

Anyway, version 1.1-1 has a bug with the NumPad. The solution is to download the source of tmux 1.2 and build it. It depends on libevent so you’ll need to get it first:

this is how to make it work:

1. sudo apt-get install libevent-dev

2. Get the source tarball of tmux from here.

3. tar xzf tmux-1.2.tar.gz

4. cd tmux-1.2

5. ./configure

6. make

7. sudo make install

Done. Now your life is better. Have fun ;-)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , , ,

Saturday, July 3rd, 2010 Vim 2 Comments

Re-Use A Bash Command With Different Parameters

Suppose you have typed and executed this command in your Linux shell:

1
./script_a.sh 1.23 && ./script_b.sh 1.23 && ./script_c.sh 1.23.45

Now you want to run the same command, but with 2.34 instead of 1.23
A nice way to do it is this:

1
!!:gs/1.23/2.34

Meaning, run the last command (!! is also called ‘bang bang’, and it’s substituted by the last command you executed), and replace every instance of 1.23 by 2.34

via Unix Bash Scripting.
Have fun ;)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: ,

Sunday, September 27th, 2009 Bash No Comments

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 ;)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , ,

Saturday, September 26th, 2009 Vim No Comments

Strip Leading Characters Off A String

Say you have a bash variable (say x) storing the string “MyLongString”

This bash command:

1
    echo ${x##My}

Will strip the leading string “My” off the original string. And thus the output will be:

LongString

via @bashcookbook

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: ,

Friday, September 4th, 2009 Bash No Comments

Strip the File Name Suffix off a Bash Variable

Suppose you have a bash variable storing a file name, say x =file.jpg

You can use this substitution command in order to strip out the file suffix off the string:

1
echo ${x%.*}

The output will be the base name of the file without the suffix.

via @bashcookbook

Enjoy ;)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: ,

Tuesday, September 1st, 2009 Bash No Comments

Create Multiple Nested Directories in Linux

Did you know that you can create a complete directory tree with one command?

Let’s start with a simple example:

mkdir -p a/b/c

will create this tree:

`-- a
    `-- b
        `-- c

And any of these:

mkdir -p a/{b1,b2}/c

or

mkdir -p a/b{1,2}/c

Will create this tree:
› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , ,

Friday, July 3rd, 2009 Bash No Comments

Edit The Command Line With Vim

This is a quick (and great) tip I found at Daily Vim:

Open a linux terminal, and type some (long) command.
Now type [ctrl]+[x] and then [ctrl]+[e]
The command should be moved now to a vim window.
Edit the command (fix typos, change parameters, etc..) and save.
The command will now be executed.
Enjoy ;)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , ,

Monday, June 1st, 2009 Vim No Comments

Renaming Files In Linux

In a previous post, I wrote about converting strings from camelCase to undescore delimited format.

In this post, we’ll do the same but for file names. We’ll use the command line program “rename” for this purpose.
Here we go:

1. Convert all file names in current directory which are of the form “myFileName” or “MyFileName” into the form of “my_file_name”:

1
rename 's/(.)([A-Z])/$1_\l$2/g' * && rename 's/([A-Z])/\l$1/g' *

2. Convert all file names in current directory which are of the form “my_file_name” into the form “myFileName”:

1
rename 's/([a-z])_([a-z])/$1\u$2/g' *

3. Convert all file names in current directory which are of the form “my_file_name” into the form “MyFileName”:

1
rename 's/([a-z])_([a-z])/$1\u$2/g' * && rename 's/^([a-z])/\u$1/g' *

Enjoy ;)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: ,

Saturday, May 30th, 2009 Bash 1 Comment
my email
my photo
Hi,
My name is Amir Watad. I have a BSc. in biomedical engineering from The Biomedical Engineering school , Technion , Israel, and a BSc. in electrical engineering from The Electrical Engineering school , Technion , Israel.
I'm a Verification Engineer in Mellanox Technologies Ltd.
I love Linux, the Command Line and the OpenSource Community.
I used to write Poems (Arabic) when I was able to find time for this.
September 2010
S M T W T F S
« Aug    
 1234
567891011
12131415161718
19202122232425
2627282930  
SEO Powered by Platinum SEO from Techblissonline

Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.