ls -l Linux command
ls command has various options. Ls command has many options. To list all the options for ls commands use man command. In this post, we will learn about the Linux ls -l command option.
man ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is speciā
fied.
Mandatory arguments to long options are mandatory for short options
too.
-a, --all
do not ignore entries starting with .
-A, --almost-all
do not list implied . and ..
--author
with -l, print the author of each file
-b, --escape
print C-style escapes for nongraphic characters
--block-size=SIZE
scale sizes by SIZE before printing them; e.g., '--block-size=M'
prints sizes in units of 1,048,576 bytes; see SIZE format below
-B, --ignore-backups
do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last modification of
file status information); with -l: show ctime and sort by name;
otherwise: sort by ctime, newest first
-C list entries by columns
--color[=WHEN]
colorize the output; WHEN can be 'always' (default if omitted),
'auto', or 'never'; more info below
-d, --directory
list directories themselves, not their contents
-D, --dired
generate output designed for Emacs' dired mode
-f do not sort, enable -aU, disable -ls --color
-F, --classify
ls -l command with output
After executing the ls -l command, we can see the below output. The ls -l shows the total number of files in the current directory, it shows the file’s attributes and permissions in 7 column format. Let’s understand the meaning of the seven columns along with the description.
- The first column of ls -l shows permission of the file.
- Second column of ls -l represent the total number of links.
- The third column of ls -l tells the name of the file owner.
- The fourth column of ls -l represents the name of Group ownership.
- The fifth column of ls -l shows the total size of the File in bytes.
- The sixth column of ls -l shows the last modification time of the file.
- Seventh column of ls -l represent the name of the file.
sumit@sumit-linux:~$ ls -l total 10988 -rw-r--r-- 1 sumit sumit 285 Jan 20 12:58 1 drwxr-xr-x 3 sumit sumit 4096 Jan 22 21:35 bash-programs drwxr-xr-x 4 sumit sumit 4096 Jul 29 2019 chutkule -rw-r--r-- 1 sumit sumit 141510 Jan 29 16:10 data.txt drwxr-xr-x 3 sumit sumit 4096 Jan 20 13:07 Desktop drwxr-xr-x 2 sumit sumit 4096 Jul 19 2019 Documents drwxr-xr-x 3 sumit sumit 4096 Jan 22 17:18 Downloads drwxrwxr-x 3 sumit sumit 4096 Jan 26 01:49 emoji -rw-r--r-- 1 sumit sumit 10900787 Jan 26 01:07 emoji.zip -rw-r--r-- 1 sumit sumit 8980 Jul 18 2019 examples.desktop drwxr-xr-x 2 sumit sumit 4096 Jul 29 2019 fdrive -rw-r--r-- 1 sumit sumit 16564 Jan 29 13:28 files.txt drwxr-xr-x 2 sumit sumit 4096 Jul 19 2019 Music drwxr-xr-x 2 sumit sumit 4096 Oct 28 12:02 Pictures drwxr-xr-x 3 sumit sumit 4096 Oct 28 14:57 programs drwxr-xr-x 2 sumit sumit 4096 Jul 19 2019 Public drwxr-xr-x 99 sumit sumit 12288 Jan 29 16:10 pythonbaba.com drwxr-xr-x 2 sumit sumit 4096 Jul 21 2019 python_programs -rwxr-xr-x 1 sumit sumit 396 Jan 29 14:57 script.sh drwxr-xr-x 3 sumit sumit 4096 Jan 22 18:13 snap drwxr-xr-x 2 sumit sumit 4096 Jul 19 2019 Templates -rw-r--r-- 1 sumit sumit 1081 Jan 23 00:34 testdisk.log -rw-r--r-- 1 sumit sumit 9419 Jul 21 2019 text -rw-r--r-- 1 sumit sumit 12874 Jan 29 13:12 types_input.txt -rw-r--r-- 1 sumit sumit 52222 Jan 29 13:28 types.txt drwxr-xr-x 2 sumit sumit 4096 Jul 19 2019 Video