类似于正则表达式规则,略有不同
| 符号 | 匹配项目 |
|---|---|
| * | 任意多个字符(包含0个) |
| ? | 单个任意字符 |
| [characters] | 任意一个属于字符集characters的字符 |
| [!characters] | 任意一个不属于字符集characters的字符 |
| [[:class:]] | 任意一个属于指定字符类的字符 |
| 字符类 | |
| 符号 | 匹配项目 |
| :-------: | :--------------: |
| [:digit:] | 任一个数字 |
| [:alnum:] | 任一个数字或字母 |
| [:lower:] | 任一个小写字母 |
| [:upper:] | 任一个大写字母 |
举例:把1.0 2.0 3.0 ~ 50.0等文件移动到目标文件夹dst
mv [[:digit:]] <dst>
mv [[:digit:]][[:digit:]].0 <dst>
man 显示手册页whatis 显示命令的简要概述--help shell内置命令的文档infotype 显示命令的类型which 显示可执行命令的路径less 分页显示wc word count,统计字数find 举个例子,#在当前目录搜索大写字母开头的文件,不要文件夹
find ./ -maxdepth 1 -type f -name '[A-Z]*' -print | xargs grep <正则表达式>
libGL.so,是一个软链接,链接到真实文件libGL.so.5,当.5升级.6,只需把软链接重定向到新版本,软件仍可找到具体依赖库而正常运行。ls -i可以显示节点信息,以确认硬链接。ln <文件> <硬链接>
# 软链接文件夹可以不存在
ln -s <文件> <软链接>
(1). 硬链接即文件本身
(2). 硬链接无法引用目录
(3). 硬链接不能引用自身文件系统之外的文件
如何快速清点不同文件夹下的文件数,如检查处理的文件都已就位?
for i in frankfurt munster lindau;do for j in $(ls $i/images/aicodec/); do ls $i/images/aicodec/$j | wc ;done; done;
echo $((2+8))
echo $((2**3))
ctrl + A 移动光标到首
ctrl + E 到末
ctrl + F 向前,forward
ctrl + B 向后, backward
ctrl + L clear
ctrl + K 剪切从光标到末尾的
ctrl + U 剪切从光标到行首的
Alt + D 剪切光标到当前词尾
Alt +backspace 剪切光标到当前词头
ctrl + Y 粘贴
#看发行版本
lsb_release -a
#看内核版本
uname -a
cat /etc/lsb-release
#添加路径,不改变路径
pushd -n
#同时改变路径
pushd
#查看路径
dirs -lv
#切换
pushd -
# 看文件夹下的文件个数
ls | wc -l
# 按修改时间查看文件
ll -t
# 查看当前路径下各个文件的大小
du -h –max-depth=1 *
# 文件夹大小排序,numeric reverse
du -d 1 | sort -nr
# 当前路径下文件(夹)大小超过1G的,由大到小排序
du -h -d 0 * | grep G | sort -nr
# 查看文件大小,以MB\KB等单位显示
ls -lh
# 解压
unzip <zipped_file.zip> -d <unzipped_directory>
tar -zxvf zipped_file.tar.gz -C <unzipped_directory>
# 查看
unzip -l zipped_file.zip
有代理的下载:
wget -e use_proxy=yes -e http_proxy=http://user:key@proxy.huawei.com <其他参数>
apt installsudo -E apt install <lib&app>
sudo -E pip install <lib&app>
sudo -E -H pip install <> --trusted-host pypi.douban.com -i http://pypi.douban.com/simple/
git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
pip install --proxy https://username:pwd@proxy:host
high-level interface to the package manager
可以用来代替apt命令。
id命令显示用户身份信息
ls -l命令输出结果的前十个字符表示文件属性
第1个字符的含义
| 符号 | 含义 |
|---|---|
| - | 普通文件 |
| d | 文件夹 |
| l | 软链接 |
| c | 字符设备文件,如终端、调制解调器 |
| b | 块设备文件,如硬盘驱动或光驱 |
| 后面每3个字符依次是用户、所属组和其他所有成员的读取、写入、执行权限。 | |
chmod命令修改三种权限,可以用八进制或符号表示法,如二进制111对应的八进制7,表示三种权限都有;符号表示法,用u g o分别表示所有者、所属组、其他所有用户,举例如下表 | |
| 符号 | 含义 |
| :—: | :--------------------------------------------: |
| u+x | 给所有者添加执行权限 |
| o-rw | 其他所有用户被剥离读写权限 |
| go=rw | 所属组和其他所有用户被赋予读写权限,无执行权限 |
chown命令更改文件的所有者和所属群组 |
fg bgps aux | grep 关键字
# For a 'polite' stop to the process (prefer this for normal use), send SIGTSTP:
kill -TSTP [pid]
# For a 'hard' stop, send SIGSTOP:
kill -STOP [pid]
# Note that if the process you are trying to stop by PID is in your shell's job table, it may remain visible there, but terminated, until the process is fg'd again.
# To resume execution of the process, sent SIGCONT:
kill -CONT [pid]