File In Linux | In this
article we learn about file management that is how to create,copy,rename and
delete of file of linux system. All
datas are located in the file and all files are located inside the directories and
all directories located inside the file system of the linux machine. It
basically created a tree structure.
Type of file in linux system
Normally
there are two types of files:
Regular file:All datas, texts, instruction are
located in the regular file.
Special file:Special file provides the access of
hardware like hard drive, ethenet adapter, CD-ROM. Link file is also special
file of linux system.
List the file in linux system
To list the
file in the linux system execute the ‘ls’ command and to get the more information
we use ‘ls-l’ command .See the below output of the command.
#ls -l
total 36
-rw-------. 1 root
root 1044 Aug 31 15:32 anaconda-ks.cfg
-rw-r--r--. 1 root
root 10544 Aug 31 15:32 install.log
-rw-r--r--. 1 root
root 3091 Aug 31 15:27
install.log.syslog
-rw-r--r--. 1 root
root 9 Sep 23 15:01 test1
-rw-r--r--. 1 root
root 9 Sep 23 15:01 test2
-rw-r--r--. 1 root
root 9 Sep 23 15:02 test3
-rw-r--r--. 1 root
root 9 Sep 23 15:02 test4
File Management Of Linux/unix with practical guide |
First field: Represent type of file and also represent permission of the file.
· Second field: Block of memory assigned for the
file .
·
Third field: Owner of the file.
·
Fourth field: Group of the file.
·
Fifth field: Size of the file in bytes.
·
Sixth field: Last creation orr modified date
and time of the file.
·
Seventh field: Name of the file.
Create file in linux system
To create a empty file we use ‘touch’
command. After executing the command we can get the below output.
[root@localhost
~]# touch test5
[root@localhost
~]# ls -l | grep test5
-rw-r--r--.
1 root root 0 Sep 23 15:10 test5
We also create a file
using vi editor.After open the vi editor to enter the edit mode press I and
after write some test press wq to sand and quit from the vi editor.
Copy file in linux system
To copy the file we execute ‘cp ’
commad. After executing the command we can get the below output.
[root@localhost
~]# cp test5 test5.bak
[root@localhost
~]# ls -l | grep test5
-rw-r--r--.
1 root root 0 Sep 23 15:10 test5
-rw-r--r--.
1 root root 0 Sep 23 15:15 test5.bak
Rename file in linux system
To rename the file we execute ‘mv ’
commad. After executing the command we can get the below output.
[root@localhost
~]# mv test5 Test5
[root@localhost
~]# ls -l | grep test5
-rw-r--r--.
1 root root 0 Sep 23 15:15 test5.bak
[root@localhost
~]# ls -l | grep Test5
-rw-r--r--.
1 root root 0 Sep 23 15:10 Test5
Delete file in linux system
To delete the file we execute ‘rm ’
commad. After executing the command we can get the below output.
[root@localhost
~]# rm Test5
rm:
remove regular empty file `Test5'? y
[root@localhost
~]# ls -l | grep Test5
If this article is useful to know about File In Linux please share and subscribe it
Hi admin, Congratulations I was looking for something like that and found it here. I'm really grateful for your blog post. You will find a lot of approaches after visiting your post.
ReplyDeleteDocument Management Software
Electronic Document Management System
Document Management System
Cloud Document Management Software