- Linux commands
- Shell Script
linux's Introduction
linux's People
linux's Issues
Command : Source
Query Commands
DNS Server
NFS Server
Shell Script Example : Get the power state and verify DIMM state in IPMITOOL
max=20
for i in `seq 1 $max`
do
power_wrong_state=0
dimm_wrong_state=0
echo "Test Cycle: $i"
for power_state in on off;
do
ipmitool power $power_state
sleep 10
# Check Power state
current_state=$(eval ipmitool power status)
echo $current_state
if [[ $current_state == *"$power_state"* ]]; then
echo "correct power state"
else
echo "wrong power state"
power_wrong_state=1
break
fi
# Check DIMM_A2 state
dimm_state=$(eval ipmitool sdr | grep DIMM_A2)
echo $dimm_state
case $power_state in
on*)
if [[ $dimm_state == *"degrees"* ]]; then
echo "correct dimm state"
else
echo "wrong dimm state"
dimm_wrong_state=1
break
fi
;;
off*)
if [[ $dimm_state == *"disabled"* ]]; then
echo "correct dimm state"
else
echo "wrong dimm state"
dimm_wrong_state=1
break
fi
;;
esac
done
echo $dimm_wrong_state
if [ $dimm_wrong_state == 1 ]; then
break
fi
echo $wrong_state
if [ $power_wrong_state == 1 ]; then
break
fi
done
TFTP Server
Shell Script - While Loop
SSH Server
Mail Server
Linux指令- grep 指令
Exit code
SED example
sed -n 's/(La)/\1Oo/p' dataf3
把找到的 La 存起來,用 \1 取回來使用
sed -i 取代修改原始檔
將多個空白取代成逗號
$ sed -r "s/[ ]+/,/g" sed_space.data
轉成dos文字檔
sed -i 's/$/\r/' xxx.txt
sed '1,4d' xxx.txt
刪除 1 至 4 列
sed '/YYY/d' xxx.txt
刪除含有 YYY 字串的列
sed '/[0-9]{3}/d' xxx.txt
把含有 3個數字的列刪除
sed '/^$/d' ttt
把 ttt 檔案中的空白列刪除。
sed '/YYY/!d' xxx.txt
把不含有 YYY 的列刪除
sed -n '/AAA/s/234/567/p' dataf3
找到含有 AAA 的那一列之後,將 234 換成 567
sed -n '/AAA/,/DDD/s/B/567/p' dataf3
含有 AAA 一直到含有 DDD 的那幾列,皆將其中的 B 換成 567
sed -n '2,4s/B/567/p' dataf3
由第 2 列到第 4 列,皆將其中的 B 換成 567
Linux Shell - Array
Tutor website
http://www.linuxjournal.com/content/bash-arrays
Command : Test
SECONDS
root@aci-npcm750olympus:~# SECONDS=5
root@aci-npcm750olympus:~# echo "Time: $SECONDS"
Time: 7
root@aci-npcm750olympus:~# echo "Time: $SECONDS"
Time: 8
root@aci-npcm750olympus:~# echo "Time: $SECONDS"
Time: 9
counter=0;SECONDS=0;while (( SECONDS < 60 )); do ipmitool -I dbus raw 6 1;((counter++)); done;echo $((counter/60)) cmds/sec;
DHCP Server
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.