in gdb tui mode scroll the command window

Use cgdb instead.

Let GDBW denote the command window,
let SRCW denote the source window
let TTYW denote the input window.

Cgdb basic usage

1
2
3
4
5
6
ESC key in GDBW: switch to SRCW
i key in SRCW: switch to GDBW
T key in SRCW: switch on/off TTYW
PgUp/PgDn key in GDBW: scroll GDBW
PgUp/PgDn key in SRCW: scroll SRCW
-/= in SRCW: decrease/increase SRCW size

Patch: GDBW output is truncated.
cgdb/scroller.cpp:146
https://github.com/cgdb/cgdb/pull/269

refer to:
https://github.com/cgdb/cgdb/blob/master/doc/cgdb.texi

linux命令备忘录

名词

1
2
3
4
5
pie: position-independent executable
pic: position-independent code
aslr: address space layout randomization
got: global offset table
vdso: virtual dynamic shared object

Basic command

1
2
3
4
5
6
7
8
9
10
11
12
13
grep [OPTION]... PATTERNS [FILE]...
find [-H] [-L] [-P] [-Olevel] [-D debugopts] [path...] [expression]
find . -size +2G -exec du -sh {} \;
ps axl | grep VirtualBoxVM | grep -v grep | awk '{print $3};'
cat /etc/passwd | sort -k5,5 -t: | column -t -s:
while true; do echo sleep 1 sec; sleep 1; cat /home/work/aa.txt 2>/dev/null && echo ok && break; done
echo first | xargs -i echo {} second
 
cat /etc/shadow
sudo !!
 
cd other_dir
cd - # return back

swap文件

1
2
3
4
dd if=/dev/zero of=./swap_file bs=1G count=8
mkswap ./swap_file
swapon ./swap_file
swapoff ./swap_file

objcopy

1
2
3
objcopy -I binary -O elf32-i386 -B i386 test.jpg test.o
objdump -s -b binary test.o
readelf -s test.o

静态链编stdc++

1
-Bstatic -lstdc++ -Bdynamic

工具

1
2
3
4
5
6
systemtap
inotify-tools
windres
reptyr
nmcli
nmtui

自启动

1
2
3
4
5
6
7
8
9
10
11
12
#/lib/systemd/system/mytask.service
#ln -s /lib/systemd/system/mytask.service /etc/systemd/system/multi-user.target.wants/mytask.service
[Unit]
Description=mytask
After=network.target
 
[Service]
Type=simple
ExecStart=mytask.sh
 
[Install]
WantedBy=multi-user.target

ubuntu

1
2
3
4
5
6
7
8
9
10
#网络配置文件路径,默认DHCP的连接不会生成文件
/etc/NetworkManager/system-connections/
#run arm64 binary on x86
dpkg --add-architecture armhf && apt-get update && apt-get install libc6:armhf
cat /proc/sys/fs/binfmt_misc/
qemu-user -L /home/bamanzi/i386-libs ./prog
#disable background process
systemctl disable unattended-upgrades
ss -tap
pv -d <pid>

centos

1
2
3
4
#网络配置文件路径
/etc/sysconfig/network-scripts/ifcfg-
#compiz
https://spins.fedoraproject.org/mate-compiz/download/index.html

refer to:
http://blog.chinaunix.net/uid-28461677-id-5766451.html
https://blog.csdn.net/weixin_33842304/article/details/91443399
https://unix.stackexchange.com/questions/4034/how-can-i-disown-a-running-process-and-associate-it-to-a-new-screen-shell
https://blog.csdn.net/wuzhong8809/article/details/117450302
https://stackoverflow.com/questions/18312935/find-file-in-linux-then-report-the-size-of-file-searched
https://www.toutiao.com/a7073448755428688399/
https://www.likecs.com/show-695436.html