Linux Command To show Playing song in Terminal

Linux Command To show Playing song in Terminal

In this Article i will show you Linux Command To show Playing song in Terminal. The concept comes form, In linux everything is either files or Process. So I thought ‘lsof’ must list the file that is playing. yes Bingo it does list the file that is playing. Then I used grep to catch the playing song, I used some regular Expression and what i found that the song i am playing is in terminal.

After Playing any song , just open terminal and put this command:
basename "`lsof | grep -i -E ".*\.(flv|mp3|mp4|mkv|wvm|ogg|3gp|webm|mov)$"`"

Linux Command To show Playing song in Terminal
I have added only most common used format. you can add more format just add pipe and format.

Some other way :
lsof -F n| grep -i -E ".*\.(flv|mp3|mp4|mkv|wvm|ogg|3gp|webm|mov)$" | head -n 1 | awk -F "/" '{print $NF}'
lsof | awk -F "/" '/.*\.(flv|mp3|mp4|mkv|wvm|ogg|3gp|webm|mov)$/ {print $NF}' | head -n 1
Plz Share Share on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someoneShare on RedditShare on TumblrDigg thisBuffer this pagePrint this pagePin on PinterestShare on StumbleUponFlattr the author
Bookmark the permalink.

One Comment

  1. you became 1000% cooler just for listening to that song.

Leave a Reply

Your email address will not be published. Required fields are marked *