LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-14-2009, 09:37 PM   #1
mvmoncayo
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
Reviewing Tar commands with one key


Hello,

I am trying to recall all tar commands that I have executed. Then I am trying to see them in turn by repeatedly pressing one key.

I would like to use either history command and/or an alias.

Thank you for any help.
 
Old 10-14-2009, 09:53 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,330

Rep: Reputation: 227Reputation: 227Reputation: 227
press the up arrow key
 
Old 10-14-2009, 09:57 PM   #3
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by mvmoncayo View Post
Hello,

I am trying to recall all tar commands that I have executed. Then I am trying to see them in turn by repeatedly pressing one key.

I would like to use either history command and/or an alias.

Thank you for any help.
1. In a shell session, perform your tar actions.

2. Press the up arrow key repeatedly until you get to the first tar command.

3. Press the down arrow key to review your commands as entered.

Alternative:

1. Perform your tar actions.

2. Examine your .bash_history file:

$ kwrite ~/.bash_history

The most recent commands are at the bottom -- the commands are listed in chronological order.
 
Old 10-14-2009, 10:08 PM   #4
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,275

Rep: Reputation: 126Reputation: 126
Is this a homework question? If so, what have you tried? There is a combination of commands using "history", two "greps" and "more" (or "less") that would probably do almost exactly what you want.
 
Old 10-15-2009, 12:32 AM   #5
shahkent
LQ Newbie
 
Registered: Aug 2009
Posts: 13

Rep: Reputation: 1
Another way to see what tar commands you've issued is to use the following command:

history | grep tar

That'll display all occurrences of the tar command that's stored in your shell's history.

Shahriar
 
Old 10-15-2009, 06:03 AM   #6
emu019
LQ Newbie
 
Registered: Oct 2009
Posts: 1

Rep: Reputation: 0
Thanks a lot...
 
Old 10-15-2009, 01:08 PM   #7
mvmoncayo
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Got it!

I was trying to avoid using the up arrow key. Yes this was a homework question. I figured out what it wanted was for me to actually browse the history using in line command editing. First I set vi options by using set -o vi. then type /tar (to match the tar pattern) and [esc]. I then I can press n to go through the different tar commands. Thank you for all your help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create file using tar and ls commands Ejdaha Linux - Newbie 2 02-16-2009 09:55 AM
Differences between tar, cpio and dump commands diwakars Linux - Newbie 2 06-08-2008 03:26 PM
IBM TS3100 Tape Library and TAR commands R00thavok AIX 1 09-09-2007 02:54 PM
About tar and gzip commands satimis *BSD 2 05-29-2007 03:20 AM
tar Commands Orkie Linux - Software 7 07-27-2005 03:50 PM


All times are GMT -5. The time now is 08:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration