ls Command In Kali Linux Terminal

Hi, buddy in this article we gonna break down how to use the ls Command In Kali Linux terminal. Please alert us when we use the ls command in Ubuntu, Debian, CentOS, Fedora, Arch and other Linux distros purpose is always different. And I know why you want to use the ls command in Kali.

For almost two and a half years I use Kali as the main OS for pen testing, I know what is the importance of the LS command when you work especially on Linux servers. I can explain some hidden secrets about LS command you definitely need to know.

Whatever command I share here you just copy-paste your terminal and check you will get the same result, Most important don’t take a lot of headaches just do step by step. Before Learning how to use LS please understand what is LS in Linux.

What is ls Command

In Linux terminal ls command stands for list directory or folder contents, In Linux Terminal If you want to see what files and directories or folders are Available in a current directory or folder then you need to just type ls in a small English alphabet letter.

ls – list directory contents

ls in Linux: List information about the FILEs Especially the current directory.

How to see current files in Linux Terminal: type “ls” in your Linux terminal.

Open your Linux terminal and just type an ls in a small alphabet letter.

ls

Out-Put

ls Command In Kali Linux

ls come with a lot of options but always remember 80/20 rules please don’t learn each and everything just focus on 20% which helps to complete 99% of the work.

How To See All Hidden Files In Linux Terminal

Type your Linux Terminal ls -a for all files including hidden files.

Command

ls -a

Out-Put

──(kali㉿kali)-[~]
└─$ ls -a 
 .                       Downloads       .mozilla            Templates
 ..                      .face           .msf4               tex.py
 .bash_history           .face.icon      Music               up1
 .bash_logout            .fonts.conf     .mysql_history      Videos
 .bashrc                 .gnupg          MyTool              vim
 .bashrc.original        go              .nc_history         .viminfo
 Best_bash_command.txt   GOD             Notebooks          'VirtualBox VMs'
 bin                     .gtkrc-2.0      Pictures            vm
 .BurpSuite              .hashcat        .pki                website
 .cache                  hydra.restore   .profile            .weevely
 Commands                .ICEauthority   Public              .wget-hsts
 .config                 ip.sh           python              Work
 ctf                     .java           .python_history     .wpscan
 Cyber_Job               .john           .rediscli_history   YouTube
 .dbus                   .kde            .sqlite_history     .ZAP
 Desktop                 .lesshst        .ssh                .zsh_history
 Documents               .local          .ssr                .zshrc

Hidden files start with { . } Dot.

How To Check All Files In Linux Terminal

Type your Linux Terminal ls -A {Capital A} for all files and directories (folder).

Command

ls -A

Out-Put

┌──(kali㉿kali)-[~]
└─$ ls -A
 .bash_history           .face.icon      Music               up1
 .bash_logout            .fonts.conf     .mysql_history      Videos
 .bashrc                 .gnupg          MyTool              vim
 .bashrc.original        go              .nc_history         .viminfo
 Best_bash_command.txt   GOD             Notebooks          'VirtualBox VMs'
 bin                     .gtkrc-2.0      Pictures            vm
 .BurpSuite              .hashcat        .pki                website
 .cache                  hydra.restore   .profile            .weevely
 Commands                .ICEauthority   Public              .wget-hsts
 .config                 ip.sh           python              Work
 ctf                     .java           .python_history     .wpscan
 Cyber_Job               .john           .rediscli_history   YouTube
 .dbus                   .kde            .sqlite_history     .ZAP
 Desktop                 .lesshst        .ssh                .zsh_history
 Documents               .local          .ssr                .zshrc
 Downloads               .mozilla        Templates
 .face                   .msf4           tex.py

Hidden files and directories (folder) start with { . } Dot.

ls -l Command in Linux

Using the ls -l (use a long listing format) option we can do the below task.

  1. Check File Permissions.
  2. Check the Modified Time Of A File.
  3. Check File Size.

These 3 tasks we mostly use In Linux see the below examples.

How To Check File Permissions In Linux Terminal

Type your Linux Terminal ls -la to check all files and directories (folder) Permissions.

Command

ls -la

Out-Put

┌──(kali㉿kali)-[~]
└─$ ls -la
total 151020
drwxr-xr-x 43 kali kali      4096 Oct  5 20:31  .
drwxr-xr-x  3 root root      4096 May 24  2021  ..
-rw-------  1 kali kali        19 Oct  6  2021  .bash_history
-rw-r--r--  1 kali kali       220 May 24  2021  .bash_logout
-rw-r--r--  1 kali kali      4728 Dec 31  2021  .bashrc
-rw-r--r--  1 kali kali      3526 May 24  2021  .bashrc.original
-rw-r--r--  1 kali kali        45 May 25  2021  Best_bash_command.txt
drwxr-xr-x  2 kali kali      4096 Jul 27  2021  bin
drwx------  6 kali kali      4096 Dec 27  2021  .BurpSuite
drwx------ 38 kali kali      4096 Sep 29 19:17  .cache
drwxr-xr-x  2 kali kali      4096 Oct  3 09:12  Commands
drwx------ 47 kali kali      4096 Sep 29 19:18  .config
drwxr-xr-x  4 kali kali      4096 Aug  5  2021  ctf
drwxr-xr-x  2 kali kali      4096 Sep 28  2021  Cyber_Job
drwx------  3 kali kali      4096 Sep 19  2021  .dbus
drwxr-xr-x  2 kali kali      4096 Sep 12  2021  Desktop
drwxr-xr-x  4 kali kali      4096 Oct 21  2021  Documents
drwxr-xr-x  3 kali kali     12288 Oct  4 17:18  Downloads
-rw-r--r--  1 kali kali     11759 May 24  2021  .face
lrwxrwxrwx  1 kali kali         5 May 24  2021  .face.icon -> .face
-rw-r--r--  1 kali kali       110 Sep 27  2021  .fonts.conf
drwx------  3 kali kali      4096 May 25  2021  .gnupg
drwxr-xr-x  4 kali kali      4096 Jul 27  2021  go

lrwxrwxrwx after seeing this please don’t confuse see below.

How to understand Linux permission files

  • r : Read
  • w : Write
  • x : Execute
  • -rw——- : Read and Write
  • -rw-r–r– : Read and Write and Root user also Write
  • drwxr-xr-x : All User are able to Read the directory, but modify only be changed by the creator.
  • drwx—— : Read, Write and Accessible by the user
  • lrwxrwxrwx : Read, Write And Execute Access and Permissions the Creator, and other User need privileges.

How To Check Modified Time Of A File In Linux Terminal

Type your Linux Terminal ls -lt for the time of last modification of file all files and directories (folder).

Command

ls -lt

Out-Put

┌──(kali㉿kali)-[~]
└─$ ls -lt 
total 150780
drwxr-xr-x  4 kali kali      4096 Oct  5 13:30  Work
drwxr-xr-x  3 kali kali     12288 Oct  4 17:18  Downloads
drwxr-xr-x  2 kali kali      4096 Oct  3 09:12  Commands
drwxr-xr-x  3 kali kali      4096 Sep 27 10:53  GOD
drwxr-xr-x  3 kali kali      4096 Sep 26 07:26  YouTube
drwxr-xr-x  2 kali kali      4096 Jun 23 17:57  Pictures
drwxr-xr-x 19 kali kali      4096 May 13 18:50  python
drwxr-xr-x 15 kali kali      4096 Apr 25 00:40  Videos
drwxr-xr-x  5 kali kali      4096 Apr  3  2022  website
drwxr-xr-x  2 kali kali      4096 Dec 21  2021  MyTool
drwxr-xr-x  4 kali kali      4096 Oct 21  2021  Documents
drwxr-xr-x  2 kali kali      4096 Oct 11  2021  vim
-rw-r--r--  1 kali kali         0 Oct  6  2021  tex.py
drwxr-xr-x  2 kali kali      4096 Sep 28  2021  Cyber_Job
drwxr-xr-x  2 kali kali      4096 Sep 12  2021  Desktop
drwxr-xr-x  3 kali kali      4096 Sep 11  2021 'VirtualBox VMs'
-rw-r--r--  1 kali kali 154276097 Sep  5  2021  hydra.restore

drwxr-xr-x 2 kali kali 4096 Oct 11 2021 vim : last modification date Oct 11 2021.

How To Check File Size In Linux Terminal ( Human Readable )

With help of two, commands ls -lh and ls -sh we are able to Check the File Size in Human Readable format.

First Command:

ls -lh

Out-Put

┌──(kali㉿kali)-[~]
└─$ ls -lh
total 148M
-rw-r--r--  1 kali kali   45 May 25  2021  Best_bash_command.txt
drwxr-xr-x  2 kali kali 4.0K Jul 27  2021  bin
drwxr-xr-x  2 kali kali 4.0K Oct  3 09:12  Commands
drwxr-xr-x  4 kali kali 4.0K Aug  5  2021  ctf
drwxr-xr-x  2 kali kali 4.0K Sep 28  2021  Cyber_Job
drwxr-xr-x  2 kali kali 4.0K Sep 12  2021  Desktop
drwxr-xr-x  4 kali kali 4.0K Oct 21  2021  Documents
drwxr-xr-x  3 kali kali  12K Oct  4 17:18  Downloads
drwxr-xr-x  4 kali kali 4.0K Jul 27  2021  go
drwxr-xr-x  3 kali kali 4.0K Sep 27 10:53  GOD
-rw-r--r--  1 kali kali 148M Sep  5  2021  hydra.restore
-rwxr-xr-x  1 kali kali  230 May 25  2021  ip.sh
drwxr-xr-x  2 kali kali 4.0K Jun 21  2021  Music
drwxr-xr-x  2 kali kali 4.0K Dec 21  2021  MyTool
drwxr-xr-x  3 kali kali 4.0K May 25  2021  Notebooks
drwxr-xr-x  2 kali kali 4.0K Jun 23 17:57  Pictures

See file size shown below format.

  • K: Kilowbytes
  • M: Megabytes
  • T: terabyte

2nd Command:

ls -sh

Out-Put

┌──(kali㉿kali)-[~]
└─$ ls -sh
total 148M
4.0K  Best_bash_command.txt  148M  hydra.restore  4.0K  up1
4.0K  bin                    4.0K  ip.sh          4.0K  Videos
4.0K  Commands               4.0K  Music          4.0K  vim
4.0K  ctf                    4.0K  MyTool         4.0K 'VirtualBox VMs'
4.0K  Cyber_Job              4.0K  Notebooks      4.0K  vm
4.0K  Desktop                4.0K  Pictures       4.0K  website
4.0K  Documents              4.0K  Public         4.0K  Work
 12K  Downloads              4.0K  python         4.0K  YouTube
4.0K  go                     4.0K  Templates
4.0K  GOD                       0  tex.py

With this command, we can’t see the hidden file sizes rest all same.

How To Find Inode of any directory

Type your Linux Terminal ls -i for the index number of each file and directory (folder).

Command:

ls -i

Out-Put

┌──(kali㉿kali)-[~]
└─$ ls -i 
16523144  Best_bash_command.txt  16646155  Notebooks
16646350  bin                    16515200  Pictures
18219435  Commands               16515197  Public
16777219  ctf                    17170462  python
17170528  Cyber_Job              16515196  Templates
16515194  Desktop                16530732  tex.py
16515198  Documents              16522201  up1
16515195  Downloads              16515201  Videos
17956865  go                     17170486  vim
16646396  GOD                    16646409 'VirtualBox VMs'
16530114  hydra.restore          17432626  vm
16522978  ip.sh                  18350421  website
16515199  Music                  16518468  Work
17301945  MyTool                 17825906  YouTube

Index number help to find files and directories (folder).

How To Check Subdirectories In Linux Terminal

If you want to find Subdirectories in your Linux terminal then just type ls -R {Capital R}.

ls -R

Out-Put

┌──(kali㉿kali)-[~/vm]
└─$ ls -R             
.:
metaspoitable_vm

./metaspoitable_vm:
keyword.txt       nmapmysql.txt  note.txt      xxs_Redirection.txt
keyword.txt.save  nmap.txt       shell001.php
                                                                                  
┌──(kali㉿kali)-[~/vm]

Why this command is important when you want to find something without going into the directory then use this command and find everything that the under the directory.

FAQ

What does the command ls mean in Linux?

Show all List information about the FILEs directories (folder) in the current directory (folder).

What does the Linux command ls stand for?

ls stand for – list directory contents.

How is a symbolic link displayed in Linux using the ls command?

Need to use “ ls –dereference-command-line-symlink-to-dir “in this command.

Other Articles for you:

History Command In Kali Linux.

grep Command In Kali Linux.

Please Subscribe to Our YouTube Channel

Scroll to Top
Top 7 Gaming Project In python Save ₹25,000 Laptop under ₹11,999 Top 7 Funny error in Python Unicodeescape Most dangerous error in Python Hero Electric Battery Price In 2023