Linux 命令#
ctrl + C打断执行pwd输出当前位置cmd1;cmd2首先运行命令 1,然后运行命令 2cmd1&&cmd2仅在命令 1 成功结束时才运行命令 2cmd1||cmd2仅当命令 1 失败时才运行命令 2strace追踪程序系统调用touch新建文件,内容为空catcat filenameTo view a single filecat [filename-whose-contents-is-to-be-copied] > [destination-filename]Copy the contents of one file to another file.cat file1 >> file2Cat command can append the contents of one file to the end of another file.
- 管道;用
|连接两个命令,以前面一个命令的输出作为后面命令的输入strace -f gcc a.c 2>&1 | vim -This will pipe both stdout and stderr to vim. The-argument tells vim to read from stdin.strace pmap 152 |& vim -
|&: This is a shorthand for2>&1 |in bash and zsh. It passes both standard output and standard error of one command as input to another.
sort -nk 6依第 6 列升序排列- 执行多次,或循环执行
#for i in {1..5}; do // while true; do > command >done - crontab 的使用
crontab -e- 注意:crontab 运行的环境并不包含 docker 命令。需要指定完整的路径。
lsof -i:端口号查看端口占用情况kill -9 PID杀掉对应的进程grep(global regular expression) 用于查找文件里符合条件的字符串或正则表达式which查找安装路径 如which dockerls -l详细信息~/.bashrc是 Bash shell 在每次启动时都会自动执行的一个脚本文件,可以用于设置环境变量、别名和一些其他 Bash shell 配置。source /opt/rh/devtoolset-9/enable更新 gcc 版本- export PS1='[][\W]$ []' 修改 PS1 变量,让其更加简洁。PS1 的默认设置为
\[\][\u@\h \W]\$ \[\]
tartar cvf file.tar *.ccreates a tar file called file.tar which is the Archive of all .c files in current directory.tar xvf file.tarextracts files from Archives.ztells tar command that creates tar file using gzip 即tar.gz
- 可以利用 TAB 补全查看所有可用的命令选项 (连按两次 TAB 键)
汇编相关#
objdump -d filenameprint the assembler content of the sections capable of execution.objdump -s filenameprint the complete content of all the sections of the file
gcc#
gcc - E a.c对 a.c 进行宏展开- 升级 gcc 版本到 gcc9 CentOS7 升级 gcc 版本到 gcc9
source /opt/rh/devtoolset-9/enable -static静态编译,省去动态链接相关的系统调用
vim#
- cmd 模式
:!cmdexecute a shell command from within Vim!gcc %编译!xxd将当前文件转换为十六进制表示并显示在终端中%!xxd将当前文件的内容通过管道传递给外部命令 xxd,并将其输出替换为当前文件的内容
:set nu显示行号:set wrap:%!grep execve:%! grep -v ENOENT:%s/term/another_term/g替换
- visual 模式 按 v 进入
y复制选中内容d删除
uundo
gdb#
- 编译时要带
-g bttrace