Linux Quick Commands
Linux Quick Commands
PS1
PS1="┌──\u@\h:\w\n└─\$ " |
Manufacturer information:
dmidecode -t memory |
Temporarily allow the required algorithms directly in your SSH command:
ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa user@hostname |
Convert line break CRLF to LF.
sed -i 's/\r//g' a.txt |
Convert file encoding.
file input.txt |
Rename files.
find . -name "* *.md" -exec rename -f 's/ /-/g' {} \; # space to - |
Convert all characters to lowercase or uppercase in file context.
find . -name "*.htm*" -exec sed -i '/src=\"\..*.\/img\/.*\"/s/src=.*/\L&/g' {} \; |
Log analysis.
find . -name "*.gz" -exec gunzip {} \; |
Search files and compress.
find /mnt/e/Customers/Services/ -type f -name "*file*" | xargs -I {} zip -j /mnt/e/Temp/temp.zip "{}" |
Search duplication files.
find . -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate |
Convert mp4 video HEVC encoding libx265 to libx264.
ffmpeg -i input.mp4 -c:v libx264 -preset fast -crf 23 output.mp4 |
Rsync.
rsync -e "ssh -p 2222" -av --delete --include="*/" --include="*.pdf" --exclude="*" /mnt/e/assets/res/ jove@192.168.3.112:/var/www/html/assets/res/ |
Temp for Hexo Posts.
find /mnt/e/butterfly/source/_posts -type f -name "*.md" -exec sed -i 's/html"><i>/html">/' {} \; -exec sed -i 's/html">/html"><i>/' {} \; |
All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.




