LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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-27-2002, 09:07 PM   #1
bumstickie
LQ Newbie
 
Registered: Oct 2002
Posts: 1

Rep: Reputation: 0
Unhappy Need homework help!


Newbie! I started out OK, but now I'm getting confused! I think I'm thinking too hard on these, either that or my brain fried....I will happily take "hints", or a push in the right direction! I'm doing fine on other parts, but some questions just aren't clicking in my head. Here are my problems:

1. I am to deliberately write a command that generates an error, like "ls -l asfd". No problem. I am then to send this stderr to a file called "errfile". Again, no problem. Now here's the problem: "send stdout to tempfile and stderr to errfile" How do I do both at the same time?
More on the same question: "write a version of above, send both stdout and stderr to tempfile" ALSO: "write another version where you only need to specify the name 'tempfile' one time, but both stdout and stderr are redirected to 'tempfile' (hint - use "&").

2. "Find" command with reg exp....write a Find command to find all filenames in the /dev directory that begin with 'fd', but limit the list to files ending with '20' or '40'....I'm so close, but I just can't get it. I know the basic theory on using ? and *, but I just can't get it. I tried "find /dev -name fd[24] -print" with all versions of *'s, ?'s, ^'s...but just can't figure it out. I know this is a really stupid quesiton!!!

3. "grep" confuses me.... Just a hint here and I should be able to get the rest.... "Type 'ls -al > tempfile' to store a directory listing in tempfile".
a.) "Write a grep command which will show all lines of all files in your home directory that contain the string '.bash'"
b.) write another to show all lines with file permissions rw-r--r--
c.) write one command containing 2 commands connected by a pipe to accomplish "a.)"
d.) write one command containing 2 commands connected by a pipe to accomplish "b.)"

4. Aliases. I understand the concept. I am to edit the ".bashrc" script to add an alias using vi editor. I did that. It worked. I shut down and went about my day. Started Linux back up and continued on with this question - and it disappeared. I saved it originally, and tested it out. But when I logged in later, it wasn't there. I am supposed to figure out how to automate this for all new users that are created. I understand that this is done with /etc/skel, but I can't figure out how. (Like I said, I think I'm thinking too hard or not getting enough sleep or somethign, because I know I should be able to figure these simple things out, they're just not coming to me!)

5. Need basic help with mounting. "use 'cat' command to create a small text file in '/mnt/cdrom', use ls to verify. insert CD and mount it. Why I can't get this is beyond me....I'm an idiot!

6. Was to run the "ps" command as "ps -ef". Fine, no prob. Then wa asked to write "a ps command in the format 'ps -eo <option list> which gives exactly the same display as -ps -ef'" Tried everything. CHecked everywhere...just can't get it.

7. "Use the --sort option of ps to repeat #6 in reverse order by user"

Any help anyone can give me is greatly appreciated! I don't need exact answers (although they are welcome!), just a point in the right direction. I picked a bad time to start this particular class (life in general), and I'm struggling. Things should get better (now that I got laid off and will have plenty of time to study) - but as for now, I'm confused. Thanks in advance!

d
 
Old 10-27-2002, 10:44 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 234Reputation: 234Reputation: 234
Well, the one suggestion I'll give you is to search for you answers first.

Check out:

www.tldp.org - lots of howto's, guides, good information there.
www.google.com/linux - the best search engine around for Linux.

Not to sound rude or anything, but most members here and mods don't like people who ask to help with homework or the such and it often annoys us. Its just the whole principle of the thing. That's why its assignment, its for you to do, not anyone else.
 
Old 10-27-2002, 10:51 PM   #3
sewer_monkey
Member
 
Registered: May 2002
Location: Toronto, ON, Canada
Distribution: Ubuntu, Debian, RedHat/CentOS
Posts: 624

Rep: Reputation: 31
Just curious... What school/course was this assignment given in?

Most schools nowadays only do Micro$oft junk.
 
Old 10-28-2002, 04:37 AM   #4
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
1. Read the manual pages of bash. Particullary the sections Redirecting Output & Redirecting Standard Output and Standard Error

2. Your find command looks for all entries starting with fd and followed by a 2 or a 4. It should be starting with fd then any range of characters and then ending with either a 2 or a 4 and then a zero.

3. Read the manual pages of grep. Basically you just type 'grep string_to_search filename'. For the first two commands grep reads from the tempfile. In the c and d you should be able to let grep work on the output of the first ls command by using a pipe. They haven't specified the question very clearly though, making c and d sound a bit confusing.

4. Just adding the commands to /etc/skel/.bashrc should be enough to have it set for each newly created user. The command you added dissapeared from the .bashrc file? Is there some start up script which is overwriting the file on bootup?

5. What do they want you to do for this question? After mounting the cd the file you just created obviously won't be there.

6. If you look at the first line of ps -ef you should be able to see all the field names. You should be able to get the same options using an option list. To get the first two fields you could run the command: ps -eo "user pid"
You can find the rest by reading the man page of ps.

7. A normal ps command sorts by pid. You can specify a reverse sort by adding a - before the key.
 
  


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
Help on Homework... Cant find .bashrc maravillasc Linux - Newbie 11 10-17-2005 09:39 PM
Linux homework Ghstfce Linux - General 7 09-09-2005 04:39 AM
homework help louce Linux - Newbie 3 09-04-2005 08:00 PM
please help my homework again donotexpert Programming 7 08-23-2005 10:26 AM
help me(my homework) please! donotexpert Programming 4 08-20-2005 06:26 AM


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