• [体验官] linux进程树方式查看进程
    ps axjf:linux以进程树的方式查看进程root@ecs-385f:~# docker ps CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMESroot@ecs-385f:~# ps axjf |grep docker    1  1698  1698  1698 ?           -1 Ssl      0  42:55 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock 5374  5578  5577  5374 pts/0     5577 S+       0   0:00          \_ grep docker进程树会显示进程之间的关系。也可以使用pstree显示
  • [云享读书会] 【获奖公示】邀请好友参加云享读书会《Linux系统管理》,赢取好礼,活动正在进行中!
    【云享读书会《Linux系统管理》】已上线报名现已开启>>>>>>>点击此处了解详情当然我们一定不会只有学习课程这么简单我们准备了“带着好友一起学习,一起进步,一起“赢好礼”的超大惊喜01. 活动详情 奖励情况特别说明:经反复比对被邀请人信息和已经完成读书笔记相关同学的信息,最终确认没有人完成本次邀请任务,所以不进行相关码豆奖励,望周知~如有疑问可以和小助手联系咨询~邀好友,学课程,赢大礼,添码力!邀请好友一起报名本期云享读书会,就有机会得到好礼!一起学习,共享进步!-邀请活动时间:即日起-2021年5月10日课程开始前截止 -邀好友,赢奖励:邀友报名课程, 进入累计邀请人数排行榜,可获得码豆奖励:-tips:如何邀请好友?步骤一:邀请人成功报名云享读书会《Linux系统管理》活动后(点击去报名),点击图示中的“分享有礼”按钮 步骤二:通过生成的专属链接/邀请二维码,即可邀请好友报名活动有效邀请的定义(邀请的好友):所有被邀请人员需满足以下条件才可算成功邀请,纳入奖励数量:拥有华为云账号,并完成实名认证,且需至少完成一次读书笔记不要忘记的PS:参与邀请活动需自己先实名数量和名额都很有限,先到先得!获得的码豆可在华为云码豆会员中心进行奖品兑换哦!点击查看码豆会员中心(https://www.huaweicloud.com/devcloud/bonus.html) 说明:1) 被邀请的好友需要进行课程报名与学习,且需至少完成一次读书笔记;2) 本次邀请活动为云享读书《Linux系统管理》招募期活动~活动结果会在全部活动结束后的20个工作日内结算并发布,发放时间根据实际情况动态调整,如有延期敬请见谅;3) 活动结束后将统计最终排名及获奖结果,如核查发现存在邀请账号为机器注册账号或无效账号将取消此部分邀请数据。如出现邀请人数并列的情况,按最先达成人数的时间优先排名。4) 奖励标准优先判断奖励限制是否达成,同一奖励标准内再计算排名,并按照实际达到的邀请人数发放对应奖励。 02. 活动·         专属链接/二维码禁止在本期课程学习群内露出,如发现群内露出将取消活动邀请资格·         参与活动需获取专属链接,专属链接需大家按照上述活动步骤自行获取,然后在本帖下方回复您的链接。·         活动结束后20个工作日内公布详细结果,公示期5个工作日,公示期结束开始兑奖·         请勿使用论坛私聊或类似功能骚扰其它华为云用户,违者直接取消活动资格·         如遇奖品库存不足会进行同价位奖品调换,介意者谨慎参与活动·         如发现使用他人身份恶意重复报名活动,或采取机器批量注册/虚拟手机号注册/购买账号等恶意注册行为进行违规行为,华为云AI社区有权取消相应人员的活动参与权利,并收回相关奖励·         本次活动所有回帖内容需满足华为云论坛发帖规范:https://bbs.huaweicloud.com/forum/thread-23077-1-1.html
  • [应用开发] 通过Linux网卡转发配置MDC连接外网,无法ping通www.huawei.com
    问题背景:通过删除网关的方式,在ubuntu16.04PC机上上实现wifi上外网与有线网连接MDC300的网口(不是MTB的网口)同时进行,可通过ssh远程连接mdc,如下图所示外网配置方案选择快速入门指南中的Linux网卡转发方案已完成步骤:在PC机的Linux中配置端口转发在Linux系统中设置SNAT转发配置MDC300的DNS服务器其中DNS服务器的ip地址配置为PC机所连接wifi的DNS服务器ip地址将MDC的默认路由配置为PC机连接内网的ip地址如图,将Gateway配置为192.1698.1.1115验证MDC是否连上外网尝试ping同设置的DNS服务器或者8.8.8.8,发现无法ping通请问遇到这种情况应该怎么解决,上述配置过程是否有操作错误?
  • [交流分享] linux stat 查看文件和目录的属性
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux stat 查看文件的属性 #### stat查看文件 ``` bash $ stat sshd_config File: sshd_config Size: 5202 Blocks: 16 IO Block: 4096 regular file Device: fd01h/64769d Inode: 2097157 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2021-03-26 18:05:23.439945941 +0800 Modify: 2021-03-16 12:41:38.511007121 +0800 Change: 2021-03-16 12:41:38.511007121 +0800 Birth: 2020-05-18 13:20:59.117400674 +0800 ``` #### stat查看目录 ``` bash $ ls -dhl ssh drwxr-xr-x. 3 root root 4.0K Mar 16 12:41 ssh ``` ``` bash $ stat ssh File: ssh Size: 4096 Blocks: 8 IO Block: 4096 directory Device: fd01h/64769d Inode: 2097631 Links: 3 Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2021-03-26 18:04:27.506810207 +0800 Modify: 2021-03-16 12:41:37.932007121 +0800 Change: 2021-03-16 12:41:37.932007121 +0800 Birth: 2020-05-18 13:13:59.623000000 +0800 ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux 查看文本文件的内容
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux 查看文本文件的内容 #### cat 查看内容+显示行号(适用于查看内容较少的文本) ``` bash $ cat -n sshd_config 1 # $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $ 2 3 # This is the sshd server system-wide configuration file. See 4 # sshd_config(5) for more information. 5 6 # This sshd was compiled with PATH=/usr/local/bin:/usr/bin 7 8 # The strategy used for options in the default sshd_config shipped with 9 # OpenSSH is to specify options with their default value where 10 # possible, but leave them commented. Uncommented options override the 11 # default value. 12 13 # If you want to change the port on a SELinux system, you have to tell 14 # SELinux about this change. 15 # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER 16 # 17 #Port 22 ...... ``` #### more 翻阅查看文本内容,显示5行 ``` bash $ more -5 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. --More--(3%) ``` #### head 查看文本的前5行 ``` bash $ head -n 5 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. ``` #### tail 查看文本的最后10行 ``` bash $ tail -10 sshd_config Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com ClientAliveCountMax 0 Banner /etc/issue.net MACs hmac-sha2-512,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-256-etm@openssh.com,hmac-sha1,hmac-sha1-etm@openssh.com StrictModes yes AllowTcpForwarding no AllowAgentForwarding no GatewayPorts no PermitTunnel no KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256 ``` #### tail 实时刷新 ``` bash # tail -f -n 2 messages-20210326 Mar 26 03:21:11 localhost systemd[1]: dnf-makecache.service: Succeeded. Mar 26 03:21:11 localhost systemd[1]: Started dnf makecache. ``` #### wc 查看文本的行数 word数 byte数 ``` bash $ wc -lwc sshd_config 170 607 5202 sshd_config $ wc -l sshd_config 170 sshd_config $ wc -w sshd_config 607 sshd_config $ wc -c sshd_config 5202 sshd_config ```   ### 帮助文档(部分) ``` bash $ 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: <https://www.gnu.org/software/coreutils/> Full documentation <https://www.gnu.org/software/coreutils/cat> or available locally via: info '(coreutils) cat invocation' ``` ``` bash $ more --help Usage: more [options] <file>... 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 -<number> the number of lines per screenful +<number> display file beginning from line number +/<string> display file beginning from search string match --help display this help -V, --version display version For more details see more(1). ``` ``` bash $ wc --help Usage: wc [OPTION]... [FILE]... or: wc [OPTION]... --files0-from=F Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified. A word is a non-zero-length sequence of characters delimited by white space. With no FILE, or when FILE is -, read standard input. The options below may be used to select which counts are printed, always in the following order: newline, word, character, byte, maximum line length. -c, --bytes print the byte counts -m, --chars print the character counts -l, --lines print the newline counts --files0-from=F read input from the files specified by NUL-terminated names in file F; If F is - then read names from standard input -L, --max-line-length print the maximum display width -w, --words print the word counts --help display this help and exit --version output version information and exit GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Full documentation <https://www.gnu.org/software/coreutils/wc> or available locally via: info '(coreutils) wc invocation' ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux pwd cd 查看与切换工作目录
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux ls cd 查看与切换工作目录 #### pwd 查看当前的工作目录 ``` bash $ pwd /home/vhjwYUS ``` #### cd 切换工作目录 ``` bash $ cd /etc/ssh/ $ pwd /etc/ssh $ cd ~ $ pwd /home/vhjwYUS ``` #### ls 查看目录的属性 ``` bash $ ls -dl /etc/ssh drwxr-xr-x. 3 root root 4096 Mar 16 12:41 /etc/ssh ```   ### 帮助文档(部分) ``` bash $ pwd --help pwd: pwd [-LP] Print the name of the current working directory. Options: -L print the value of $PWD if it names the current working directory -P print the physical directory, without any symbolic links By default, `pwd' behaves as if `-L' were specified. Exit Status: Returns 0 unless an invalid option is given or the current directory cannot be read. ``` ``` bash $ help cd cd: cd [-L|[-P [-e]] [-@]] [dir] Change the shell working directory. Change the current directory to DIR. The default DIR is the value of the HOME shell variable. The variable CDPATH defines the search path for the directory containing DIR. Alternative directory names in CDPATH are separated by a colon (:). A null directory name is the same as the current directory. If DIR begins with a slash (/), then CDPATH is not used. If the directory is not found, and the shell option `cdable_vars' is set, the word is assumed to be a variable name. If that variable has a value, its value is used for DIR. Options: -L force symbolic links to be followed: resolve symbolic links in DIR after processing instances of `..' ...... ``` ``` bash $ ls --help Usage: ls [OPTION]... [FILE]... List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print C-style escapes for nongraphic characters --block-size=SIZE with -l, scale sizes by SIZE when printing them; e.g., '--block-size=M'; see SIZE format below -B, --ignore-backups do not list implied entries ending with ~ -c with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name; otherwise: sort by ctime, newest first ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux history 查看历史命令
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux history 查看历史命令 ``` bash $ history 1 cd .. 2 cd . 3 cd . 4 ps 5 ps aux 6 ps aux 7 ps aux 8 ps auxf ...... ``` #### 历史命令存储在.bash_history ``` bash $ cat ~/.bash_history #1616666205 cd .. #1616666207 cd . #1616666210 cd . #1616666213 ps #1616666216 ps aux #1616666388 ps aux #1616666409 ...... ```   ### 帮助文档(部分) ``` bash $ history --help history: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...] Display or manipulate the history list. Display the history list with line numbers, prefixing each modified entry with a `*'. An argument of N lists only the last N entries. Options: -c clear the history list by deleting all of the entries -d offset delete the history entry at position OFFSET. Negative offsets count back from the end of the history list -a append history lines from this session to the history file -n read all history lines not already read from the history file and append them to the history list -r read the history file and append the contents to the history list -w write the current history to the history file -p perform history expansion on each ARG and display the result without storing it in the history list -s append the ARGs to the history list as a single entry If FILENAME is given, it is used as the history file. Otherwise, if HISTFILE has a value, that is used, else ~/.bash_history. If the HISTTIMEFORMAT variable is set and not null, its value is used as a format string for strftime(3) to print the time stamp associated with each displayed history entry. No time stamps are printed otherwise. Exit Status: Returns success unless an invalid option is given or an error occurs. ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux uname 查看系统内核和系统版本信息
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux uname 查看系统内核和系统版本信息 ``` bash $ uname --all Linux ecs-openeuler 4.19.90-2003.4.0.0036.oe1.x86_64 #1 SMP Mon Mar 23 19:10:41 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux $ uname --kernel-name Linux $ uname --nodename ecs-openeuler $ uname --kernel-release 4.19.90-2003.4.0.0036.oe1.x86_64 $ uname --machine x86_64 $ uname --processor x86_64 $ uname --hardware-platform x86_64 $ uname --operating-system GNU/Linux $ uname --version uname (GNU coreutils) 8.31 Copyright (C) 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later /gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David MacKenzie. ```   ### 帮助文档(部分) ``` bash $ uname --help Usage: uname [OPTION]... Print certain system information. With no OPTION, same as -s. -a, --all print all information, in the following order, except omit -p and -i if unknown: -s, --kernel-name print the kernel name -n, --nodename print the network node hostname -r, --kernel-release print the kernel release -v, --kernel-version print the kernel version -m, --machine print the machine hardware name -p, --processor print the processor type (non-portable) -i, --hardware-platform print the hardware platform (non-portable) -o, --operating-system print the operating system --help display this help and exit --version output version information and exit GNU coreutils online help: /www.gnu.org/software/coreutils/> Full documentation /www.gnu.org/software/coreutils/uname> or available locally via: info '(coreutils) uname invocation' ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux pidof 查看指定服务进程的pid值
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux pidof 查看指定服务进程的pid值 ``` bash $ pidof sshd 507876 507874 507873 507854 505477 505452 3524 ``` ``` bash $ ps aux | grep sshd root 3524 0.0 0.4 13448 7268 ? Ss Mar16 0:00 /usr/sbin/sshd -D root 505452 0.0 0.5 15100 8584 ? Ss 17:16 0:00 sshd: root [priv] root 505477 0.0 0.3 15100 5156 ? S 17:16 0:00 sshd: root root 507854 0.0 0.5 15100 8404 ? Ss 17:57 0:00 sshd: vhjwYUS [priv] vhjwYUS 507873 0.0 0.3 15100 4992 ? S 17:58 0:00 sshd: vhjwYUS root 507874 0.0 0.5 15096 9008 ? Ss 17:58 0:00 sshd: vhjwYUS [priv] vhjwYUS 507876 0.0 0.3 15096 4972 ? S 17:58 0:00 sshd: vhjwYUS@pts/0 vhjwYUS 509061 0.0 0.0 213308 900 pts/0 S+ 18:18 0:00 grep --color=auto sshd ```   ### 帮助文档(部分) ``` bash $ pidof --help Usage: pidof [options] [program [...]] Options: -s, --single-shot return one PID only -c, --check-root omit processes with different root -x also find shells running the named scripts -o, --omit-pid omit processes with PID -S, --separator SEP use SEP as separator put between PIDs -h, --help display this help and exit -V, --version output version information and exit For more details see pidof(1). ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux ps 查看系统中的进程状态
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux ps 查看系统中的进程状态 #### BSD的格式 ps aux ``` bash $ ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.7 106296 11532 ? Ss 2313 0:06 /usr/lib/systemd/systemd --switched-root --syst root 2 0.0 0.0 0 0 ? S 2313 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? I 2313 0:00 [rcu_gp] root 4 0.0 0.0 0 0 ? I 2313 0:00 [rcu_par_gp] root 6 0.0 0.0 0 0 ? I 2313 0:00 [kworker/0:0H-kblockd] root 7 0.0 0.0 0 0 ? I 2313 0:02 [kworker/u4:0-events_unbound] ``` #### BSD的格式+树形结构展示 ps auxf ``` bash $ ps auxf ...... USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2 0.0 0.0 0 0 ? S 2313 0:00 [kthreadd] root 47 0.0 0.0 0 0 ? S Mar16 0:00 \_ [kswapd0] root 98 0.0 0.0 0 0 ? I Mar16 0:00 \_ [kthrotld] root 99 0.0 0.0 0 0 ? I Mar16 0:00 \_ [acpi_thermal_pm] ...... ```   #### 标准格式 ps -ef ``` bash $ ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 2313 ? 00:00:06 /usr/lib/systemd/systemd --switched-root --system --deserializ root 2 0 0 2313 ? 00:00:00 [kthreadd] root 3 2 0 2313 ? 00:00:00 [rcu_gp] root 4 2 0 2313 ? 00:00:00 [rcu_par_gp] ```   ### 帮助文档(部分) ``` bash # ps --help Usage: ps [options] Try 'ps --help ' or 'ps --help ' for additional help text. For more details see ps(1). ``` ``` bash # ps --help a Usage: ps [options] Basic options: -A, -e all processes -a all with tty, except session leaders a all with tty, including other users -d all except session leaders -N, --deselect negate selection r only running processes T all processes on this terminal x processes without controlling ttys Selection by list: -C command name -G, --Group real group id or name -g, --group session or effective group name -p, p, --pid process id ...... ```   ### 参考资料 * https://blog.csdn.net/a12345555555/article/details/72770789 * https://blog.csdn.net/ruibin_cao/article/details/84660224   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux date 按照指定格式来查看时间
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux date 按照指定格式来查看时间 ``` bash date "+%Y%m%d%H%M%S" 20210325173020 ``` ``` bash date "+%Y%m%d-%H%M%S" 20210325-173110 ```   ### 帮助文档(部分) ``` bash # date --help Usage: date [OPTION]... [+FORMAT] or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] Display the current time in the given FORMAT, or set the system date. Mandatory arguments to long options are mandatory for short options too. -d, --date=STRING display time described by STRING, not 'now' --debug annotate the parsed date, and warn about questionable usage to stderr -f, --file=DATEFILE like --date; once for each line of DATEFILE -I[FMT], --iso-8601[=FMT] output date/time in ISO 8601 format. FMT='date' for date only (the default), 'hours', 'minutes', 'seconds', or 'ns' for date and time to the indicated precision. Example: 2006-08-14T02:34:56-06:00 -R, --rfc-email output date and time in RFC 5322 format. Example: Mon, 14 Aug 2006 02:34:56 -0600 --rfc-3339=FMT output date/time in RFC 3339 format. FMT='date', 'seconds', or 'ns' for date and time to the indicated precision. Example: 2006-08-14 02:34:56-06:00 -r, --reference=FILE display the last modification time of FILE -s, --set=STRING set time described by STRING -u, --utc, --universal print or set Coordinated Universal Time (UTC) --help display this help and exit --version output version information and exit FORMAT controls the output. Interpreted sequences are: %% a literal % %a locale's abbreviated weekday name (e.g., Sun) %A locale's full weekday name (e.g., Sunday) %b locale's abbreviated month name (e.g., Jan) %B locale's full month name (e.g., January) %c locale's date and time (e.g., Thu Mar 3 23:05:25 2005) %C century; like %Y, except omit last two digits (e.g., 20) %d day of month (e.g., 01) ...... ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux systemctl 查看服务状态和开机启动
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux systemctl 查看服务状态和开机启动 #### 查看服务状态 ``` bash # systemctl status rsyslog.service ● rsyslog.service - System Logging Service Loaded: loaded (/usr/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2021-03-16 12:41:33 CST; 1 weeks 1 days ago Docs: man:rsyslogd(8) https://www.rsyslog.com/doc/ Main PID: 720 (rsyslogd) Tasks: 3 Memory: 8.3M CGroup: /system.slice/rsyslog.service └─720 /usr/sbin/rsyslogd -n -iNONE Mar 16 12:41:33 localhost.localdomain systemd[1]: Starting System Logging Service... Mar 16 12:41:33 localhost.localdomain rsyslogd[720]: [origin software="rsyslogd" swVersion="8.1907.0" x-pid="720" x-info="https://> Mar 16 12:41:33 localhost.localdomain rsyslogd[720]: imjournal: No statefile exists, /run/log/imjournal.state will be created (ign> Mar 16 12:41:33 localhost.localdomain systemd[1]: Started System Logging Service. Mar 23 18:12:05 ecs-openeuler rsyslogd[720]: imjournal: journal reloaded... [v8.1907.0 try https://www.rsyslog.com/e/0 ] ``` #### 查看是否为开机启动 ``` bash # systemctl is-enabled rsyslog.service enabled ```   ### 帮助文档(部分) ``` bash # systemctl --help systemctl [OPTIONS...] {COMMAND} ... Query or send control commands to the systemd manager. -h --help Show this help --version Show package version --system Connect to system manager --user Connect to user service manager -H --host=[USER@]HOST Operate on remote host -M --machine=CONTAINER Operate on local container -t --type=TYPE List units of a particular type --state=STATE List units with particular LOAD or SUB or ACTIVE state --failed Shorcut for --state=failed -p --property=NAME Show only properties by this name -a --all Show all properties/all units currently in memory, including dead/empty ones. To list all units installed on the system, use the 'list-unit-files' command instead. ...... ```   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [交流分享] linux 查看系统的默认启动目标target
    ### ECS信息 * 规格:通用入门型 | t6.large.1 | 2vCPUs | 2GB * 镜像:openEuler 20.03 64bit | 公共镜像   ### linux 查看系统的默认启动目标 ``` bash # systemctl get-default multi-user.target ``` ``` bash # ls /etc/systemd/system -l | grep default lrwxrwxrwx. 1 root root 37 May 18 2020 default.target -> /lib/systemd/system/multi-user.target ``` ### 查看/lib/systemd/system中的target文件 ``` bash # ls /lib/systemd/system -l | grep .target -rw-r--r--. 1 root root 919 Sep 3 2019 basic.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 basic.target.wants -rw-r--r--. 1 root root 419 Sep 3 2019 bluetooth.target -rw-r--r--. 1 root root 455 Sep 3 2019 boot-complete.target -rw-rw-r-- 1 root root 536 Aug 18 2018 cloud-config.target -rw-rw-r-- 1 root root 255 Aug 18 2018 cloud-init.target -rw-r--r--. 1 root root 465 Sep 3 2019 cryptsetup-pre.target -rw-r--r--. 1 root root 412 Sep 3 2019 cryptsetup.target lrwxrwxrwx. 1 root root 13 Mar 24 2020 ctrl-alt-del.target -> reboot.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 dbus.target.wants lrwxrwxrwx. 1 root root 16 Mar 24 2020 default.target -> graphical.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 default.target.wants -rw-r--r--. 1 root root 471 Sep 3 2019 emergency.target -rw-r--r--. 1 root root 541 Sep 3 2019 exit.target -rw-r--r--. 1 root root 480 Sep 3 2019 final.target -rw-r--r--. 1 root root 506 Sep 3 2019 getty-pre.target -rw-r--r--. 1 root root 500 Sep 3 2019 getty.target -rw-r--r--. 1 root root 598 Sep 3 2019 graphical.target drwxr-xr-x. 2 root root 4096 May 18 2020 graphical.target.wants -rw-r--r--. 1 root root 527 Sep 3 2019 halt.target -rw-r--r--. 1 root root 509 Sep 3 2019 hibernate.target -rw-r--r--. 1 root root 530 Sep 3 2019 hybrid-sleep.target -rw-r--r--. 1 root root 593 Sep 3 2019 initrd-fs.target -rw-r--r--. 1 root root 561 Sep 3 2019 initrd-root-device.target -rw-r--r--. 1 root root 566 Sep 3 2019 initrd-root-fs.target -rw-r--r--. 1 root root 777 Sep 3 2019 initrd-switch-root.target -rw-r--r--. 1 root root 763 Sep 3 2019 initrd.target drwxr-xr-x. 2 root root 4096 May 18 2020 initrd.target.wants -rw-r--r--. 1 root root 173 Mar 24 2020 iprutils.target -rw-r--r--. 1 root root 541 Sep 3 2019 kexec.target -rw-r--r--. 1 root root 435 Sep 3 2019 local-fs-pre.target -rw-r--r--. 1 root root 547 Sep 3 2019 local-fs.target drwxr-xr-x. 2 root root 4096 May 18 2020 local-fs.target.wants -rw-r--r--. 1 root root 532 Sep 3 2019 multi-user.target drwxr-xr-x. 2 root root 4096 May 18 2020 multi-user.target.wants -rw-r--r--. 1 root root 505 Sep 3 2019 network-online.target -rw-r--r--. 1 root root 502 Sep 3 2019 network-pre.target -rw-r--r--. 1 root root 521 Sep 3 2019 network.target -rw-r--r--. 1 root root 554 Sep 3 2019 nss-lookup.target -rw-r--r--. 1 root root 513 Sep 3 2019 nss-user-lookup.target -rw-r--r--. 1 root root 394 Sep 3 2019 paths.target -rw-r--r--. 1 root root 592 Sep 3 2019 poweroff.target -rw-r--r--. 1 root root 417 Sep 3 2019 printer.target -rw-r--r--. 1 root root 583 Sep 3 2019 reboot.target -rw-r--r--. 1 root root 549 Sep 3 2019 remote-cryptsetup.target -rw-r--r--. 1 root root 436 Sep 3 2019 remote-fs-pre.target -rw-r--r--. 1 root root 522 Sep 3 2019 remote-fs.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 remote-fs.target.wants -rw-r--r--. 1 root root 492 Sep 3 2019 rescue.target drwxr-xr-x. 2 root root 4096 May 18 2020 rescue.target.wants -rw-r--r--. 1 root root 540 Sep 3 2019 rpcbind.target lrwxrwxrwx. 1 root root 15 Mar 24 2020 runlevel0.target -> poweroff.target lrwxrwxrwx. 1 root root 13 Mar 24 2020 runlevel1.target -> rescue.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 runlevel1.target.wants lrwxrwxrwx. 1 root root 17 Mar 24 2020 runlevel2.target -> multi-user.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 runlevel2.target.wants lrwxrwxrwx. 1 root root 17 Mar 24 2020 runlevel3.target -> multi-user.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 runlevel3.target.wants lrwxrwxrwx. 1 root root 17 Mar 24 2020 runlevel4.target -> multi-user.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 runlevel4.target.wants lrwxrwxrwx. 1 root root 16 Mar 24 2020 runlevel5.target -> graphical.target drwxr-xr-x. 2 root root 4096 Mar 24 2020 runlevel5.target.wants lrwxrwxrwx. 1 root root 13 Mar 24 2020 runlevel6.target -> reboot.target -rw-r--r--. 1 root root 230 Oct 29 2019 selinux-autorelabel.target -rw-r--r--. 1 root root 442 Sep 3 2019 shutdown.target -rw-r--r--. 1 root root 402 Sep 3 2019 sigpwr.target -rw-r--r--. 1 root root 460 Sep 3 2019 sleep.target -rw-r--r--. 1 root root 449 Sep 3 2019 slices.target -rw-r--r--. 1 root root 420 Sep 3 2019 smartcard.target -rw-r--r--. 1 root root 396 Sep 3 2019 sockets.target drwxr-xr-x. 2 root root 4096 May 18 2020 sockets.target.wants -rw-r--r--. 1 root root 420 Sep 3 2019 sound.target -rw-r--r--. 1 root root 123 Mar 24 2020 sshd-keygen.target -rw-r--r--. 1 root root 503 Sep 3 2019 suspend.target -rw-r--r--. 1 root root 577 Sep 3 2019 suspend-then-hibernate.target -rw-r--r--. 1 root root 393 Sep 3 2019 swap.target -rw-r--r--. 1 root root 558 Sep 3 2019 sysinit.target drwxr-xr-x. 2 root root 4096 May 18 2020 sysinit.target.wants drwxr-xr-x. 2 root root 4096 Mar 24 2020 syslog.target.wants -rw-r--r--. 1 root root 543 Sep 3 2019 system-update-pre.target -rw-r--r--. 1 root root 617 Sep 3 2019 system-update.target drwxr-xr-x. 2 root root 4096 May 18 2020 system-update.target.wants -rw-r--r--. 1 root root 445 Sep 3 2019 timers.target drwxr-xr-x. 2 root root 4096 May 18 2020 timers.target.wants -rw-r--r--. 1 root root 426 Sep 3 2019 time-set.target -rw-r--r--. 1 root root 479 Sep 3 2019 time-sync.target -rw-r--r--. 1 root root 457 Sep 3 2019 umount.target ```   ### 参考资料 * https://blog.csdn.net/weixin_46654114/article/details/107126144 * https://blog.csdn.net/sinat_36888624/article/details/78544084   ### 学习资料 * openEuler-官网 openeuler.org/zh * openEuler-B站 space.bilibili.com/527064077 * openEuler-慕课 openeuler.org/zh/learn/mooc * openEuler-文档 openeuler.org/zh/documentation   欢迎各位同学来讨论~!
  • [赋能学习] linux环境python3连接安全集群HDFS
    本文借鉴 https://blog.csdn.net/u012133034/article/details/100704082 实现说明:使用 hdfs 模块连接 webhdfs 接口实现1 环境系统:CentOS Linux release 7.6.1810 (Core)  3.10.0-957.el7.x86_64python编译器:Python 3.7.8  FusionInsight HD 版本:6.5.1 或者 8.0.2,其中dfs.http.policy配置为 HTTP_AND_HTTPS说明:(1)linux环境安装python3可参考 https://bbs.huaweicloud.com/forum/forum.php?mod=viewthread&tid=936822 步骤2.1 安装python依赖(1)因我的测试环境未连互联网,所有的依赖包是通过外网下载后上传到节点安装的,最终安装的python的依赖包如下:安装过程中使用的包:说明:(1)安装 cryptography 使用的是 cryptography-3.4.6-cp36-abi3-manylinux2010_x86_64.whl ,不要使用其tar.gz包来安装,否则需要依赖的东西太多,安装更麻烦(2)安装gssapi的时候,不能执行FI客户端的source,建议重新开个ssh终端来安装2.2 创建测试脚本脚本内容如下,其中IP为主Namenode节点IP,端口固定25002,注意修改对应的认证用户名import osfrom hdfs.ext.kerberos import KerberosClientfrom krbcontext import krbcontextclass HDFSTest:    def __init__(self, host, port):        self.keytab_file = os.path.split(os.path.realpath(__file__))[0] + '/user.keytab'        print(self.keytab_file)        self.user = 'developuser'        self._connect(host, port)    def _connect(self, host, port, sso_ticket=None):        try:            hdfs_url = 'http://' + host + ':' + port            active_str = 'kinit -kt {0} {1}'.format(self.keytab_file, self.user)            # 激活当前kerberos用户认证,因为python缓存机制,切换用户,这个缓存不会自动切换,需要手动处理下            os.system(active_str)            with krbcontext(using_keytab=True, keytab_file=self.keytab_file, principal=self.user):                self.client = KerberosClient(hdfs_url)        except Exception as e:            raise e    def test(self):        print(self.client.list("/"))        print(self.client._list_status("/tmp").json()["FileStatuses"]["FileStatus"])if __name__ == '__main__':    host = '8.5.136.6'    port = '25002'    a = HDFSTest(host, port)    a.test()2.3 执行测试脚本(1)将脚本中指定用户的认证票据文件user.keytab文件放到和该脚本同一级目录内(2)执行source 客户端bigdata_env(3)执行测试脚本  python3 huaweiHDFSTest.py
  • [其他问题] 在flink开发指南中,flinkkafkaexaple打包在linux上运行报错,报的错是:提取元数据时,kafka超时已过期
    【功能模块】【操作步骤&问题现象】1、2、【截图信息】【日志信息】(可选,上传日志内容或者附件)报错信息如下: The program finished with the following exception:org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: org.apache.flink.client.program.ProgramInvocationException: Job failed (JobID: 9e3c78adac04823062e5328231935728)        at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:335)        at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:205)        at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:138)        at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:700)        at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:219)        at org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:932)        at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1005)        at java.security.AccessController.doPrivileged(Native Method)        at javax.security.auth.Subject.doAs(Subject.java:422)        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1737)        at org.apache.flink.runtime.security.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)        at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1005)Caused by: java.util.concurrent.ExecutionException: org.apache.flink.client.program.ProgramInvocationException: Job failed (JobID: 9e3c78adac04823062e5328231935728)        at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)        at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)        at org.apache.flink.streaming.api.environment.StreamContextEnvironment.execute(StreamContextEnvironment.java:83)        at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1651)        at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1633)        at com.huawei.bigdata.flink.examples.ReadFromKafka.main(ReadFromKafka.java:59)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:498)        at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:321)        ... 11 moreCaused by: org.apache.flink.client.program.ProgramInvocationException: Job failed (JobID: 9e3c78adac04823062e5328231935728)        at org.apache.flink.client.deployment.ClusterClientJobClientAdapter.lambda$null$6(ClusterClientJobClientAdapter.java:112)        at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616)        at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:591)        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)        at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)        at org.apache.flink.client.program.rest.RestClusterClient.lambda$pollResourceAsync$21(RestClusterClient.java:565)        at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)        at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)        at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)        at org.apache.flink.runtime.concurrent.FutureUtils.lambda$retryOperationWithDelay$8(FutureUtils.java:291)        at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)        at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)        at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:575)        at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:943)        at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:456)        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)        at java.lang.Thread.run(Thread.java:748)Caused by: org.apache.flink.runtime.client.JobExecutionException: Job execution failed.        at org.apache.flink.runtime.jobmaster.JobResult.toJobExecutionResult(JobResult.java:147)        at org.apache.flink.client.deployment.ClusterClientJobClientAdapter.lambda$null$6(ClusterClientJobClientAdapter.java:110)        ... 19 moreCaused by: org.apache.flink.runtime.JobException: Recovery is suppressed by NoRestartBackoffTimeStrategy        at org.apache.flink.runtime.executiongraph.failover.flip1.ExecutionFailureHandler.handleFailure(ExecutionFailureHandler.java:110)        at org.apache.flink.runtime.executiongraph.failover.flip1.ExecutionFailureHandler.getFailureHandlingResult(ExecutionFailureHandler.java:76)        at org.apache.flink.runtime.scheduler.DefaultScheduler.handleTaskFailure(DefaultScheduler.java:192)        at org.apache.flink.runtime.scheduler.DefaultScheduler.maybeHandleTaskFailure(DefaultScheduler.java:186)        at org.apache.flink.runtime.scheduler.DefaultScheduler.updateTaskExecutionStateInternal(DefaultScheduler.java:180)        at org.apache.flink.runtime.scheduler.SchedulerBase.updateTaskExecutionState(SchedulerBase.java:484)        at org.apache.flink.runtime.jobmaster.JobMaster.updateTaskExecutionState(JobMaster.java:380)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:498)        at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleRpcInvocation(AkkaRpcActor.java:279)        at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleRpcMessage(AkkaRpcActor.java:194)        at org.apache.flink.runtime.rpc.akka.FencedAkkaRpcActor.handleRpcMessage(FencedAkkaRpcActor.java:74)        at org.apache.flink.runtime.rpc.akka.AkkaRpcActor.handleMessage(AkkaRpcActor.java:152)        at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:26)        at akka.japi.pf.UnitCaseStatement.apply(CaseStatements.scala:21)        at scala.PartialFunction$class.applyOrElse(PartialFunction.scala:123)        at akka.japi.pf.UnitCaseStatement.applyOrElse(CaseStatements.scala:21)        at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170)        at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:171)        at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:171)        at akka.actor.Actor$class.aroundReceive(Actor.scala:517)        at akka.actor.AbstractActor.aroundReceive(AbstractActor.scala:225)        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:592)        at akka.actor.ActorCell.invoke(ActorCell.scala:561)        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:258)        at akka.dispatch.Mailbox.run(Mailbox.scala:225)        at akka.dispatch.Mailbox.exec(Mailbox.scala:235)        at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)        at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)        at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)        at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)Caused by: org.apache.kafka.common.errors.TimeoutException: Timeout expired while fetching topic metadata
总条数:1204 到第 页
上滑加载中