Results 1 to 6 of 6

Thread: filenames shortcut?

  1. #1
    Join Date
    Sep 2010
    Location
    romania
    Beans
    94
    Distro
    Ubuntu 10.10 Maverick Meerkat

    filenames shortcut?

    hei, is there any way of abbreviating a filename ?

    for example I wanna run a movie
    terminal: cd Downloads
    ls -l
    cd Dark.Island.720p.play-On
    mplayer Dark.Island.720p.play-On.avi


    is there any way of just doing mplayer Dark.Island ?

    I know I can do mplayer /Downloads/Dark.Island.720p.play-On/Dark.Island.720p.play-On.avi

    but what I'm asking is abbreviating filenames with something like.... intuitive guessing ? typing maybe mplayer Dark.Island-- and the terminal guesses the rest of the filename ? sucks having to type all those numbers.

  2. #2
    Join Date
    Aug 2006
    Beans
    13,354
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: filenames shortcut?

    You can type 'mplayer Dark.Island' and hit the 'Tab' key to autocomplete.

  3. #3
    Join Date
    Apr 2010
    Location
    England
    Beans
    3,286

    Re: filenames shortcut?

    Press tab to autocomplete in a shell.

    e.g.

    cd Dark.[TAB]

    will autocomplete to:

    cd Dark.Island.720p.play-On

    (assuming that there's no other filenames beginning with "Dark.", and you're using bash/zsh; I don't think it works in dash, and I haven't tried any other shells)

    zsh has an amazing autocomplete system. I can type

    cd /h/w/D/inc[TAB] and it'll autocomplete to:

    cd /home/wormzy/Downloads/incomplete

    (cd /h/w/D/in[TAB] matches incomplete and installers, and gives me the option to cycle between them with additional tab presses)
    http://xkcd.com/293/
    There are 10 kinds of people in this world: Those who understand ternary, those who don't, and those who confuse it with binary.

  4. #4
    Join Date
    Jan 2009
    Location
    USA! goin downhill tho :(
    Beans
    400
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: filenames shortcut?

    You can also file glob. Using wildcards and such


    such as


    mplayer Dark*.avi

    "*" will match anything that begins with Dark and ends with .avi in that directory.

    This is especially useful for seasons such as totem Dexter.S01*.mkv

  5. #5
    Join Date
    Sep 2010
    Location
    romania
    Beans
    94
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: filenames shortcut?

    Thank you, Thank you, Thank you !

  6. #6
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

    Re: filenames shortcut?

    Another good one is Esc .

    That will print the last argument to the last command

    so
    Code:
    mkdir holiday_photos
    Then
    Code:
    cd 'Esc .'
    That means type cd then hold down escape and press the full stop/period button.

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
  •