显示 /etc 目录下,以非字母开头,后面跟了一个字母以及其他任意长度任意字符的文件或目录:
root@ubuntusvr:~# ls -a /etc/ | grep -v ^[[:alpha:]] | grep [[:alpha:]]
.pwd.lock
复制 /etc 目录下,所有以 p 开头,以非数字结尾的文件或目录到 /tmp/mytest1 目录中:
root@ubuntusvr:~# find /etc/ -maxdepth 1 -name "p*[^0-9]" -exec cp -r {} /tmp/mytest1/ \;
root@ubuntusvr:~# ls -l /tmp/mytest1/
total 72
-rw-r--r-- 1 root root 552 2月 23 09:00 pam.conf
drwxr-xr-x 2 root root 4096 2月 23 09:00 pam.d
-rw-r--r-- 1 root root 3 2月 23 09:00 papersize
-rw-r--r-- 1 root root 3086 2月 23 09:00 passwd
-rw-r--r-- 1 root root 3047 2月 23 09:00 passwd-
drwxr-xr-x 2 root root 4096 2月 23 09:00 pcmcia
drwxr-xr-x 3 root root 4096 2月 23 09:00 perl
drwxr-xr-x 4 root root 4096 2月 23 09:00 pki
drwxr-xr-x 3 root root 4096 2月 23 09:00 pm
-rw-r--r-- 1 root root 7649 2月 23 09:00 pnm2ppa.conf
-rw-r--r-- 1 root root 350 2月 23 09:00 popularity-contest.conf
drwxr-xr-x 5 root root 4096 2月 23 09:00 postfix
drwxr-xr-x 7 root root 4096 2月 23 09:00 ppp
-rw-r--r-- 1 root root 581 2月 23 09:00 profile
drwxr-xr-x 2 root root 4096 2月 23 09:00 profile.d
-rw-r--r-- 1 root root 2932 2月 23 09:00 protocols
drwxr-xr-x 3 root root 4096 2月 23 09:00 pulse
将 /etc/issue 文件中的内容转换为大写后保存至 /tmp/issue.out 文件中
root@ubuntusvr:~# cat /etc/issue | tr a-z A-Z > /tmp/issue.out
root@ubuntusvr:~# cat /tmp/issue.out
UBUNTU 20.04.1 LTS \N \L
未完待续…