Linux / UNIX Tech Support Forum
This is a discussion on Reverse Search For Bash History within the Getting started tutorials forums, part of the Linux Getting Started category; Hello My friends, Not sure if you were aware of this great bash function that I use daily in my ...
|
Register free or login to your existing account and remove all advertisements. |
|
|||||||
| Getting started tutorials So much to read, so little time! If that is your problem, we have solution. Read our FAQ and tutorials to help you cut through the clutter of information overload. Only members of "contributors" group can post new tutorials. Other members can just reply to thread. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
| Sponsored Links | ||
|
|
|
||||
|
Code:
command-name Code:
!! Code:
cp /path/to/a/long/file/dir/name/file1 /go/to/dest/file2 Code:
echo !!:1 Code:
echo !!:2
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
| The Following User Says Thank You to rockdalinux For This Useful Post: | ||
jaysunn (12-03-2009)
| ||
|
||||
|
@rockdalinux
Sweeeeeeeet. I was never aware of that one. Also this list can go on forever so please join. Regards, Jaysunn
__________________
Give a man a fish, feed him for today. Teach a man to fish, he will feed himself from now on. |
|
||||
|
Getting dir name or only a file name from a long path is also pretty handy when you use rsync or scp / ssh and friends
Code:
rsync /nas/a/x/y/foo/bar.txt root@server1:/dest/to/path Code:
rsync -a !!:1:h !!:2 Code:
cp /path/to/logn/dir/foofilenameverylongfilename.txt /mnt/floppy Code:
cp !!:1:t !!:2 Code:
scp user@server1:/path/to/alongdir1/file.txt user@server2:/dest Code:
scp !!:1:s/dir1/dir2 !!:2 FYI, they are called history modifiers.
__________________
|
| The Following User Says Thank You to sweta For This Useful Post: | ||
kumarat9pm (12-04-2009)
| ||
|
||||
|
Thanks for sharing
though this is known to every just i want to share. ~/.bash_hisroty --contaions all your commands history to check history size echo $HISTSIZE to change default history size(which is 500 in most of the linux flavors) to 20 commands history HISTSIZE=20 To clear history history -c
__________________
Thanks, Surendra Kumar Anne Ubuntu: Simple, Stylish and Striking..! Linux: Fast, friendly, flexible and .... free! Support Open source. |
|
|||
Last edited by cfajohnson; 01-05-2010 at 09:15 PM. |
![]() |
| Tags |
| bash , bash ctrl + r , bash history , shell |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Quit Bash Without Saving History | jaysunn | Getting started tutorials | 4 | 09-02-2009 03:54 PM |
| bash history...suse 10.1 | grogf | Linux software | 4 | 10-30-2007 05:42 PM |
| Command history | ricc | Linux software | 1 | 04-26-2006 05:57 PM |
| shortcut linux command history | Shell scripting | 1 | 12-26-2005 07:22 PM | |
| want a script keep backup of all users history. | ricc | Shell scripting | 3 | 08-26-2005 01:30 AM |