ablog

不器用で落着きのない技術者のメモ

grep の検索結果:

AWS CLI 集

AWS

…instances|grep '"DBInstanceIdentifier' "DBInstanceIdentifier": "ar1r9c7i*******" $ aws cloudwatch get-metric-statistics --metric-name CPUUtilization --start-time 2017-07-24T00:00:00+0900 --end-time 2017-07-24T01:00:00+0900 --period 60 --nam…

プロセスがファイルに読み書きしてる内容を覗き見する

… ps -elf|egrep [2]3801 1 S oracle 23801 22232 0 76 0 - 16525 wait 11:03 pts/2 00:00:00 -bash 0 S oracle 23813 23801 0 76 0 - 14732 - 11:03 pts/2 00:00:00 sleep 5 $ ls -l /proc/23801/fd total 0 lrwx------ 1 oracle oinstall 64 Mar 20 11:03 0 …

Oracle Linux 7 でデフォルト起動カーネルを変更する

…エントリを確認 # grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2 Oracle Linux Server (3.10.0-327.el7.x86_64 with Linux) 7.2 ★RHCK Oracle Linux Server (3.8.13-98.7.1.el7uek.x86_64 with Unbreakable Enterprise Kernel) 7.2 Oracle Linux Server …

tar の解凍結果を -O オプションで標準出力する

….tar.gz | grep 'foo' gzipと違い-Oオプションが--stdoutで、解凍結果を標準出力にだします gzやtar.gzに固められたログをgrepする - kanonjiの日記 tar(1) - Linux manual page NAME top tar - an archiving utility SYNOPSIS top Traditional usage tar {A|c|d|r|t|u|x}[GnSkUWOmpsMBiajJzZhPlRvwo] …

tar.gz を解凍せずにその中の特定ファイルの中身を検索する

… ${LINE}|egrep '^./top_'|xargs -I{} -n1 tar xfz ${LINE} -O {}|perl -snle '/top - ([\d:]+)/ and $t=$1;/java/ and print qq/$file $t $_/' -- -file=$LINE done > out.txt 参考 http://d.hatena.ne.jp/kanonji/20110816/1313476218 http://man7.org/linux/…

nfsiostat で NFS の I/O レイテンシや IOPS を調べる

…stat 2>&1|grep /proc open("/proc/meminfo", O_RDONLY|O_CLOEXEC) = 3 open("/proc/self/mountstats", O_RDONLY) = 3 ★ ソースコード より #!/usr/bin/python # -*- python-mode -*- """Emulate iostat for NFS mount points using /proc/self/mountstats ★ """ ... …

strace の -y や -yy でFD番号と共にファイルパスやIPアドレス・ポート番号を表示する

…strace -h|grep '\-y' -y print paths associated with file descriptor arguments -yy print protocol specific information associated with socket file descriptors 実行例 -y でFD番号とともにファイルパスを表示する $ ./strace -y ls > /dev/null execve("/bin/ls", ["ls"],…

よく使う strace のオプション

… $ ps -ef|grep [t]nslsnr oracle 55447 1 0 Feb09 ? 00:04:00 /u01/app/12.1.0.2/grid/bin/tnslsnr MGMTLSNR -no_crs_notify -inherit oracle 56996 1 0 Feb09 ? 00:33:21 /u01/app/12.1.0.2/grid/bin/tnslsnr LISTENER_SCAN3 -no_crs_notify -inherit oracl…

perf-map-agent で Java のプロセスにアタッチすると AttachNotSupportedException が発生する

… $ ps -ef|grep java $ java -cp attach-main.jar:$JAVA_HOME/lib/tools.jar net.virtualvoid.perf.AttachOnce <PID> (中略) Caused by: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or Hot…

実行中のマルチスレッドプログラムの特定スレッドのみ停止(SIGSTOP的な)させる方法

…grid -lLf|grep css$ gdb -p 3449-> LWP:3449 のステータスが t になりました— yohei-a (@yoheia) 2016年3月29日@yoheia gdb -iex="set non-stop on" -iex="set target-async on" -p プロセス して cont -a してから特定プロセスを interrupt してもいいですね。こちらのほうが自由にスレッド間を行き来できていいかも。— Tsukasa Ha…

Oracle GoldenGate 12.1.2.0.0 を使ってみる

…]$ ps -ef|grep [g]g oracle 9933 9923 0 01:30 ? 00:00:00 /u01/Middleware/OGG_Source/ggcmd PARAMFILE /u01/Middleware/OGG_Source/dirprm/jagent.prm REPORTFILE /u01/Middleware/OGG_Source/dirrpt/JAGENT.rpt PROCESSID JAGENT USESUBDIRS oracle 9966 …

WebLogic Server の実行スレッド以外のスレッドの数を調べてみた

…OFF)の場合 $ grep '^\"' wls12120_thread_dump_2cpu_20160124.log|wc -l 33 $ grep '^\"' wls12120_thread_dump_2cpu_20160124.log|grep -v weblogic.kernel.Default|wc -l 28 $ grep '^\"' wls12120_thread_dump_2cpu_20160124.log|sort "[ACTIVE] ExecuteThre…

hugepages_settings.sh 使うときは PRE_PAGE_SGA=TRUE にしたほうが良いと思う

…e HPG_SZ=`grep Hugepagesize /proc/meminfo | awk {'print $2'}` # Start from 1 pages to be on the safe side and guarantee 1 free HugePage NUM_PG=1 # Cumulative number of pages required to handle the running shared memory segments for SEG_BYTE…

DBサーバの空きメモリサイズの見方(Oracle Database on Linux)

… for easy grepping and expansion. */ seq_printf(m, "MemTotal: %8lu kB\n" "MemFree: %8lu kB\n" + "MemAvailable: %8lu kB\n" "Buffers: %8lu kB\n" "Cached: %8lu kB\n" "SwapCached: %8lu kB\n" @@ -105,6 +141,7 @@ static int meminfo_proc_show(stru…

vm.min_free_kbytes からの wmark_{min|low|high} 算出式

…sysctl -a|grep min_free_kbytes vm.min_free_kbytes = 16114 ★ min_free_kbytes = 16,114 KB $ cat /proc/zoneinfo Node 0, zone DMA pages free 3976 min 3 ★ min_pages = 3 * 4KB = 12 KB low 3 ★ low_pages = 3 * 4KB = 12 KB high 4 ★ high_pages = 4 * …

pgrep で子プロセスの PID を調べる

…0 ├─pstree,14216 -alp 13840 ├─zsh,13940 │ └─sleep,14213 10 └─zsh,13992 └─sleep,14215 10 シェルスクリプトで子プロセスの PID を取得して何か自動処理したいときには pgrep が便利そう。 P: 親プロセスの PID を指定 d: デリミタを指定 $ pgrep -d: -P $$ 13940:13992 参考 子プロセスのプロセスIDを取得するコマンド - アウトプットができる技術者に

”私の環境で”大きなテキストファイルをawkで処理するときにcatで投げ込むと速い理由

….txt 2>&1|grep -C2 fadvise open("sample.txt", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0664, st_size=2800000000, ...}) = 0 fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffa7cb3930) = -1 ENOTTY (Ina…

大きなテキストファイルをawkで処理するときにcatで投げ込むと速い理由

….txt 2>&1|grep -C2 fadvise $ /usr/src/gnu/coreutils-8.24/src/cat --version|head -1 cat (GNU coreutils) 8.24 $ strace /usr/src/gnu/coreutils-8.24/src/cat sample.txt 2>&1|grep -C2 fadvise open("sample.txt", O_RDONLY) = 3 fstat(3, {st_mode=S_I…

Perlワンライナー集

…。 awk、sed、grep の正規表現の書き方などをそれぞれ覚えれない。awk、sed、grep でできることはだいたい Perl でできるので、Perl に絞ると覚えることを減らせる*2。 最小限の労力で最大限の仕事ができる。ちょっとしたプログラムを書くような処理でも Perl ワンライナーを使うとたった1行で済むことがあります*3。 Perlワンライナー集 一部、Perl 以外に bash、find、xargs なども含んでいます。 レコードセパレータを変更する per…

funcgraph で Linux カーネル内のボトルネックをミクロに追跡する

… # ps -ef|grep [c]hrome # ./funcgraph -Htp 4511 vfs_write 参考 perf-tools/funcgraph at master · brendangregg/perf-tools · GitHub Ftrace: The hidden light switch [LWN.net] Ftrace と Systrace - steps to phantasien Velocity 2015 linux perf tools …

VirtualBox を 4.3.20 から 4.3.22 にアップグレードした

…$ ps auxw|grep yum|grep -v grep root 4774 11.9 0.9 446356 148708 pts/0 S+ 10:17 2:05 /usr/bin/python /usr/bin/yum update VirtualBox-4.3 $ watch pstree -alp 4774 yum,4774 /usr/bin/yum update VirtualBox-4.3 └─sh,5134 /var/tmp/rpm-tmp.3nXBqe 2…

最近使った Perl ワンライナーのメモ

…{map{$t=$_ and print $t;map{print qq/$t\t$_\t$h->{$t}->{$_}/} keys %{$h->{$_}}} keys %$h}'' strace.loggrep -hA 20 '^top -' top.logperl -lane '/top - ([\d:]+)/ and $t=$1;$F[0]=~/\d+/ and printf (qq/%s %s%s\n/,$t,$_,lc(sprintf(q/%X/,$F[0])))'

Javaのスレッドダンプの読み方

…$ ps auxw|grep [j]ava yazekats 21083 0.0 0.0 5411796 14924 pts/0 Sl+ 15:36 0:00 java Counter $ kill -3 21083 Java 7u4 HotSpot では jcmd で取得できるらしいです。 $ jcmd 30759 sun.tools.jcmd.JCmd 30444 weblogic.Server $ jcmd 30444 Thread.print|head -10 304…

micbench でノートPCのメモリアクセスレイテンシを計測してみた

…/cpuinfo |grep 'model name'|head -1 model name : Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz $ cd /sys/devices/system/cpu/cpu0/cache $ echo `cat index0/level` `cat index0/type` `cat index0/size` 1 Data 32K $ echo `cat index1/level` `cat index1…

gdb でレジスタの値を書き換えてみる

…$ ps auxw|grep [w]rite_loop yazekats 5873 97.6 0.0 3968 284 pts/0 R+ 22:01 1:18 ./write_loop ファイルディスクリプタを確認する。 $ ls -l /proc/5873/fd total 0 lrwx------ 1 yazekats yazekats 64 Dec 19 22:10 0 -> /dev/pts/0 l-wx------ 1 yazekats yazekats 64 De…

Huge Page の解放について

…linux ~]# grep -i hugepage /proc/meminfo AnonHugePages: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB [root@yazekats-linux ~]# sysctl -w vm.nr_hugepages=200 vm.nr_hugepages = 200 [root@y…

micbench をインストールしてみた

…/cpuinfo |grep 'model name'|head -1 model name : Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz [yazekats@yazekats-linux ~]$ cd /sys/devices/system/cpu/cpu0/cache [yazekats@yazekats-linux cache]$ echo `cat index0/level` `cat index0/type` `cat ind…

prociostat.pl と visualize_prociostat.R で Linux のプロセスのボトルネックを分析する

…対象プロセス(今回はgrep)を実行する $ grep -R foo . > /dev/null 2>&1 & [1] 14520 prociostat.pl でプロセスの性能情報をCSVに記録する $ perl prociostat.pl -C -p 14520 pid 14520 uid 501 user 20.16 sys 8.16 r 11112370176 w 0 cmd grep-Rfoo. ^CBye! ←Ctrl+Cで停止 $ ls -1 process.14…

LinuxでCPU使用率を上げるコマンド

…d -multi `grep processor /proc/cpuinfo|wc -l` としてやれば良いです。 最後に書籍紹介。絵で見てわかるシステムパフォーマンスの仕組み作者: 小田圭二,榑松谷仁,平山毅,岡田憲昌出版社/メーカー: 翔泳社発売日: 2014/06/21メディア: 単行本(ソフトカバー)この商品を含むブログ (2件) を見るSystems Performance: Enterprise and the Cloud (English Edition)作者:…

yum update したら"Another app is currently holding the yum lock; waiting for it to exit..."と怒られる

…# ps -elf|grep yum 0 S root 3982 3625 3 80 0 - 131821 poll_s 09:28 ? 00:00:22 /usr/bin/python /usr/share/PackageKit/helpers/yum/yumBackend.py get-updates none 0 S root 4589 4470 0 80 0 - 25825 pipe_w 09:40 pts/1 00:00:00 grep yum # kill 398…