linux shell tips

Bash Bits: Check if item is in array

This is a simple function which helps you find out if an (non associative) array has an item. It allows you to call the function with just the array name, not ${arrayname[@]}. It returns 1 if the item is in the array, and 0 if it is not. 继续阅读

SSL and TLS Deployment Best Practices

Version 1.5 (8 June 2016)

SSL/TLS is a deceptively simple technology. It is easy to deploy, and it just works–except when it does not. The main problem is that encryption is not often easy to deploy correctly. To ensure that TLS provides the necessary security, system administrators and developers must put extra effort into properly configuring their servers and developing their applications.

In 2009, we began our work on SSL Labs because we wanted to understand how TLS was used and to remedy the lack of easy-to-use TLS tools and documentation. We have achieved some of our goals through our global surveys of TLS usage, as well as the online assessment tool, but the lack of documentation is still evident. This document is a step toward addressing that problem.

Our aim here is to provide clear and concise instructions to help overworked administrators and programmers spend the minimum time possible to deploy a secure site or web application. In pursuit of clarity, we sacrifice completeness, foregoing certain advanced topics. The focus is on advice that is practical and easy to follow. For those who want more information, Section 6 gives useful pointers. 继续阅读


AWK单行脚本快速参考 2008年4月28日
编辑: Eric Pement eric [at] pement.org 版本 0.26
翻译: 董一粟 yisudong [at] gmail.com


Unix: awk ‘/pattern/ {print “$1”}’ # 标准 Unix shell环境
DOS/Win: awk ‘/pattern/ {print “$1”}’ # DJGPP 可编译通过
awk “/pattern/ {print \”$1\”}” # GnuWin32,UnxUtils,Mingw环境

‘/like/ {“this”}’。但是,用户必须知道在DOS/Windows环境下,使用CMD.EXE或者
COMMAND.COM程序的话,单引号并不能保护重定向符号(<, >)和管道(|)。
会沿用Unix标准的用法。 继续阅读

6 Stages of Linux Boot Process (Startup Sequence)

Press the power button on your system, and after few moments you see the Linux login prompt.

Have you ever wondered what happens behind the scenes from the time you press the power button until the Linux login prompt appears?

The following are the 6 high level stages of a typical Linux boot process.


How to Write Linux Init Scripts Based on LSB Init Standard

LSB stands for Linux Standard Base.

LSB was started by Linux Foundation to reduce the difference between several Linux distributions, and thereby reducing the cost involved in porting between different distributions. Init scripts are one among them to be standardized.

In this article, we will see how to write an Init script that conforms to LSBInit Standard.

Init scripts are used to start|stop a software|service. For example, if you are using postgresql software, we will have a Init script named ‘/etc/init.d/postgresql’ which can be used to ‘start|stop|restart|reload|force-reload|status’. 继续阅读

Linux Standard Base

Linux Standard BaseSpecifications Archive

The LSB 5 Specification Series

The Linux Standard Base is now on LSB 5. A further evolution of the specification, with considerable internal restructuring, finally delivering on a modular LSB.

The LSB 5.0 Specification

This is the approved final version of the LSB 5.0 specification. The tables below present two popular formats, you may also go to the page with all formats.

Release notes outlining changes from the previous release of the specification can be found at http://www.linuxfoundation.org/en/ReleaseNotes50

Note that the LSB 5.0 Core specification set is an evolution of the ISO/IEC International Standard 23360, which corresponded to LSB 3.1. This edition is not to be considered an ISO standard.

LSB 5.0 was released June 3, 2015. 继续阅读

戴尔PowerEdge RAID控制卡使用示例

Dell PERC使用示例列表(PERC H710P为例)



示例演示环境:PowerEdge R620 + H710p Raid控制卡  + 9 x 300G 10k SAS 硬盘 继续阅读



1. 我们临时创建了一个新的RAID1阵列,如图(Disk Group:1;Virtual Disks ID:2),选中该阵列,按F2,在弹出菜单里选择Initialization



戴尔PowerEdge服务器RAID控制卡的配置,可以使用戴尔提供的多种工具和界面来进行。其中包括H710p板载的PERC BIOS管理界面,生命周期控制器,系统设置,以及OMSA软件等。下面针对不同的使用目的,我们选取推荐的配置工具和界面给大家做个演示。

默认情况下,我们可以使用PERC H710p的板载固化配置管理界面进行大多数的功能配置。如果需要重新初始化RAID卡里硬盘的RAID配置信息,我们可以进行下面步骤:

注:下面PERC卡RAID配置信息初始化的演示,我们将清除PERC卡的磁盘阵列信息,但不清除磁盘上实际存放的用户数据。在后面的实验里,我们将演示在原有的硬盘上创建同样的RAID配置,来恢复硬盘上的用户数据。 继续阅读