Linux下的基本指令

1. ls 指令

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

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


2. pwd指令


3. cd 指令

Linux下的基本指令

代码语言:JavaScript代码运行次数:0运行复制

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:/#
Linux下的基本指令
Linux下的基本指令

4. touch指令 代码语言:javascript代码运行次数:0运行复制

root@hcss-ecs-78b3:~# touch hello.txtroot@hcss-ecs-78b3:~# pwd/rootroot@hcss-ecs-78b3:~# lshello.txt

5. mkdir指令代码语言:javascript代码运行次数:0运行复制

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:~#

代码语言:javascript代码运行次数:0运行复制

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:~# 

代码语言:javascript代码运行次数:0运行复制

root@hcss-ecs-78b3:~# tree kianakiana0 directories, 0 filesroot@hcss-ecs-78b3:~# tree aa└── b    └── c2 directories, 0 filesroot@hcss-ecs-78b3:~# 

6. which指令 代码语言:javascript代码运行次数:0运行复制

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:~# 

7. alias指令

如:

给pwd命令取别名叫做kiana

代码语言:javascript代码运行次数:0运行复制

root@hcss-ecs-78b3:alias kiana=pwd

8. rm指令代码语言:javascript代码运行次数:0运行复制

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:

9. man指令代码语言:javascript代码运行次数:0运行复制

root@hcss-ecs-78b3:~#  man manroot@hcss-ecs-78b3:~#  man pwdroot@hcss-ecs-78b3:~#  man ll
Linux下的基本指令

10. cp指令代码语言:javascript代码运行次数:0运行复制

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:~# 

11. mv指令


理论杂谈

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

12. cat指令

Linux下的基本指令

重定向操作

Linux下的基本指令

13. more指令 代码语言:javascript代码运行次数:0运行复制

[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

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运行复制

zip -r day4.zip day4
Linux下的基本指令
Linux下的基本指令
Linux下的基本指令
Linux下的基本指令

22. tar指令:打包/解包,不打开它,直接看内容

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

23. uname指令

Linux下的基本指令

收尾杂谈代码语言:javascript代码运行次数:0运行复制

cnt=0; while [ $cnt -le 100 ]; do echo "hello $cnt"; let cnt++;done

代码语言:javascript代码运行次数:0运行复制

cnt=0; while [ $cnt -le 100 ]; do touch code${cnt}.c; let cnt++;done
Linux下的基本指令

完结撒花~

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享