一、将/etc/issue文件中的内容转换为大写后保存至/tmp/issue.out文件中
[root@centos7 ~]#cat /etc/issue | tr [:lower:] [:upper:] > /tmp/issue.out
[root@centos7 ~]#cat /tmp/issue.out
\S
KERNEL \R ON AN \M
TTY: /L
HOSTNAME: /N
TIME: /T
二、将当前系统登录用户的信息转换为大写后保存至/tmp/who.out文件中
[root@centos7 ~]#who | tr [:lower:] [:upper:] > /tmp/who.out
[root@centos7 ~]#cat /tmp/who.out
ROOT :0 2019-10-23 01:07 (:0)
ROOT PTS/0 2019-10-23 01:11 (:0)
ROOT PTS/1 2019-10-23 01:11 (192.168.30.1)
三、一个linux用户给root发邮件,要求邮件标题为”help”,邮件正文如下:
Hello, I am 用户名.
The system version is here.
Please help me to check it, thanks!
操作系统版本信息
[root@centos6 ~]#mail -s 'help' root <<EOF
> Hello, i am $USER.
> The system version is here.
> Please help me to check it, thanks!
> `OS version is lsb_release -a`
> EOF
You have mail in /var/spool/mail/root

这篇博客涵盖了Linux中的多个命令操作,包括:1) 将/etc/issue文件内容转为大写并保存;2) 登录用户信息转换为大写存储;3) 用户向root发送带有特定标题和内容的邮件;4) 列出/root/目录文件名并一行显示;5) 计算1到100的和;6) 删除Windows文件中的'^M'字符;7) 提取字符串中的数字和空格;8) PATH变量中每个目录独占一行;9) 替换文件中的数字为字母;10) 文件中每个单词独立显示,无空行。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



