Sunday, April 5, 2020

How to check Ubuntu version

Check ubuntu version with follwoing command

lsb_release -a

Sunday, January 26, 2020

How to compile google protocol buffer 2.7.0 in ubuntu

1. Download the google protocol buffer 2.7.0 from github branches

https://github.com/protocolbuffers/protobuf/tree/2.7.0

 

2. Download gmock1.7.0.zip from following github

https://github.com/paulsapps/gmock-1.7.0

 

3. unzip the zip file

unzip gmock-1.7.0.zip

 
4. Rename the gmock-1.7.0 to gmock

mv gmock-1.7.0 gmock

 

5.run following command

./autogen.sh
./configure
make
make check
make install

How to add user with sudo privilage in ubuntu using gpasswd

We can grant a user with sudo privileges by adding them to the group like this: 
 
sudo gpasswd -a username sudo

Monday, August 8, 2016

Normal TCP termination sequence

We have two peers: A and B

    A calls close()
        A sends FIN to B
        A goes into FIN_WAIT_1 state
    B receives FIN
        B sends ACK to A
        B goes into CLOSE_WAIT state
    A receives ACK
        A goes into FIN_WAIT_2 state
    B calls close()
        B sends FIN to A
        B goes into LAST_ACK state
    A receives FIN
        A sends ACK to B
        A goes into TIME_WAIT state
    B receives ACK
        B goes to CLOSED state – i.e. is removed from the socket tables

Thursday, July 7, 2016

Bring the network interface up or down in linux

It is possible to bring up or bring down the network interface with following command
To bring down eth1
ifdown eth1
To bring up eth1
ifup eth1

How to disable root SSH login


[root@root ~]# vi /etc/ssh/sshd_config
Change this line:
#PermitRootLogin yes
Edit to this:
PermitRootLogin no
Restart ssh service to change the setting
service ssh restart

Thursday, February 25, 2016

Using VI editor to replace text

To perform a global search and replace in vi, use the search and replace command in command mode:
:%s/search_string/replacement_string/g
The % is a shortcut that tells vi to search all lines of the file for search_string and change it to replacement_string. The global (g) flag at the end of the command tells vi to continue searching for other occurrences of search_string. To confirm each replacement, add the confirm (c) flag after the global flag.