LoginSignup
13
13

More than 5 years have passed since last update.

■よく使うコマンド集まとめ

Last updated at Posted at 2014-03-18

筆者がよく使うコマンド集を書いています。

ruby bundle コマンド集

history | grep bundle
bundle install --path=vendor/bundle 
# => 地味に便利

rbenv コマンド集

rbenv --version 
# => バージョン確認
rbenv install --list 
# => インストール可能なバージョン一覧の表示
rbenv install [バージョン] 
# => rubyのインストール
rbenv rehash             
# => rbenv の再読み込み
rbenv global [バージョン]  
# => defaultで使うrubyのバージョン
rbenv versions
# => インストールされているバージョンを確認
rbenv local 2.0.0-p247
# => ローカルのRubyバージョン変更
■rbenvの更新
rm -rf ~/.rbenv/plugins/ruby-build
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

Rails コマンド集

コピペ様に書いて置くんですが実運用において以外に便利

bundle exec unicorn_rails -E -p 8080 -c config/unicorn.rb -D
# => unicornの起動
bundle exec rake db:create
# => database.ymlに記載されたDBの作成
bundle exec rake db:migrate
# => databaseのテーブル作成
bundle exec rake db:migrate:reset
# => Drop table 実行後 migrate file に従った create table
bundle exec rake db:migrate:reset RAILS_ENV=staging
# => stagingモード

Capistrano

bundle exec cap deploy:setup  
# 初期セットアップ 

AWS コマンド集

1.AMIから起動する場合どうやらインスタンスのDISKの容量を超えるDISKを設定するとterminateされてしまう。
# => 実証済み
2.
sudo cp /usr/share/zoneinfo/Japan /etc/localtime
=> 
■日本語表示のインストール
export LANG=ja_JP.UTF-8
update-locale LANG=ja_JP.UTF-8
■Amazon-Linuxの場合
rootのパスワード
sudo passwordにて変更可能
sudo su でrootユーザーに移動可能

Git コマンド集

git コマンド
comit  #localに反映
push   #サーバーに反映
revert #ファイルを変更前に戻す
pull   #localを、サーバーの最新版に更新
reset  #指定したコミットの状態にする
git remote add リポジトリURL
git merge ブランチ名
git remote set-url test 
git remote add test Repository名
git config --global user.email "[メールアドレス]"
git config --global user.name "自分の名前"

ubuntsu linux コマンド集

adduser ユーザー名
# => ubuntsuでのユーザーの追加 かなり便利です。
ssh-keygen -t rsa
# => sshキー作成
sudo gpasswd -a redmine sudo
# => sudo su の権限を付与する
chown redmine:redmine *
# ファイルの所有権を変更する
nginx -t -c /etc/nginx/nginx.conf
# => nginxのSyntax check
/etc/init.d/nginx restart
# => nginx の再起動
/etc/init.d/httpd restart
# => apache の再起動

MYSQL 関連

mysql --version
# => バージョン確認
source ****.sql
# => Dumpfileのインポート
13
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
13