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.
Okay, I'm having a hard time. I'm currently going to college, and one of the classes for some odd reason I have to take which is Linux. I'm going to college for web design, and Linux was one of the classes I had to complete (why I don't know). But honestly, I've been working on this question all week and have unable to answer correctly, each time I send it in the teacher says it is incorrect. I'm taking online classes at Baker College (just so you know). Here's the question...
Let us say there is a command "double" which displays each input line twice in the output and let us assume that the input file input.txt has 5 lines of text. How many lines will be output by the following command?
cat input.txt | double | double | double
My first answer was 35, which was wrong, then I got 15 and that is also wrong. I'm not exactly sure what I am doing wrong? I know that the pipe command redirects the output of one command to the input of another command. Which is like this: first_command | second_command and so forth, and can do multiple commands.
I do not know what I am doing wrong, and the teacher isn't helping me out at all. I have read and reread the book of ours, searched online to get an idea and that hasn't helped so far. Any thoughts on this would be highly appreciated. If you do not want to answer that is fine, but I am not sure what I am doing wrong at all.
Mate ... that's not even a "linux question" but a simple Maths problem, and even w/o
a shell around, or a program that does what you're asking (double) you should see that
within a few seconds ... the result (even if only *one* of the processes along the
chain of pipes does a "times two" somewhere) the result will be even ...
I will try to explain pipe clearly. The use of pipe is to redirect the output which means, the output of the first command will be given as input to the second command.
Eg:
$ ls | less
ls - list all files in that directory
less - to display one page at a time
Here the output of the first command is to list all the files in that directory and this output will be displayed one page at a time by using less.
Try it out practically. Then its easy otherwise its very hard. I too am a beginner but i am trying to learn.
ALL THE BEST.
PHP Code:
1% of intelligence and 99% of hard work makes you great person - suman
Okay, I'm having a hard time. I'm currently going to college, and one of the classes for some odd reason I have to take which is Linux. I'm going to college for web design, and Linux was one of the classes I had to complete (why I don't know). But honestly, I've been working on this question all week and have unable to answer correctly, each time I send it in the teacher says it is incorrect. I'm taking online classes at Baker College (just so you know). Here's the question...
Let us say there is a command "double" which displays each input line twice in the output and let us assume that the input file input.txt has 5 lines of text. How many lines will be output by the following command?
cat input.txt | double | double | double
My first answer was 35, which was wrong, then I got 15 and that is also wrong. I'm not exactly sure what I am doing wrong? I know that the pipe command redirects the output of one command to the input of another command. Which is like this: first_command | second_command and so forth, and can do multiple commands.
I do not know what I am doing wrong, and the teacher isn't helping me out at all. I have read and reread the book of ours, searched online to get an idea and that hasn't helped so far. Any thoughts on this would be highly appreciated. If you do not want to answer that is fine, but I am not sure what I am doing wrong at all.
Thanks, much appreciated!!
Seeing how there have been good explanations posted for the pipe command...I'll add on why your college is having you take a Linux course....I'll keep it short and sweet when it comes to the Internet and Web design...Linux is not the new OS in town....the percentage of web servers running Linux compared to running windows is very high.
Apache...runs on Linux which is used host websites...websites are designed with MySQL back end databases...or with php which is just like asp.net...so learning Linux would be beneficial to you...and give you a better understanding of web design outside of a windows environment.
Its nice to know that colleges are providing Linux Classes...when I went to school...Linux classes weren't offered as part of web design..so your getting a bonus... don't take it for granted!
I guess I can see what you are saying shaolin77, thanks for explaining that to me! My other classmates were also wondering the samething. I'll definitely have to let them know what you said.
No offence, but if someone wants to go to college and have anything to do with computers, whatever the technology, Math is and always will be always there. Math and computers always go together.
You must have picked the right college, so be grateful for the teachers, I am sure they know what they are doing.
Just because you are studying web designing does not mean you don't need to know what technology you will see in the real world. That's what's schools are for, explore everything and get prepared for the tough world, so don't say you don't like Math.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.