LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 08: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, 08:53 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
press the up arrow key
 
Old 10-14-2009, 08: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, 09:08 PM   #4
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
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-14-2009, 11:32 PM   #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, 05:03 AM   #6
emu019
LQ Newbie
 
Registered: Oct 2009
Posts: 1

Rep: Reputation: 0
Thanks a lot...
 
Old 10-15-2009, 12: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



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 08:55 AM
Differences between tar, cpio and dump commands diwakars Linux - Newbie 2 06-08-2008 02:26 PM
IBM TS3100 Tape Library and TAR commands R00thavok AIX 1 09-09-2007 01:54 PM
About tar and gzip commands satimis *BSD 2 05-29-2007 02:20 AM
tar Commands Orkie Linux - Software 7 07-27-2005 02:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:47 PM.

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
Open Source Consulting | Domain Registration