Linux系统管理文件及目录

linux系统作为一个主流系统之一,和我们习惯的windows系统一样也会存在文件和目录文件(相当于windows系统常说的文件夹。)为了秉持一贯思想,linux系统下,一切皆文件,我们这里称为目录文件。linux系统里严格管理各个文件的权限,所以一些基础知识有必要了解。


关于如何去看这些奇奇怪怪的信息,前面文章已经描述过,不在赘述。

今天主要来讲一下,如何去管理这些文件,目录。

处理目录常用命令:ls cd pwd mkdir rmdir cp rm mv

处理文件常用命令:ls touch rm cp mv

文件查看常用命令:cat tac nl more less head tail

这里推荐两个重要命令,可以有助于我们学习Linux系统。通过man帮助页和help命令能让我们最详细了解命令的使用方法。关于以上提到的命令,只是系统内的一部分,更多使用方法等着我们自己去探索。

[root@localhost ~]# man ls

[root@localhost ~]# man --help

今天就来演示一些基本命令操作。

---------------------------------------------------------------------

#显示当前目录下文件

[root@localhost ~]# ls

anaconda-ks.cfg
#创建目录test

[root@localhost ~]# mkdir test

[root@localhost ~]# ls

anaconda-ks.cfg test

#切换到目录test

[root@localhost ~]# cd test/

[root@localhost test]# ls

#查看当前路径

[root@localhost test]# pwd

/root/test

#切换目录,因为当前所在路径是test内,不存在test目录,所以切换时报错【上一文章提到的路径问题】

[root@localhost test]# cd test

-bash: cd: test: 没有那个文件或目录

[root@localhost test]# ls

[root@localhost test]# pwd

/root/test

#创建普通文件file

[root@localhost test]# touch file

[root@localhost test]# ls

file

#复制文件file并给新文件起名为file1

[root@localhost test]# cp file file1

[root@localhost test]# ls

file file1

[root@localhost test]# mkdir dir

[root@localhost test]# ls

dir file file1

#移动普通文件file到目录文件dir下

[root@localhost test]# mv file dir/

[root@localhost test]# ls

dir file1

[root@localhost test]# cd dir/

[root@localhost dir]# ls

file

#使用mv给文件file改名为file2

[root@localhost dir]# mv file file2

[root@localhost dir]# ls

file2

关于文中提到的命令,根据实际应用有多种用途,详细使用可以借助help帮助页,man手册学习。更多有趣的linux使用小技巧等着大家自己发现!

展开阅读全文

页面更新:2024-05-15

标签:文件   目录   系统   使用方法   路径   命令   常用命令   更多   详细   文章

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top