Linux file management

LORY
3 min readFeb 12, 2021

--

Linux file system directory structure

bin : user binary files

boot : include files needed when boot system

dev : devices , appear as files

etc : system wide configuration files . user specific configuration file located in each user/home

home : home folder of each user

lib : system libraries . user specific library located in user/lib

media : removable media devices

mnt : mount points for temporary files systems

opt : optional software packages

sbin : system binary files

tmp : temporary files

usr: usr binaries and read-only data

var : writable counterpart to the /usr directory

root : root user home directory

proc : special files, contains system and process information

lost+found: misplaced data

Permission code

Types

-for files

d for directories

l for links

c for character devices

b for block devices

n for network devices

file actions

r for read permission for the object

w for write permission for the object

x for execute permission for the object

User types

The owner of the object

The group that owns the object

Everyone else on the system

Sample

drwxrwxr-x

d it is a directory

rwx for the file owner (set to the login name rich)

rwx for the file group owner (set to the group name rich)

r-x for everyone else on the system

Sticky bit

Folder or file could also include sticky bit to only allow owner or root be able to delete or rename .

drwxrwxrwt

Files under this folder only owner or root can write .

File metadata and inode

Every file and directory include inode . contains all metadata of files or directories . also include blocks which blocks data are stored in .

Hard link and soft link

Soft link is pointing to original file. Once file removed ,soft link become invalid ;hard link is pointing to same place as original file where data is stored .when original file removed, hard link still valid .

Sample

After original file removed, soft link is showing as error and hard link file still remains .

--

--

LORY
LORY

Written by LORY

A channel which focusing on developer growth and self improvement

No responses yet