This is just my notebook of useful tricks for the UNIX/Linux command line shell / terminal.
See https://github.com/blairw/pdfworks
sudo apt install libheif-examples
heif-convert -q 60 IMG_1234.HEIC IMG_1234.jpegconvert -border 2x2 -bordercolor '#999999' example.png example_border.png
From https://github.com/arp242/border/
The use of soffice requires LibreOffice, but then this should work:
soffice --headless --convert-to pdf:writer_pdf_Export "Blair Wang PhD Thesis rev03.docx"If you need to catch multiple files, sometimes you cannot put the wildcard in that end part there, try this instead:
find . -type f -name "*.doc" -exec soffice --headless --convert-to pdf:writer_pdf_Export {} \;ffmpeg -ss 00:15:00.000 \
-i /Users/blair/Desktop/oneheartsunday200503_original.mp4 \
-to 01:14:50.000 \
-c copy ~/Desktop/oneheartsunday200503_shaved.mp4The use of ffmpeg requires one to install it first (e.g., on Mac, brew install ffmpeg), but then this should work:
ffmpeg -i video_only.mp4 -i audio_only.m4a -c:v libx264 -c:a aac output_merged.mp4for file in *.zip; do unzip "$file" -d "${file%.zip}"; doneCredits to Jeff Fisher and Peter Flynn: https://stackoverflow.com/a/49856874
List all files (including hidden files) in current directory
# bash/zsh (Mac/Linux)
ls -lah
# Windows Powershell
gci -fo# Mac
pwd | tr -d '\n' | pbcopy
# Linux
pwd | tr -d '\n' | xclip -selection clipboard
# Windows
$pwd.Path | Set-Clipboardfind . -type f -size -16kMore info: https://superuser.com/a/204571
This can either be done in one step:
du -h -d1 | sort -hrOr in two steps:
du -h -d1 > du-h-d1.txt
cat du-h-d1.txt | sort -hrThe latter is handy on network drives where it may be useful to keep that record of the folder sizes. It's the du that takes a long time to run (cataloguing all your files and folders); the sort is very quick as it just reads the text output of the du.
Handy to use in conjunction with SSHelper on Android, e.g.,
rsync -e 'ssh -p 2222' -av 192.168.1.221:/data/data/com.arachnoid.sshelper/files/home/SDCard/DCIM/Camera/ /Users/blair/Desktop/PhotosFromPhoneFor example, to search for currently-running instances of rclone:
ps -ef | grep rcloneConfiguration:
defaults write com.apple.desktopservices DSDontWriteNetworkStores trueAd hoc removal:
find . -type f -name '.DS_Store' -exec rm -rfv {} \;