Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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!
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.