simple trick - Redhat

This is a discussion on simple trick - Redhat ; And probably very old but I just came across it. I'll take the risk of posting old news. I got a bad rar file in s bittorrent download. So how do I fix just that without starting over? Create a ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: simple trick

  1. simple trick

    And probably very old but I just came across it. I'll take the risk of posting
    old news.

    I got a bad rar file in s bittorrent download. So how do I fix just that
    without starting over? Create a new file but any of the obvious ways would
    contaminate it with at least one byte AND the file names is something like 50
    characters long so I have to type it without error.

    So first I us ls and tab completion to get the right file and hit return.

    Then I up arrow to get that last command and backspace through it to the ls. I
    erase the ls and replace it with > the greater-than caret/arrow and I have a
    zero byte file.

    --
    Senior military in Iraq against the troop increase are replaced. Consensus
    building Neocon style.
    -- The Iron Webmaster, 3742
    nizkor http://www.giwersworld.org/nizkook/nizkook.phtml
    commentary http://www.giwersworld.org/opinion/running.phtml a5


  2. Re: simple trick

    On Sat, 24 Mar 2007, in the Usenet newsgroup linux.redhat, in article
    <4605cd0b$0$24772$4c368faf@roadrunner.com>, Matt Giwer wrote:

    >And probably very old but I just came across it.


    C and Korn shell - mid 1980s

    >Create a new file but any of the obvious ways would contaminate it with
    >at least one byte AND the file names is something like 50 characters
    >long so I have to type it without error.
    >
    >So first I us ls and tab completion to get the right file and hit return.


    OK

    >Then I up arrow to get that last command and backspace through it to the
    >ls. I erase the ls and replace it with > the greater-than caret/arrow
    >and I have a zero byte file.


    Other Bash tricks

    1. Press the '>' key, a space, then use tab completion (though in
    reality, most people would feel more comfortable verifying that the tab
    completion is going to do the right thing before they blast a file).

    2. Write in whatever your "new" command is plus the separating space,
    then press the right Alt and period keys together to copy the last
    argument from the previous command.

    3. Press the ^ key (shift 6), write the crap that you want to replace,
    then press the ^ key key again, followed by the "new" crap.

    [compton ~]$ echo '111' > FOO
    [compton ~]$ cat <--- press 'Alt' and '.' together, which gives
    [compton ~]$ cat FOO
    111
    [compton ~]$ ^cat^rm
    rm FOO <--- the shell shows the result of the substitution
    [compton ~]$ !cat <--- repeat the last command that began with 'cat'
    cat FOO <--- shell says "that must be this one"
    cat: FOO: No such file or directory
    [compton ~]$

    It's all in the man page for the Bash shell - try 'man bash'

    If the command line is wrong, you can either backspace out of it, or just
    press the left Ctrl and 'u' keys together to erase the command.

    Old guy

+ Reply to Thread