Archive for year 2009
Bash brace expansion to expand arguments
Aug 1st
Braces can be used to expand arguments in bash. Bash expands a list of strings separated by commas with in braces to a list of strings separated by spaces. Look at the simple example below:
[neo@techpulp ~]# echo {red,green,white}
red green white
[neo@techpulp ~]#
The above example may not be really useful but you can use bash to expand the arguments by adding prefix or suffix to the braces as shown below to generate expanded arguments. Note that there should not be any space between suffix/prefix and the start/end bracket. Otherwise it is considered as a separate list.
[neo@techpulp ~]# echo {red,green,white}ball
redball More > How to run multiple commands at once in bash shell
Jun 24th
All commands can be just appended using a semicolon (;) to make the bash to run all the commands one after the other as shown below.
[liz@techpulp ~]# make config; make; make release
The above command is equivalent to running three commands “make config”, “make” and “make release” one after the other. The only difference is that you don’t need wait for one command to finish to type in the next command.
However if you have a series of dependant commands that require the previous command to succeed to execute the next command, you can change the command as shown below.
[liz@techpulp ~]# make More >
How to solve ‘Stale NFS file handle’ error while accessing or unmounting a NFS volume
May 14th
This error is typically seen in a system which has active NFS mount point. The NFS protocol doesn’t define any automatic way of communication for any change of NFS server configuration. For example, if a client system mounts an NFS volume and the Administrator at the NFS server removes the directory from the NFS exported list, The client system will not know the change of configuration at NFS server side. In such cases, the ‘df’ command starts showing this error ‘Stale NFS file handle’.
Similar error is seen when a file or directory is deleted in the NFS server while the More >
How to change the order of network card detection in Linux
May 14th
There are multiple issues you would notice when you have more than one Ethernet card (NIC) in your system. The NICs may not get detected in the order you want it to be. The on-board Ethernet port may get detected as “eth2″ while you want it to be detected as “eth0″.
Another problem is when you already have 3 Ethernet cards on your system and removed one them (more specifically the one which used to be detected as “eth1″). In such case, you system shows two Ethernet interfaces “eth0″ and “eth2″ while you might like it to be “eth0″ and “eth1″ More >
How to merge two files using text mode in Linux
May 10th
The Linux provides a command “vimdiff” which can open two files using standard “vim” editor but in two separate logical windows. This is a text-mode based tool. This tool highlights the differences between two files so that the user can inspect the differences and change or move the contents from one window to the other.
First of all, the two file which need merging have to be opened with “vimdiff” as shown below.
vimdiff file1.c file2.c
User can type “Ctrl w w” key combination to switch between windows i.e effectively between two files. You can use standard “vim” commands to copy and paste More >
How to export a NFS volume in Fedora or RedHat Linux
May 9th
NFS stands for Network File System and is a easy way to share files across Linux systems. However the downside of NFS file sharing is that shared folder can’t be protected with a password. But you can limit access to particular IP addresses.
The Fedora Linux system comes up with NFS utilities by default. Otherwise you can install them using “yum” as shown below:
[root@techpulp ~]# yum install -y nfs-utils rpcbind
You can enable the NFS service to start at boot time using the following commands. The “rpcbind” service also needs to be enabled as NFS internally using RPC service. But if you More >
Fedora 11 (LEONIDAS) gets ready to hit the road by end of May
May 8th
The upcoming Fedora 11 release, named Leonidas, is scheduled to be released towards end of May. This release comes up with all latest versions of desktops like KDE, GNOME, XFCE and popular applications like Firefox, OpenOffice.org etc. The following are the notable features in this release.
- EXT4 as default file system
- KDE 4.2, GNOME 2.26, Xfce 4.6, OpenOffice.org 3.1.0, Firefox 3.1, Thunderbord 3
- Improvement in time taken for start up and shut down (20 sec start up)
- Simplified volume control
- Native Windows cross compiler
How to get a shell with root access in Ubuntu similar to “su” in RedHat or Fedora Linux
May 8th
In RedHat or Fedora systems, you will separate passwords and separate user accounts for root and non-root user.
But in Ubuntu, the default user already has root privileges but not allowed to run any command that requires root privileges directly. Instead the user needs to use “sudo” command to invoke any command that requires root privileges. However this is little bit inconvenient if one (especially a RedHat/Fedora user who is used to “su” command) is sick of “sudo” command and wants a full shell access with root privileges.
In Ubuntu, you need to provide self password whenever “sudo” command prompts for password.
There More >
What is the difference between a macro and an inline function in C
May 8th
The fundamental difference between a macro and an inline function is that they are handled in different phases of binary creation. A macro is expanded during pre-processing stage by the “cpp” command. The “cpp” command is the C preprocessor. On the other hand, the inline functions are handled by the actual compiler “gcc“.
As the preprocessor is less intelligent, it does blind code replacements wherever it finds usage of a macro. A function described in a macro form doesn’t look nice in terms of code readability. Also arguments taken by a macro do not carry their type and often cause compilation More >
How to enable auto login for SSH
Apr 23rd
This article assumes that the host name of server is “server1.techpulp.com” and that of client machine is “client1.techpulp.com“. You can replace these with your own domain names or IP addresses to suit your needs.
Login to the server system to which you would like password-less login.
[neo@client1 ~]$ ssh neo@server1.techpulp.com neo@server1.techpulp.com's password: [neo@server1 ~]$
Generate a RSA key pair in the server as shown below. Just press ENTER key when it prompts for passphrase. The following example may be exactly as shown below and may vary based on the version of ssh-keygen present in your server system. But it prompts you for same input More >


Recent Comments