限制文件修改删除
创建容器挂在需要的目录
启动目录并挂在文件
1docker run --rm --privileged -it -v /autoupd:/tt alpine sh
安装所需命令
1apk add e2fsprogs-extra
2lsattr tt
3chattr +sia tt
4lsattr tt
5chattr -sia tt
awk
1echo "11 22, 33 44, 55 55, 56 77, 89 99" | awk -F ', ' '{for(i=1;i<=NF;i++){print $i}}'
alpine add python3 pip3
1apk add python3 py3-pip
2ln -s /usr/bin/python3 /usr/bin/python
去除文件属性 -rwxr-xr-x@, remove ……@
查看
1xattr -l $file
去除xattr -l $file
值
例如从github下载的可执行的二进制
1com.apple.metadata:kMDItemWhereFroms:
200000000 62 70 6C 69 73 74 30 30 A2 01 02 5F 11 02 2B 68 |bplist00..._..+h|
300000010 74 74 70 73 3A 2F 2F 6F 62 6A 65 63 74 73 2E 67 |ttps://objects.g|
400000020 69 74 68 75 62 75 73 65 72 63 6F 6E 74 65 6E 74 |ithubusercontent|
500000030 2E 63 6F 6D 2F 67 69 74 68 75 62 2D 70 72 6F 64 |.com/github-prod|
600000040 75 63 74 69 6F 6E 2D 72 65 6C 65 61 73 65 2D 61 |uction-release-a|
700000050 73 73 65 74 2D 32 65 36 35 62 65 2F 38 33 39 30 |sset-2e65be/8390|
800000060 34 32 35 32 2F 63 61 62 39 33 64 31 65 2D 31 31 |4252/cab93d1e-11|
900000070 36 36 2D 31 31 65 38 2D 39 31 63 30 2D 34 31 36 |66-11e8-91c0-416|
1000000080 61 61 35 31 33 64 62 61 66 3F 58 2D 41 6D 7A 2D |aa513dbaf?X-Amz-|
1100000090 41 6C 67 6F 72 69 74 68 6D 3D 41 57 53 34 2D 48 |Algorithm=AWS4-H|
12000000A0 4D 41 43 2D 53 48 41 32 35 36 26 58 2D 41 6D 7A |MAC-SHA256&X-Amz|
13000000B0 2D 43 72 65 64 65 6E 74 69 61 6C 3D 41 4B 49 41 |-Credential=AKIA|
14000000C0 49 57 4E 4A 59 41 58 34 43 53 56 45 48 35 33 41 |IWNJYAX4CSVEH53A|
15000000D0 25 32 46 32 30 32 33 30 37 30 35 25 32 46 75 73 |%2F20230705%2Fus|
16000000E0 2D 65 61 73 74 2D 31 25 32 46 73 33 25 32 46 61 |-east-1%2Fs3%2Fa|
17000000F0 77 73 34 5F 72 65 71 75 65 73 74 26 58 2D 41 6D |ws4_request&X-Am|
1800000100 7A 2D 44 61 74 65 3D 32 30 32 33 30 37 30 35 54 |z-Date=20230705T|
1900000110 30 38 33 35 35 37 5A 26 58 2D 41 6D 7A 2D 45 78 |083557Z&X-Amz-Ex|
2000000120 70 69 72 65 73 3D 33 30 30 26 58 2D 41 6D 7A 2D |pires=300&X-Amz-|
2100000130 53 69 67 6E 61 74 75 72 65 3D 66 63 38 35 34 32 |Signature=fc8542|
2200000140 31 61 32 64 63 30 64 62 66 62 61 37 35 66 30 35 |1a2dc0dbfba75f05|
2300000150 31 32 39 39 32 31 31 64 36 62 34 34 35 62 64 63 |1299211d6b445bdc|
2400000160 63 38 38 34 33 64 64 65 61 34 65 30 39 65 34 33 |c8843ddea4e09e43|
2500000170 65 32 35 39 38 34 33 62 34 38 26 58 2D 41 6D 7A |e259843b48&X-Amz|
2600000180 2D 53 69 67 6E 65 64 48 65 61 64 65 72 73 3D 68 |-SignedHeaders=h|
2700000190 6F 73 74 26 61 63 74 6F 72 5F 69 64 3D 30 26 6B |ost&actor_id=0&k|
28000001A0 65 79 5F 69 64 3D 30 26 72 65 70 6F 5F 69 64 3D |ey_id=0&repo_id=|
29000001B0 38 33 39 30 34 32 35 32 26 72 65 73 70 6F 6E 73 |83904252&respons|
30000001C0 65 2D 63 6F 6E 74 65 6E 74 2D 64 69 73 70 6F 73 |e-content-dispos|
31000001D0 69 74 69 6F 6E 3D 61 74 74 61 63 68 6D 65 6E 74 |ition=attachment|
32000001E0 25 33 42 25 32 30 66 69 6C 65 6E 61 6D 65 25 33 |%3B%20filename%3|
33000001F0 44 64 65 70 74 68 5F 31 2E 32 2E 31 5F 64 61 72 |Ddepth_1.2.1_dar|
3400000200 77 69 6E 5F 61 6D 64 36 34 26 72 65 73 70 6F 6E |win_amd64&respon|
3500000210 73 65 2D 63 6F 6E 74 65 6E 74 2D 74 79 70 65 3D |se-content-type=|
3600000220 61 70 70 6C 69 63 61 74 69 6F 6E 25 32 46 6F 63 |application%2Foc|
3700000230 74 65 74 2D 73 74 72 65 61 6D 5F 10 36 68 74 74 |tet-stream_.6htt|
3800000240 70 73 3A 2F 2F 67 69 74 68 75 62 2E 63 6F 6D 2F |ps://github.com/|
3900000250 4B 79 6C 65 42 61 6E 6B 73 2F 64 65 70 74 68 2F |KyleBanks/depth/|
4000000260 72 65 6C 65 61 73 65 73 2F 74 61 67 2F 76 31 2E |releases/tag/v1.|
4100000270 32 2E 31 00 08 00 0B 02 3A 00 00 00 00 00 00 02 |2.1.....:.......|
4200000280 01 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 |................|
4300000290 00 00 00 00 00 00 00 02 73 |........s|
4400000299
其中com.apple.metadata:kMDItemWhereFroms属性的名字
去除属性
1xattr -r -d com.apple.metadata:kMDItemWhereFroms $file
linux 快速去除
1xattr -cr *
read file & rename & ffmpeg mp4 to mp3
1#!/bin/bash
2
3
4# cat list | while read line; #";" 必须要加,否则有问题
5# do
6# name=$line
7# target=$(echo $line | awk '{print $(NF-1)"_"$NF}')
8# echo "mv \"$line\" \"$target\""
9# done
10#
11for v in `ls *.mp4`
12do
13 s=$v
14 t=$(echo $v | awk -F '.' '{print $(NF-1)".mp3"}')
15 echo "ffmpeg -i $v -f mp3 -vn mp3/$t"
16done
for i++, 循环size次数并异步处理。睡眠5s等待异步执行完毕
1#!/bin/bash
2
3size=3
4
5for ((i=0;i<=$size;i++))
6do
7 {
8 echo -e "$i.tmp"
9 }&
10done
11
12sleep 5
rename file
1#!/bin/bash
2
3for file in `ls -l *.mkv | awk '{print $NF}'`
4do
5 ori_name=$file
6 # echo $ori_name
7 suffix_value=`echo $ori_name | awk -F '.' '{print "."$(NF)}'`
8 target_name=`echo $ori_name | egrep "(EP[0-9]{2})" --color=auto -o`
9 # echo "$ori_name => $target_name$suffix_value"
10 # mv $ori_name $target_name$suffix_value
11done
disable ipv6
1sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
2sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
图形界面、字符界面切换
1# 字符界面
2systemctl set-default multi-user.target
3
4# cli 进入 gui
5startx
6
7# 恢复到GUI界面
8systemctl set-default graphical.target
评论