LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-31-2015, 12:52 PM   #1
Prasad321
LQ Newbie
 
Registered: Aug 2015
Posts: 5

Rep: Reputation: Disabled
Shortcut - last output of previous command


Is there a shortcut to access last output of previous command?
example:
pwd
/home/test1/test/

cd (output of pwd)

Thanks for your help.
 
Old 08-31-2015, 02:27 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Not sure what your question exactly is and your example doesn't help.

There's no point in changing directory to the current working directory, because you're there already.

Maybe you want to read this reference http://www.tldp.org/LDP/intro-linux/html/chap_05.html
 
1 members found this post helpful.
Old 08-31-2015, 03:00 PM   #3
Prasad321
LQ Newbie
 
Registered: Aug 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Let me explain in another way.

>locate catalina.sh
/usr/tomcat/bin/catalina.sh
>vi /usr/tomcat/bin/catalina.sh (Is there a shortcut for the output of locate command, instead of copying /usr/tomcat/bin/catalina.sh and pasting. )
 
Old 08-31-2015, 04:26 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
I don't believe so, mostly because the output of a command can be millions of lines long, so it's not kept in any kind of memory once it's printed out on the screen. If you want to save it, you need to do it yourself, eg:
Code:
var=$(locate catalina.sh)
vi $var
 
Old 09-01-2015, 08:02 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
And since those are so very rudimentary, the question of cut/paste really is not relevant.

As I've pointed out, the I/O redirectors can help you with some of this. As well as bash scripts.

You've asked a very general question. It is either hypothetical or you have a specific problem you're trying to solve. Which is it? Hypothetical or a specific problem?

There are some initial thoughts by myself and suicidaleggroll for the hypothetical side of things.

If you have a specific problem, then why not describe that fully? But bear in mind that many formulations of solution may match something like suicidaleggroll has shown, use of a variable, or something involving I/O redirection as the point I raised.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Truncating an output file and overwriting its previous content moraxu Linux - Newbie 1 03-15-2013 01:44 PM
[SOLVED] Does the output of the previous command get stored in any variable... trist007 Linux - Newbie 8 03-26-2011 11:28 PM
use output of previous command as parameter to another command raviluchmun Linux - Newbie 4 11-14-2010 12:35 AM
[SOLVED] redirecting STDOUT of previous command to STDIN of next command urban.yoga.journeys Linux - General 9 11-22-2009 03:16 AM
[SOLVED] [vi|man|less] covers/erases previous screen output zedmelon Linux - Software 4 01-10-2005 06:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:08 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