Wednesday, May 27, 2015

Private and Public IP Addresses

IP addresses can be classified into Private and Public IP addresses.

To preserve the IP address space, Private IP addresses were introduced. Private IP addresses are used on the internal network and are never advertised to the public network.

Private IP addresses range:

10.0.0.0 - 10.255.255.255
Total host addresses : 16,777,216

172.16.0.0 - 172.31.255.255
Total host addresses : 1,048,576

192.168.0.0 - 192.168.255.255
Total Host addresses : 65536

Private IP addresses go through a process of NATing if they want to communicate with public internet

Public IP addresses are those addresses which are advertised on the public network, inter-networks.

Tuesday, May 26, 2015

What would happen if we type "mv *" in the command line?

What will happen if we type the command  mv * ?

To check it, I went to folder containing the following entries

$ ls -l
total 24
-rw-rw-r-- 1 xxxx yyyy  97 Mar  2 18:51 elb
-rw-rw-r-- 1 xxxx yyyy  96 Mar  6 12:09 elb2
-rw-rw-r-- 1 xxxx yyyy 108 Mar  6 11:49 elb3
-rw-rw-r-- 1 xxxx yyyy 132 Mar  6 11:53 elb4
-rw-rw-r-- 1 xxxx yyyy 128 Mar  6 11:56 elb5
-rw-rw-r-- 1 xxxx yyyy  10 May 24 16:20 host.txt

$ mv *
mv: target `host.txt' is not a directory

To see what the above command mv * did really, I ran the following command

$ echo mv *
mv elb elb2 elb3 elb4 elb5 host.txt

So the shell basically expands * to all the file names in the directory before calling the mv command.

So the mv command sees the last argument as the destination- in this case it is host.txt. It is a file and not a directory. The reason for mv command to consider the last argument as a directory is specified in the man command for mv

DESCRIPTION
       Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.

More info about mv command can be found from

$ info coreutils 'mv invocation'

Monday, May 25, 2015

-bash: man: command not found

When I wanted to find the man  page for a command, I was presented with the message

-bash: man: command not found

The reason is that CentOS minimal install, will not include the man pages.

So install the man  pages using

yum -y install man

How to create a file named "-f" and delete the same?

Say, I want to create a file named -f

It can be done using the option --

vi -- -f

Similarly the deletion of file -f can be done using the option -- with rm command

rm -- -f

Wednesday, May 20, 2015

Difference between TRUNCATE, DELETE and DROP commands in database

DELETE command is used to remove rows from a table. A WHERE clause can be used to only remove some rows. If no WHERE condition is specified, all rows will be removed. 

TRUNCATE removes all rows from a table. The operation cannot be rolled back and no triggers will be fired. As such, TRUCATE is faster and doesn't use as much undo space as a DELETE.

The DROP command removes a table from the database. All the tables' rows, indexes and privileges will also be removed. No DML triggers will be fired. The operation cannot be rolled back.


DROP and TRUNCATE are DDL commands, whereas DELETE is a DML command. Therefore DELETE operations can be rolled back (undone), while DROP and TRUNCATE operations cannot be rolled back.


TRUNCATE is much faster than DELETE.

Reason:When you type DELETE.all the data will get copied into the Rollback Tablespace first, then delete operation will get performed. That's why when you type ROLLBACK after deleting a table ,you can get back the data(The system get it for you from the Rollback Tablespace).All this process take time. 

Reference: