How to get rid of locale files in /usr/share?

Hello,

This forum thread is the internet’s top search link for

reduce /usr/share/locale

Here is my stab at an answer

This list deletes everything not english, proceed with caution, adjust to those language you won’t use only.

cd /usr/share/local ; rm -rf ab ace ach af ain ak am an ang ar as ast ay az az_IR ba bal bar be be@latin bg bi bn bn_BD bn_IN bo br bs byn ca ca@valencia ce ch chr ckb crh cs csb cs_CZ cv cy da de de_CH de_DE de@hebrew dv dz ee el en en@arabic en_AU en@cyrillic en@greek en@hebrew en_NZ en@piglatin en@shaw eo es es_ES es_EU es_MX et eu fa ff fi fil fo fr frp fur fy ga gd gez gl gn gu gv ha haw he hi hr ht hu hu_HU hy ia id id_ID ie io is it iu ja jam ka kab kg ki kk kl km kmr kn ko kok ku kv kw kw_GB ky lg li lo lt lv mai mg mhr mi mjw mk ml mn mo mr ms mt my na nah nb nb_NO nds ne nl nl_BE nl_NL nn no nso nv oc or pa pap pa_PK pi pl ps pt pt_BR pt_PT ro rom ro_MD ru ru_UA rw sc sd si sk sl so son sq sr sr@ije sr@latin sr@Latn sv sw ta te tg th ti tig tk tl tr tt tt@iqtelif tzm ug uk ur uz uz@cyrillic ve vi wa wal wo xh yi yo zh_CN zh_Hans zh_Hant zh_HK zh_TW zu

To run it at every boot, run the following command

echo "rm -rf rm -rf ab  ace  ach  af  ain  ak  am  an  ang  ar  as  ast  ay  az  az_IR  ba  bal  bar  be  be@latin  bg  bi  bn  bn_BD  bn_IN  bo  br  bs  byn  ca  ca@valencia  ce  ch  chr  ckb  crh  cs  csb  cs_CZ  cv  cy  da  de  de_CH  de_DE  de@hebrew  dv  dz  ee  el  en  en@arabic  en_AU     en@cyrillic   en@greek  en@hebrew  en_NZ  en@piglatin  en@shaw   eo  es  es_ES  es_EU  es_MX  et  eu  fa  ff  fi  fil  fo  fr  frp  fur  fy  ga  gd  gez  gl  gn  gu  gv  ha  haw  he  hi  hr  ht  hu  hu_HU  hy  ia  id  id_ID  ie  io  is  it  iu  ja  jam  ka  kab  kg  ki  kk  kl  km  kmr  kn  ko  kok  ku  kv  kw  kw_GB  ky  lg  li  lo  lt  lv  mai  mg  mhr  mi  mjw  mk  ml  mn  mo  mr  ms  mt  my  na  nah  nb  nb_NO  nds  ne  nl  nl_BE  nl_NL  nn  no  nso  nv  oc  or  pa  pap  pa_PK  pi  pl  ps  pt  pt_BR  pt_PT  ro  rom  ro_MD  ru  ru_UA  rw  sc  sd  si  sk  sl  so  son  sq  sr  sr@ije  sr@latin  sr@Latn  sv  sw  ta  te  tg  th  ti  tig  tk  tl  tr  tt  tt@iqtelif  tzm  ug  uk  ur  uz  uz@cyrillic  ve  vi  wa  wal  wo  xh  yi  yo  zh_CN  zh_Hans  zh_Hant  zh_HK  zh_TW  zu"  | sudo tee /usr/local/cleanlocale.sh > /dev/null
echo "[Unit]
Description=Clean locale
#After=network.target

[Service]
Type=oneshot
ExecStart=/usr/local/cleanlocale.sh
RemainAfterExit=true
StandardOutput=journal

[Install]
WantedBy=multi-user.target" | sudo tee /etc/systemd/system/cleanlocale.service > /dev/null
sudo systemctl enable --now cleanlocale.service

based on Need to run command at startup - #2 by Mirdarthos

Bonus round, you can save another 150M by

cd /usr/share/dict
rm -rf  bokmaal brazilian  bulgarian catalan  danish dutch  french  italian  nederlands ngerman  norsk nynorsk polish portuguese  spanish svenska swedish