How To Pass or Redirect output from shell command to a file
RegisterLogin
How To Pass or Redirect output from shell command to a file
Post Description: How To Pass or Redirect output from shell command to a file
Tags: How, To, Pass, or, Redirect, output, from, shell, command, to, a, file
This Post Was Posted On Feb 29, 2008 By tomas #2103
Post Description: How To Pass or Redirect output from shell command to a file
Tags: How, To, Pass, or, Redirect, output, from, shell, command, to, a, file
This Post Was Posted On Feb 29, 2008 By tomas #2103
How To Pass or Redirect output from shell command to a file by tomas
when you tell the shell to execute a command, for example who, teh code for who runs and outputs a listing or furrent users. teh process running the who utilty locates the needed information and formats the report. the defulat output destination for the formatted results of running the who utitly is your screen.
you can tell the shell to redirect the otup of a command awasy from your screent to a file
just follow these steps and i will show you how you can do this:
1. look at the files in your current directory:
ls
2. Type the this command line that includes the > symbol:
who > logged_users
Nothing appears on the screen except the next shell prompt. there is no confimation or acknowledgement that your command went through ok. In UNIX or Linux, "nothing" is good, it usually means the command went through without any problems. You have just instructed the shell to craete a new file and connect it to the output of the process that is running the who utitly.
3. Check that the file you created now exists with this commnad:
ls
now you should see a file called logged_users
4. see the contents of the logged_users file
cat logged_users
thats it
remember, you use the > symbol to redirct information from a command to a file
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
©2011 Webune Forums - Wed Dec 21, 2011 3:56 am
Powered by: Webune Forums V3
Powered by: Webune Forums V3