67a86268c1
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@130 a672b425-5310-4d7a-af5c-997e18724b81
69 lines
2 KiB
HTML
69 lines
2 KiB
HTML
---
|
|
layout: page
|
|
category-title: Basic commands
|
|
category-page: basic
|
|
tags: open
|
|
author: Gianmarco De Vita
|
|
title: open
|
|
previous-page: pages/cmd/basic/openshell.html
|
|
next-page: pages/cmd/basic/cd.html
|
|
---
|
|
<p>
|
|
You can open files and folder as new windows through the terminal.
|
|
The command is <code>open</code>. By writing the command open followed by the
|
|
path and the name of the file (remember that you can omit the path if
|
|
the file is in the current position), a new window in the common user
|
|
interface opens. Now you can work on the opened file.
|
|
|
|
<pre>
|
|
open path/name-file
|
|
</pre><br>
|
|
|
|
<h3>Open a file with a specific application</h3>
|
|
Adding the flag <code>-a</code> to the command permit you to decide with
|
|
which specific application open the file. Just write the flag followed by the
|
|
name of the application.
|
|
|
|
<pre>
|
|
open -a application-name path/name-file
|
|
</pre>
|
|
|
|
Assume that you want to open the file <i>abc.pdf</i> on my Desktop using the program "preview".
|
|
|
|
<pre>
|
|
open -a preview Desktop/abc.pdf
|
|
</pre>
|
|
|
|
As result, a new <i>Preview</i> window appears showing the content of the
|
|
chosen file.<br><br>
|
|
|
|
<h3>Open the folder which contains the file</h3>
|
|
If you want to open the folder that contains a specific file, just use
|
|
the flag <code>-R</code> and write the path and the name of the file you want to open.
|
|
|
|
<pre>
|
|
open -R Desktop/text.txt
|
|
</pre>
|
|
|
|
As result, a new <i>Finder</i> window opens the folder displaying its content.<br><br>
|
|
|
|
<h3>Open a file with an editor</h3>
|
|
If you want to open a file with your default editor,
|
|
just use the flag <code>-t</code> and write the path and the name of
|
|
the file you want to open.
|
|
|
|
<pre>
|
|
open -t Desktop/text.txt
|
|
</pre><br>
|
|
|
|
<h3>Visit a Website</h3>
|
|
You can use this tool not only to open files and folders, but also webpages.
|
|
Just write the command <code>open</code> followed by the <i>URL</i> of the page
|
|
you want to visit.
|
|
|
|
<pre>
|
|
open http://www.google.com
|
|
</pre>
|
|
|
|
A new page of your default browser will open on the indicated page (in this
|
|
example, the main page of the Google Search Engine).
|