linux初体验

常见Linux的发行版有哪些?并描述不同发行版之间的联系与区别

因为LInuxLinux是一套免费使用和自由传播的类Unix操作系统,其内核源代码等内容都可以自由获取,所以出现了不同公司自行开发的Linux发行版。
主要分为Debian系、RedHat系、Slackware三个系列,其下都具有各自的商业发行版,分别为Ubuntu Server、SUSE Linux Enterprise和RedHat Enterprise Linux。
除了商业发行版外,各分支又或多或少出现了不同的社区开源版本,如CentOS、Fedora、OpenSUSE、Gentoo等。

打印显示当前时间,格式是:20181209211008

[root@centos7 ~]$ date +%Y%m%d%H%M%S
20190321092234

实现晚上20:30自动关机,并提示用户

使用at一次性计划任务实现(crontab也可实现该功能)
创建计划任务

[root@centos7 ~]$ at 20:30
at> wall "will shutdown"
at> sleep 10
at> shutdown
at> <EOT>
job 1 at Thu Mar 21 20:30:00 2019

查看任务

[root@centos7 ~]$ at -l
1       Thu Mar 21 20:30:00 2019 a root
[root@centos7 ~]$ at -c 1
#!/bin/sh
#atrun uid=0 gid=0
#mail root 0
umask 22
...
${SHELL:-/bin/sh} << 'marcinDELIMITER159a0b71'
wall "will shutdown"
init 0

marcinDELIMITER159a0b71

使用shutdown命令实现

[root@centos7 ~]$ shutdown -t 10 -P 20:30 "System will be closed"
Shutdown scheduled for Thu 2019-03-21 20:30:00 CST, use 'shutdown -c' to cancel.

history命令历史的用法

[root@centos7 ~]$ type history
history is a shell builtin
history [n]:列出最近的n条命令
[root@centos7 ~]$ history 2
190  history 185
191  history 2
history -c				#删除所有的history记录
history -d offset		#删除指定编号的history记录
history -anrw [filename]#
		-a				#将新增的history记录写入historyfile中
		-n				#将指定historyfile中的记录读入到当前session中的history记录中(当前history中不存在的)
		-r				#将定historyfile中的记录读入到当前session中的history记录之后并作为当前session的history
		-w				#将当前session中的history记录写入指定的文件中,如不指定filename则默认写入.bash_history中

在想要执行相关编号的命令时可使用“!编号”的形式来执行

!string					#执行与string相符的最后一条命令

Linux帮助用法

在Linux下常用的帮助有man,info,help等工具
其中man命令通过调用系统的帮助文档来实现,一般都存放于/usr/share/man目录下(除手动编译指定)
man命令通常配合whatis命令来使用,确定命令指定章节再进行查看
总结Linux帮助用法
在Linux下常用的帮助有man,info,help等工具
其中man命令通过调用系统的帮助文档来实现,一般都存放于/usr/share/man目录下(除手动编译指定)
man命令通常配合whatis命令来使用,确定命令指定章节再进行查看

type				#判断是否是内置命令
help				#适用于内置命令,显示简单帮助信息
--help/-h		#适用于外部命令,显示简单帮助信息
info				#显示info文档信息
man				#显示命令手册
which			#显示命令所在目录
whereis		#显示命令所在目录、手册等信息
[root@centos7 ~]$ whatis df
df (1)               - report file system disk space usage
df (1p)              - report free disk space
[root@centos7 ~]$ man 1p df
DF(1P)                         POSIX Programmer's Manual                        DF(1P)

PROLOG
       This manual page is part of the POSIX Programmer's Manual.  The Linux implemen‐
       tation of this interface may differ (consult  the  corresponding  Linux  manual
       page for details of Linux behavior), or the interface may not be implemented on
       Linux.

NAME
       df - report free disk space
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值