Directory Management Of Linux/unix with practical guide


Directory Management Of Linux/unix with practical guide


In this article we learn about directory management that is how to create,rename and delete of directory 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.

What is home directory

Home directory is user own directory when a user login first time ,after login user place its home directory. User can switch its home directory using ~ sign.Suppose user bob wants to go his home directory he should execute the below command to enter his home directory.

#cd ~bob

To identified the position  of file we should know the concept of pathname. Pathname is divided into two types.
  •          Absolute path: Absolute path is the path which has a relation to root.Absolute path start with /.
  •          Relative path: Relative path is the path which has no relation to root. Relative path never start with /.

To know the current working directory we have to execute the ‘pwd’ command on the shell.

# pwd
/root

List the file in linux system

To list the directory in the linux system execute the ‘ls’ command.

[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  test

Create directory in linux system

 To create a directory we use ‘mkdir’ command. After executing the command we can get the below output.


[root@localhost ~]# mkdir test
[root@localhost ~]# ll
total 24
-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
drwxr-xr-x. 2 root root  4096 Sep 26 16:04 test

Directory Management Of Linux/unix with practical guide
Directory Management Of Linux/unix with practical guide


Rename directory in linux system 


To rename the directory we execute ‘mv ’ commad. After executing the command we can get the below output.

[root@localhost ~]# mv test newtest
[root@localhost ~]# ll
total 24
-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
drwxr-xr-x. 2 root root  4096 Sep 26 16:04 newtest

Change directory in linux system 


To change the directory we execute ‘cd’ commad. After executing the command we can get the below output.

[root@localhost ~]# cd newtest/
[root@localhost newtest]# pwd
/root/newtest

Delete directory in linux system 


To delete the directory we execute ‘rmdir’ commad. After executing the command we can get the below output.

[root@localhost ~]# rmdir newtest/
[root@localhost ~]# ll
total 20
-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

SHARE

Admin

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

1 comments: