Skip to content

Instantly share code, notes, and snippets.

@psu
Last active January 24, 2026 08:56
Show Gist options
  • Select an option

  • Save psu/abe8dec7377883c5a7b5749a87bf7ff2 to your computer and use it in GitHub Desktop.

Select an option

Save psu/abe8dec7377883c5a7b5749a87bf7ff2 to your computer and use it in GitHub Desktop.
Useful Shell Commands

Useful Shell Commands

ffmpeg

Convert .mkv to .mp4

ffmpeg -i "${input_file}" -vcodec copy -acodec copy "${output_file_name}".mp4

File Handling

Change encoding for text file

iconv -f "ISO-8859-1" -t "UTF-8" "${input_file}" -s > "${output_file}"

Remove tags and move to Archive folder

for file in {query}
do

  # remove tag information in extended attributes, FinderInfo contains color info
  xattr -d com.apple.metadata:_kMDItemUserTags "$file"
  xattr -d com.apple.FinderInfo "$file"

  # move file
  mv "$file" "$archive_path"

done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment