miércoles, 18 de septiembre de 2019

The compilation process in c


Image 1. The compilation process

When we try to compile a file (e.g. main.c), we need to understand what the system does. The figure above explains the process of compiling these files.

  • We need to use a compiler (e.g. gcc)
  • The command to compile with gcc is: gcc filename.c
  • The output is the executable file a.out (See image 2)





Image 2. Compilation example

lunes, 16 de septiembre de 2019

Linux link


Image 1. Symbolic Link


Image 2. Hard Link


Every file in the system has an inode (Index node), that contains all file information (Inode number, file size, ouner information, permissions, file type, other) except the contents and name.

There are two types:

- Symbolic links: It is a pointer to the original file.

- ln -s source linkname


Image 3. Create symbolic link


- Hard links: Different name of the same file, same file size, same inode number.





Understanding linux command ls *.c










Image 1.

ls is a unix like system command that prints on screen the content of current directory or the directory that is passed as parameter, as it's shown below.


Image 2.

When the command ls is used with the wilcard * following a file extension (e.g .c), it tells the system that it wants to list all files that have the desired extension regardless of what was before.

Examples:

  • ls
  • ls /etc/init.d
  • ls *.c
  • ls *.txt