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-04-2006, 11:48 AM   #1
meniscus
Member
 
Registered: May 2006
Posts: 70

Rep: Reputation: 15
command output to text file?


Ive installed a package called smartmontools and i am attempting to write the op to a file in my home directory.

With the command

$sudo smartctl -a /dev/hda

evrything works fine. Its ops the info to the terminal


When i type

$sudo smartctl -a /dev/hda > /Home

It gives me an error...

bash: /Home: Permission denied

What am i doin wrong?

Thanks,
meniscus
 
Old 10-04-2006, 11:54 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,087

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
/Home is a file called Home in your root (/) directory. You probably aren't allowed to create a file there.
Try $sudo smartctl -a /dev/hda > /home/yourusername/filename

HTH
 
Old 10-04-2006, 11:56 AM   #3
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
The syntax that you are using means that you are trying to create a file named Home in the top level directory. Try this instead.
Code:
$sudo smartctl -a /dev/hda > $HOME/smartctl-output.txt
In my example I am using the environment variable HOME as the directory to write into. Then I am adding a file name to hold the output of the smartctl command. This will create a file named smartctl-output.txt in your home directory when you run the command.
 
Old 10-05-2006, 04:40 AM   #4
meniscus
Member
 
Registered: May 2006
Posts: 70

Original Poster
Rep: Reputation: 15
It worked! Brilliant! Thanks!

Is it possible for me to have that run periodically say every 5 mins without having to write the command in the terminal each time...like a daemon? Can you suggest any tutorials where i might learn how to do this?
 
Old 10-05-2006, 06:29 AM   #5
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Check man crontab or check the internet for crontab tutorial
 
  


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
pipe output to append to a text file davee Linux - Newbie 5 03-22-2016 08:44 PM
Media player output text file for now playing Berticus Linux - Software 0 08-05-2006 12:05 AM
how to enumerate first line of text file to standard output? zero79 Linux - General 1 07-07-2004 07:37 PM
Pipe telnet session output to text file joshlamerritt Linux - Software 3 02-10-2004 09:42 PM
Piping output to a text file joadoor Linux - Newbie 7 04-19-2002 04:50 AM

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

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