50 interesting Linux command lines
- Convert CRLF terminated files to just CR
- Check if JSON is valid
$ json_verify < file.json
- Same as above but prints out nicely.
- Get rid of duplicate spaces occuring together
- Send mail from command line
$ mutt -s hi foo@yahoo.com < /tmp/mail.txt
- Move in bulk based on patterns
- Use interactive file deletion DOS style
(midnight commander DOS style UI)
- Fancy list files (show dirs with /)
- Show a file with line numbers
- Use cut to split fields
$ echo 1:2:3 | cut -d: -f2
- Edit file in place and do search and replace
$ perl -pi -e 's/old/new/' file.txt
- Same as above but not in place
$ sed -e 's/old/new/' file.txt > new.txt
- Spidermonkey (interactive js shell)
- Simple video to audio conversion
$ ffmpeg -i file.mp4 song.mp3
- Download youtube video to disk
$ youtube-dl https://youtu.be/XXXX
- Same as above, faster
$ yt-dlp https://youtu.be/XXX
- Show progress bar or ETA with pipeviewer
$ cat file.tgz | pv | tar zxpf
- Play gif animation
- View image
- Same as above
- Same as above
- Same as above
- Nice PDF viewer
- Fire up a web server using current dir
- Fire up web server to interpret markdown files
- Do a simple file upload to FTP or HTTP
$ curl -T file.input ftp://remote/dir/A
- Do a fast download breaking file into chunks and fetch
using multiple TCP connections
- Figure out common lines
$ comm file.txt file2.txt
- Compare binary files
- Printout SHA256 fingerprint
$ openssl dgst sha256 < file.txt
- Same as above.
- Always import fresh into git repo
$ find . -name .git | xargs rm -rf
- Hear same song repeatedly
$ mplayer favsong.mp3 -loop 0
- Watch video with vol boost, 0,9 for +,-
$ mplayer -softvol -softvol-max 1000 file.mp4
- Listen to Internet radio on command line
$ mplayer <shoutcast url>
- Resize image with ImageMagick
$ convert file.png -resize 500x500! small.png
- Find out width and height
- Tell the length of media
$ mplayer -identify -frames 0 <media>
- Nuke everthing in mp3 after 90 seconds
$ ffmpeg -i file.mp3 -to 90 out.mp3
- Get rid of first 30 seconds.
$ ffmpeg -i file.mp3 -ss 30 out.mp3
- Convert a postscript file to PDF
- Create webp from png or jpg
$ cwebp file.png -o file.webp
- Change image format
$ convert file.jpg file.png
- Copy file.txt to paste buffer
- Take screenshot from command line
- Scour entire file system for files
- Look for pattern recursively and ignore case
- Get rid of newline whilst printing
- Batch top output
- Show speed of download/upload
- Find directories and nuke them
$ find . -name mango -type d | xargs rm -rf
- Prints random quote or cookie
- Compress files using zstd
- Decompress using zstd
- Record screencast video
- Download youtube video in mp4
$ yt-dlp -f mp4 https://youtu.be/XXXXX
- FTP client with superpowers
- Show statistics and counters
- Show bandwidth usage
- Start a TCP server at port 1234
- Connect to server using netcat
- Generate strong password
- Generate lookalike domains
- anagram generator
- Profile execution of a program
- Save changes to disk
- Figure out USB or SSD or HDD performance
- Find out bandwidth between two point
- Scan for machines in local network
$ fping -g 192.168.1.0/24
- Colored less
- JSON power tool
- YAML power tool
- Search for man pages
- Indent javascript
- Capture screenshot
$ sleep 3; import foo.png
Download this cheatsheet PDF
Gumroad download
Tweet this to your followers