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!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I guess that depends on what the book was trying to accomplish with the command. The original command as you posted doesn't really do anything useful. This would probably be a better example:
cd /bin && ls | wc
This command does the following in steps:
cd /bin -- changes the current working directory to /bin
&& ls -- if successful then do ls
| wc -- count the words in the ls output
Originally posted by pony85 hey guys i found out the size of the ls file in my /bin folder is 0 bytes... and may be this is the reason it is doing nothing. DOES THAT MEAN I FOUND A BUG IN REDHAT 9.0 ??
Originally posted by pony85 ok type this command at ur shell prompt as root
cd /sbin | ls > wc
and check the size of the ls file in your /bin directory
This command does not do what you think it is doing. It is send the output of "cd /sbin" to the ls command. Since /sbin exists the ls command is acting on null input. Look at the steps individually. "cd /sbin" just returns you to the next prompt unless there is an error. Piping the output of a cd command to ls doesn't make any sense. It makes more sense to cd then ls which is:
cd /sbin && ls
You keep doing "> wc" which is collecting the output the last command. There are two problems with this. First, you littering your file systems with little files called wc everywhere. Secondly, wc is an actual command which may cause problem later. If you did this in the directory where the real wc command exists you would corrupt that command.
Well dude the problem is that it works in a similar way in all the directories even if the dir is not empty and i know it doesnt make any sense but may be its a bug in Redhat 9.0 that the size of ls becomes 0 bytes once this command is executed.
ok Wow u r a genius Tink. i did do ls > ls but can how will my ls file in /bin dir become zero?? and also pleaseeeeeeeeeeeee tell me how can i put it right? will copying the ls file from another redhat 9.0 system help??
Hehe, nice doing.
Copy the ls from an other distro should do it (or from your installation cd-rom even better).
And where the heck did you get that command? Was someone trying to fuck with you?
You should keep out about typing such commands as root, because you can do really harmful and not fixable damage to your linux system.
You should never ever work as root unless you really require being root (e.g to make configuration or somesuch).
Wow!! U know it feels soo gud for the first time i did something which can we used a shell script 2 ruin da ls command hmmm i do write virus on WINDOZE but... Linux is different... Boyyy!! LINUX ROX!!!
Originally posted by pony85 well stickman actually i didnt mean anything. I just tried it as i read bout piping in a Unix book.. but can u please let me know how i can set it right.
What book were your reading? I suspect that you should probably find another book with fewer questionable and dubious commands. Also, doing these types of experiments as root is not really wise unless you like fixing problems that could have been easily avoided. Try working as a regular user. You'll get feedback from the OS about permissions and such that will help you get the command that you really want.