<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sever Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/sever/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Wed, 23 Jun 2021 16:34:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>Open files using the terminal</title>
		<link>https://www.osradar.com/open-files-terminal-linux/</link>
					<comments>https://www.osradar.com/open-files-terminal-linux/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Sat, 26 Jun 2021 04:33:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[sever]]></category>
		<category><![CDATA[Tricks]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=30777</guid>

					<description><![CDATA[<p>Hello friends. You know we like the terminal so lately we are solving some usual problems and today we have another one. Although it is not a problem it is quite a problem for scripts or applications that we are developing. In short, in this post, you will learn how to open files from the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/open-files-terminal-linux/">Open files using the terminal</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Hello friends. You know <a href="https://www.osradar.com/tag/terminal" target="_blank" rel="noreferrer noopener">we like the terminal</a> so lately we are solving some usual problems and today we have another one. Although it is not a problem it is quite a problem for scripts or applications that we are developing. <strong>In short, in this post, you will learn how to open files from the terminal.</strong></p>



<h2>Why would it be useful for me to know how to open files from the terminal?</h2>



<p>Generally, most Linux users use the graphical interface more than the terminal. But others prefer to do many tasks from the terminal because it is faster and more efficient.</p>



<p>On the other hand, if you are a developer, you probably need to use some system features. Some command or some process revision may become useful in the development of this application.</p>



<p>So, one of them can be to open a file directly from our application or script, then you have to use the command that actually executes our option. Even shortcuts can be configured so the possibilities are many.</p>



<p>So, let&#8217;s start</p>



<h2>Open files using the terminal</h2>



<p>To open a file from the terminal you can invoke the application command with the file path. For example, if I want to open an image with the program <code>okular</code> then you have to run</p>



<pre class="wp-block-preformatted">okular [file_path]</pre>



<p>This will open the file with the <code>okular</code> program. Although this method is effective, because you only have to remember the program command in question, it has two drawbacks. The first is that <strong>we have to remember the command that executes the application</strong>; secondly, it will open a permanent process in the terminal that will terminate when the program is closed.</p>



<p>The second one can be solved in the following way:</p>



<pre class="wp-block-preformatted">okular [file_path] &amp;&gt; /dev/null &amp;</pre>



<p>Remember that I am using <code>okular</code> as an example, but it could be <code>firefox</code> or <code>vlc</code>.</p>



<p>There is another method that I think is even more efficient. I am talking about the <code>xdg-open</code> command.</p>



<p>What this command does is runs the default program to open the file that we pass as an argument. For example, if the file is MP3 then it will open the default program to open that type of file. <strong>With this, we don&#8217;t need to worry about knowing the name of the applications.</strong></p>



<pre class="wp-block-preformatted">xdg-open [file_path]</pre>



<p>In this way, the file will be opened with the ideal program for it. The best thing is that an independent process will be created and the terminal will be free.</p>



<p>So, enjoy it</p>



<h2>Conclusion</h2>



<p>Now you know how to get more out of the terminal and open files from the terminal which can be useful in application development or scripting.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/open-files-terminal-linux/">Open files using the terminal</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/open-files-terminal-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
