linux
songpeng26
这个作者很懒,什么都没留下…
展开
-
apt-build 使用
环境:公司的arm设备1. 测试编译:apt-build build-source tree报错:cc1: error: unknown value ‘armv7’ for -mtunecc1: note: valid arguments are: cortex-a35 cortex-a53 cortex-a57 cortex-a72 cortex-a73 thunderx thunderxt88p1 thunderxt88 thunderxt81 thunderxt83 xgene1 falko原创 2021-06-18 11:27:54 · 825 阅读 · 0 评论 -
expect 入门用法
#!//usr/bin/expectset timeout 1000spawn ssh scale@172.25.115.195expect "*password*"send "123456\r"expect "*scale*"send "touch abc.txt\r"send "ls\n"expect eof原创 2021-04-27 14:17:07 · 285 阅读 · 0 评论 -
qt gdb debug remotely
sudo apt install libc6-dbgsudo apt install libc6-devcopy all files in debug folder include <program name>.debugproceed with normal gdb remote debugging:https://blog.csdn.net/songpeng26/article/details/115957725原创 2021-04-23 16:14:24 · 247 阅读 · 0 评论 -
gdb remote debuging from ubuntu to arm
# on hostarm-linux-gnueabihf-gcc -g -o main main.cscp main use@ip:/home/user# on remote(arm)# 172.25.115.195 is arm ip address# 13000 is port to debug, can be anycd /home/usergdbserver 172.25.115.195:13000 main# on hostarm-linux-gnueabihf-gdb main原创 2021-04-21 15:35:53 · 96 阅读 · 0 评论 -
ps command understanding
一、ps aux -> BSD语法1. ps a -> 显示所有用户的程序1-1. ps aux 和 ps ux 对比1-1-1. ps aux 列出了所有用户的进程peng@peng-vmware:~/Desktop$ps auxUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDroot 24800 0.2 1.6 80572 32532 pts/1 S+ 08原创 2020-08-30 11:48:06 · 529 阅读 · 0 评论 -
simulate “insert“ key with xmodmap | 模拟 “shift + insert” key with autokey-gtk
1.simulate insert key with xmodmap用F9来替换insert键:# set Key and Shift+Keyxmodmap -e "keycode 75 = Insert Insert"or# set allxmodmap -e "keycode 75 = Insert Insert Insert Insert Insert Insert"原理:先用xev来查看按键的键值,上面的keycode 75就是按F9输出的键值notice:Each keysy原创 2020-08-29 14:23:54 · 134 阅读 · 0 评论 -
vim-plug + nerdtree + vim-colorschemes
1.下载vim-plugcd ~/.vim/autoloadwget https://github.com/junegunn/vim-plug/archive/0.10.0.tar.gztar -xvf 0.10.0.tar.gzcp vim-plugxxxxxxx/plug.vim ./2.配置vim-plug , 安装 vim-colorscheme 和 nerdtree2-1 修改~/.vimrcvim ~/.vimrc输入:" vimset nocompatible" vi原创 2020-08-22 23:23:49 · 394 阅读 · 1 评论 -
/etc/bash.bashrc DIY
# env statusecho “sourcing /etc/bash.bashrc…”# cd shortcutalias …2=“cd …/…/”alias …3=“cd …/…/…/”alias …4=“cd …/…/…/…/”alias …5=“cd …/…/…/…/…/”alias …6=“cd …/…/…/…/…/…/”alias …7=“cd …/…/…/…/…/…/…/”alias …8=“cd …/…/…/…/…/…/…/…/”alias cdd=“cd ~/Desk原创 2020-08-22 20:54:55 · 2254 阅读 · 0 评论 -
.bashrc DIY
# env statusecho “sourcing ~/.bashrc…”# enter desktop when open terminalecho “enter desktop…”if [[ $PWD == $(realpath ~) ]]; thencd ~/Desktop/fi原创 2020-08-22 20:46:24 · 190 阅读 · 0 评论 -
Linux Shell 环境变量 /etc/profile /etc/bashrc ~/.profile ~/.bashrc 作用时机
1.为了一探环境变量起作用的时机,我们在各个关键文件中追加echo1-1.在/etc/profile中追加`echo "sourcing /etc/profile..."1-2.在/etc/bashrc中追加echo "sourcing /etc/bashrc..."or在/etc/bash.bashrc (Debian/Ubuntu)中追加:echo "sourcing /etc/bash.bashrc..."1-3.在~/.profile中追加echo "sourcing ~/.原创 2020-08-22 18:19:47 · 294 阅读 · 0 评论 -
log4cpp arm环境 直接编译/交叉编译
1. build./configure --build=armmakemake checkmake install2. use log4cpp2.1 makefileCC=g++all: $(CC) main.cpp -I /usr/local/include -L /usr/local/lib -llog4cpp -o mainclean: rm -f *.o main原创 2020-06-17 16:46:00 · 1435 阅读 · 0 评论 -
linux build/use library
Linux下动态库文件的文件名形如libxxx.so,其中so是 Shared Object 的缩写,即可以共享的目标文件。在链接动态库生成可执行文件时,并不会把动态库的代码复制到执行文件中,而是在执行文件中记录对动态库的引用。程序执行时,再去加载动态库文件。如果动态库已经加载,则不必重复加载,从而能节省内存空间。Linux下生成和使用动态库的步骤如下:编写源文件。 将一个或几个源文件编译链接,生成共享库。 通过-L<path> -lxxx的gcc选项链接生成的libx...转载 2020-06-17 12:38:40 · 208 阅读 · 0 评论 -
bash 符号运用搜集
01.大括号Brace expansion is a mechanism by which arbitrary strings may be generated. This mechanism is similar to filename expansion (see Filename Expansion), but the filenames generated need not exist. Patterns to be brace expanded take the form of an optio原创 2020-05-26 10:38:05 · 206 阅读 · 0 评论 -
login shell
# sudo asks for *your* password and must be configured via /etc/sudoerssudo -s # Shell for superusersudo -i # Login shell for superusersudo -u jimmy -s # Shell for user "jimmy"sudo -u jimmy -i # Login shell for user "jimmy原创 2020-05-18 10:06:14 · 114 阅读 · 0 评论 -
VirtualBox 中的 Debian 与 Windows 主机共享文件夹/双向拷贝
1. 安装好虚拟机增强程序vbox的安装环境:保持安装盘在的状态,调整启动顺序为 hard disk -> cdrom启动后,进入terminal,更新程序apt-get updateapt-get install build-essential linux-headers-$(uname -r)2.新增一块盘片,盘片对应VirtualBox安装目录下的VBoxGuestAdditions.iso文件(64位操作系统上路径是:C:\Program Files\Oracle\VirtualB原创 2020-05-11 15:13:38 · 1078 阅读 · 0 评论 -
linux build kernel module
1. 安装需要的库apt install linux-headers-$(uname -r)note: 如果没安装headers,/lib/modules/$(uname -r)里面就没有build 文件夹2. 最基础的 kernel module 代码#include <linux/init.h>#include <linux/module.h>#includ...原创 2020-05-08 13:52:38 · 1174 阅读 · 0 评论 -
linux 初装需要安装到包 / 常用库 collection/收集
Libncurses库:用来在显示器上显示文本界面。典型例子就是Linux内核的make menuconfig配置界面。:Libssl-dev:openssl的头文件和库原创 2020-05-08 13:42:30 · 647 阅读 · 0 评论 -
linux kernel 编译
1.grab the kernel from kernel.orgwget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.4.189.tar.gz2. extract filetar -xvf linux-4.4.189.tar.gzcd linux-4.4.1893. Install the required...原创 2020-05-08 10:47:50 · 466 阅读 · 0 评论 -
tree practice
1..树形显示目录所有内容:tree -a2..完整路径显示/full path:tree -af3..按修改时间排列:tree -aft4.. 目录深度设为2层:tree -aft -L 25.. 打印显示时间:tree -aft -L 2 -timefmt '%y-%m-%d %H:%M'...原创 2020-05-04 00:10:10 · 113 阅读 · 0 评论 -
快捷键/shortcut 收集/collection
mac 截图:在剪贴板里获取整个屏幕的截图:Shift+Command+3截取部分屏幕,并复制图片到剪贴板:Shift+Command+4在剪贴板里获取整个屏幕的截图:Shift+Control+Command+3截取部分屏幕,并复制图片到剪贴板:Shift+Control+Command+4...原创 2020-04-18 10:16:33 · 168 阅读 · 0 评论 -
linux window manager/display manager check/config
which window manager is running:wmctrl -mwindow manager config:$sudo apt-get install xfce4可用以命令显示当前系统安装的窗口管理器:$sudo update-alternatives --display x-window-managerorcat /etc/X11/default-display-...原创 2020-04-17 14:09:05 · 433 阅读 · 0 评论 -
linux sed -i replace text/sed 跟expression替换文本
1.生成测试文本:peng@peng:~$ cat > aa.txtaabbccddee^C2.原本的方案,用vi替换文本:aa替换成abc:%s/aa/abc/3.用sed命令替换文本:sed -e "s/aa/abc/" aa.txt原创 2020-04-09 19:28:25 · 717 阅读 · 0 评论 -
linux cut practice
step1:bash --versionresult:root@CN_PENGS01:/home/peng# bash --versionGNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)Copyright (C) 2016 Free Software Foundation, Inc.License GPLv3+: G...原创 2020-04-07 13:32:56 · 125 阅读 · 0 评论 -
linux from scratch / 从零开始生成linux
文章背景:http://www.linuxfromscratch.org/lfs/view/stable/index.html创建分区:parted /dev/sda mkpart primary ext4 50G 100%参考:https://blog.csdn.net/songpeng26/article/details/105180694格式化分区:mkfs /dev/sda3...原创 2020-04-06 11:16:20 · 1252 阅读 · 0 评论 -
grep command practice
1. get several lines around searching line:搜索wget --help输出文本中,带continue字段的所在行的 附近几行。grep practice 1:1 line after "continue"line ,1 line before "continue"line.command:wget --help | grep -C 1 cont...原创 2020-04-01 13:23:59 · 157 阅读 · 0 评论 -
linux 登入/登出日志
last command:-F, --fulltimes Print full login and logout times and dates.-n, --limit number Tell last how many lines to show.-f, --file file Tell last to use a specific file instead of ...原创 2020-03-30 15:46:38 · 914 阅读 · 0 评论 -
debian: set shortcut / 设置快捷键 -> 打开终端 / open terminal
打开终端:Ctrl + Alt + t结果:在xfce下不管用。设置快捷键:Application -> Setting -> Keyboard -> Application shortcuts 选项卡 -> Add -> Command输入:x-terminal-emulator -> Ctrl + Alt + t。结果:成功...原创 2020-03-30 13:46:04 · 683 阅读 · 0 评论 -
debian 设置不要锁屏/ do not lock screen / 退出登录
Setting -> Power manager -> Display 选项卡 -> 将"black after / sleep after / switch off after" 调整为Never。Setting -> Power manager -> Security 选项卡 -> 将"lock screen when system is going fo...原创 2020-03-30 11:44:46 · 1835 阅读 · 0 评论 -
linux: kill process/program / 杀死进程
杀死图形界面的进程:在终端输入:xkill然后点选界面通过PID杀死进程1:pidof 进程名kill 进程ID通过PID杀死进程2:获得进程ID:ps aux | grep 进程名根据进程ID杀死进程:kill 进程ID备注:从几个程序的位置,看通用性/usr/bin/xkill/bin/ps/bin/pidofps 和 pidof 位于bin文件夹里,看来通用...原创 2020-03-30 10:57:27 · 502 阅读 · 0 评论 -
mount point / 挂载点
挂载点定义:A mount point is a directory (typically an empty one) in the currently accessible filesystem on which an additional filesystem is mounted (i.e., logically attached).挂载点的个人理解:linux的设备挂载比较灵活,在目...原创 2020-03-29 18:45:17 · 4325 阅读 · 0 评论 -
primary / extended / logic 分区的区别
primary —主分区。可以做引导分区。最多不能超过四个。在主分区中,不允许再建立其他逻辑分区。extended----扩展分区,不可引导的分区称之为扩展分区。最多一个。logic----逻辑分区,需要从扩展分区中分逻辑分区。参考文献:MBR:https://blog.csdn.net/songpeng26/article/details/105181186分区的区别:htt...原创 2020-03-29 17:20:51 · 5561 阅读 · 0 评论 -
MBR / GPT
缩写的全文:MBR (Master Boot Record)GPT (GUID Partition Table)如果从方便记忆的角度,他们的区别是:MBR:我们原来用的“分区表”GPT:新款牛叉分区表如果从关联的角度,他们的区别是:BIOS + MBR模式UEFI + GPT模式如果从如何选择角度,他们的区别是:2T以上磁盘要用GPT,2T以下都可以。...原创 2020-03-29 16:41:39 · 266 阅读 · 0 评论 -
gparted 创建分区 / mkfs 格式化分区为某filesystem
1.0 创建分区gpartedmkpart part-type [fs-type] start endMake a part-type partition for filesystem fs-type (if specified), beginning at start and ending at end (by default in megabytes). part-type shou...原创 2020-03-29 16:34:10 · 1052 阅读 · 0 评论 -
sda 在linux是什么意思
sda:sd - scsi sata usb devicesda中的a代表系统中这类设备的序号sda表示第一个磁盘设备sda5表示第一个设备的第5个分区原创 2020-03-29 12:11:38 · 6529 阅读 · 0 评论 -
linux 目录结构:/bin /sbin /usr/bin /usr/local/bin
/bin This directory contains executable programs which are needed in single user mode and to bring the system up or repair it./sbin Like /bin, this directory holds commands needed to boo...原创 2020-03-28 13:15:27 · 370 阅读 · 0 评论 -
Ubuntu 18.10 cosmic换源
前情提要:今天突然ubuntu apt update 无法用了,通过调查才知道ubuntu产品售后是有期限的。过了期限的版本,会被切换到old release的源。尝试切换到中科大源:##中科大源deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic main restricted universe multiversedeb-src https:/...原创 2020-03-22 12:49:28 · 3098 阅读 · 1 评论 -
linux sed - stream editor(.s + ed )
使用sed打印文件的第x行到第y行,练习:生成一个20行的练习文件:seq 20 > test.txt文件内容如下:1234567891011121314151617181920打印第11行到第15行: sed -n -e "11,15 p" -e "15 q" test.txt使用sed打印文件的第x行到第y行,需要用到的知识:-...原创 2020-03-21 21:23:57 · 147 阅读 · 0 评论 -
VMware debian 装机流程 / VirtualBox ubuntu 装机流程
01. keep login;02. autologin;03.vi set nocompatible;04. change source05.sudo;06. git07. open-vm-tools-desktop;08. vmware patch09. ssh-keygen;原创 2020-03-19 19:31:40 · 234 阅读 · 0 评论 -
debian9 自动登陆
vi /usr/share/lightdm/lightdm.conf.d/01_debian.conf[SeatDefaults]autologin-user=username原创 2020-03-19 18:45:20 · 743 阅读 · 0 评论 -
linux: change user password
进入管理员账户:sudo su如果不知道原密码,将旧的密码过期:passwd username -e重设账户密码:passwd username登录验证:Ctrl+Alt+F1登录验证,Ctrl+Alt+F7退出。...原创 2020-03-19 13:34:27 · 2421 阅读 · 0 评论