月別アーカイブ: 2016年11月

【メモ】Macでddコマンド

Macでddコマンドを実行する時にやり方がわからなかったのでメモ。
(macOS Sierra 10.12.1)

$ df -h
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk0s2 362Gi 298Gi 64Gi 83% 3375753 4291591526 0% /
devfs 193Ki 193Ki 0Bi 100% 667 0 100% /dev
map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net
map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home
/dev/disk0s4 102Gi 46Gi 56Gi 45% 218071 59169477 0% /Volumes/BOOTCAMP
/dev/disk1s0 4.7Mi 4.7Mi 0Bi 100% 0 0 100% /Volumes/xbeox
$

/dev/disk1s0の/Volumes/xbeoxをddコマンドでバックアップしようとして

$ sudo dd if=/dev/disk1s0 of=./xbeox.iso

をしようとしたら、

dd: /dev/disk1s0: Resource busy

と怒られできない。

調べたところ、先にdiskutil umountコマンドを使用してアンマウントすればいいというので実行したところできた。

$ diskutil umount /Volumes/xbeox
Volume xbeox on disk1s0 unmounted
$ sudo dd if=/dev/disk1s0 of=./xbeox.iso
Password:
273824+0 records in
273824+0 records out
140197888 bytes transferred in 78.961542 secs (1775521 bytes/sec)
$

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-11-05-14-34-03

参考
http://www.lifewithunix.jp/notes/2013/06/13/how-to-use-dd-command-on-snow-leopard/

シェルスクリプトでFizzBuzz

FizzBuzz問題というのがあることを恥ずかしながら最近知りました。

業務でシェルスクリプト書いてたのでシェルスクリプト(Bourne shell)で書いてみました。1から100まで実行します。
いろいろ素人臭いところあると思いますがご了承ください(汗

Raspbianで/bin/sh指定(dash)で動いているのでBourne shell互換のシェルならどこでも動くと思います。(だからシバンも#!/bin/shです)

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-10-17-22-58-26

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-10-17-22-59-06

#!/bin/sh
num=1
while :
do
fizz=`expr ${num} % 3`
buzz=`expr ${num} % 5`
if [ ${fizz} = 0 -a ${buzz} = 0 ]; then
echo “FizzBuzz”
elif [ ${fizz} = 0 ]; then
echo “Fizz”
elif [ ${buzz} = 0 ]; then
echo “Buzz”
else
echo ${num}
fi
num=`expr ${num} + 1`
if [ ${num} = “101” ]; then
exit
fi
done

SUSE Certified Administrator in Enterprise Linux 11取得

先月SUSEの資格、SUSE Certified Administrator in Enterprise Linux 11を取得しました。

cert_linux_admin_11

20161015_035003495_ios

今年8月まではLPIC-1を持っていれば申請するだけで無料無資格でもらえた資格だったそうですが、

私がそのこと知ったのは今年9月末で、

Effective September 1, 2016, this SUSE Certified Linux Administrator Certification form is no longer available for LPI certificate holder.

http://practicum.novell.com/LPI2CLAForm.php

すでに終わってしまってました。
悔しいのでとってやりました。

内容は詳細は守秘義務なので言えませんが、概ねLPIC-1の内容でLPIC-2の内容も若干入っているようかな感じでした。
難易度はLPIC-1より簡単なくらいだと思います。受験料も税込9720円と(LPICと比べて)安かったです。

勉強内容は、
SUSE固有の機能を見直したり、LPIC-1の範囲を見直してました。
https://thinkit.co.jp/cert/article/0710/5/1/4.htm
https://ja.wikipedia.org/wiki/Yet_another_Setup_Tool
https://ja.opensuse.org/ソフトウエア管理のコマンドライン比較

また、OpenSUSEを入れていじってみたりもしました。

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-10-10-12-38-08

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-10-10-12-38-43

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-10-10-12-39-09

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-10-10-12-39-50

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-10-10-12-40-27

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-10-10-12-42-10

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-10-10-12-52-02