DESCRIPTION List information about the FILEs (the current directoryby default). Sort entries alphabetically ifnoneof -cftuvSUX nor --sort is specified.
Mandatory arguments tolong options are mandatory forshort options too.
-a, --all donot ignore entries starting with .
-A, --almost-all donot list implied . and ..
--author with -l, print the author ofeachfile
-b, --escape print C-style escapes for nongraphic characters
--block-size=SIZE scale sizes by SIZE before printing them; e.g., '--block-size=M' prints sizes in units of1,048,576 bytes; see SIZE format below
-B, --ignore-backups Manual page ls(1) line1 (press h for help or q to quit)
此时可以通过空格键或者回车键来向后翻屏或者翻页,可以使用b或者k向前查看。
查看关键词时可以使用:
/关键词 向后查找 n:下一个
?关键词 向前查找 N:前一个
可以通过q来退出。
ls后面还有一个(1),详细的解释可以参考《Linux 安装 man 帮助程序》
类似于whatis命令
man有个参数为-f,就是whatis的功能,比如:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$ man -f lscd file cat more less ls (1) - list directory contents ls (1p) - list directory contents cd (1) - bash built-in commands, see bash(1) cd (1p) - change the working directory cd (n) - Change working directory file (1) - determine file type file (1p) - determine file type file (n) - Manipulate file names and attributes cat (1) - concatenate files and print on the standard output cat (1p) - concatenate and print files more (1) - file perusal filter for crt viewing more (1p) - display files on a page-by-page basis less (1) - opposite of more less (3pm) - perl pragma to request less of something
与whatis命令完全一致
类似于apropos命令
man有个参数为-k,就是apropos的功能,比如:
1 2 3 4 5 6 7 8 9 10 11
$ man -k who at.allow (5) - determine who can submit jobs via at or batch at.deny (5) - determine who can submit jobs via at or batch btrfs-filesystem (8) - command group of btrfs that usually work on the whole filesystem docker-trust-signer (1) - Manage entities who can sign Docker images ipsec_newhostkey (8) - generate a new raw RSA authentication key for a host ipsec_showhostkey (8) - show host's authentication key w (1) - Show who is logged on and what they are doing. who (1) - show who is logged on who (1p) - display who is on the system whoami (1) - print effective userid
$ whatis lscd file cat more less ls (1) - list directory contents ls (1p) - list directory contents cd (1) - bash built-in commands, see bash(1) cd (1p) - change the working directory cd (n) - Change working directory file (1) - determine file type file (1p) - determine file type file (n) - Manipulate file names and attributes cat (1) - concatenate files and print on the standard output cat (1p) - concatenate and print files more (1) - file perusal filter for crt viewing more (1p) - display files on a page-by-page basis less (1) - opposite of more less (3pm) - perl pragma to request less of something
bno_plot (1) – generate interactive 3D plot of IO blocks and sizes gnuplot (1) – an interactive plotting program pbmtoplot (1) – convert a PBM image into a Unix 'plot' file
或许每个人的输出不同,这个主要取决于安装的软件包和索引的数据库。以上。
再来一个实例,这个应该大部分的都类似:
1 2 3 4 5 6 7 8 9 10 11 12
$ apropos who
at.allow (5) - determine who can submit jobs via at or batch at.deny (5) - determine who can submit jobs via at or batch btrfs-filesystem (8) - command group of btrfs that usually work on the whole filesystem docker-trust-signer (1) - Manage entities who can sign Docker images ipsec_newhostkey (8) - generate a new raw RSA authentication key for a host ipsec_showhostkey (8) - show host's authentication key w (1) - Show who is logged on and what they are doing. who (1) - show who is logged on who (1p) - display who is on the system whoami (1) - print effective userid
If the file is longer than the size of Terminal window then it will be not easy to read or view all the content of the file easily. But there is a tweak, you can use less with cat command. It will give user an ability to scroll forward and backward through the content of the files using PgUp and PgDn keys or Up and Down Arrow keys on the keyboard.
auditd 48/udp # Digital Audit Daemon la-maint 51/tcp # IMP Logical Address Maintenance la-maint 51/udp # IMP Logical Address Maintenance xns-time 52/tcp # XNS Time Protocol xns-time 52/udp # XNS Time Protocol xns-ch 54/tcp # XNS Clearinghouse xns-ch 54/udp # XNS Clearinghouse isi-gl 55/tcp # ISI Graphics Language isi-gl 55/udp # ISI Graphics Language xns-auth 56/tcp # XNS Authentication xns-auth 56/udp # XNS Authentication xns-mail 58/tcp # XNS Mail xns-mail 58/udp # XNS Mail ni-mail 61/tcp # NI MAIL ni-mail 61/udp # NI MAIL 5%
此时可以在左下角看到,有个百分比。
-N 显示行号
使用-N可以实现cat中-n的效果,显示行号
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
$ less -N /etc/services 1 # /etc/services: 2 # $Id: services,v 1.55 2013/04/14 ovasik Exp $ 3 # 4 # Network services, Internet style 5 # IANA services version: last updated 2013-04-10 6 # 7 # Note that it is presently the policy of IANA to assign a single well-known 8 # port number for both TCP and UDP; hence, most entries here have two entries 9 # even if the protocol doesn't support UDP operations. 10 # Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports 11 # are included, only the more common ones. 12 # 13 # The latest IANA port assignments can be gotten from 14 # http://www.iana.org/assignments/port-numbers 15 # The Well Known Ports are those from 0 through 1023. 16 # The Registered Ports are those from 1024 through 49151
# /etc/services: # $Id: services,v 1.55 2013/04/14 ovasik Exp $ # # Network services, Internet style # IANA services version: last updated 2013-04-10 # # Note that it is presently the policy of IANA to assign a single well-known # port number for both TCP and UDP; hence, most entries here have two entries # even if the protocol doesn't support UDP operations. # Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports # are included, only the more common ones. # # The latest IANA port assignments can be gotten from # http://www.iana.org/assignments/port-numbers # The Well Known Ports are those from 0 through 1023. # The Registered Ports are those from 1024 through 49151 # The Dynamic and/or Private Ports are those from 49152 through 65535 # # Each line describes one service, and is of the form: # # service-name port/protocol [aliases ...] [# comment]
tcpmux 1/tcp # TCP port service multiplexer tcpmux 1/udp # TCP port service multiplexer rje 5/tcp # Remote Job Entry rje 5/udp # Remote Job Entry echo 7/tcp
# Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports # are included, only the more common ones. # # The latest IANA port assignments can be gotten from # http://www.iana.org/assignments/port-numbers # The Well Known Ports are those from 0 through 1023. # The Registered Ports are those from 1024 through 49151 # The Dynamic and/or Private Ports are those from 49152 through 65535 # # Each line describes one service, and is of the form: # # service-name port/protocol [aliases ...] [# comment]
$ more -10 /etc/services # /etc/services: # $Id: services,v 1.55 2013/04/14 ovasik Exp $ # # Network services, Internet style # IANA services version: last updated 2013-04-10 # # Note that it is presently the policy of IANA to assign a single well-known # port number for both TCP and UDP; hence, most entries here have two entries # even if the protocol doesn't support UDP operations. # Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports
$ more +/number /etc/services # # Note that it is presently the policy of IANA to assign a single well-known # port number for both TCP and UDP; hence, most entries here have two entries # even if the protocol doesn't support UDP operations. # Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports # are included, only the more common ones. # # The latest IANA port assignments can be gotten from # http://www.iana.org/assignments/port-numbers # The Well Known Ports are those from 0 through 1023. # The Registered Ports are those from 1024 through 49151 # The Dynamic and/or Private Ports are those from 49152 through 65535 # # Each line describes one service, and is of the form: # # service-name port/protocol [aliases ...] [# comment]
$ ll -rw-rw-r--. 1 user user 85716 Apr 5 22:16 a.log -rw-rw-r--. 2 user user 85716 Apr 5 21:34 ah.log lrwxrwxrwx. 1 user user 5 Apr 5 22:21 as.log -> b.log -rw-rw-r--. 1 user user 85716 Apr 5 22:17 b.log
$ sudochown -c user1 a b c d changed ownership of "b" from user to user1 changed ownership of "c" from user to user1 changed ownership of "d" from user to user1
$ sudochown -v user1 a b c d changed ownership of "a" from user to user1 changed ownership of "b" from user to user1 changed ownership of "c" from user to user1 changed ownership of "d" from user to user1
$ ll * dir1: total 0 -rw-rw-r-- 1 user user 0 Jul 20 21:23 a -rw-rw-r-- 1 user user 0 Jul 20 21:23 b -rw-rw-r-- 1 user user 0 Jul 20 21:23 c -rw-rw-r-- 1 user user 0 Jul 20 21:23 d
dir2: total 0 -rw-rw-r-- 1 user user 0 Jul 20 21:29 a -rw-rw-r-- 1 user user 0 Jul 20 21:25 b -rw-rw-r-- 1 user user 0 Jul 20 21:29 c -rw-rw-r-- 1 user user 0 Jul 20 21:25 d -rw-rw-r-- 1 user user 0 Jul 20 21:25 e