bexphones bexphones - 1 year ago 75
Linux Question

how to open all shortcuts files from a directory with chromium-browser in one command

On ubuntu 16.04, i have a directory with these files :

-rw-rw-r-- 1 user0 user0 86 jui 7 21:32 vim html picker.url
-rw-rw-r-- 1 user0 user0 104 jui 7 21:32 cocoonjs build android apk.url
-rw-rw-r-- 1 user0 user0 61 jui 7 21:32 Simple Modal Window - Codepad.url
-rw-rw-r-- 1 user0 user0 96 jui 7 21:32 cocoon.js android build apk+++.url
-rw-rw-r-- 1 user0 user0 44 jui 7 21:32 CodePen - Front End Developer Playground & Code Editor in the Browser (1).url

The file "vim html picker.url" have this information :

--> cat vim\ html\ picker.url


what i want to do is open all of theses files from this directory in tab in my chromium-browser.

i have tried this in my gnome-terminal :

chromium-browser *.*

but chrome open the text information : URL= and not the url itself :

wich command allow my desired behaviour ?

Answer Source

grep "^URL=" *.url | cut -d= -f2 | xargs chromium-browser should do the trick.


  • grep "^URL=" *.url - cut the line beginning with URL= from each file ending in .url
  • cut -d= -f2 - split each remaining line into parts delimited by '=' and output the second and all subsequent parts (i.e. the part after the first '=')
  • xargs chromium-browser - use the list of URLs as arguments to chromium.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download