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 ...
|
|||||||
| 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. What's wrong? I hope I am not making you uncomfortable... Never send a boy to do a mans job. |
| The Following User Says Thank You to rockdalinux For This Useful Post: | ||
jaysunn (03-12-2009)
| ||
|
||||
|
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 (04-12-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; 05-01-2010 at 08: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 | 02-09-2009 02:54 PM |
| bash history...suse 10.1 | grogf | Linux software | 4 | 30-10-2007 04:42 PM |
| Command history | ricc | Linux software | 1 | 26-04-2006 04:57 PM |
| shortcut linux command history | Shell scripting | 1 | 26-12-2005 06:22 PM | |
| want a script keep backup of all users history. | ricc | Shell scripting | 3 | 26-08-2005 12:30 AM |