Running two commands in one line | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Running two commands in one line

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-30-2007
rdns rdns is offline
Registered User
 
Join Date: Oct 2007
Last Activity: 26 January 2008, 4:04 AM EST
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Running two commands in one line

hi!

how do i run 2 command from the same line
e.g: 'which screen' and then ls -la 'which screen'
Sponsored Links
    #2  
Old 11-30-2007
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
who?
 
Join Date: Dec 2003
Last Activity: 22 October 2014, 12:44 PM EDT
Location: /dev/ph
Posts: 4,822
Thanks: 64
Thanked 429 Times in 398 Posts

Code:
which screen; ls -la `which screen`

Sponsored Links
    #3  
Old 11-30-2007
rdns rdns is offline
Registered User
 
Join Date: Oct 2007
Last Activity: 26 January 2008, 4:04 AM EST
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by fpmurphy View Post
Code:
which screen; ls -la `which screen`

thank you. I will remember this the rest of my life
    #4  
Old 04-27-2009
abhilash_menon abhilash_menon is offline
Registered User
 
Join Date: Sep 2008
Last Activity: 4 May 2009, 1:25 PM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
I would like to know how can I write the output of these 2 commands into a file.I tried like
wc -l outfile2;du -sk outfile2>xyz.txt
Then it is writing only the output of second command to the file.
Without writing to a file, it is giving outputs of both correctly.Any thoughts?

Last edited by abhilash_menon; 04-27-2009 at 10:53 AM.. Reason: Correction
Sponsored Links
    #5  
Old 04-27-2009
abhilash_menon abhilash_menon is offline
Registered User
 
Join Date: Sep 2008
Last Activity: 4 May 2009, 1:25 PM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks.I got the same as
echo `wc -l outfile2; du -sk outfile2` > xyz.txt
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Running oracle commands Directly from Command Line SkySmart UNIX and Linux Applications 4 05-11-2010 10:05 AM
For loop and running 2 commands at once? Stephan Shell Programming and Scripting 5 02-26-2010 07:28 AM
Running sed commands Dolph Shell Programming and Scripting 3 01-26-2010 06:39 AM
How to disable running commands from vi Umesh_Sharoff Shell Programming and Scripting 1 07-14-2006 12:05 PM
running start up commands skotapal UNIX for Dummies Questions & Answers 3 12-03-2002 06:31 AM



All times are GMT -4. The time now is 08:38 PM.