Linux 文件管理-基础知识-文件与目录管理-扫盲篇

Linux 文件与存储之间的关系

在安装操作系统的时候,会让选择扇区的大小,操作系统在读取数据的时候,为了效率会一次读取由N个扇区组成的Block,这些Block的大小与安装时设置的参数有关,Inode=Index node即文件索引。可以理解为一旦一个磁盘的容量确定了,这个磁盘里面的Inode数量也就确定了,不同的存储系统,ext4或者xfs无外乎存储数据的底层结构以及一些附带的属性不太一样,归根到底都是执行下面的操作:应用层把数据交给操作系统,操作系统按照一定的规则(xfs|ext4|others)来存储数据,数据存储到磁盘上,每个inode都包含了一定大小的连续的Block存储空间,文件存储在磁盘上可能并不一定是相邻的Inode上,上层的一些命令,例如ls,stat 等软件,在向操作系统申请读取一个文件时,只需要告诉操作系统这个文件的起始Inode即可,这个起始的inode上已经记录了这个文件的的大小以及占用了多少个block,只要按照顺序读取这些block里的数据拼接起来就是完整的数据。

cd 

cd=change directory

 

Linux与目录相关的操作符
 cd .当前目录情形结果
cd ..上一级目录  
cd ~当前用户的home目录  
cd -前一个工作目录cd /etc/nginx;cd /var/logs;cd -;最终目录会是/etc/nginx
cd ~accountname指定用户的home目录  

cd  当前用户的home目录 和cd ~一样

 

pwd

print working directory

命令简介:

    该命令用来显示目前所在的工作目录。指令英文原义:print work directory

    执行权限    :All User

    指令所在路径:/usr/bin/pwd 或 /bin/pwd

命令语法:


    pwd [OPTION]...

命令参数: 

参数

长参数

描叙

-L

--logical(无效)

当目录为连接路径时,显示连接路径

-P

--physical(无效)

显示实际物理路径,而非使用连接(link)路径

 

--help

显示命令在线帮助(该参数无法使用)

 

--version

显示命令版本信息(该参数无法使用)

使用示例:
 

1:查看pwd命令的帮助信息

PWD(1)                                                                                                                       User Commands                                                                                                                       PWD(1)

NAME
       pwd - print name of current/working directory

SYNOPSIS
       pwd [OPTION]...

DESCRIPTION
       Print the full filename of the current working directory.

       -L, --logical
              use PWD from environment, even if it contains symlinks

       -P, --physical
              avoid all symlinks

       --help display this help and exit

       --version
              output version information and exit

       NOTE: your shell may have its own version of pwd, which usually supersedes the version described here.  Please refer to your shell's documentation for details about the options it supports.

       GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report pwd translation bugs to <http://translationproject.org/team/>

AUTHOR
       Written by Jim Meyering.

COPYRIGHT
       Copyright © 2013 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
       This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       getcwd(3)

       The full documentation for pwd is maintained as a Texinfo manual.  If the info and pwd programs are properly installed at your site, the command

              info coreutils 'pwd invocation'

       should give you access to the complete manual.

 

2:显示当前目录所在路径 pwd

   1: [root@DB-Server networking]# pwd 
   2: /etc/sysconfig/networking


3:显示当前目录的物理路径 pwd –P

   1: [root@DB-Server init.d]# cd /etc/init.d 
   2: [root@DB-Server init.d]# pwd -P 
   3: /etc/rc.d/init.d


4: 显示当前目录的连接路径:pwd -L

   1: [root@DB-Server networking]# cd /etc/init.d 
   2: [root@DB-Server init.d]# pwd -L 
   3: /etc/init.d 
   4: [root@DB-Server init.d]# pwd 
   5: /etc/init.d

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值