linux cat more head tail 查看文本

网友投稿 497 2022-05-30

ECS信息

规格:2vCPUs | 4GiB | kc1.large.2

镜像:openEuler 20.03 64bit with ARM | 公共镜像

linux cat more Head tail 查看文本

# cat ssh_config -n 1 # $OpenBSD: ssh_config,v 1.33 2017/05/07 23:12:57 djm Exp $ 2 3 # This is the ssh client system-wide configuration file. See 4 # ssh_config(5) for more information. This file provides defaults for 5 # users, and the values can be changed in per-user configuration files 6 # or on the command line. 7 8 # Configuration data is parsed as follows: 9 # 1. command line options 10 # 2. user-specific file 11 # 3. system-wide file 12 # Any configuration value is only changed the first time it is set. 13 # Thus, host-specific definitions should be at the beginning of the 14 # configuration file, and defaults at the end. 15 16 # Site-wide defaults for some commonly used options. For a comprehensive 17 # list of available options, their meanings and defaults, please see the 18 # ssh_config(5) man page. 19 20 # Host * 21 # ForwardAgent no 22 # ForwardX11 no 23 # PasswordAuthentication yes 24 # HostbasedAuthentication no 25 # GSSAPIAuthentication no 26 # GSSAPIDelegateCredentials no 27 # GSSAPIKeyExchange no 28 # GSSAPITrustDNS no 29 # BatchMode no 30 # CheckHostIP yes 31 # AddressFamily any 32 # ConnectTimeout 0 33 # StrictHostKeyChecking ask 34 # IdentityFile ~/.ssh/id_rsa 35 # IdentityFile ~/.ssh/id_dsa 36 # IdentityFile ~/.ssh/id_ecdsa 37 # IdentityFile ~/.ssh/id_ed25519 38 # Port 22 39 # Protocol 2 40 # Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc 41 # MACs hmac-md5,hmac-sha1,umac-64@openssh.com 42 # EscapeChar ~ 43 # Tunnel no 44 # TunnelDevice any:any 45 # PermitLocalCommand no 46 # VisualHostKey no 47 # ProxyCommand ssh -q -W %h:%p gateway.example.com 48 # RekeyLimit 1G 1h 49 # 50 # To modify the system-wide ssh configuration, create a *.conf file under 51 # /etc/ssh/ssh_config.d/ which will be automatically included below 52 Include /etc/ssh/ssh_config.d/*.conf

more 可以滚动查看大文本

-5 的意思是 每屏显示5行

向下浏览是 z 或者 space

向上浏览是 b

linux cat more head tail 查看文本

# more -5 ssh_config # $OpenBSD: ssh_config,v 1.33 2017/05/07 23:12:57 djm Exp $ # This is the ssh client system-wide configuration file. See # ssh_config(5) for more information. This file provides defaults for # users, and the values can be changed in per-user configuration files --More--(15%)

# head -n 10 sshd_config # $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $ # This is the sshd server system-wide configuration file. See # sshd_config(5) for more information. # This sshd was compiled with PATH=/usr/local/bin:/usr/bin # The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the

# pwd /var/log # tail -f secure Oct 2 22:52:37 ecs-4eee sshd[21279]: pam_unix(sshd:session): session closed for user root Oct 2 22:52:37 ecs-4eee sshd[21344]: pam_unix(sshd:session): session closed for user root Oct 2 22:55:38 ecs-4eee sshd[21438]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 22:55:38 ecs-4eee sshd[21503]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 22:56:33 ecs-4eee sshd[21438]: pam_unix(sshd:session): session closed for user root Oct 2 22:56:33 ecs-4eee sshd[21503]: pam_unix(sshd:session): session closed for user root Oct 2 23:09:18 ecs-4eee sshd[21605]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 23:09:19 ecs-4eee sshd[21670]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 23:09:27 ecs-4eee sshd[21605]: pam_unix(sshd:session): session closed for user root Oct 2 23:09:27 ecs-4eee sshd[21670]: pam_unix(sshd:session): session closed for user root

此时再新建一个ssh会话,查看日志输出变化

# tail -f secure Oct 2 22:52:37 ecs-4eee sshd[21279]: pam_unix(sshd:session): session closed for user root Oct 2 22:52:37 ecs-4eee sshd[21344]: pam_unix(sshd:session): session closed for user root Oct 2 22:55:38 ecs-4eee sshd[21438]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 22:55:38 ecs-4eee sshd[21503]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 22:56:33 ecs-4eee sshd[21438]: pam_unix(sshd:session): session closed for user root Oct 2 22:56:33 ecs-4eee sshd[21503]: pam_unix(sshd:session): session closed for user root Oct 2 23:09:18 ecs-4eee sshd[21605]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 23:09:19 ecs-4eee sshd[21670]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 23:09:27 ecs-4eee sshd[21605]: pam_unix(sshd:session): session closed for user root Oct 2 23:09:27 ecs-4eee sshd[21670]: pam_unix(sshd:session): session closed for user root Oct 2 23:10:34 ecs-4eee sshd[21740]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 23:10:34 ecs-4eee sshd[21805]: pam_unix(sshd:session): session opened for user root by (uid=0)

关闭新建的ssh会话,查看日志输出变化

# tail -f secure Oct 2 22:52:37 ecs-4eee sshd[21279]: pam_unix(sshd:session): session closed for user root Oct 2 22:52:37 ecs-4eee sshd[21344]: pam_unix(sshd:session): session closed for user root Oct 2 22:55:38 ecs-4eee sshd[21438]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 22:55:38 ecs-4eee sshd[21503]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 22:56:33 ecs-4eee sshd[21438]: pam_unix(sshd:session): session closed for user root Oct 2 22:56:33 ecs-4eee sshd[21503]: pam_unix(sshd:session): session closed for user root Oct 2 23:09:18 ecs-4eee sshd[21605]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 23:09:19 ecs-4eee sshd[21670]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 23:09:27 ecs-4eee sshd[21605]: pam_unix(sshd:session): session closed for user root Oct 2 23:09:27 ecs-4eee sshd[21670]: pam_unix(sshd:session): session closed for user root Oct 2 23:10:34 ecs-4eee sshd[21740]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 23:10:34 ecs-4eee sshd[21805]: pam_unix(sshd:session): session opened for user root by (uid=0) Oct 2 23:10:53 ecs-4eee sshd[21740]: pam_unix(sshd:session): session closed for user root Oct 2 23:10:53 ecs-4eee sshd[21805]: pam_unix(sshd:session): session closed for user root

帮助文档(部分)

# cat --help Usage: cat [OPTION]... [FILE]... Concatenate FILE(s) to standard output. With no FILE, or when FILE is -, read standard input. -A, --show-all equivalent to -vET -b, --number-nonblank number nonempty output lines, overrides -n -e equivalent to -vE -E, --show-ends display $ at end of each line -n, --number number all output lines -s, --squeeze-blank suppress repeated empty output lines -t equivalent to -vT -T, --show-tabs display TAB characters as ^I -u (ignored) -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB --help display this help and exit --version output version information and exit Examples: cat f - g Output f's contents, then standard input, then g's contents. cat Copy standard input to standard output. GNU coreutils online help: Full documentation or available locally via: info '(coreutils) cat invocation'

# more --help Usage: more [options] ... A file perusal filter for CRT viewing. Options: -d display help instead of ringing bell -f count logical rather than screen lines -l suppress pause after form feed -c do not scroll, display text and clean line ends -p do not scroll, clean screen and display text -s squeeze multiple blank lines into one -u suppress underlining - the number of lines per screenful + display file beginning from line number +/ display file beginning from search string match --help display this help -V, --version display version For more details see more(1).

# head --help Usage: head [OPTION]... [FILE]... Print the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. -c, --bytes=[-]NUM print the first NUM bytes of each file; with the leading '-', print all but the last NUM bytes of each file -n, --lines=[-]NUM print the first NUM lines instead of the first 10; with the leading '-', print all but the last NUM lines of each file -q, --quiet, --silent never print headers giving file names -v, --verbose always print headers giving file names -z, --zero-terminated line delimiter is NUL, not newline --help display this help and exit --version output version information and exit NUM may have a multiplier suffix: b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024, GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y. Binary prefixes can be used, too: KiB=K, MiB=M, and so on. GNU coreutils online help: Full documentation or available locally via: info '(coreutils) head invocation'

# tail --help Usage: tail [OPTION]... [FILE]... Print the last 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. -c, --bytes=[+]NUM output the last NUM bytes; or use -c +NUM to output starting with byte NUM of each file -f, --follow[={name|descriptor}] output appended data as the file grows; an absent option argument means 'descriptor' -F same as --follow=name --retry -n, --lines=[+]NUM output the last NUM lines, instead of the last 10; or use -n +NUM to output starting with line NUM ......

学习资料

弹性云服务器 ECS

openEuler-官网

openEuler-B站

openEuler-慕课

openEuler-文档

鲲鹏社区

欢迎各位同学一起来交流学习心得^_^

Linux openEuler

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:细说机器人过程自动化(RPA)与AI人工智能
下一篇:LiteOS树莓派移植指南(二)
相关文章