• Modifying Files and Directories
  • Creating Files
  • Concatenation with cat
  • L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h




    Download 7,3 Mb.
    Pdf ko'rish
    bet37/125
    Sana14.05.2024
    Hajmi7,3 Mb.
    #232858
    1   ...   33   34   35   36   37   38   39   40   ...   125
    Bog'liq
    linuxbasicsforhackers

    ps aux | grep apache2
    root 4851 0.2 0.7 37548 7668 ? Ss 10:14 0:00 /usr/sbin/apache2 -k start
    root 4906 0.0 0.4 37572 4228 ? S 10:14 0:00 /usr/sbin/apache2 -k start
    root 4910 0.0 0.4 37572 4228 ? Ss 10:14 0:00 /usr/sbin/apache2 -k start
    --
    snip
    --
    This command tells Linux to display all my services and then send 
    that output to 
    grep
    , which will look through the output for the keyword 
    apache2 and then display only the relevant output, thus saving me consid-
    erable time and my eyesight.
    Modifying Files and Directories
    Once you’ve found your files and directories, you’ll want to be able to per-
    form actions on them. In this section, we look at how to create files and 
    directories, copy files, rename files, and delete files and directories.
    Creating Files
    There are many ways to create files in Linux, but for now we’ll just look at 
    two simple methods. The first is 
    cat
    , which is short for concatenate, meaning 
    to combine pieces together (not a reference to your favorite domesticated 
    feline). The 
    cat
    command is generally used for displaying the contents of a 
    file, but it can also be used to create small files. For creating bigger files, it’s 
    better to enter the code in a text editor such as vim, emacs, leafpad, gedit, 
    or kate and then save it as a file.
    Concatenation with cat
    The 
    cat
    command followed by a filename will display the contents of that 
    file, but to create a file, we follow the 
    cat
    command with a redirect, denoted 
    with the 
    >
    symbol, and a name for the file we want to create. Here’s an 
    example:
    kali >
    cat > hackingskills
    Hacking is the most valuable skill set of the 21st century!


    14
    Chapter 1
    When you press 
    enter
    , Linux will go into interactive mode and wait for 
    you to start entering content for the file. This can be puzzling because 
    the prompt disappears, but if you simply begin typing, whatever you enter 
    will go into the file (in this case, hackingskills). Here, I entered 
    Hacking
    is the most valuable skill set of the 21st century!
    . To exit and return to 
    the prompt, I press 
    ctrl
    -D. Then, when I want to see what’s in the file 
    hackingskills, I enter the following:
    kali >

    Download 7,3 Mb.
    1   ...   33   34   35   36   37   38   39   40   ...   125




    Download 7,3 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h

    Download 7,3 Mb.
    Pdf ko'rish