Re: simple trick
- From: ibuprofin@xxxxxxxxxxxxxxxxxxxxxx (Moe Trin)
- Date: Sun, 25 Mar 2007 14:26:52 -0500
On Sat, 24 Mar 2007, in the Usenet newsgroup linux.redhat, in article
<4605cd0b$0$24772$4c368faf@xxxxxxxxxxxxxx>, 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
.
- References:
- simple trick
- From: Matt Giwer
- simple trick
- Prev by Date: Re: PCI bios bug Not using MMConfig
- Next by Date: pen drive format in linux in FAT format
- Previous by thread: simple trick
- Next by thread: PCI bios bug Not using MMConfig
- Index(es):
Relevant Pages
|
|