POSIX   コマンド

ホーム


コマンド

POSIX コマンドの覚書です。

General


mkdir -p dir1/dir2/dir3
ln -s dir1/dir2/dir3 dirA
# dir という名前はダメみたい。
unlink dirA
Ubuntu
$ sudo gpasswd -a dokku sudo
CentOS
$ sudo gpasswd -a newuser wheel
$ sudo usermod -G wheel 
$ cat /etc/redhat-release
パス
$ export PATH=$HOME/.cabal/bin:$PATH
$ export PATH=$HOME/.local/bin:$PATH
macOS
$ export PATH=$PATH:/Users/ユーザー名/.local/bin
テキストエディタで開く
$ open .bash_profile
アップロード
// ローカルホストで実行
$ scp -P 22 index.html admin@domain.com:/home/admin/htdocs/
ダウンロード
// ローカルホストで実行
$ scp -P 22 admin@domain.com:/home/admin/htdocs/index.html ./
http参照
$ curl https://123.123.123.123
    

Shutdown & Restart


$ sudo shutdown -h now
$ sudo shutdown -r now
    

Emacs


ホームディレクトリ(~/以下)に .emacs ファイルがあるか作る。
*.~ というバックアップファイルを作らない
(setq make-backup-files nil)
.#* というバックアップファイルを作らない
(setq auto-save-default nil)
行番号を常に表示する。(バージョン23以上)
(setq line-number-display-limit-width 10000)
もしくは
(global-linum-mode t)
あるいは
(global-linum-mode t)
(setq linum-format "%d ")
(set-face-attribute 'linum nil
            :foreground "#a9a9a9"
            :height 0.9)
    

CentOS 7.6


[CentOS 7.6]
sudo yum -y install httpd
sudo service httpd start
sudo systemctl start httpd.service
sudo chkconfig httpd on
firewall-cmd --permanent --zone=public --add-service=http
success
firewall-cmd --permanent --zone=public --add-service=https
success
firewall-cmd --reload
success
ファイアーウォールの無効化
systemctl stop firewalld
起動時にファイアーウォールが無効化されるように設定
systemctl disable firewalld
ポート番号指定して開く。
firewall-cmd --zone=public --add-port=443/tcp
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --reload
    

HTML


シングルクォート
'
    

Key


$ ssh-keygen -t rsa
$ sudo chmod 700 /home/ubuntu/.ssh/
$ sudo chmod 600 /home/ubuntu/.ssh/authorized_keys
$ cat ~/.ssh/id_rsa.pub | ssh root@dokku.com "sudo sshcommand acl-add dokku custom-identifier"
$ cat path/to/id_rsa.pub | sudo sshcommand acl-add dokku custom-identifier
$ cat ~/.ssh/id_rsa.pub | ssh root@123.123.123.123 "sudo sshcommand acl-add dokku laptop"
$ cat ~/.ssh/custom.pub | ssh root@mydomain.com "sudo sshcommand acl-add dokku custom-identifier"
$ ssh -T git@github.com
    

Stack


プロジェクトを作る
$ stack init
ビルド関連
$ stack clean
$ stack build
インストール
macOS
curl -sSL https://get.haskellstack.org/ | sh
Linux
wget -qO- https://get.haskellstack.org/ | sh
アンインストール
$ rm -rf ~/.stack
$ rm -rf ~/.local/bin/stack
$ rm -rf .stack-work
Cabal
$ stack install cabal-install
Template
$ stack templates
    

EC2


ssh -i ~/.ssh/ec2-key.pem ubuntu@123.123.123.123
cat ~/.ssh/id_rsa.pub | ssh -i ~/.ssh/ec2-key.pem ubuntu@123.123.123.123 'cat >> .ssh/id_rsa.pub'
ssh -i ~/.ssh/name.pem ec2-user@123.123.123.123
ssh -i ~/.ssh/name.pem ubuntu@123.123.123.123
アップロード
scp -i ~/.ssh/ec2-key.pem index.html ec2-user@123.123.123.123:/var/www/html
ダウンロード
scp -i ~/.ssh/ec2-key.pem ec2-user@123.123.123.123:/var/www/html/index.html .
    

Dokku


sudo apt install dokku
0.4.13
(ubuntu 14.04)
wget https://raw.githubusercontent.com/dokku/dokku/v0.4.13/bootstrap.sh
sudo DOKKU_TAG=v0.4.13 bash bootstrap.sh
0.10.5
(ubuntu 16.04)
wget https://raw.githubusercontent.com/dokku/dokku/v0.10.5/bootstrap.sh
sudo DOKKU_TAG=v0.10.5 bash bootstrap.sh
0.12.4
wget https://raw.githubusercontent.com/dokku/dokku/v0.12.4/bootstrap.sh
sudo DOKKU_TAG=v0.12.4 bash bootstrap.sh
0.14.5
(ubuntu 18.04)
wget https://raw.githubusercontent.com/dokku/dokku/v0.14.5/bootstrap.sh;
sudo DOKKU_TAG=v0.14.5 bash bootstrap.sh

sudo dokku ssh-keys:add <name> <path>
dokku domains:add-global <domain>

dokku version
0.14.5

[postgre]
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku postgres:create rails-database
dokku postgres:link rails-database ruby-rails-sample
[client]
git clone git@github.com:heroku/ruby-rails-sample.git

[buildpacks]
https://github.com/mfine/heroku-buildpack-stack
https://github.com/begriffs/heroku-buildpack-ghc.git
https://github.com/mietek/haskell-on-heroku
https://github.com/circuithub/haskell-on-heroku.git
[postgresql]
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku postgres:create rails-database
dokku postgres:link rails-database 


1049 visits
Posted: Feb. 16, 2019
Update: Mar. 13, 2019

ホーム   ページトップ