LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-19-2006, 06:04 PM   #1
strello
LQ Newbie
 
Registered: Oct 2006
Posts: 4

Rep: Reputation: 0
Writing /etc files to a new file


I am trying to write a one line command that will:

write any file name in the /etc directory that has an extension of .cfg to a file named mywork (the file mywork has not been created yet).

Any suggestions on what command I can use to accomplish this.
 
Old 11-19-2006, 06:11 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Is this a homework assignment?
 
Old 11-19-2006, 06:14 PM   #3
strello
LQ Newbie
 
Registered: Oct 2006
Posts: 4

Original Poster
Rep: Reputation: 0
Yes it is, and after spending hours to try and find it in my book I am resorting to other methods, whcich in this case are the forums
 
Old 11-19-2006, 06:46 PM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
OK. I don't like to give homework answers directly, but I'm happy to point you in the right direction. There's some terminology you'll need to know to find the info.

Commands which print output can have that output redirected to a file. This is done by the shell (the program which runs inside a terminal window - it read commands, execute them and prints their output). The shell on most Linux systems is called bash. If you look up the bash documentation and search for redirection, that should tell you how to do it.

After that it's just a matter of finding the right command. You can use several for this purpose. ls is probably the one you want. To work out how to list a specific directory's contents, see the documentation

Most Linux systems ship with documentation for both these things in the system manual. To access the system manual, you can type in "man subject" in a terminal window. You can use space to page down, up and down cursors to move a little bit, / to serach, and q to quit.

So to see the manual page for bash, type "man bash", and likewise "man ls" for the ls documentation.
 
Old 11-19-2006, 06:47 PM   #5
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
man find

--Ian
 
  


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
limewire keeps writing files...? santiagosilva Linux - Desktop 1 09-20-2006 10:06 AM
writing spec file for RPM to move files Help Me Linux - Newbie 2 05-08-2006 12:58 PM
writing to files in C ocularbob Programming 9 02-17-2004 12:06 PM
Command for writing over files? soulflyer Linux - Newbie 2 12-12-2003 05:26 PM
Writing Single files to a CD jimmmac Linux - Software 11 04-27-2003 04:20 PM


All times are GMT -5. The time now is 04:25 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration