====== Linux ====== * [[http://vbird.dic.ksu.edu.tw/|鸟哥的linux私房菜]] * [[http://www.debian.org/doc/manuals/debian-reference/]] * [[maintain]] * [[ubuntu]] * [[kylin]] * [[linux input subsystem]] * [[linux-program]] * [[shell]] * [[.:gsettings]] * [[network]] * [[https://paper.seebug.org/779/|驱动开发入门]]这个技术博客其他文章也很不错=) * [[wp>Direct_Rendering_Manager|DRM 子系统]]: Direct Rendering Manager(DRM)是linux内核子系统,负责与显卡交互 * [[https://blog.csdn.net/weixin_41028621/article/details/110202300|libdrm]] ===== Fun ===== * [[cmatrix]] * [[http://misc.flogisoft.com/bash/tip_colors_and_formatting|Terminal colors and formating]],适用于 ANSI/VT100 命令行窗口 * [[https://en.wikipedia.org/wiki/ANSI_escape_code|ANSI escape code]] ===== Kernel ===== * [[https://szlin.me/2016/05/12/linux-kernel-%E5%B0%8D%E6%96%BC%E7%B3%BB%E7%B5%B1%E7%99%BC%E7%94%9Fkernel-panic-%E8%87%AA%E5%8B%95%E9%87%8D%E5%95%9F%E4%B9%8B%E5%8E%9F%E7%90%86/|Linux Kernel 對於系統發生kernel panic 自動重啟之原理]] * 在系統中直接對''/proc/sys/kernel/panic''進行設定. 預設為0, 也就是不會自動重啟系統 * 或編輯 /etc/sysctl.conf, 在裡面設定 ''kernel.panic = 5'' 之後開機即自動設定完成 * [[https://www.ibm.com/developerworks/cn/linux/l-cn-dumpanalyse/index.html|使用 Crash 工具分析 Linux dump 文件]] * ''/proc''下的信息:[[http://man7.org/linux/man-pages/man5/proc.5.html]] * linux 怎么添加i2c设备的方法:https://www.kernel.org/doc/Documentation/i2c/instantiating-devices ===== Desktop ===== * [[X11]] * 桌面种类: * KDE:[[https://kde.org/]] * GNOME: [[http://gnome.org/]] * DEEPIN: [[https://www.deepin.org/zh/dde/]], 国产 * Cinnamon: [[https://github.com/linuxmint/cinnamon]] * MATE: [[https://zh.wikipedia.org/wiki/MATE|zh wiki]], [[https://mate-desktop.org/zh_cn/|mate-desktop.org]] * Budgie: [[https://zh.wikipedia.org/wiki/Budgie_(%E6%A1%8C%E9%9D%A2%E7%8E%AF%E5%A2%83)|zh wiki]] * Xfce: [[https://www.xfce.org/|xfce.org]] [[https://wiki.archlinux.org/title/xfce|archlinux wiki]]轻量 * 获取桌面环境 * 桌面环境中可用''echo $XDG_CURRENT_DESKTOP''或''echo $DESKTOP_SESSION'' 查看 * 获取详细版本可安装 ''screenfetch'' sudo apt-get install screenfetch screenfetch # 得在桌面上开的 terminal 才有桌面信息, ssh 没有。 * ssh 可用如下指令获取 pgrep -l "gnome|kde|mate|cinnamon|lxde|xfce|jwm" # 或 ps -A | egrep -i "gnome|kde|mate|cinnamon|lxde|xfce|jwm" # 或 ls /usr/bin/*session* * 一个图形信息软件 ''sudo apt install hardinfo'' * 桌面图标设置 [[https://wiki.deepin.org/wiki/Desktop_Entry_%E6%96%87%E4%BB%B6|Desktop Entry]] ===== Package manager ===== * debian 系用dpkg/APT,//.deb// ''dpkg'', ''apt-get'', ''aptitude'' * [[https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html|Basics of the Debian package management system]] * redhat 系用RPM, //.rpm// , ''yum'' * dpkg 添加32位包信息: # 添加32位包索引 $ sudo dpkg --add-architecture i386 $ sudo apt-get update * [[http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/|简单deb包制作]] * [[https://www.debian.org/doc/manuals/maint-guide/index.zh-cn.html|Debian 新维护者手册]] * FHS: [[wp>Filesystem Hierarchy Standard]] ===== Service ===== * init.d 脚本编写参考 ''/etc/init.d/skeleton'' 使用start-stop-daemon启动nodejs保存输出的方法: start-stop-daemon --start --quiet \ --pidfile $PIDFILE -b -m --startas \ /bin/bash -- -c "exec ${NODE_PATH} ${NODE_SCRIPT} >> ${LOG_PATH} 2>&1" * [[Systemd]] * [[Upstart]] * [[supervisor]] ===== Commands ===== * nohup * watch ==== ldconfig ==== * ''/etc/ld.so.conf'' 动态链接搜索路径设置, 改完后需要 ''sudo ldconfig'' * ''ldconfig -p'' 列举动态链接库列表 ===== Tools ===== * Socat, simulate a pair of serial ports: ''socat -d -d PTY PTY'' * [[tmux]] ===== Hardware ===== *使用 bash 串口通信 # 设置波特率 ## 查看当前信息 $ stty -F ttyO1 ## 设置波特率 $ stty -F ttyO1 38400 # 监听 $ od -t x1 ttyO1 # 写 $ echo hello > ttyO1 # 或者用 screen 读写 $ screen tty01 38400 ===== Tips ===== ==== 文件查找 ==== * https://www.madebygps.com/an-intro-to-finding-things-in-linux/ * **which** : 查看命令关联之文件(或link) * **locate** : 该命令需要索引数据库作为支撑,在 Ubuntu 中数据库文件位于 ''/var/cache/locate/locatedb''。一般来说,这个数据库文件每天通过 cron 自动更新。可执行 ''sudo updatedb'' 来手动更新。 假如想要查找一个名为 linux.html 的文件,可以执行:''locate linux.html''。locate 选项 ''-r''即可使用正则表达式。具体 man locate 查看说明. * **find** : 一般使用方法:''find 位置 -name 文件名称''例如'' find / -name linux.html''。find 也可以根据文件大小''-size n ''、''-atime n ''来搜索文件。 此外,find支持使用正则表达式,只需指定 ''-regex'' . 具体可以 man find 查看说明. ==== 二进制文件 ==== * 查看:''od -x '', 具体''man od''; * 小的二进制文件可用 vim 编辑:''vim -b ''打开后,输入命令 '':%!xxd''; * 大内容二进制文件修改部分: ''printf "\x41\x41" | dd of=big_binary.dat bs=1 count=2 conv=notrunc seek=888888'' ;