Linux Files

In Linux system, everything is considered as a file whether it is text files, images, compiled programs, partitions, hardware device drivers or directories and if it is not a file, it is a process. Linux considers everything as a file.

Files are always case sensitive so be careful while using filenames in commands. Let’s take an example. We have two files with the same name (demo.txt and Demo.txt) but they are still different files as one used uppercase D and another used lowercase d in their filenames.

codes@w3schools:~$ cd downloads
 
codes@w3schools:~/Downloads$ ls
 
demo.txt Demo.txt
 
codes@w3schools:~/Downloads$

Types of Files:

  1. Regular files (-): It consists of all the programs, executable files and text files.
  2. Directory files (d): It is always shown in blue color and contains the list of files.
  3. Special files:
  • Block file (b)
  • Character device file (c)
  • Named pipe file (p)
  • Symbolic link file (l)
  • Socket file (s)

Linux File Commands

Command Description
file It determines the file type.
touch It is used to create a file.
rm Use this command to remove a file.
cp It is used to copy a file.
mv It can be used to rename or move a file.
rename It is used to rename a file.

 

Please follow and like us:
Content Protection by DMCA.com