Linux directories for new programmers really useful

Directories in UNIX or LINUX a really useful concept for new programmers. LINUX directories are like in windows they are folders. Links, Files and Directories are major components you need to learn. Linux or UNIX have case sensitive names.

Directories and Files

Root Directory

  • Before, you first start to learn about directory-You can think it is a ‘Folder’ in windows. In Linux, the ‘/’ (slash) is called root directory.
  • Under root directory all other directories like User or System directories are usually created.
mkdir name_of_your_dir

File System

A file is called Regular file and Plain file, normally created in directories. Each file has some extension with (.) dot, so that you can easily recognise the type of files.
#creating files
>mydir vi sample.java
#when you save the data your file is ready sample.java

Examples

  1. mysample.java
  2.  stdio.h

Directory within other directory

You can create another directory in a directory, which already created

File structure in Linux

File structure
Unix directories
In the above structure, in the root directory, you can see both files,links and directories. You can create symbolic links like short links to quick use.

Directory details

  • Every directory by default you can see two dots(dot-dot)-‘..’, this tells the link for directory itself
  • /.. tells root directory
  • File name should not be more that 255 bytes in Linux systems
  • Type ‘pwd’ to know present or current working directory
  • Path, it denotes the where directory or file is located
  • Example for absolute path name /home/mtk/.bashrc, /usr/include
  • Example for relative path name /include/stdio.h

Ownership of Files

  1. Files have ownership. The ownership can be read, write and execute
  2. Major operations on file i/o are open()read()write()close()

Important interview question

UNIX systems have no end-of-filecharacter; the end of a file is detected by a read that returns no data.

Also read

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.