Command line snippets


Tags: unix cli
Reading time: less than 1 minute

sed

Search and replace in-place

sed -i 's/search/replace/g' *.py

git

Delete all git branches locally

git branch | grep -v \* | xargs git branch -D

postscript

Convert a plain-text file into a PDF

a2ps file.txt -1 -B --borders no | ps2pdf - - > test.pdf

mpv

Play a YouTube music playlist

mpv 'PLAYLIST_URL' --no-video --shuffle --loop-playlist

Play raw audio file

mpv --demuxer-rawaudio-format=u8 --demuxer-rawaudio-channels=1 --demuxer-rawaudio-rate=8000 --demuxer=rawaudio

rsync

rsync -avP --delete -e 'ssh -p 23' root@whatever:/path/to/folder target/path

The following pages link here

Citation

If you find this work useful, please cite it as:
@article{yaltirakliwikicommandlinesnippets,
  title   = "Command line snippets",
  author  = "Yaltirakli, Gokberk",
  journal = "gkbrk.com",
  year    = "2024",
  url     = "https://www.gkbrk.com/wiki/CommandLineSnippets/"
}
Not using BibTeX? Click here for more citation styles.
IEEE Citation
Gokberk Yaltirakli, "Command line snippets", December, 2024. [Online]. Available: https://www.gkbrk.com/wiki/CommandLineSnippets/. [Accessed Dec. 17, 2024].
APA Style
Yaltirakli, G. (2024, December 17). Command line snippets. https://www.gkbrk.com/wiki/CommandLineSnippets/
Bluebook Style
Gokberk Yaltirakli, Command line snippets, GKBRK.COM (Dec. 17, 2024), https://www.gkbrk.com/wiki/CommandLineSnippets/

Comments

© 2024 Gokberk Yaltirakli