Linux File System

Linux File System

If you are in IT Field or thinking of getting into it. Then a deep understanding of Linux is very important. In this article, we are going to get a decent understanding of Linux File System.

What is a File System ?

OS stores data on disk drives using a structure called a file system, consisting of files, directories and the information needed to access and locate them. There are many different types of file systems. In general, improvements have been made to file systems with new releases of operating systems and each new filesystem has been given a different name.

E.g. EXT3;EXT4;XFS;NTFS;FAT etc

Unlike windows, Linux filesystems store information in a hierarchy of directories and files.

File Structure

All the files and folders in Linux is structured in an hierarchy order. the uses of each file folder is listed as follows

File Structure

 

  • /boot                        Contains file that is used by the bootloader (grub.cfg)
  • /root                         Root user’s home directory
  • /dev                         System devices (e.g. disk, cdrom, speakers, flash drive, keyboard etc.)
  • /etc                          Configuration Files
  • /bin -> /usr/bin         Everyday User Commands
  • /sbin -> /usr/sbin     System/Filesystem Commands
  • /opt                          Optional add-on applications (Not part of OS apps)
  • /proc                        Running Processes (Only exit in Memory)
  • /lib -> /usr/lib           C programming library files needed by commands and apps
  • /tmp                         Directory for temporary files needed by commands and apps
  • /home                      Directory of User
  • /var                          System Logs
  • /run                         System daemons that start very early to store PID files
  • /mnt                         To mount external filesystems
  • /media                     For cdrom Mounts

File Types in Linux

  •  –     Regular File
  • d      Directory
  • l        Link
  • c        Device File
  • s        Socket File
  • p       Named File
  • b       Blockfile

File Paths

There are two paths to navigate to a filesystem :

  • Absolute Path
  • Relative Path

An absolute path always begins with a “/”.This indicates that the path starts at the root directory. An example of an absolute path is :

cd  /var/log/httpd

A relative path does not begin with a “/”.It identifies a location relative to your current position. An example of a relative path is :

cd /var

cd log

cd httpd

Navigation Through Terminal

These are some important command for navigating in an UNIX filesystem:

  • cd
  • pwd
  • ls

“cd” stands for change directory. It is the primary command for moving you around the file system. “pwd” stands for print working directory. It tells you where you are in the system. “ls” stands for list. It lists all the contents in a directory.

Now, here some attributes can be used with ls to increase its capabilities.

ls -al
ls -a

When we are using -al along with ls we can see the items are listed in a detailed manner,to understand every aspect of the result, have a look to the file types section of the article. The result explains :

TYPE

No. of Links

Owner

Group

Size

Month

Day

Time

Name

drwxr-xr-x21rootroot4096May2710:20var
drwxr-xr-x1rootroot15May2710:22bin
-rw-r-r–1rootroot0Jun211:15testfile

File System Color Codes

  • Blue = Directory
  • White = File
  • Green = Executable
  • Sky Blue = Symbolic Link
  • Pink = Graphic Image File
  • Red = Archive file (tar)
  • Red with black background = Broken Link

Coping Files and Folders

Coping and moving files and folders from one directory to another can be done with these commands:

  • Copying Specific Files
    • cp oldfilepath newfilepath
  • Moving Files
    • mv oldfilepath newfilepath
  • Copying Directories
    • cp -r olddirpath newdirpath
  • Moving Directories
    • mv -r olddirpath newdirpath

Creating Files and Directories

A file can be created in linux with the help of touch command or through a text editor like nano. For creating a blank file using touch, this command can be used:

touch testfile

And for creating a directory, “mkdir” command is used:

mkdir testfile

Reading and Removing Files and Directories

A file can be read with the cat command for example:

cat testfile.txt

And for removing a file “rm can be used”. For removing a directory -r attribute must be specified:

rm testfile
rm -r testdir

That’s all for now. If you want to know something more, don’t forget to check out our YouTube channel for a better understanding. For any doubt you can reach us through the comments or through the contact us page.

 

Share the Post...
WhatsApp

About Cybervie

Cybervie provides best cyber security training program in hyderabad, India.This cyber security course enables you to detect vulnerablities of a system, wardoff attacks and manage emergency situations. Taking a proactive approach to security that can help organisations to protect their data, Cybervie has designed its training module based on the cyber security industry requirements with three levels of training in both offensive and defensive manner, and use real time scenarios which can help our students to understand the market up-to its standard certification which is an add on advantage for our students to stand out of competition in an cyber security interview.

More Info – Click Here

Recent Posts

Follow Us on Youtube

CSEP : Certified Security Engineer Professional

Certified Security Engineer Professional (CSEP) certification is a comprehensive program designed for individuals aspiring to become cybersecurity engineers. It equips candidates with hands-on knowledge across various in-demand cybersecurity domains, ensuring they are well-prepared for current and future industry needs.

Organizations today seek candidates with a diverse set of skills beyond just one tool or area of expertise. The CSEP certification addresses this need by providing essential hands-on experience, making you proficient in multiple cybersecurity domains.

The program includes live classes featuring practical exercises, followed by a real-time project that offers valuable industrial knowledge.

Domains covered in the CSEP certification:

  • Cybersecurity Essentials
  • Penetration Testing
  • Application Security
  • Security Operations
  • AI in Cybersecurity
  • Multi-Cloud Security
  • Threat Intelligence

 

This certification is ideal for those looking to secure a role as a cybersecurity engineer and want to gain a competitive edge in the cybersecurity field.

For Further kindly feel free to fill out the profile form  for relevant information on our counselor will get in touch with you

Sign up for our Newsletter

Interested in Cyber Security Training Program 2024 – Click Here
Open chat
1
Hello 👋
How can we help you?