Ethernet States in Linux

In Linux environment, sometimes you need to find the connected or connected state of Ethernet cable . There are few solutions,using ‘ifconfig’ and Ping a host . But this may not be helpful when network is configured properly. In such a case, the results of this commands are not valid. So in such a case we can use below steps to detect the state of Ethernet cable.

Continue reading

Creating patch in linux

As a developer you often need to create a patch file, when working between codes.Below are the few methods to create patch file.
1.Using diff command

Below command creates patch between two copies of code in current directories.

diff -Naur subdir1 subdir2 > patch.txt

2.Using Git

By using git, we can create path in different ways.

a)This one creates patch for the last commit

git show > mypatch.txt

b)This command creats patch for current changes in git repository.

git diff > mypatch.txt

c)This command creats patch between two commits in git.

git diff <commitid1> <commitid2> > mypatch.txt