• Need More Help
  • Introductiontolinux




    Download 4,86 Mb.
    Pdf ko'rish
    bet12/18
    Sana23.12.2023
    Hajmi4,86 Mb.
    #127288
    1   ...   8   9   10   11   12   13   14   15   ...   18
    Bog'liq
    introductiontolinux

    23
    Piping output from one command into another is a very useful way of working at the command 
    prompt. It can allow you to output the results of a command into a file, or even allow you to search 
    through the output for a specific string. Let’s try looking for the same man pages again, but this time 
    we will redirect the output to the Linux search system ‘grep ’, and search for a specific line of text.
    As you can see, now only a few results are displayed. Only the results from ‘man –k directory ’ 
    containing that search string ‘ls ’ are displayed, and the lines not meeting the search criteria are 
    discarded.
    Grep can be useful when searching through a long list of files/folders for one specific entry, or 
    when working with any large amounts of data. In this case, we simply used it to filter search results. 
    Using the command ‘man –k directory | grep  ’, try searching for some other keywords, 
    replacing with the word of your choice. For example: run, NT, ACL, ln. 
    Need More Help?
    If at any point you require more help than the ‘man’ pages can provide, there are a number of other 
    resources. One of these resources is ‘TLDP’ (The Linux Documentation Project). Not only does this 
    contain a copy of all the man pages, but there are Howto, guides, and FAQs on various Linux-related 
    subjects. Take a look at 
    http://www.tldp.org
    in your own time. 
    By far, the best source of information for Linux is ‘Google’. If you are ever stuck, try Googling for 
    the solution. You will always feel a greater sense of accomplishment if you solve a problem yourself. 
    Never underestimate forums or newsgroups. While a solution may not immediately be apparent 
    (especially from the first few posts), the users that have posted will normally work toward a solution, 
    and the forum is a very good way of finding out what has worked and not worked previously.
    When Googling, remember to put exactly what you’re looking for. It is recommended that you put 
    your linux distro into the search string, as some problems and solutions may be distro-specific. 
    Another key word to use is ‘howto ’. If you are looking for a guide, this can provide the best results. 
    Try it by Googling for; ‘linux dhcp howto ’ in your free time, and take a look at the results.
    After (and only) after you have exhausted ALL other avenues for help, ask someone. People are more 
    willing to help if you have tried to solve things yourself. 
    REMEMBER:
    Always try to help yourself first by researching the problem!
    clear
    man -k directory | grep ls
    Clear all previous output
    This pipes the output from the man-k 
    command into grep. In this instance, 
    we have told grep to search for the 
    string ‘ls’
    NOTE:
    Pipe (|) is not a capital ‘i’



    Download 4,86 Mb.
    1   ...   8   9   10   11   12   13   14   15   ...   18




    Download 4,86 Mb.
    Pdf ko'rish