扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
★熟悉shell
<!--[if !supportLists]-->ü <!--[endif]-->常用的shell命令
<!--[if !supportLists]-->ü <!--[endif]-->常用的Bourne shell命令
<!--[if !supportLists]-->ü <!--[endif]-->常用的C shell命令
<!--[if !supportLists]-->ü <!--[endif]-->常用的Korn shell命令
★用户和组管理
<!--[if !supportLists]-->ü <!--[endif]-->添加用户
<!--[if !supportLists]-->ü <!--[endif]-->删除用户
<!--[if !supportLists]-->ü <!--[endif]-->更改用户信息
<!--[if !supportLists]-->ü <!--[endif]-->创建删除组
★角色管理
<!--[if !supportLists]-->ü <!--[endif]-->针对特殊任务授权超级用户权限
<!--[if !supportLists]-->ü <!--[endif]-->创建修改删除角色
★文件系统管理
<!--[if !supportLists]-->ü <!--[endif]-->文件系统的类型
<!--[if !supportLists]-->ü <!--[endif]-->加载移除文件系统
<!--[if !supportLists]-->ü <!--[endif]-->文件系统一致性检查
<!--[if !supportLists]-->ü <!--[endif]-->备份恢复文件和文件系统
<!--[if !supportLists]-->ü <!--[endif]-->创建cache文件系统
★设备管理
<!--[if !supportLists]-->ü <!--[endif]-->理解设备自动配置
<!--[if !supportLists]-->ü <!--[endif]-->使用DVD-ROM设备
<!--[if !supportLists]-->ü <!--[endif]-->使用磁带
<!--[if !supportLists]-->ü <!--[endif]-->格式化操盘
<!--[if !supportLists]-->ü <!--[endif]-->磁盘使用监控
<!--[if !supportLists]-->ü <!--[endif]-->服务访问技巧
<!--[if !supportLists]-->ü <!--[endif]-->设置双向modem.
★管理系统
<!--[if !supportLists]-->ü <!--[endif]-->查找系统信息
<!--[if !supportLists]-->ü <!--[endif]-->创建本地邮件别名
<!--[if !supportLists]-->ü <!--[endif]-->配置其他的交换空间
<!--[if !supportLists]-->ü <!--[endif]-->管理时间和日期
★打印管理
<!--[if !supportLists]-->ü <!--[endif]-->安装打印服务器和客户端
<!--[if !supportLists]-->ü <!--[endif]-->使用打印命令
★认识文件访问问题
<!--[if !supportLists]-->ü <!--[endif]-->通过查找path来坚定问题
<!--[if !supportLists]-->ü <!--[endif]-->通过权限和所有来解决问题
<!--[if !supportLists]-->ü <!--[endif]-->通过网络定位问题
本书不包含安装系统软件,安装第3方软件,配置管理网络服务,配置邮件服务,添加删除硬件,安全管理和账号,系统监控和网络性能等.
超级用户的UID是0,su到超级用户的log在: /var/adm/sulog, 如果需要使用环境变量,使用su –
<!--[if !supportLists]-->ü <!--[endif]-->登陆时的信息显示: /etc/motd
<!--[if !supportLists]-->ü <!--[endif]-->发送消息给单个用户: write ,要在线的才可以发送
比如: bash-2.03# write meil
meil is logged on more than one place.
You are connected to "pts/2".
Other locations are:
pts/3
good Afternoon
bash-2.03#
<!--[if !supportLists]-->ü <!--[endif]-->发送消息给所有用户 wall
<!--[if !supportLists]-->ü <!--[endif]-->发送消息给网络用户 rwall
<!--[if !supportLists]-->ü <!--[endif]-->Email
需要关键的情况如下:
<!--[if !supportLists]-->· <!--[endif]-->Turning off system power.
<!--[if !supportLists]-->· <!--[endif]-->Installing a new release.
<!--[if !supportLists]-->· <!--[endif]-->Preparing for a power outage.
<!--[if !supportLists]-->· <!--[endif]-->Adding hardware to a system.
<!--[if !supportLists]-->· <!--[endif]-->Performing maintenance on a file system.
Table 1. System Init States | |
|
Function |
0 |
Power-down state. |
S, or s |
Single-user state. All file systems mounted. |
1 |
Administrative state. All file systems mounted and user logins allowed. |
2 |
Multiuser state (resources not exported). All daemons are running except the NFS server daemons. |
3 |
Multiuser state. NFS resource-sharing available. |
4 |
Alternative multiuser state (currently unused). |
|
Power-down state. Shut down the operating system so that it is safe to turn off power to the system. If possible, turn off power on systems that support this feature. |
6 |
Reboot. Shut down the system to init state 0 and then reboot to the multiuser state defined in the inittab file. |
/etc/inittab定义的重要内容如下:
<!--[if !supportLists]-->· <!--[endif]-->The default run level for the system.
<!--[if !supportLists]-->· <!--[endif]-->The processes to start, monitor, and restart if they terminate.
<!--[if !supportLists]-->· <!--[endif]-->Actions to take when the system enters a new run level.
它的字段如下:
Field |
Description |
id |
A unique identifier for the entry. |
rstate |
A list of run levels to which this entry applies. |
action |
How the process specified in the process field is to be run. Possible values include initdefault, sysinit, boot, bootwait, wait, and respawn. |
process |
The command to execute. |
比如:
bash-2.03# vi /etc/inittab
"/etc/inittab" 17 lines, 1081 characters
ap::sysinit:/sbin/autopush -f /etc/iu.ap
ap::sysinit:/sbin/soconfig -f /etc/sock2path
fs::sysinit:/sbin/rcS sysinit >/dev/msglog 2<>/dev/msglog </dev/console
is:3:initdefault:
p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog 2<>/dev/msglog
sS:s:wait:/sbin/rcS >/dev/msglog 2<>/dev/msglog </dev/console
s0:0:wait:/sbin/rc0 >/dev/msglog 2<>/dev/msglog </dev/console
s1:1:respawn:/sbin/rc1 >/dev/msglog 2<>/dev/msglog </dev/console
s2:23:wait:/sbin/rc2 >/dev/msglog 2<>/dev/msglog </dev/console
s3:3:wait:/sbin/rc3 >/dev/msglog 2<>/dev/msglog </dev/console
s5:5:wait:/sbin/rc5 >/dev/msglog 2<>/dev/msglog </dev/console
s6:6:wait:/sbin/rc6 >/dev/msglog 2<>/dev/msglog </dev/console
fw:0:wait:/sbin/uadmin 2 0 >/dev/msglog 2<>/dev/msglog </dev/console
of:5:wait:/sbin/uadmin 2 6 >/dev/msglog 2<>/dev/msglog </dev/console
rb:6:wait:/sbin/uadmin 2 1 >/dev/msglog 2<>/dev/msglog </dev/console
sc:234:respawn:/usr/lib/saf/sac -t 300
co:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` console login: " -T sun -d /dev/console -l console -m ldterm,ttcompat
init的执行脚本sbin中,
bash-2.03# ls /sbin/rc*
/sbin/rc0 /sbin/rc1 /sbin/rc2 /sbin/rc3 /sbin/rc5 /sbin/rc6 /sbin/rcS
控制文件在/etc/init.d中,它们连接到/etc/rc*.d, 其下面的文件K开头的表示kill, S开头的表示start
<!--[if !supportLists]-->· <!--[endif]-->Stop system services and daemons.
<!--[if !supportLists]-->· <!--[endif]-->Terminate all running processes.
<!--[if !supportLists]-->· <!--[endif]-->Unmount all file systems.
<!--[if !supportLists]-->· <!--[endif]-->Stop system services and daemons.
<!--[if !supportLists]-->· <!--[endif]-->Terminate all running processes.
<!--[if !supportLists]-->· <!--[endif]-->Unmount all file systems.
<!--[if !supportLists]-->· <!--[endif]-->Bring the system up in single-user mode.
<!--[if !supportLists]-->· <!--[endif]-->Mount all local file systems.
<!--[if !supportLists]-->· <!--[endif]-->Enable disk quotas if at least one file system was mounted with the quota option.
<!--[if !supportLists]-->· <!--[endif]-->Save editor temporary files in /usr/preserve.
<!--[if !supportLists]-->· <!--[endif]-->Remove any files in the /tmp directory.
<!--[if !supportLists]-->· <!--[endif]-->When boot -r is used, create device entries in /dev for new disks.
<!--[if !supportLists]-->· <!--[endif]-->Configure system accounting.
<!--[if !supportLists]-->· <!--[endif]-->Configure default router.
<!--[if !supportLists]-->· <!--[endif]-->Set
<!--[if !supportLists]-->· <!--[endif]-->Reboot the system from the installation media or a boot server if either /.PREINSTALL or /AUTOINSTALL exists.
<!--[if !supportLists]-->· <!--[endif]-->Start inetd and rpcbind and named, if appropriate.
<!--[if !supportLists]-->· <!--[endif]-->Start Kerberos client-side daemon, kerbd.
<!--[if !supportLists]-->· <!--[endif]-->Start
<!--[if !supportLists]-->· <!--[endif]-->Start keyserv, statd, lockd, xntpd, and utmpd.
<!--[if !supportLists]-->· <!--[endif]-->Mount all NFS entries.
<!--[if !supportLists]-->· <!--[endif]-->Start cscd (nameservice cache daemon).
<!--[if !supportLists]-->· <!--[endif]-->Start automount, cron, LP print service, sendmail, utmpd, and vold daemons.
<!--[if !supportLists]-->· <!--[endif]-->Clean up sharetab.
<!--[if !supportLists]-->· <!--[endif]-->Start nfsd.
<!--[if !supportLists]-->· <!--[endif]-->Start mountd.
<!--[if !supportLists]-->· <!--[endif]-->If the system is a boot server, start rarpd, rpc.bootparamd, and rpld.
<!--[if !supportLists]-->· <!--[endif]-->Start snmpdx (Solstice Enterprise Agent process).
<!--[if !supportLists]-->· <!--[endif]-->Kill all active processes.
<!--[if !supportLists]-->· <!--[endif]-->Unmount the file systems.
<!--[if !supportLists]-->· <!--[endif]-->Establish a minimal network.
<!--[if !supportLists]-->· <!--[endif]-->Mount /usr if necessary.
<!--[if !supportLists]-->· <!--[endif]-->Set the system name.
<!--[if !supportLists]-->· <!--[endif]-->Check the root and /usr file systems.
<!--[if !supportLists]-->· <!--[endif]-->Mount pseudofile systems (/proc and /dev/fd).
<!--[if !supportLists]-->· <!--[endif]-->Rebuild the device entries for reconfiguration boots.
<!--[if !supportLists]-->· <!--[endif]-->Check and mount other file systems to be mounted in single-user mode.
查看系统的运行级别:
In the following example, the system named paperbark is at the default multiuser run level (3), the date and time of the last run level change is May 2 08:34, the process termination status is 3, the number of times at this run level since the last reboot is 0, and the previous run level is S.
paperbark% who -r
. run-level 3 May 2 08:34 3 0 S
Daemon的定义:
注意时不需用户输入的
A daemon is a special type of program that, once activated, starts itself and carries out a specific task without any need for user input. Daemons typically are used to handle jobs, such as printing, mail, and communication, that have been queued.
改变运行状态,可以使用telinit or init, 建议使用telinit.
关机命令的选择.
<!--[if !supportLists]-->· <!--[endif]-->/usr/sbin/shutdown
<!--[if !supportLists]-->· <!--[endif]-->/etc/telinit and /sbin/init
<!--[if !supportLists]-->· <!--[endif]-->/usr/sbin/halt
<!--[if !supportLists]-->· <!--[endif]-->/usr/sbin/reboot
<!--[if !supportLists]-->· <!--[endif]-->/usr/sbin/uadmin
Shutdown用于多用户环境,会通知所有用户,然后进入单用户模式.
Telinit和init用于关闭单用户环境或者改变运行级别.
Halt用于立即停机,不通知其他用户.不执行rc shutdown脚本,一般不推荐使用
Reboot 同上,同时重启.
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者