martes, 15 de junio de 2021

HARD LINKS AND SYMBOLIC LINKS IN LINUX




HARD LINKS

Each file in the Linux file system begins with a single hard link.

The link is between the file name and the actual data stored in the file system.

Creates a new filename that points to the exact same data as the old filename. This means that the two file names, although different, point to identical data.

For example, if I create file /home/tcarrigan/demo/link_test and write hello world in the file, I have a single hard link between the file name link_test and the file content hello world.

[tcarrigan@server demo]$ ls -l
total 4
-rw-rw-r--. 1 tcarrigan tcarrigan 12 Aug 29 14:27 link_test

Take note of the link count here (1).

Next, I create a new hard link in /tmp to the exact same file using the following command:

[tcarrigan@server demo]$ ln link_test /tmp/link_new

The syntax is ln (original file path) (new file path).

Now when I look at my filesystem, I see both hard links.

[tcarrigan@server demo]$ ls -l link_test /tmp/link_new 
-rw-rw-r--. 2 tcarrigan tcarrigan 12 Aug 29 14:27 link_test
-rw-rw-r--. 2 tcarrigan tcarrigan 12 Aug 29 14:27 /tmp/link_new

The primary difference here is the filename. The link count has also been changed (2). Most notably, if I cat the new file's contents, it displays the original data.

[tcarrigan@server demo]$ cat /tmp/link_new 
hello world

When changes are made to one filename, the other reflects those changes. The permissions, link count, ownership, timestamps, and file content are the exact same. If the original file is deleted, the data still exists under the secondary hard link. The data is only removed from your drive when all links to the data have been removed. If you find two files with identical properties but are unsure if they are hard-linked, use the ls -i command to view the inode number. Files that are hard-linked together share the same inode number.

[tcarrigan@server demo]$ ls -li link_test /tmp/link_new 
2730074 -rw-rw-r--. 2 tcarrigan tcarrigan 12 Aug 29 14:27 link_test
2730074 -rw-rw-r--. 2 tcarrigan tcarrigan 12 Aug 29 14:27 /tmp/link_new

The shared inode number is 2730074, meaning these files are identical data.


Symbolic links

link together non-regular and regular files.

They can also span multiple filesystems. By definition, a soft link is not a standard file, but a special file that points to an existing file. Let's look at how to create a soft link. I use the ln -s command and the following syntax:

ln -s (file path you want to point to) (new file path)

In the example below, I create a new file at /home/tcarrigan/demo/soft_link_test with the file content soft Hello world. I then create a soft link to that file at /tmp/soft_link_new:

[tcarrigan@server demo]$ ln -s /home/tcarrigan/demo/soft_link_test /tmp/soft_link_new
[tcarrigan@server demo]$ ls -l soft_link_test /tmp/soft_link_new 
-rw-rw-r--. 1 tcarrigan tcarrigan 17 Aug 30 11:59 soft_link_test
lrwxrwxrwx. 1 tcarrigan tcarrigan 35 Aug 30 12:09 /tmp/soft_link_new -> /home/tcarrigan/demo/soft_link_test

Notice that /tmp/soft_link_new is just a symbolic link, pointing to the original /home/tcarrigan/demo/soft_link_test. If I cat the content of /tmp/soft_link_new, I should see the soft Hello world text.

[tcarrigan@server demo]$ cat /tmp/soft_link_new 
soft Hello world

DIFFERENCE - A hard link always points a file name to data on a storage device. - A symbol link always points one filename to another filename,      which then points to information on a storage device.

martes, 24 de mayo de 2016

Tim Berners-Lee

Sir Timothy "Tim" John Berners-LeeKBE (LondresReino Unido8 de junio de 1955) es un científico de lacomputación británico, conocido por ser el padre de la Web. Estableció la primera comunicación entre un cliente y un servidor usando el protocolo HTTP en noviembre de 1989. En octubre de 1994 fundó el Consorcio de la World Wide Web (W3C) con sede en el MIT, para supervisar y estandarizar el desarrollo de las tecnologías sobre las que se fundamentala Web y que permiten el funcionamiento de Internet.
Ante la necesidad de distribuir e intercambiar información acerca de sus investigaciones de una manera más efectiva, Berners-Lee desarrolló las ideas fundamentales que estructuran la web. Él y su grupo crearon lo que por sus siglas en inglés se denomina Lenguaje HTML (HyperText Markup Language) o lenguaje de etiquetas de hipertexto, el protocoloHTTP (HyperText Transfer Protocol) y el sistema de localización de objetos en la web URL (Uniform Resource Locator).
Es posible encontrar muchas de las ideas plasmadas por Berners-Lee en el proyecto Xanadú (que propuso Ted Nelson) y el memex (de Vannevar Bush).
Nació en el sudoeste de Londres en 1955. Sus padres eran matemáticos y formaron parte del equipo que construyó elManchester Mark I. Se graduó en física en 1976 en el Queen's College de la Universidad de Oxford. Conoció a su primera esposa en este periodo. En 1978, trabajó en D.G. Nash Limited (también en Poole) donde escribió un sistema operativo.