2014/10/28

bash if option

if test -x ....
then
fi
====>いろいろな条件

[ -a FILE ]    True if FILE exists.
[ -b FILE ]    True if FILE exists and is a block-special file.
[ -c FILE ]    True if FILE exists and is a character-special file.
[ -d FILE ]    True if FILE exists and is a directory.
[ -e FILE ]    True if FILE exists.
[ -f FILE ]    True if FILE exists and is a regular file.
[ -g FILE ]    True if FILE exists and its SGID bit is set.
[ -h FILE ]    True if FILE exists and is a symbolic link.
[ -k FILE ]    True if FILE exists and its sticky bit is set.
[ -p FILE ]    True if FILE exists and is a named pipe (FIFO).
[ -r FILE ]    True if FILE exists and is readable.
[ -s FILE ]    True if FILE exists and has a size greater than zero.
[ -t FD ]    True if file descriptor FD is open and refers to a terminal.
[ -u FILE ]    True if FILE exists and its SUID (set user ID) bit is set.
[ -w FILE ]    True if FILE exists and is writable.
[ -x FILE ]    True if FILE exists and is executable.
[ -O FILE ]    True if FILE exists and is owned by the effective user ID.
[ -G FILE ]    True if FILE exists and is owned by the effective group ID.
[ -L FILE ]    True if FILE exists and is a symbolic link.
[ -N FILE ]    True if FILE exists and has been modified since it was last read.
[ -S FILE ]    True if FILE exists and is a socket.
[ FILE1 -nt FILE2 ]    True if FILE1 has been changed more recently than FILE2, or if FILE1 exists and FILE2 does not.
[ FILE1 -ot FILE2 ]    True if FILE1 is older than FILE2, or is FILE2 exists and FILE1 does not.
[ FILE1 -ef FILE2 ]    True if FILE1 and FILE2 refer to the same device and inode numbers.
[ -o OPTIONNAME ]    True if shell option "OPTIONNAME" is enabled.
[ -z STRING ]    True of the length if "STRING" is zero.
[ -n STRING ] or [ STRING ]    True if the length of "STRING" is non-zero.
[ STRING1 == STRING2 ]     True if the strings are equal. "=" may be used instead of "==" for strict POSIX compliance.
[ STRING1 != STRING2 ]     True if the strings are not equal.
[ STRING1 < STRING2 ]     True if "STRING1" sorts before "STRING2" lexicographically in the current locale.
[ STRING1 > STRING2 ]     True if "STRING1" sorts after "STRING2" lexicographically in the current locale.
[ ARG1 OP ARG2 ]    "OP" is one of -eq, -ne, -lt, -le, -gt or -ge. These arithmetic binary operators return true if "ARG1" is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to "ARG2", respectively. "ARG1" and "ARG2" are integers.

linux gnome 電源管理問題、vboxディスク拡張

----
インストールに問題があります!
GNOME電源管理のデフォルトの設定が正しくインストールされていないようです。
システム管理者に問い合わせてみて下さい。
---

原因はおそらくHDD残量の不足かと思います。
df -h
==>Use 100%

・virtualbox ハードディスク拡張
VBoxManager.exe modifyhd "*.vid" --resize **

で。。。GParted Live (Default settings)でやる

・linux disk構成管理
ここもいろいろわからない
disk-->物理ボリュームー>論理ボリュームグループー>論理ボリューム
(下記はファイルシステムの領域に入る)
ー>マウントポイントー>フォルダ/file

df,fdisk===>などなど、普段は使っているが、上記のどの段階で何のためのコマンド、よくわからず。。。
df ==>ファイル・システムについて,使用領域と空き領域のサイズを表示する
mount ==>論理ボリュームをファイルシステムにいれる。/etc/fstab 自動的に入れる物

fdisk コマンドで領域の確保を行い、 mke2fs コマンドで領域のフォーマットを行っておく必要があります(ファイルシステム)
fdiskコマンドでは、ハードディスクのパーティションの作成、削除、また、パーティション情報を調べる事ができます。

・ディスクの状況を確認する
dmesg | grep sd
dmesg | grep sd=>SATAの場合

ここでも
/dev/hd...
/dev/sd...

そして sudo fdisk -l /dev/...
/dev/sda2              64        1045     7875584   8e  Linux LVM
==>こいつはLVM


sudo pvdisplay
sudo vgdisplay
sudo lvdisplay

Lvmのサイズを拡張する
lvextend -L12G /dev/myvg/homevol

sudo pvcreate /dev/sdb5
  sudo vgextend ubuntudevbox2 /dev/sdb5
  sudo lvextend 100% /dev/ubuntudevbox2/root
  lvextend --help
  sudo lvextend -l 100%FREE /dev/ubuntudevbox2/root
  sudo lvextend -r -l 100%FREE /dev/ubuntudevbox2/root
sudo resize2fs  /dev/mapper/ubuntudevbox2-root

==>resize2fsようなの物がまるね。。。
==>resize2fs - ext2/ext3 ファイルシステムのサイズを変更する

何となく。。

2014/10/26

eclipse jdk os 32bit/64bit

I am confusing with that
I think if the os is 32bit ,then jdk,eclipse also 32bit 
64bit the same
but .....
there is a lot aborting ...
i am wrong? they are wrong?

eclipse-java-luna-SR1-win32-x86_64
window7 64bit
jdk-8u20-windows-x64


i think it will  be ok
but ....


oh ,this time it goes oK! I uninstall all the jdk,and reinstall them

2014/10/24

ruby `require': no such file to load -- mysql (LoadError)

require 'mysql'
でエラーになった
でも
sudo gem install ruby-mysqlをインストール済みが。。
先に
require 'rubygems'
が必要だ。。

で、sudo ruby
=>sudo: ruby: コマンドが見つかりません
which ruby
==>/usr/local/bin

で、visodu
visudoでsecure_pathに「/usr/local/bin」を追加する。

linux 色 front 環境設定

★vi
:syntax on
:syntax off


★lsの色
echo $LS_COLORS
sudo vi /etc/DIR_COLOR
eval ``

★front PS1
==>Linuxの標準シェルであるbashでは、PS1という環境変数によってプロンプトを定義している。従って、exportコマンドでPS1を変更すればいい。
==>front?
ログインして、「test@somehostname」のことね。
export PS1="$"
ログインして、「$」に変わる

~/.bashrcを修正して

PS1="\[\033[0;34m\]$PS1"
の0;32の部分はfrontの色変わる

linux sed

・sed 's/^192.168.0.1/&localhost/ example
==>^頭、192.168.0.1ーー>192.168.0.1&localhost

・sed '/test/'d example
==>testを含める行を削除する
 g-->これはないと、行単位の初めての物がターゲットになる

・sed '2d' example =->d 削除、2第二行
 sed '$d' example  最後の一行を削除する
 sed '2,$d' example  第2行から最後の一行を削除する
 
・sed -n '/test/mytest/p' example
  ==>-n p 条件を満たす行をプリンターする
 
・sed 's#10#100#g' example
=->s後ろの物が分隔用になる

・sed -n '/test/,/let/p' example
testとletの間で確定された行をプリンタする

・sed -e '1,5d' -e's/let/letus/g' example
実行できる

2014/10/03

pipをインストール

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py --proxy="http://proxy.jp:8080"

apache Invalid command 'Order'Add Star

LoadModule authz_host_module modules/mod_authz_host.so
=>load module mod_access_compat, or update configuration to 2.4 authorization directives.

ruby require エラー

Rubyファイルを実行するとrequireでエラーがでてるよってとき

require "kakiku"
==>エラーになり、書き方を修正する
require File.expand_path('kakiku.rb',__FILE__)=>NG
require File.expand_path('./kakiku.rb',__FILE__)=>NG
require File.expand_path('../kakiku.rb',__FILE__)=>OK

バージョン:
ruby 2.0.0p353 (2013-11-22) [x86_64-linux]

perl モジュール install

mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
==>Data-Dumperのperlのモジュールが必要で。。



perlモジュールをインストールするにはCPANを使用すると便利である

http://search.cpan.org/でほしい物を検索する

例:
http://search.cpan.org/~smueller/Data-Dumper-2.154/Dumper.pm

wget http://search.cpan.org/~smueller/Data-Dumper-2.154/Dumper.pm
tar xzvf Data-Dumper-2.154.tar.gz
cd Data-Dumper-2.154
perl Makefile.PL
インストールして途中でエラーになった。
Can't locate ExtUtils/MakeMaker.pm in @INC
==>yum install perl-ExtUtils-MakeMaker

make
make test
==>エラーになった!!


make install


★他のエラー

    Can't locate CPAN.pm in @INC (@INC contains:....)

⇒ yum install perl-CPAN

    Can't locate Test/More.pm in @INC (@INC contains:....)

⇒ perl -MCPAN -e 'install Test::More'

    Can't locate LWP/Simple.pm in @INC (@INC contains:....)

⇒ perl -MCPAN -e 'install LWP::Simple'

    perl -MCPAN -e 'install URI'
    Can't locate object method "install" via package "URI" at -e line 1.

⇒CPANシェルで実行するとOK

   Can't locate Time/HiRes.pm in @INC
==>yum install perl-Time-HiRes


===>ああ。。あきらめる

yum list | grep perl | tee perl_package.log
==>あった。
sudo yum install perl-Data-Dumper.x86_64

easy_installなどなど、みんなyumにしていいじゃん?