LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-11-2019, 11:14 AM   #1
fromvt
LQ Newbie
 
Registered: Apr 2012
Posts: 6

Rep: Reputation: Disabled
putting an output from a terminal command to a file


Hi,
I am trying to save error messages when compiling file "a.f" on my MAC using
gfortran as a FORTRAN compiler.

The terminal command
gfortran -c a.f > log

puts compiler errors on the screen rather than into the file "log". I have tried
both with existing and non-existing file "log"

There is no complaint about using the redirect sign ">". It simply ignores it.
Thank you in advance
 
Old 10-11-2019, 11:18 AM   #2
kermitdafrog8
Member
 
Registered: Dec 2018
Location: Orlando, FL
Distribution: Slackware AARCH64 and X86_64
Posts: 334

Rep: Reputation: Disabled
putting an output from a terminal command to a file

Did you try with &> log ?
 
Old 10-11-2019, 11:22 AM   #3
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,808
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
Your question is a duplicate of this thread.

Another option is to precede your activity with the script command, which mirrors all screen activity to a file until you terminate the script command with Ctrl-C.
 
Old 10-11-2019, 11:28 AM   #4
fromvt
LQ Newbie
 
Registered: Apr 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Dear kermitdafrog8

Dear kermitdafrog8

Thank you very much. Your suggestion using "&>" for redirect worked
 
Old 10-11-2019, 12:15 PM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
if you want to read some background info, look for stdin/stdout/stderr. You will find pages like this:
https://linuxtechlab.com/12-bash-scr...o-redirection/ or this: https://www.tldp.org/LDP/abs/html/io-redirection.html
 
  


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
Wrote Shell in C - piping output from first command to second command, sending to output file issue KarenWest Programming 2 03-31-2016 05:27 PM
Putting saved xdiff output back into (text) columns twork Linux - Software 2 02-04-2016 08:07 PM
putting binaries in /opt and then running them from terminal from any directory? Cultist Linux - Software 2 11-25-2011 09:13 AM
[SOLVED] append command output to file by giving command in terminal sumeet inani Linux - Newbie 4 07-03-2009 10:36 AM
Redirect terminal output to file AND terminal shan Linux - General 3 09-29-2006 08:36 AM

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

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