1. ls 指令
-r 对目录反向排序 -t 以时间排序 -s 在l文件名后输出该文件的大小。(大小排序,如何找到目录下最大的文件) -r 列出所有子目录下的文件(递归) -1 一行只输出一个文件
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:/#
root@hcss-ecs-78b3:~# touch hello.txtroot@hcss-ecs-78b3:~# pwd/rootroot@hcss-ecs-78b3:~# lshello.txt
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:~#
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:~#
root@hcss-ecs-78b3:~# tree kianakiana0 directories, 0 filesroot@hcss-ecs-78b3:~# tree aa└── b └── c2 directories, 0 filesroot@hcss-ecs-78b3:~#
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:~#
如:
给pwd命令取别名叫做kiana
代码语言:javascript代码运行次数:0运行复制root@hcss-ecs-78b3:alias kiana=pwd
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:
root@hcss-ecs-78b3:~# man manroot@hcss-ecs-78b3:~# man pwdroot@hcss-ecs-78b3:~# man ll
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:~#
[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
如图,我们压缩了一个压缩包day4.zip,将这个压缩包传递给other,但是当我们打开之后发现day4.zip下的文件并没有一起传送过去,只传了一个空文件夹day4.zip,解决方式就是要加上一个 ‘-r’
代码语言:javascript代码运行次数:0运行复制zip -r day4.zip day4
cnt=0; while [ $cnt -le 100 ]; do echo "hello $cnt"; let cnt++;done
cnt=0; while [ $cnt -le 100 ]; do touch code${cnt}.c; let cnt++;done
完结撒花~
以上就是Linux下的基本指令的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号