LinuxQuestions.org
Help answer threads with 0 replies.
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-08-2012, 01:40 PM   #1
darkmouse
LQ Newbie
 
Registered: Oct 2012
Distribution: LinuxMint 13, Edubuntu, Ubuntu 12.10
Posts: 16

Rep: Reputation: Disabled
Changing directories


I was wondering how I can:
1) list the contents of the top-level/directory into a new file entitled slashroot.lst
2) list the contents of the /bin directory into a new file entitled bin.lst
3) list the contents of the .etc directory into a new file entitled etc.lst
4) list the contents of the /var directory into a new file entitled var.lst
5) cause the contents of the four files just created to be contained in a new file entitled 4dir.lst and in order of the preceding steps.
6) cause the contents of the newly created 4dir.lst file to exist in another new file entitled 4dirsort.lst and sorted alphabetically
7) cause every line containing the tex "gnome" in 4dirsort.lst to be displayed on screen
8) cause the first 10 lines and the last 10 lines of the 4dir.lst file to be displayed to the screen
9) change current directory to home directory
10) list the contents of teh /root directory, including hidden files, into a new file entitled root.lst

Thanks to anyone who can provide assistance to and help me with these questions.
 
Old 10-08-2012, 04:10 PM   #3
felbvts
Member
 
Registered: Mar 2009
Posts: 38

Rep: Reputation: 3
You can do a "cat <filename> > <fileyouwant>
example : cat bin > bin.lst

The file will need to exist before you can write to it so you'll need to do a touch bin.lst
if you want to add to the file (append it) then use >> in place of >
 
1 members found this post helpful.
Old 10-08-2012, 04:40 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
This sounds like homework to me. If you want us to help you on your homework the first thing to do is to show us what you have already done and where you have problems. We will for sure assist you if you have problems, but don't expect us to do your homework for you.
 
  


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
changing home directories help autotron Linux - Newbie 4 05-01-2012 05:02 PM
Changing directories in Sabayon. mwarwick Linux - Newbie 1 03-23-2008 08:23 PM
changing permissions only for directories xpucto Linux - Newbie 2 03-11-2007 06:09 AM
Changing Permissions on Directories... bob4432 Linux - Newbie 6 06-25-2004 03:50 PM
Changing physical location of directories Linus VanPelt Mandriva 2 02-23-2004 08:42 AM


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