Linux file management

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 .

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
LORY

LORY

1.2K Followers

A Senior Software Developer/Body builder . to help others enjoy coding and stay healthy