vim のタブ幅を4文字に変更する

vimでのタブの文字数はデフォルトでは「8文字」です。プログラムとか書いているとタブが8文字だと横幅が長くなり見難くなるので、タブ幅を8文字から4文字に変更するには「.vimrc」に以下を追加します
$ ~/.vimrcset ...sedコマンドで空行を削除する

sedコマンドで空行の削除して表示するには、以下のように「sed ‘/^$/d’ (ファイル名)」で表示できます
$ cat test123456789$ sed '/ ...設定ファイルのコメントアウトを空行を除外して表示

Apacheの設定ファイルなどで「#」でコメントアウトしている設定は除外して表示するには「cat」,「grep」コマンドを利用すれば表示できます。
コマンド:cat (設定ファ ...
dateコマンドで曜日を取得する

下記のように「SELECT * FROM 〜〜 INTO OUTFILE 〜〜」でMySQLのデータをCSVファイルにエクスポートした場合、「Null」を含 ...
sshログインすると「POSSIBLE BREAK-IN ATTEMPT!」のエラー表示

sshでログインすると下記のように「but th ...
ファイル内の特定の文字を含む行を削除する

ファイル内で特定の文字列を含む行を削除するには、「awk」, 「grep」 , 「sed」コマンドで削除できますが、今回は「sed」コマンドを利用した場合の方法を紹介します」
下記 ...
シェルスクリプトでファイルが空かどうか確認する

シェルスクリプトでファイルが空ファイル(0byete)かどうか確認する場合はifコマンドの「-s」のオプションを利用します。
$ sh test.sh#!.bin/bashFILE=te ...Let’s Encryptで古い各種証明書を自動で削除する

Let’s Encryptの証明書の有効期限が90日なので、1月に1回Cronで更新作業をおこなっています、そうすると新しいファイルは/etc/letse ...
シェルスクリプトを利用して、logmonで除外キーワードを設定

logmonのログ監視では、指定した文字列のみヒットするとメールを送付する、任意のシェルスクリプトを実行するなどのアクションが実行できます。
※ logmonのインストール方法は「l ...
cpコマンドで確認なしでコピー

通常ではcpコマンドはコピーする際にcp -f (コピー元) (コピー先)として確認不要でコピーしても、下記のように確認コマンドが出る場合あります
$ cp -f hoge.txt ...CentOS 6.x 系で、MySQL5.1からMySQL5.6にバージョンアップする

CentOS 6.x系のMySQLのバージョンは、「mysql-5.1系」で.「mysql-5.6系」を使用したい場合に、yumでのインストール方法を紹介します
1,M ...
lftpを使用して自動同期する

lftpはFTPサイトでファイルやディレクトリをダウンロードできたりアップロードできたりするコマンドです。通常のFTPクライアントではrsyncのように特定のディレクトリ ...
空のディレクトリを削除する方法

ファイルが何も入っていない空のディレクトリがある場合、lsコマンドでディレクトリの内容を確認してファイルが無ければ削除するって事を手動でやっていると時間ばかりかかるので、findコマンドで空 ...
CentOS に最新のgitをインストールする

CentOS 6.x系のgitサーバーは、yumを利用してインストールすると1.7系と古いので、2.x系のをインストールする手順を紹介します。
インストール作業は、 ...
FTPサイトをディレクトリごとダウンロードする(wget)

あるFTPサイトのバックアップスクリプトを作っていて、FTPサイトをFTPコマンドでダウンロードしようと思ったのですが、FTPコマンドだとディレクトリをまるごとダウンロード ...