• Listing the Contents of a Directory with ls
  • Getting Help
  • 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
    bet31/125
    Sana14.05.2024
    Hajmi7,3 Mb.
    #232858
    1   ...   27   28   29   30   31   32   33   34   ...   125
    Bog'liq
    linuxbasicsforhackers

    cd ..
    kali >
    pwd
    /
    kali >
    This moves us up one level from /etc to the / root directory, but you can 
    move up as many levels as you need. Just use the same number of double-
    dot pairs as the number of levels you want to move:
    • 
    You would use
    ..
    to move up one level.
    • 
    You would use 
    ../..
    to move up two levels.
    • 
    You would use 
    ../../..
    to move up three levels, and so on.
    So, for example, to move up two levels, enter 
    cd
    followed by two sets of 
    double dots with a forward slash in between:
    kali >
    cd ../..
    You can also move up to the root level in the file structure from any-
    where by entering 
    cd /
    , where 
    /
    represents the root of the filesystem.
    Listing the Contents of a Directory with ls
    To see the contents of a directory (the files and subdirectories), we can use 
    the 
    ls
    (list) command. This is very similar to the 
    dir
    command in Windows.
    kali >
    ls
    bin initrd.img media run var


    8
    Chapter 1
    boot initrd.img.old mnt sbin vmlinuz
    dev lib opt srv vmlinuz.old
    etc lib64 proc tmp
    home lost+found root usr
    This command lists both the files and directories contained in the 
    directory. You can also use this command on any particular directory, not 
    just the one you are currently in, by listing the directory name after the 
    command; for example, 
    ls /etc
    shows what’s in the /etc directory.
    To get more information about the files and directories, such as their 
    permissions, owner, size, and when they were last modified, you can add 
    the 
    -l
    switch after 
    ls
    (the 
    l
    stands for long). This is often referred to as 
    long listing. Let’s try it here:
    kali >
    ls -l
    total 84
    drw-r--r-- 1 root root 4096 Dec 5 11:15 bin
    drw-r--r-- 2 root root 4096 Dec 5 11:15 boot
    drw-r--r-- 3 root root 4096 Dec 9 13:10 dev
    drw-r--r-- 18 root root 4096 Dec 9 13:43 etc
    --
    snip
    --
    drw-r--r-- 1 root root 4096 Dec 5 11:15 var
    As you can see, 
    ls -l
    provides us with significantly more information, 
    such as whether an object is a file or directory, the number of links, the 
    owner, the group, its size, when it was created or modified, and its name.
    I typically add the 
    -l
    switch whenever doing a listing in Linux, but to 
    each their own. We’ll talk more about 
    ls -l
    in Chapter 5.
    Some files in Linux are hidden and won’t be revealed by a simple 
    ls
    or 
    ls -l
    command. To show hidden files, add a lowercase 
    –a
    switch, like so:
    kali >
    ls -la
    If you aren’t seeing a file you expect to see, it’s worth trying 
    ls
    with the 
    a
    flag When using multiple flags, you can combine them into one, as we’ve 
    done here with 
    -la
    instead of 
    -l -a
    .
    Getting Help
    Nearly every command, application, or utility has a dedicated help file in 
    Linux that provides guidance for its use. For instance, if I needed help 
    using the best wireless cracking tool, aircrack-ng, I could simply type the 
    aircrack-ng
    command followed by the 
    --help
    command:
    kali >

    Download 7,3 Mb.
    1   ...   27   28   29   30   31   32   33   34   ...   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