Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-04-2006, 10:48 AM   #1
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?

Old 10-04-2006, 10:54 AM   #2
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Debian "Testing"
Posts: 6,093

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

Old 10-04-2006, 10:56 AM   #3
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.
$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
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 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: 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


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 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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration