Web site created using create-react-app
Linuxでは、実行することでシステムに重大な影響を及ぼす操作がいくつもある。 今回は、全てのシステム領域を削除してしまうようなものだったり、重要データを削除してしまうような危険なコマンド7個を紹介する。 1.rm -rf rmコマンドでファイルを削除する際、このオプションを用いて削除することで非常に手っ取り早く作業を行う事が出来る…のだが、ちょっとしたタイプミスをしてしまった場合、消してしまってはいけないファイルも強制的に削除されてしまうこともある。 以下に例を記載しよう。 rm :ファイルを削除するコマンド。 rm -r :フォルダを指定することで、再帰的に中のファイルを削除する。 rm -f :削除確認無しに、強制的にファイルを削除する。 ここまでは問題無い使い方。実際に危険なのは、以下のコマンドになる。 rm -rf / :実行するとルートディレクトリ配下を強制的に削除する。 rm
Linuxの管理をしていると、OSが搭載されているハードウェア情報を取得する事がある。 今回は、そんなときに使えるハードウェア情報を取得するコマンドを紹介する。 1.lscpu CPUに関する情報を取得するコマンド。コア数やスレッド数、仮想に対応しているか否か等の情報を取得出来る。 以下に実行例を記載する。 $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 コアあたりのスレッド数:1 ソケットあたりのコア数:4 Socket(s): 1 NUMAノード: 1 ベンダーID: GenuineIntel CPUファミリー: 6 モデル: 23 ステッピング: 10 CPU MHz: 2833.596 Bo
コマンドラインツールについて語るときに僕の語ること - YAPC::Asia Tokyo 2014 コマンドラインツールが好きで昔からつくってきた. 今年のYAPCで,そのコマンドラインツールをつくるときにどういうことを意識して作っているのか?どのような流れで開発しているのか?といったことを語る機会をもらえた. 具体的な内容については,是非トークを聴きに来てもらうとして, スライドをつくるにあったって過去に読んだ資料や,よく参考にしている記事を集め直したので,その一部を参考資料としてまとめておく. UNIXという考え方 UNIXという考え方 Mike GancarzによるUNIXの思想や哲学をまとめた本.古いが全然色あせてない. コマンドラインツールの作り方を書いた本ではないが,これらの思想の上で動くツールはこの思想に準拠して作られるべきだと思う.何度も読んで考え方を染み付かせた. 小さい
今回は、Linuxが搭載されているハードウェアのパーツごと、例えばサウンドボードやマザーボード、ハードディスク等のベンダーや型番といった詳細情報を取得出来るコマンド『Inxi』を紹介する。 1.インストール まずはインストールから。 以下のコマンドを実行しインストールを行う。 Debian/Ubuntu sudo apt-get install inxi RHEL系 sudo yum install inxi --enablerepo=epel 2.コマンドの実行 さて、それでは実際にコマンドを実行してみよう。まずはオプションを付けず、デフォルトの内容を表示してみる。 以下の内容は、実際に自宅で用いてるマシンのデータを表示している。 $ inxi CPU~Quad core Intel Core2 Quad Q9550 (-MCP-) clocked at 2833 Mhz Kernel~
Linuxの標準コマンドは強力なものではあるが、実際に人間が使う際にわかりやすいか、というと十分ではない。 そこで、今回はLinuxの標準コマンドから乗り換える事が可能なコマンドラインユーティリティーを調査、整理してまとめてみることにした。 1.df → dfc まずはこれ。以前にこちらでも記述している。 dfコマンドをより分かりやすくしたコマンドで、バーで利用率を認識することが出来る。 インストールは以下のコマンドで行える。 sudo apt-get install dfc (Debian or Ubuntu) 2.vmstat → dstat パフォーマンスのモニタリングでよく用いられるvmstatを、更に拡張したコマンドであるdstatにする。 dstatには、vmstatにはないネットワークに関するパフォーマンスが追加されており、見た目も見やすくなっている。 インストールは以下のコ
sedを用いた小文字から大文字への変換方法について調べる機会があったのでその備忘。 GNU拡張されたsedとそうでないsedと存在し、GNU拡張がされている場合は以下の内容を実行することで小文字→大文字への変換ができる。 sed 's/\(.*\)/\U\1/' 小文字→大文字の場合は以下。 sed 's/\(.*\)/\L\1/' ただし、GNU拡張されていないsed(VMware ESXiのshellはこれが使われている)の場合は、以下のような内容で実行する必要がある。 sed "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/" 大文字→小文字の場合は以下。 sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" 2016/07/08 追記 その他、s
Linuxで使えるジョークコマンドってどんなのがあるんだろう? ということで、ちょっと調べてまとめてみた。 はっきり言って実用性は皆無なので、間違ってもメインのサーバやマシンには入れちゃダメだぜ! 1.sl ジョークコマンドとして定番。実行すると、AAのSL列車がコンソール上を走り抜ける。 インストールは以下。 debian系の場合 apt-get install sl Redhat系の場合 yum install sl 実行した結果がこちら。 一応、オプションが4個ほどついてるのでその紹介。 -a …小さい人?が助けを求めるようになる -l…SLが小さくなる -F…SLが画面上の方に移動するようになる -e…SLが走っている最中に「Ctrl + C」で離脱できるようになる オプションは組み合わせて使うこともできる。 2.cowsay AAで表示されるウシに、引数で記述した内容を喋らせると
The SCP protocol is a network protocol, based on the BSD RCP protocol, which supports file transfers between hosts on a network. SCP uses Secure Shell (SSH) for data transfer and utilizes the same mechanisms for authentication, thereby ensuring the authenticity and confidentiality of the data in transit. A client can send (upload) files to a server, optionally including their basic attributes (per
LinuxやMacなどで一時ファイル作成が不要になる「プロセス置換」の使い方について紹介します。 1.はじめに 2つのファイルを比較するときには、通常diffを利用します。 % diff foo.txt bar.txt ですが、一方または両方のファイルを加工してから比較したい場合、次のようなことを行うことがあります。 % grep -v hoge foo.txt > foo2.txt % grep -v hoge bar.txt > bar2.txt % diff foo2.txt bar2.txt 具体的な例として、5月9日と5月10日のウェブサイトへのページ別アクセス数のログ(CSVファイル)があるとします(Google AnalyticsからダウンロードしたCSVとか)。 % cat 0509.log aaa.html,300 bbb.html,20 ccc.html,156 ddd
日本アニメ初の快挙!海外アニメ賞を受賞した『スキップとローファー』海外ライセンス部長&プロデューサーが語る、奮闘の舞台裏
Linuxでサイズの大きいファイルを分割する方法を紹介します。 1.はじめに データのバックアップなどをサーバ上で収集したあとローカルPCに保存する際、FTPなどを使ってダウンロードしますが、サーバによってはダウンロード中にエラーになるケースがあります。 ということで、サーバ上のファイルを分割してダウンロード可能なサイズに変更する方法を紹介します。 2.サイズの大きいファイルを分割する サイズの大きいファイルを分割するにはsplitコマンドを利用します。 たとえば、100MB単位でファイルを分割するには次のようにします。 % split -b 100m -a 3 test.tar.gz test.tar.gz- オプションの意味は次のとおりです。 -b:分割するバイト数を指定。500バイトは「500」、10KBは「10k」100MBは「100m」など -a:分割ファイルに付与する接尾辞部分
Webサーバに限らずだけど、サーバのパフォーマンス測定をするときには、CPU利用率やLoadAverageなどの値を測定しておくとベター。そういうデータがあれば、httpdのセッション数の時間推移とCPU利用率の推移を突き合わてやることで、そのマシンの性能一杯を使っているのか、余裕で動いているのかの判断がしやすくなるわけだ。 Linuxであれば"sar"というコマンドを使えば、比較的簡単にCPU利用率やLoadAverageのデータを取得できるので、それを使うのがいいと思うし、自分でもそれを使ってデータ取りしていることがほとんど。 "sar"は、sysstatというパッケージに含まれているので、Debianだったら aptitude install sysstat CentOSでも yum install sysstat でインストールは完了。 使い方は簡単で sar 10 とコマンドライ
織田信長 ぼちぼち、元気にやっています。少し薬にも慣れた...んかなぁ。相変わらず食べられないけど。朝、指がこわばって文字なんて入力できなかったけど、それはほぼなくなった。関節もどこも痛くない。薬効いてきたんやろな。 で、ブログを書こうと言う気がまた起きてきた。 …
booksディレクトリ下の*.txtを全て標準出力経由でrubyのプログラムに渡したい時 cat books/*.txt | nkf -u | ruby -Ku make_dict.rb > dict.txt これでいいのだが、ファイルが多いと "argument list too long" と言われてしまう。 xargsとfindを使ったらできた。 find books | grep "\.txt$" | xargs cat | nkf -u | ruby -Ku make_dict.rb > dict.txt xargs xargsは引数に与えられたコマンドに、標準入力を改行区切りで渡す find lsだとファイル名がフルパスで出なかったので、findでディレクトリ名を指定した。
Network monitoring on Linux This post mentions some linux command line tools that can be used to monitor the network usage. These tools monitor the traffic flowing through network interfaces and measure the speed at which data is currently being transferred. Incoming and outgoing traffic is shown separately. Some of the commands, show the bandwidth used by individual processes. This makes it easy
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く