Results 1 to 6 of 6

Thread: Command Line Pipes and Opening Files

  1. #1
    Join Date
    Jan 2009
    Location
    Pennsylvania
    Beans
    113
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Command Line Pipes and Opening Files

    Hi all,

    I've been using Ubuntu for about 4 years now and have usually managed to avoid the command line. I've been spoiled by the GUI!

    One of the first issues I've had with the CLI is that I have to remember how to open a file by the program to open it with. If it's a flash video, its not much of an issue (just % vlc video.flv) but what if I don't know or remember how to open it?

    I tried "% open file" and "% openvt file" but that didn't work at all haha.

    I'm a grad student in chemistry and am using AMBER m.d. which requires extensive use of the CLI, so I'm trying to become more fluent.
    I've tried to learn pipes, and tried a very basic

    % pwd | nautilus

    to try to open a file browser in the current directory. The command "nautilus" unfortunately doesn't have a manual page! But it is usually worked

    % nautilus /your/directory/here

    so I figured piping the output from "pwd" to "nautilus" would open a file browser of the directory I was currently in. Alas it just opened the home directory! I figured there was something basic I was missing so I asked the resident Ubuntu Guru and he was just as mystified.

    Would anyone be able offer any pointers?

    Thanks so much!
    -Dave

  2. #2
    Join Date
    Apr 2008
    Location
    RiceMonsterland, Canada
    Beans
    Hidden!

    Re: Command Line Pipes and Opening Files

    try this:
    Code:
    nautilus `pwd`
    If you use back ticks, it will use the output of the command within the back ticks. Not all programs will accept data through pipes.
    Code:
    while true; do echo -n "RiceMonster "; done
    Best thread ever

  3. #3
    Join Date
    May 2007
    Location
    USA
    Beans
    318
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: Command Line Pipes and Opening Files

    Quote Originally Posted by hailholyghost View Post
    % pwd | nautilus
    That just redirects standard output of the pwd command to standard input of nautilus. AFAIK Nautilus does not use standard input, but accepts command line arguments. You may obtain the result I think you are seeking with something like this:

    Code:
    nautilus "$PWD"
    or

    Code:
    nautilus "$( pwd )"

  4. #4
    Join Date
    Jan 2006
    Beans
    Hidden!

    Re: Command Line Pipes and Opening Files

    Code:
    nautilus .
    Great links: Tutorials & Tips Forum - GNOME System Administration Guide - Bash-Scripting Guide
    Remember: Please mark your thread as [ SOLVED ] if you found a working solution!

  5. #5
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Command Line Pipes and Opening Files

    Code:
    ls -la | more
    dmesg | more
    cd && cat .profile
    history | more
    Last edited by tgalati4; July 12th, 2010 at 09:52 PM.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  6. #6
    nmaster is offline Extra Foam Sugar Free Ubuntu
    Join Date
    Jun 2009
    Beans
    718

    Re: Command Line Pipes and Opening Files

    Quote Originally Posted by hailholyghost View Post

    I tried "% open file" and "% openvt file" but that didn't work at all haha.
    open works in OS X. in ubuntu use gnome-open.

    Code:
    gnome-open file

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •