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.
I hope you can explain each section and what it all means and what this is supposed to do... the only things i think i understand is that it is a pipe.. and its supposed to redirect to the conf file?
for each cmd and read the manual and/or google would do as well.
Anyway... basically it lists the /etc dir, looks for the string 'conf' in the o/p, attempts to eliminate strings with literal '.'s in them (although that won't work; uppercase V is version, lowercase v is 'invert-match' ie don't match), then sort (sic) the results into a file (conf) in the user's home dir .
A much better option (which is doing the same thing)
Code:
ls /etc | awk '/\.conf$/' > ~/conf
"ls /etc" lists all files from the /etc directory, then it passes the results to the awk command which is using the Reqex to filter out all the files which do not end with ".conf", after that it writes the result to the "conf" file located inside the users home directory.
There is no need for the "sort" command because "ls" is already returning the sorted results (depends on the configuration through)
"|" (Pipe) means pass the result of the last command to the next command
">" (Redirection) means write the result to whatever is on the right side (file, device, socket)
Last edited by andros705; 09-04-2017 at 08:12 PM.
Reason: Fix typo
I hope you can explain each section and what it all means and what this is supposed to do... the only things i think i understand is that it is a pipe.. and its supposed to redirect to the conf file?
thank you so much for your help!
Yes, it's broken and likely doesn't do what its author intended. If you're looking to learn from example, I'd look elsewhere.
I hope you can explain each section and what it all means and what this is supposed to do... the only things i think i understand is that it is a pipe.. and its supposed to redirect to the conf file?
thank you so much for your help!
If you really wish to learn UNIX and command line work then I suggest that you can read & learn from the following;
Quote:
Just a few links to aid you to gaining some understanding;
Thank you so much everyone! I am literally just starting to learn but am in an advanced course and all of the tools and explanations given have really helped me. thanks again!
learning the AWK and SED commands currently. Would anyone be able to have a IM chat going with me so i can ask questions in real time? any help is greatly appreciated.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.