新聞中心
linux在文件管理方面對比于windows很友好,本文將簡要描述Linux系統(tǒng)下文件位置的查找實(shí)戰(zhàn)。

一、查看工作路徑
第一,可以使用pwd命令查看自己當(dāng)前所在的工作目錄路徑,例如:
[root@localhost ~]# pwd
/root
也可以使用echo $PWD查看當(dāng)前的工作路徑。
二、查看文件和目錄
第二,可以使用ls 命令查看當(dāng)前路徑下的所有目錄和文件,例如:
[root@localhost ~]# ls
anaconda-ks.cfg Desktop my_shell pictures
也可以使用ls -l 命令查看當(dāng)前路徑下的所有文件,包括文件大小、文件類型等,例如:
[root@localhost ~]# ls -l
total 24
author:
-rw-r--r--. 1 root root 1717 Mar 3 09:21 anaconda-ks.cfg
-rw-r--r--. 1 root root 363 Mar 5 22:22 Desktop
drwxr-xr--. 2 root root 24 Mar 5 22:20 my_shell
drwx------. 2 root root 1024 Mar 5 22:37 pictures
三、查看文件位置和內(nèi)容
第三,可以使用whereis 命令查看某個(gè)文件的位置,例如:
[root@localhost ~]# whereis anaconda-ks.cfg
anaconda-ks.cfg: /root/anaconda-ks.cfg
也可以使用cat 命令查看某個(gè)文件的內(nèi)容,例如:
[root@localhost ~]# cat anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.
#version=DEVEL
…
四、查找文件
第四,可以使用find 命令查找某個(gè)目錄下是否包含某個(gè)文件,例如:
[root@localhost ~]# find / -name anaconda-ks.cfg
/home/anaconda-ks.cfg
/root/anaconda-ks.cfg
Linux系統(tǒng)中,可以使用pwd、ls、whereis、cat、find 等命令,快速查找文件位置和內(nèi)容,這可以大大減少時(shí)間成本。
創(chuàng)新互聯(lián)(cdcxhl.com)提供穩(wěn)定的云服務(wù)器,香港云服務(wù)器,BGP云服務(wù)器,雙線云服務(wù)器,高防云服務(wù)器,成都云服務(wù)器,服務(wù)器托管。精選鉅惠,歡迎咨詢:028-86922220。
當(dāng)前標(biāo)題:Linux下文件位置查找實(shí)戰(zhàn)(linux文件位置)
分享URL:http://m.fisionsoft.com.cn/article/dpeheso.html


咨詢
建站咨詢
