Читать книгу Kali Linux Penetration Testing Bible - Gus Khawaja - Страница 26
Displaying Files and Folders
ОглавлениеTo list the files and subfolders inside any directory, use the ls
command to get the job done (I use it a lot to get simpler output). But sometimes, the ls
command by itself is not enough, so you may need to add a couple of options to get better output clarity. The first option that you can use is the ‐a
command (all contents including hidden files), and the second option is the ‐l
command (formatted list):
root@kali:~# ls Desktop Documents Downloads Music Pictures Public Templates Videos root@kali:~# ls -la total 144 drwx------ 14 root root 4096 Sep 22 10:24 . drwxr-xr-x 19 root root 36864 Jul 27 15:41 .. -rw------- 1 root root 155 Sep 22 10:23 .bash_history -rw-r--r-- 1 root root 570 Jul 18 17:08 .bashrc drwx------ 6 root root 4096 Sep 22 11:21 .cache drwxr-xr-x 8 root root 4096 Sep 22 10:22 .config drwxr-xr-x 2 root root 4096 Sep 22 10:21 Desktop -rw-r--r-- 1 root root 55 Sep 22 10:21 .dmrc drwxr-xr-x 2 root root 4096 Sep 22 10:21 Documents drwxr-xr-x 2 root root 4096 Sep 22 10:21 Downloads -rw-r--r-- 1 root root 11656 Jul 27 13:22 .face lrwxrwxrwx 1 root root 11 Jul 27 13:22 .face.icon -> /root/.face drwx------ 3 root root 4096 Sep 22 10:24 .gnupg -rw------- 1 root root 306 Sep 22 10:24 .ICEauthority drwxr-xr-x 3 root root 4096 Sep 22 10:21 .local drwxr-xr-x 2 root root 4096 Sep 22 10:21 Music drwxr-xr-x 2 root root 4096 Sep 22 10:21 Pictures -rw-r--r-- 1 root root 148 Jul 18 17:08 .profile drwxr-xr-x 2 root root 4096 Sep 22 10:21 Public drwxr-xr-x 2 root root 4096 Sep 22 10:21 Templates drwxr-xr-x 2 root root 4096 Sep 22 10:21 Videos -rw------- 1 root root 98 Sep 22 10:24 .Xauthority -rw------- 1 root root 5961 Sep 22 10:24 .xsession-errors -rw------- 1 root root 6590 Sep 22 10:23 .xsession-errors.old root@kali:~#
Take note that filenames that start with a dot character before their names mean that they are hidden (e.g., .bash_history
). Also, at the far left before the permissions, the letter d
means it's a directory and not a file. Finally, you can list another directory's contents differently than the current one by specifying the path of the destination folder:
$ls -la [destination directory path]