Tuesday, December 3, 2013

Run command in Parallel

We can run shell commands in parallel which can be very useful to utilize the power of system
Today system come with multiple CPU and each CPU has multiple cores.
 To utilize the full power of these CPUs you can run shell commands in parallel of different CPU at the same time.

Below is just a small example shows dd command running in parallel using pipe "|" on different CPU :


 # dd if=dev/zero of=/dev/null | dd if=dev/zero of=/dev/null

 #prstat
PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
5080 root     1636K 1040K cpu0    40    0   0:00:24  17% dd/1
5079 root     1636K 1040K cpu3    40    0   0:00:24  17% dd/1

Similarly,
we can gunzip and tar a file :
# gzcat  <file.tar.gz> | tar -xvf -
# gzcat  <file.tar.gz> | tar -xvf -
 

Wednesday, September 4, 2013

Hot-Pluggable Versus Hot-Swappable Devices

Many times you might have come across the terms hot-swappable or hot-pluggable.
But what are these same ? What is the difference ?

By Definition:

 Hot-Pluggable :
Devices that can be removed or installed while machine is running.
These devices requires administrative action to install or remove without need of reboot.
Eg: It may be required to offline a devie before you remove it.


Hot-Swappable:

Hot-swappable devices are on the other hand more user friendly as they don't need any user intervention or administrative action.
Just plugin to install or plugout to remove.

Sunday, August 18, 2013

Top free windows softwares

Recently my desktop running Windows 7 had some issues and i had to reimage it.
After basic installation i had to install software so i thought of sharing a list with you. These are free software that can be downloaded.

Here is my list of free software that i use frequently :

1. Open Office
2. Putty (self compiled with fixes ) + putty connection manager
3. Firefox and Chrome
4. Thunderbird
5. Pidgin
6. 7-zip
7. Java 7
8. Virtual Box : with Oracle ZFS appliance simulator, ubuntu, Solaris 11
9. Winscp
10. Virtual Desktop Client ( Oracle VDI )
11. Wireshark
12. Acrobat Reader
13. Notepad++
14. PrimoPDF
15. Glary utilities
16. VNC viewer
17. MinGW
18. Dual Monitor Taskbar : http://sourceforge.net/projects/dualmonitortb/files/Releases/
19. Windows 7 Logon Background Changer : www.julien-manici.com

Saturday, July 27, 2013

Expanding root / filesystem size online

To expand ext4 root filesystem size online is possible in Linux.

 Prerequisite is that to expand filesystem you should have free sectors available on the disk.
Here I am giving the example of ubuntu :

1. Change the partition size using fdisk
  a. Delete the partition "d"
  b. create a new partition "n"
  c. Give new size. Point to remember is that First sector should be same as it was before.
      In most cases it is default.
      Then give new size as +<size>G which should be bigger than original/previous root filesystem size.
  d. Confirm changed using print "p". Then save the changes.

2. For root filesystem we cannot say it is 100% online as new size will come into effect only after reboot.
  + If this is non-root partition then just "partprobe" will work after doing umount of mount point and it will read the new size into kernel.
3. Then do : e2fsck -f /dev/sda1
4. Now magic command resize2fs
  # resize2fs /dev/sda1

And we are all set !!
You can confirm the new size using df -h

Other quick dirty way would be to boot from Live CD then turn the swapoff and then resize root partition using gparted.

Thursday, June 6, 2013

Vi Editor : Movements

Cursor Movement :

h (left), j (down), k (up), l (right)

End of Line: 
$ --> End of line
A --> Append at End of line

Start of Line:
"^ "
Begin of previous line:  "H" (shift +h)
Begin of next line : "L" (shift + l)

End of File :
Shift + g

Join two lines:
"J" --> Go to End of line then press "J"

Go to :
:n --> go to line no. "n"

Word movement :
End of current word: e
Start of current word: b
Next word: w

You may also want to know how to work with multiple files using vi split

Wednesday, May 15, 2013

Vi Editor : Working with multiple files : Split screen


Creating Multiple Screens :

:split --> Split Horizontally
:vsplit  --> Split Vertically
:new  --> to open new file
:w filename  --> to save a new file with a name filename
or :new filename --> open new file with name filename

Movements between screens :

(Remember with Control Windows : Ctrl+W)
"ctrl+w" + arrow key  ( Arrow keys easy to move between screens)
or
"ctrl+w" + [h | j | k | l ]
h --> move to left screen
l --> move to right screen
j --> move to down screen
k --> move to upper screen

Not much difficult to remember as keys "h" , "j", "k", "l" are in sequence on keyboard.

:only  --> Full screen

You may also want to know useful vi cursor movements

https://linuxhint.com/how-to-use-vim-split-screen/

Monday, April 22, 2013

lsof for Solaris 11

 Solaris 11 default repository does not contain lsof package. So i headed for sunfreeware and downloaded lsof v4.80 and tried compiling it on Solaris 11 box. But it was not successful and seems not supported.


  If you want to download binary please find the compiled lsof below :
Download lsof for Solaris 11 x64 v 4.87 lsof_x86
Download lsof for Solaris 11 Sparc v 4.87 lsof_sparc


Later I found the latest source 4.87 at :
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
Same source file should work for sparc and x64.

I downloaded it; and it compiled like a charm.

Steps:
Required packages:

I used compiler gcc-45 ( older may work) :
developer/gcc-45
system/library/gcc-45-runtime

Header files:
system/library/gcc-45-runtime

After downloading the latest source file unzip it and compile as below :

  1. # gunzip lsof_4.87.tar.gz
  2. # tar -xvf lsof_4.87.tar
  3. # cd lsof_4.87/
  4. # tar -xvf lsof_4.87_src.tar
  5. # cd lsof_4.87_src
  6. # ./Configure solaris
  7. # make
  8. # make install
  9. # ./lsof





Enjoy !!