LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-04-2006, 10: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, 10:54 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
/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, 10: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: 335Reputation: 335Reputation: 335Reputation: 335
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, 03: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, 05:29 AM   #5
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

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


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

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

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