In this blog we see most useful Linux commands for files and directories, which are used in Linux system.
What is the file system Management:
A file system is a logical collection of files on a partition or disk. A partition is a container for information and can span an entire hard drive.
One file system per partition allows for the logical maintenance and management of the different file systems. Everything in Linux consider as a file including physical devices such as DVD, USB devices and Floppy drives.
Linux File System :
In Linux system everything is a file. A file contain text files, images and compiled programs but also include partition hardware device, drivers and directories.
Linux file system is generally a built in a layer of a Linux Operating System used to handle the data management of the storage. It help to arrange file on the disk storage. It manages the file name, size, creation date and much more information about a file. For the layout of file system click here.. file layout.
|file||To determine file type|
|touch||Used to create a file|
|rm||To remove a file|
|cp||To copy a file|
|mv||Rename or move file|
Linux Directory Structure:
Linux uses a hierarchical file system structure much like on upside- down tree with root (|) at a base of the file and other directories spreading from there.
Each file or directory is uniquely identified by its name. The directory in which it resides and a unique identifier is called iNode.
The following are directories that exist on the major version of Linux
|/ root||It contain only the directories needed at the top level of the file structure|
|/ bin||The executable files are located. File are available to all users.|
|/ dev||Here all physical drives are mounted like DVD’s , USBs|
|/ etc||Contains configuration for the installed packages.|
|/ lib||It’s contains shared library files and sometimes other kernel- related files.|
|/ boot||boot loader and boot files are located.|
|/ home||Contain the home directory for user and other account such as personal folders.|
|/ proc||All processes marked as a file by process number or other information that is dynamic to the system.|
|/ tmp||Hold temporary files used between system boot|
|/ var||Contain system logs and other variable data.|
Linux commands for files and directories:
The following are some command which are commonly used in file and directories.
|pwd||It display current working location or directory of the user.|
|ls||Used to show all the list of folder.|
|cd||Stand for change directory.|
|mkdir||Used to create own directory.|
|rmdir||This is used to remove directory from system.|
|cat||Used to print contain of file and concatenate file.|
|banner||Print ASCII character in upper case.|
|bc||Used for command line calculator|
|head||This command print the first 10 lines of a file.|
|tail||Command print the last 10 lines of a file.|
|passwd||Allows to change your password.|
|test||Used as part of the conditional execution of shell command.|
|expr(expression)||This command is used to evaluate a given expression and display its standard output.|
|clear||It is stand for to clear the terminal screen|
|script||To take copy of everything which is output to display it should be name file and exist file.|