0

0

Linux下的基本指令

看不見的法師

看不見的法師

发布时间:2025-06-20 11:58:33

|

825人浏览过

|

来源于php中文网

原创

1. ls 指令

Linux下的基本指令
Linux下的基本指令

-r 对目录反向排序 -t 以时间排序 -s 在l文件名后输出该文件的大小。(大小排序,如何找到目录下最大的文件) -r 列出所有子目录下的文件(递归) -1 一行只输出一个文件


2. pwd指令

3. cd 指令
Linux下的基本指令
代码语言:javascript代码运行次数:0运行复制
<code class="javascript">root@hcss-ecs-78b3:/# cd /rootroot@hcss-ecs-78b3:~# pwd/rootroot@hcss-ecs-78b3:~# cd .root@hcss-ecs-78b3:~# pwd/rootroot@hcss-ecs-78b3:~# cd ..root@hcss-ecs-78b3:/# pwd/root@hcss-ecs-78b3:/#</code>
Linux下的基本指令
Linux下的基本指令

4. touch指令 代码语言:javascript代码运行次数:0运行复制
<code class="javascript">root@hcss-ecs-78b3:~# touch hello.txtroot@hcss-ecs-78b3:~# pwd/rootroot@hcss-ecs-78b3:~# lshello.txt</code>

5. mkdir指令代码语言:javascript代码运行次数:0运行复制
<code class="javascript">root@hcss-ecs-78b3:~# mkdir kianaroot@hcss-ecs-78b3:~# lltotal 116drwx------ 12 root root  4096 Oct 15 11:03 ./drwxr-xr-x 24 root root  4096 Oct 15 09:32 ../drwx------  3 root root  4096 Jul 22  2023 .ansible/drwxr-xr-x  2 root root  4096 Jul 22  2023 .ansible_async/-rw-r--r--  1 root root   298 Oct 15 10:15 .bash_history-rw-r--r--  1 root root  3144 Jul 22  2023 .bashrcdrwx------  2 root root  4096 Feb 10  2023 .cache/drwxr-xr-x  7 root root  4096 Jul 22  2023 docker-library/-rw-r--r--  1 root root 21926 Jul 22  2023 get-docker.sh-rw-r--r--  1 root root  1326 Jul 21  2023 githubclone.sh-rw-------  1 root root     0 Feb 10  2023 .history-rwxr-xr-x  1 root root 15353 Jul 22  2023 HSSInstall*drwxr-xr-x  2 root root  4096 Oct 15 11:03 kiana/-rw-------  1 root root    20 Oct 15 10:11 .lesshstdrwxr-xr-x  8 root root  4096 Jul 22  2023 library/drwxr-xr-x  3 root root  4096 Oct 15 09:29 .local/-rw-r--r--  1 root root   161 Jul  9  2019 .profiledrwx------  4 root root  4096 Jul 22  2023 snap/drwx------  2 root root  4096 Oct 11 19:41 .ssh/drwxr-xr-x  9 root root  4096 Jul 22  2023 stackhub/-rw-r--r--  1 root root   173 Jul 22  2023 .wget-hsts-rw-------  1 root root   177 Oct 15 11:03 .Xauthorityroot@hcss-ecs-78b3:~#</code>
代码语言:javascript代码运行次数:0运行复制
<code class="javascript">root@hcss-ecs-78b3:~# mkdir -p a/b/croot@hcss-ecs-78b3:~# lltotal 120drwx------ 13 root root  4096 Oct 15 11:05 ./drwxr-xr-x 24 root root  4096 Oct 15 09:32 ../drwxr-xr-x  3 root root  4096 Oct 15 11:05 a/drwx------  3 root root  4096 Jul 22  2023 .ansible/drwxr-xr-x  2 root root  4096 Jul 22  2023 .ansible_async/-rw-r--r--  1 root root   298 Oct 15 10:15 .bash_history-rw-r--r--  1 root root  3144 Jul 22  2023 .bashrcdrwx------  2 root root  4096 Feb 10  2023 .cache/drwxr-xr-x  7 root root  4096 Jul 22  2023 docker-library/-rw-r--r--  1 root root 21926 Jul 22  2023 get-docker.sh-rw-r--r--  1 root root  1326 Jul 21  2023 githubclone.sh-rw-------  1 root root     0 Feb 10  2023 .history-rwxr-xr-x  1 root root 15353 Jul 22  2023 HSSInstall*drwxr-xr-x  2 root root  4096 Oct 15 11:03 kiana/-rw-------  1 root root    20 Oct 15 10:11 .lesshstdrwxr-xr-x  8 root root  4096 Jul 22  2023 library/drwxr-xr-x  3 root root  4096 Oct 15 09:29 .local/-rw-r--r--  1 root root   161 Jul  9  2019 .profiledrwx------  4 root root  4096 Jul 22  2023 snap/drwx------  2 root root  4096 Oct 11 19:41 .ssh/drwxr-xr-x  9 root root  4096 Jul 22  2023 stackhub/-rw-r--r--  1 root root   173 Jul 22  2023 .wget-hsts-rw-------  1 root root   177 Oct 15 11:03 .Xauthorityroot@hcss-ecs-78b3:~# </code>
代码语言:javascript代码运行次数:0运行复制
<code class="javascript">root@hcss-ecs-78b3:~# tree kianakiana0 directories, 0 filesroot@hcss-ecs-78b3:~# tree aa└── b    └── c2 directories, 0 filesroot@hcss-ecs-78b3:~# </code>

6. which指令 代码语言:javascript代码运行次数:0运行复制
<code class="javascript">root@hcss-ecs-78b3:~# root@hcss-ecs-78b3:~# which tree/usr/bin/treeroot@hcss-ecs-78b3:~# which pwd/usr/bin/pwdroot@hcss-ecs-78b3:~# which ls/usr/bin/lsroot@hcss-ecs-78b3:~# </code>

7. alias指令

如:

给pwd命令取别名叫做kiana

靠岸学术
靠岸学术

一款集翻译,阅读,文献管理于一体的英文文献阅读器

下载
代码语言:javascript代码运行次数:0运行复制
<code class="javascript">root@hcss-ecs-78b3:alias kiana=pwd</code>

8. rm指令代码语言:javascript代码运行次数:0运行复制
<code class="javascript">root@hcss-ecs-78b3:~# lltotal 120drwx------ 13 root root  4096 Oct 15 11:05 ./drwxr-xr-x 24 root root  4096 Oct 15 09:32 ../drwxr-xr-x  3 root root  4096 Oct 15 11:05 a/drwx------  3 root root  4096 Jul 22  2023 .ansible/drwxr-xr-x  2 root root  4096 Jul 22  2023 .ansible_async/-rw-r--r--  1 root root   298 Oct 15 10:15 .bash_history-rw-r--r--  1 root root  3144 Jul 22  2023 .bashrcdrwx------  2 root root  4096 Feb 10  2023 .cache/drwxr-xr-x  7 root root  4096 Jul 22  2023 docker-library/-rw-r--r--  1 root root 21926 Jul 22  2023 get-docker.sh-rw-r--r--  1 root root  1326 Jul 21  2023 githubclone.sh-rw-------  1 root root     0 Feb 10  2023 .history-rwxr-xr-x  1 root root 15353 Jul 22  2023 HSSInstall*drwxr-xr-x  2 root root  4096 Oct 15 11:03 kiana/-rw-------  1 root root    20 Oct 15 10:11 .lesshstdrwxr-xr-x  8 root root  4096 Jul 22  2023 library/drwxr-xr-x  3 root root  4096 Oct 15 09:29 .local/-rw-r--r--  1 root root   161 Jul  9  2019 .profiledrwx------  4 root root  4096 Jul 22  2023 snap/drwx------  2 root root  4096 Oct 11 19:41 .ssh/drwxr-xr-x  9 root root  4096 Jul 22  2023 stackhub/-rw-r--r--  1 root root   173 Jul 22  2023 .wget-hsts-rw-------  1 root root   177 Oct 15 11:03 .Xauthorityroot@hcss-ecs-78b3:~# rm -rf kianaroot@hcss-ecs-78b3:~# lltotal 116drwx------ 12 root root  4096 Oct 15 11:22 ./drwxr-xr-x 24 root root  4096 Oct 15 09:32 ../drwxr-xr-x  3 root root  4096 Oct 15 11:05 a/drwx------  3 root root  4096 Jul 22  2023 .ansible/drwxr-xr-x  2 root root  4096 Jul 22  2023 .ansible_async/-rw-r--r--  1 root root   298 Oct 15 10:15 .bash_history-rw-r--r--  1 root root  3144 Jul 22  2023 .bashrcdrwx------  2 root root  4096 Feb 10  2023 .cache/drwxr-xr-x  7 root root  4096 Jul 22  2023 docker-library/-rw-r--r--  1 root root 21926 Jul 22  2023 get-docker.sh-rw-r--r--  1 root root  1326 Jul 21  2023 githubclone.sh-rw-------  1 root root     0 Feb 10  2023 .history-rwxr-xr-x  1 root root 15353 Jul 22  2023 HSSInstall*-rw-------  1 root root    20 Oct 15 10:11 .lesshstdrwxr-xr-x  8 root root  4096 Jul 22  2023 library/drwxr-xr-x  3 root root  4096 Oct 15 09:29 .local/-rw-r--r--  1 root root   161 Jul  9  2019 .profiledrwx------  4 root root  4096 Jul 22  2023 snap/drwx------  2 root root  4096 Oct 11 19:41 .ssh/drwxr-xr-x  9 root root  4096 Jul 22  2023 stackhub/-rw-r--r--  1 root root   173 Jul 22  2023 .wget-hsts-rw-------  1 root root   177 Oct 15 11:03 .Xauthorityroot@hcss-ecs-78b3:</code>

9. man指令代码语言:javascript代码运行次数:0运行复制
<code class="javascript">root@hcss-ecs-78b3:~#  man manroot@hcss-ecs-78b3:~#  man pwdroot@hcss-ecs-78b3:~#  man ll</code>
Linux下的基本指令

10. cp指令代码语言:javascript代码运行次数:0运行复制
<code class="javascript">drwx------ 12 root root  4096 Oct 15 11:22 ./drwxr-xr-x 24 root root  4096 Oct 15 09:32 ../drwxr-xr-x  3 root root  4096 Oct 15 11:05 a/drwx------  3 root root  4096 Jul 22  2023 .ansible/drwxr-xr-x  2 root root  4096 Jul 22  2023 .ansible_async/-rw-r--r--  1 root root   298 Oct 15 10:15 .bash_history-rw-r--r--  1 root root  3144 Jul 22  2023 .bashrcdrwx------  2 root root  4096 Feb 10  2023 .cache/drwxr-xr-x  7 root root  4096 Jul 22  2023 docker-library/-rw-r--r--  1 root root 21926 Jul 22  2023 get-docker.sh-rw-r--r--  1 root root  1326 Jul 21  2023 githubclone.sh-rw-------  1 root root     0 Feb 10  2023 .history-rwxr-xr-x  1 root root 15353 Jul 22  2023 HSSInstall*-rw-------  1 root root    20 Oct 15 10:11 .lesshstdrwxr-xr-x  8 root root  4096 Jul 22  2023 library/drwxr-xr-x  3 root root  4096 Oct 15 09:29 .local/-rw-r--r--  1 root root   161 Jul  9  2019 .profiledrwx------  4 root root  4096 Jul 22  2023 snap/drwx------  2 root root  4096 Oct 11 19:41 .ssh/drwxr-xr-x  9 root root  4096 Jul 22  2023 stackhub/-rw-r--r--  1 root root   173 Jul 22  2023 .wget-hsts-rw-------  1 root root   177 Oct 15 11:03 .Xauthorityroot@hcss-ecs-78b3:~# root@hcss-ecs-78b3:~# man manroot@hcss-ecs-78b3:~# root@hcss-ecs-78b3:~# cp .wget-hsts get-docker.shroot@hcss-ecs-78b3:~# lltotal 96drwx------ 12 root root  4096 Oct 15 11:27 ./drwxr-xr-x 24 root root  4096 Oct 15 09:32 ../drwxr-xr-x  3 root root  4096 Oct 15 11:05 a/drwx------  3 root root  4096 Jul 22  2023 .ansible/drwxr-xr-x  2 root root  4096 Jul 22  2023 .ansible_async/-rw-r--r--  1 root root   298 Oct 15 10:15 .bash_history-rw-r--r--  1 root root  3144 Jul 22  2023 .bashrcdrwx------  2 root root  4096 Feb 10  2023 .cache/drwxr-xr-x  7 root root  4096 Jul 22  2023 docker-library/-rw-r--r--  1 root root   173 Oct 15 11:32 get-docker.sh-rw-r--r--  1 root root  1326 Jul 21  2023 githubclone.sh-rw-------  1 root root     0 Feb 10  2023 .history-rwxr-xr-x  1 root root 15353 Jul 22  2023 HSSInstall*-rw-------  1 root root    20 Oct 15 11:27 .lesshstdrwxr-xr-x  8 root root  4096 Jul 22  2023 library/drwxr-xr-x  3 root root  4096 Oct 15 09:29 .local/-rw-r--r--  1 root root   161 Jul  9  2019 .profiledrwx------  4 root root  4096 Jul 22  2023 snap/drwx------  2 root root  4096 Oct 11 19:41 .ssh/drwxr-xr-x  9 root root  4096 Jul 22  2023 stackhub/-rw-r--r--  1 root root   173 Jul 22  2023 .wget-hsts-rw-------  1 root root   177 Oct 15 11:03 .Xauthorityroot@hcss-ecs-78b3:~# </code>

11. mv指令

理论杂谈
Linux下的基本指令
Linux下的基本指令
Linux下的基本指令

12. cat指令
Linux下的基本指令

重定向操作
Linux下的基本指令

13. more指令 代码语言:javascript代码运行次数:0运行复制
<code class="javascript">[atong@LiWenTong ~]$ ls -l  / | moretotal 162drwxr-xr-x  2 root root  4096 Apr 25 05:39 bindrwxr-xr-x  4 root root  1024 Apr 25 04:11bootdrwxr-xr-x  9 root root  3820 May  4 23:20 devdrwxr-xr-x 84 root root  4096 May  5 00:37 etc</code>

14. less指令

15. head指令

16. tail指令
Linux下的基本指令
Linux下的基本指令

17. 时间相关的指令17.1. date显示

18. Cal指令
Linux下的基本指令

19. find 查找指令
Linux下的基本指令

20. grep指令
Linux下的基本指令
Linux下的基本指令

21 .zip/unzip指令
Linux下的基本指令

如图,我们压缩了一个压缩包day4.zip,将这个压缩包传递给other,但是当我们打开之后发现day4.zip下的文件并没有一起传送过去,只传了一个空文件夹day4.zip,解决方式就是要加上一个 ‘-r’

代码语言:javascript代码运行次数:0运行复制
<code class="javascript">zip -r day4.zip day4</code>
Linux下的基本指令
Linux下的基本指令
Linux下的基本指令
Linux下的基本指令

22. tar指令:打包/解包,不打开它,直接看内容
Linux下的基本指令
Linux下的基本指令
Linux下的基本指令

23. uname指令
Linux下的基本指令

收尾杂谈代码语言:javascript代码运行次数:0运行复制
<code class="javascript">cnt=0; while [ $cnt -le 100 ]; do echo "hello $cnt"; let cnt++;done</code>
代码语言:javascript代码运行次数:0运行复制
<code class="javascript">cnt=0; while [ $cnt -le 100 ]; do touch code${cnt}.c; let cnt++;done</code>
Linux下的基本指令

完结撒花~

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

WorkBuddy
WorkBuddy

腾讯云推出的AI原生桌面智能体工作台

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
Sass和less的区别
Sass和less的区别

Sass和less的区别有语法差异、变量和混合器的定义方式、导入方式、运算符的支持、扩展性等。本专题为大家提供Sass和less相关的文章、下载、课程内容,供大家免费下载体验。

216

2023.10.12

磁盘配额是什么
磁盘配额是什么

磁盘配额是计算机中指定磁盘的储存限制,就是管理员可以为用户所能使用的磁盘空间进行配额限制,每一用户只能使用最大配额范围内的磁盘空间。php中文网为大家提供各种磁盘配额相关的内容,教程,供大家免费下载安装。

1564

2023.06.21

如何安装LINUX
如何安装LINUX

本站专题提供如何安装LINUX的相关教程文章,还有相关的下载、课程,大家可以免费体验。

716

2023.06.29

linux find
linux find

find是linux命令,它将档案系统内符合 expression 的档案列出来。可以指要档案的名称、类别、时间、大小、权限等不同资讯的组合,只有完全相符的才会被列出来。find根据下列规则判断 path 和 expression,在命令列上第一个 - ( ) , ! 之前的部分为 path,之后的是 expression。还有指DOS 命令 find,Excel 函数 find等。本站专题提供linux find相关教程文章,还有相关

300

2023.06.30

linux修改文件名
linux修改文件名

本专题为大家提供linux修改文件名相关的文章,这些文章可以帮助用户快速轻松地完成文件名的修改工作,大家可以免费体验。

801

2023.07.05

linux系统安装教程
linux系统安装教程

linux系统是一种可以免费使用,自由传播,多用户、多任务、多线程、多CPU的操作系统。本专题提供linux系统安装教程相关的文章,大家可以免费体验。

588

2023.07.06

linux查看文件夹大小
linux查看文件夹大小

Linux是一种自由和开放源码的类Unix操作系统,存在着许多不同的Linux版本,但它们都使用了Linux内核。Linux可安装在各种计算机硬件设备中,比如手机、平板电脑、路由器、视频游戏控制台、台式计算机、大型机和超级计算机。linux怎么查看文件夹大小呢?php中文网给大家带来了相关的教程以及文章,欢迎大家前来学习阅读。

570

2023.07.20

linux查看ip命令
linux查看ip命令

本专题为大家提供linux查看ip命令相关文章内容,感兴趣的朋友可以免费下载体验试试。

314

2023.07.20

TypeScript类型系统进阶与大型前端项目实践
TypeScript类型系统进阶与大型前端项目实践

本专题围绕 TypeScript 在大型前端项目中的应用展开,深入讲解类型系统设计与工程化开发方法。内容包括泛型与高级类型、类型推断机制、声明文件编写、模块化结构设计以及代码规范管理。通过真实项目案例分析,帮助开发者构建类型安全、结构清晰、易维护的前端工程体系,提高团队协作效率与代码质量。

26

2026.03.13

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
TypeScript 教程
TypeScript 教程

共19课时 | 3.4万人学习

C++教程
C++教程

共115课时 | 21.8万人学习

PHP新手语法线上课程教学
PHP新手语法线上课程教学

共13课时 | 1.0万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号