linux netfs传递参数,学习Linux命令之:ls命令

本文详细介绍了Linux中的ls命令,包括其基本功能——列出目录内容,重点讲解了-a、-l和-d参数的使用,通过实例演示展示了如何以不同格式列出目录及其内容,适合Linux初学者和管理员参考。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ls命令是Linux最常用的命令之一。

ls解释:

ls - list directory contents 列出目录内容

ls描述:

按照字母排列的顺利列出文件的信息。

ls语法:

ls [OPTION]... [FILE]...   =      ls 选项 目录名

常用参数:

-a      列出目录里的全部文件(包括隐藏文件)

-l       以长格式列出文件

-d       目录条目列表,而不是内容,不要引用符号链接

常用的参数就以上三个。还有很参数,可在在linux 中用 man ls 查询。

例1:列出root目录下的目录

[[email protected] ~]# ls

aaa anaconda-ks.cfg bbb ccc install.log install.log.syslog

例2:以长格列出root目录下的目录

[[email protected] ~]# ls -l

drwxr-xr-x. 2 root root 4096 Apr 5 15:16 aaa

-rw-------. 1 root root 1096 Apr 5 10:08 anaconda-ks.cfg

drwxr-xr-x. 2 root root 4096 Apr 5 15:23 bbb

drwxr-xr-x. 3 root root 4096 Apr 5 15:25 ccc

-rw-r--r--. 1 root root 23571 Apr 5 10:08 install.log

-rw-r--r--. 1 root root 6240 Apr 5 10:04 install.log.syslog

例3:以长格列出root目录下的所有目录

[[email protected] ~]# ls -la

dr-xr-x---. 5 root root 4096 Apr 6 13:34 .

dr-xr-xr-x. 22 root root 4096 Apr 6 13:23 ..

drwxr-xr-x. 2 root root 4096 Apr 5 15:16 aaa

-rw-------. 1 root root 1096 Apr 5 10:08 anaconda-ks.cfg

-rw-------. 1 root root 1339 Apr 6 13:30 .bash_history

-rw-r--r--. 1 root root 18 May 20 2009 .bash_logout

-rw-r--r--. 1 root root 176 May 20 2009 .bash_profile

-rw-r--r--. 1 root root 176 Sep 23 2004 .bashrc

drwxr-xr-x. 2 root root 4096 Apr 5 15:23 bbb

drwxr-xr-x. 3 root root 4096 Apr 5 15:25 ccc

-rw-r--r--. 1 root root 100 Sep 23 2004 .cshrc

-rw-r--r--. 1 root root 23571 Apr 5 10:08 install.log

-rw-r--r--. 1 root root 6240 Apr 5 10:04 install.log.syslog

-rw-r--r--. 1 root root 129 Dec 4 2004 .tcshrc

例4:列出/etc/init.d 目录中的文件

[[email protected] ~]# ls /etc/init.d

abrt-ccpp crond killall nfs-rdma restorecond svnserve

abrtd functions lvm2-lvmetad ntpd rngd sysstat

abrt-oops haldaemon lvm2-monitor ntpdate rsyslog udev-post

acpid halt mdmonitor postfix sandbox

atd ip6tables messagebus psacct saslauthd

auditd iptables netconsole quota_nld single

blk-availability irqbalance netfs rdisc smartd

cpuspeed kdump network rdma sshd

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值