Linux Command- For the Files and Directories

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 CommandDescription
fileTo determine file type
touchUsed to create a file
rmTo remove a file
cpTo copy a file
mvRename or move file
renameRename file
File commands

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

DirectoryDescription
/ rootIt contain only the directories needed at the top level of the file structure
/ binThe executable files are located. File are available to all users.
/ devHere all physical drives are mounted like DVD’s , USBs
/ etcContains configuration for the installed packages.
/ libIt’s contains shared library files and sometimes other kernel- related files.
/ bootboot loader and boot files are located.
/ homeContain the home directory for user and other account such as personal folders.
/ procAll processes marked as a file by process number or other information that is dynamic to the system.
/ tmpHold temporary files used between system boot
/ varContain system logs and other variable data.
Directories command

Linux commands for files and directories:

  The following are some command which are commonly used in file and directories.

CommandDescription
pwdIt display current working location or directory of the user.
lsUsed to show all the list of folder.
cdStand for change directory.
mkdirUsed to create own directory.
rmdirThis is used to remove directory from system.
catUsed to print contain of file and concatenate file.
bannerPrint ASCII character in upper case.
bcUsed for command line calculator
headThis command print the first 10 lines of a file.
tailCommand print the last 10 lines of a file.
passwdAllows to change your password.
testUsed 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.
clearIt is stand for to clear the terminal screen
scriptTo take copy of everything which is output to display it should be name file and exist file.

Leave a Reply

Your email address will not be published. Required fields are marked *