Linux | bash | Vi
Linux & bash
1. grep
经常用的几个选项:-v 去除, -E 开启扩展,多选用 ‘|’。
常用的正则表达式:字符 * 字符 == “abc .* hijk”。
2. awk
设定分隔符:-F ":| " 可以多个组成一个字符串。
3. printf
这个跟C的差不多用法,做一些字符转换蛮好用。
4. cut
截取字符: -c 1-4 #截取第1到4个字符。
5. netstat :查看网络状况
-a, --all, --listening display all sockets (default: connected)
-p, --programs display PID/Program name for sockets
-n, --numeric don't resolve names
netstat -apn 列出所有网络使用情况,列表一般会比较多,可以用grep -E "??|??|??" 进行过滤
6. ps
查看进程启动时间: ps --pid 18983 -o pid,args,stime 或者直接查看全面信息 ps --pid 18983 -f
7. ulimit [选项[限制]]
-a 列出所有限制.All current limits are reported
-c Core文件.The maximum size of core files created
-d The maximum size of a process's data segment
-f The maximum size of files created by the shell
-l The maximum size that may be locked into memory
-m The maximum resident set size
-n 能打开多少描述符.The maximum number of open file descriptors (most systems do not allow this value to be set)
-p The pipe size in 512-byte blocks (this may not be set)
-s The maximum stack size
-t The maximum amount of cpu time in seconds
-u The maximum number of processes available to a single user
-v The maximum amount of virtual memory available to the shell
Vi
1. 字符串替换:行头, 行尾 s/需要换的字符/换成的字符[/g]
2. 如果已经把【TAB】换成了空格,可以在插入模式下Ctrl+v,再按TAB时插入的是真的TAB。如果你写makefile时遇到*** 遗漏分隔符 。 停止。多半是你没插入真正的TAB
3. 用户配置:~/.vimrc,设置行号set nu,设置tab set tabstop=2,tab插空格 set expandtab, 自动缩进set ai,缩进宽度set shiftwidth=2,语法高亮syntax on
版权声明:本文为博主原创文章,未经博主允许不得转载。

浙公网安备 33010602011771号