ls UNIX Command with more examples

Hi Folks,

ls – Command is the most common two letters command for all UNIX users as well as the administrators. In our day today life we might use this ls command at least 10 or 20 times in a day.

In this post let us see ls command with more examples. I’ve given 35 most frequently used practical ls commands with examples. For all Unix/Linux Commands visit All UNIX Commands

Command ls
Syntax ls [OPTION]  [FILE]
Description List information about the files (the current directory by default).

 

Start with ls –help which gives you all possibilities of ls Command.

stephen@stephen:~$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

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 defaults to 'always'
                               or can be 'never' or 'auto'.  More info below
  -d, --directory            list directory entries instead of contents,
                               and do not dereference symbolic links
  -D, --dired                generate output designed for Emacs' dired mode
  -f                         do not sort, enable -aU, disable -ls --color
  -F, --classify             append indicator (one of */=>@|) to entries
      --file-type            likewise, except do not append '*'
      --format=WORD          across -x, commas -m, horizontal -x, long -l,
                               single-column -1, verbose -l, vertical -C
      --full-time            like -l --time-style=full-iso
  -g                         like -l, but do not list owner
      --group-directories-first
                             group directories before files.
                               augment with a --sort option, but any
                               use of --sort=none (-U) disables grouping
  -G, --no-group             in a long listing, don't print group names
  -h, --human-readable       with -l, print sizes in human readable format
                               (e.g., 1K 234M 2G)
      --si                   likewise, but use powers of 1000 not 1024
  -H, --dereference-command-line
                             follow symbolic links listed on the command line
      --dereference-command-line-symlink-to-dir
                             follow each command line symbolic link
                             that points to a directory
      --hide=PATTERN         do not list implied entries matching shell PATTERN
                               (overridden by -a or -A)
      --indicator-style=WORD  append indicator with style WORD to entry names:
                               none (default), slash (-p),
                               file-type (--file-type), classify (-F)
  -i, --inode                print the index number of each file
  -I, --ignore=PATTERN       do not list implied entries matching shell PATTERN
  -k, --kibibytes            use 1024-byte blocks
  -l                         use a long listing format
  -L, --dereference          when showing file information for a symbolic
                               link, show information for the file the link
                               references rather than for the link itself
  -m                         fill width with a comma separated list of entries
  -n, --numeric-uid-gid      like -l, but list numeric user and group IDs
  -N, --literal              print raw entry names (don't treat e.g. control
                               characters specially)
  -o                         like -l, but do not list group information
  -p, --indicator-style=slash
                             append / indicator to directories
  -q, --hide-control-chars   print ? instead of non graphic characters
      --show-control-chars   show non graphic characters as-is (default
                             unless program is 'ls' and output is a terminal)
  -Q, --quote-name           enclose entry names in double quotes
      --quoting-style=WORD   use quoting style WORD for entry names:
                               literal, locale, shell, shell-always, c, escape
  -r, --reverse              reverse order while sorting
  -R, --recursive            list subdirectories recursively
  -s, --size                 print the allocated size of each file, in blocks
  -S                         sort by file size
      --sort=WORD            sort by WORD instead of name: none -U,
                             extension -X, size -S, time -t, version -v
      --time=WORD            with -l, show time as WORD instead of modification
                             time: atime -u, access -u, use -u, ctime -c,
                             or status -c; use specified time as sort key
                             if --sort=time
      --time-style=STYLE     with -l, show times using style STYLE:
                             full-iso, long-iso, iso, locale, +FORMAT.
                             FORMAT is interpreted like 'date'; if FORMAT is
                             FORMAT1<newline>FORMAT2, FORMAT1 applies to
                             non-recent files and FORMAT2 to recent files;
                             if STYLE is prefixed with 'posix-', STYLE
                             takes effect only outside the POSIX locale
  -t                         sort by modification time, newest first
  -T, --tabsize=COLS         assume tab stops at each COLS instead of 8
  -u                         with -lt: sort by, and show, access time
                               with -l: show access time and sort by name
                               otherwise: sort by access time
  -U                         do not sort; list entries in directory order
  -v                         natural sort of (version) numbers within text
  -w, --width=COLS           assume screen width instead of current value
  -x                         list entries by lines instead of by columns
  -X                         sort alphabetically by entry extension
  -Z, --context              print any SELinux security context of each file
  -1                         list one file per line
      --help     display this help and exit
      --version  output version information and exit

SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).

Using color to distinguish file types is disabled both by default and
with --color=never.  With --color=auto, ls emits color codes only when
standard output is connected to a terminal.  The LS_COLORS environment
variable can change the settings.  Use the dircolors command to set it.

Exit status:
 0  if OK,
 1  if minor problems (e.g., cannot access subdirectory),
 2  if serious trouble (e.g., cannot access command-line argument).

Report ls bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'ls invocation'

ls command examples:

1. ls command – List information of files

stephen@stephen:~/demo_ls$ ls
DSC02335.JPG  OpenSSL.tar.gz  output.pdf  projects  python_exe.py  readme.txt  socket.py  socket.py~

The above ls command example would list file’s information.

2. ls -a command – does not ignore file names starting with dot(.)

stephen@stephen:~/demo_ls$ ls -a
.  ..  .demo_hidden_folder  DSC02335.JPG  OpenSSL.tar.gz  output.pdf  projects  python_exe.py  readme.txt  socket.py  socket.py~

The above ls -a command example would list all files including .(current directory), ..(parent directory), hidden files, file name starts with dot(.). In UNIX hidden files starts with (.).

3. ls -A command – does not list file name starts with . and ..

stephen@stephen:~/demo_ls$ ls -A
.demo_hidden_folder  DSC02335.JPG  OpenSSL.tar.gz  output.pdf  projects  python_exe.py  readme.txt  socket.py  socket.py~

The above ls -A command example would list file names and hidden files. It does not list .(current directory) and ..(parent directory).

 4. ls -B command – does not list backup files which ending with ~

stephen@stephen:~/demo_ls$ ls -B
DSC02335.JPG  OpenSSL.tar.gz  output.pdf  projects  python_exe.py  readme.txt  socket.py

The above ls -B command example would ignore backup files which ends with ~. The socket.py~ file is listed in above examples.

5. ls -c command – Use last modified time of the file. (file created, mode changed, and so forth) for sorting (-t) or printing (-l or -n).

stephen@stephen:~/demo_ls$ ls -c
projects  socket.py  socket.py~  output.pdf  python_exe.py  readme.txt  OpenSSL.tar.gz  DSC02335.JPG

stephen@stephen:~/demo_ls$ ls -clt
total 4652
drwxr-xr-x 3 stephen stephen    4096 Jan  6 13:31 projects
-rw------- 1 stephen stephen   21060 Jan  6 11:39 socket.py
-rw------- 1 stephen stephen   21058 Jan  6 11:39 socket.py~
-rw-r--r-- 1 stephen stephen   82330 Jan  2 17:59 output.pdf
-rw------- 1 stephen stephen     110 Jan  2 17:59 python_exe.py
-rw-rw-r-- 1 stephen stephen       0 Jan  2 17:59 readme.txt
-rw-rw-r-- 1 stephen stephen   42107 Jan  2 17:59 OpenSSL.tar.gz
-rw-r--r-- 1 stephen stephen 4573416 Jan  2 17:59 DSC02335.JPG

stephen@stephen:~/demo_ls$ ls -cl
total 4652
-rw-r--r-- 1 stephen stephen 4573416 Jan  2 17:59 DSC02335.JPG
-rw-rw-r-- 1 stephen stephen   42107 Jan  2 17:59 OpenSSL.tar.gz
-rw-r--r-- 1 stephen stephen   82330 Jan  2 17:59 output.pdf
drwxr-xr-x 3 stephen stephen    4096 Jan  6 13:31 projects
-rw------- 1 stephen stephen     110 Jan  2 17:59 python_exe.py
-rw-rw-r-- 1 stephen stephen       0 Jan  2 17:59 readme.txt
-rw------- 1 stephen stephen   21060 Jan  6 11:39 socket.py
-rw------- 1 stephen stephen   21058 Jan  6 11:39 socket.py~

The above ls -c command would list sorted files based on the time of modification. ls -clt command would list files which are sorted by ctime (last modified time of file) with more information of the files. ls -cl command would list files which are sorted by name. By default sorted by ctime.

6. ls -C command – list files by columns. Normally this is the default list view

stephen@stephen:~/demo_ls$ ls -C
DSC02335.JPG  OpenSSL.tar.gz  output.pdf  projects  python_exe.py  readme.txt  socket.py  socket.py~

The above ls -C command would list entries by columns. In general this is the default list view.

7. ls -d command – list directory instead of contents. It does not dereference symbolic links.

stephen@stephen:~/demo_ls$ ls -d
.

The above ls -d command would list directory instead of contents.

8. ls -f command – does not sort entries

stephen@stephen:~/demo_ls$ ls -f
OpenSSL.tar.gz  readme.txt  projects  DSC02335.JPG  .  python_exe.py  output.pdf  ..  socket.py~  socket.py  .demo_hidden_folder

The above ls -f command would list entries with out sort.

9. ls -F command – append indicator (one of */=>@|) to entries

stephen@stephen:~/demo_ls$ ls -F
DSC02335.JPG  OpenSSL.tar.gz  output.pdf  projects/  python_exe.py  readme.txt  socket.py  socket.py~

The above ls -F command would list directories with a trailing slash (/), doors with a trailing greater-than sign (>), executable files with a trailing asterisk (*), FIFOs with a trailing vertical bar (|), symbolic links with a trailing at-sign (@), and AF_Unix address family sockets with a trailing equals sign (=). This is the best alternative for ls -l command.

10. ls -g command – Same as -l except the owner is not printed

stephen@stephen:~/demo_ls$ ls -g
total 4652
-rw-r--r-- 1 stephen 4573416 Dec 24 11:35 DSC02335.JPG
-rw-rw-r-- 1 stephen   42107 Aug 19 17:06 OpenSSL.tar.gz
-rw-r--r-- 1 stephen   82330 Nov  4 12:54 output.pdf
drwxr-xr-x 3 stephen    4096 Nov 19 15:36 projects
-rw------- 1 stephen     110 Aug 13 16:42 python_exe.py
-rw-rw-r-- 1 stephen       0 Jun 13  2013 readme.txt
-rw------- 1 stephen   21060 Jan  6 11:39 socket.py
-rw------- 1 stephen   21058 Sep 24 11:29 socket.py~

The above ls -g command is similar to ls -l except the owner is not printed in this list.

11. ls -h command – human readable format along with -l prints size of each entries. (e.g., 5K 24M 1G)

stephen@stephen:~/demo_ls$ ls -lh
total 4.6M
-rw-r--r-- 1 stephen stephen 4.4M Dec 24 11:35 DSC02335.JPG
-rw-rw-r-- 1 stephen stephen  42K Aug 19 17:06 OpenSSL.tar.gz
-rw-r--r-- 1 stephen stephen  81K Nov  4 12:54 output.pdf
drwxr-xr-x 3 stephen stephen 4.0K Nov 19 15:36 projects
-rw------- 1 stephen stephen  110 Aug 13 16:42 python_exe.py
-rw-rw-r-- 1 stephen stephen    0 Jun 13  2013 readme.txt
-rw------- 1 stephen stephen  21K Jan  6 11:39 socket.py
-rw------- 1 stephen stephen  21K Sep 24 11:29 socket.py~

The above ls -lh command would list entries with human readable format. look at fourth column which shows size of each entries with readable format.

12. ls -i command – print the index number of each entries

stephen@stephen:~/demo_ls$ ls -i
22986751 DSC02335.JPG  22986752 OpenSSL.tar.gz  22986753 output.pdf  25087979 projects  22986754 python_exe.py  22986755 readme.txt  22986743 socket.py  22986756 socket.py~

The above ls -i command would list entries with its index number.

13. ls -l command – long listing format

stephen@stephen:~/demo_ls$ ls -l
total 4652
-rw-r--r-- 1 stephen stephen 4573416 Dec 24 11:35 DSC02335.JPG
-rw-rw-r-- 1 stephen stephen   42107 Aug 19 17:06 OpenSSL.tar.gz
-rw-r--r-- 1 stephen stephen   82330 Nov  4 12:54 output.pdf
drwxr-xr-x 3 stephen stephen    4096 Nov 19 15:36 projects
-rw------- 1 stephen stephen     110 Aug 13 16:42 python_exe.py
-rw-rw-r-- 1 stephen stephen       0 Jun 13  2013 readme.txt
-rw------- 1 stephen stephen   21060 Jan  6 11:39 socket.py
-rw------- 1 stephen stephen   21058 Sep 24 11:29 socket.py~

The above ls -l command would list files in detailed format.

Brief description of each of the above list as follows.

Permissions – First column indicates the permissions of the directory or file.

Directories – Second column indicates the amount of links or directories within the directory. The default amount of directories is going to always be 2 because of the . and .. directories.

Group – Third column indicates the group assigned to the file or directory

Owner – Fourth column indicates the owner of file or directory

Size – Fifth column indicates size of the file or directory.

Date – Sixth column indicates Date of last modification of files or directory.

Directory of file – Last column indicates the name of the file or directory.

14. ls -m command – list entries with comma separated

stephen@stephen:~/demo_ls$ ls -m
DSC02335.JPG, OpenSSL.tar.gz, output.pdf, projects, python_exe.py, readme.txt, socket.py, socket.py~

The above ls -m command would list files or directories are separated by comma.

15. ls -n command – same as -l but list numeric user and group IDs

stephen@stephen:~/demo_ls$ ls -n
total 4652
-rw-r--r-- 1 1000 1000 4573416 Dec 24 11:35 DSC02335.JPG
-rw-rw-r-- 1 1000 1000   42107 Aug 19 17:06 OpenSSL.tar.gz
-rw-r--r-- 1 1000 1000   82330 Nov  4 12:54 output.pdf
drwxr-xr-x 3 1000 1000    4096 Nov 19 15:36 projects
-rw------- 1 1000 1000     110 Aug 13 16:42 python_exe.py
-rw-rw-r-- 1 1000 1000       0 Jun 13  2013 readme.txt
-rw------- 1 1000 1000   21060 Jan  6 11:39 socket.py
-rw------- 1 1000 1000   21058 Sep 24 11:29 socket.py~

The above ls -n command would list entries in detailed. But it has numeric user and group IDs instead of names. Look at column three and four.

16. ls -o command – same as -l but does not list group name

stephen@stephen:~/demo_ls$ ls -o
total 4652
-rw-r--r-- 1 stephen 4573416 Dec 24 11:35 DSC02335.JPG
-rw-rw-r-- 1 stephen   42107 Aug 19 17:06 OpenSSL.tar.gz
-rw-r--r-- 1 stephen   82330 Nov  4 12:54 output.pdf
drwxr-xr-x 3 stephen    4096 Nov 19 15:36 projects
-rw------- 1 stephen     110 Aug 13 16:42 python_exe.py
-rw-rw-r-- 1 stephen       0 Jun 13  2013 readme.txt
-rw------- 1 stephen   21060 Jan  6 11:39 socket.py
-rw------- 1 stephen   21058 Sep 24 11:29 socket.py~

The above ls -o command would list entries. It is same as ls -l but it does not list group name.

17. ls -p command – append / indicator to directories

stephen@stephen:~/demo_ls$ ls -p
DSC02335.JPG  OpenSSL.tar.gz  output.pdf  projects/  python_exe.py  readme.txt  socket.py  socket.py~

The above ls -p command would list directories with a trailing slash (/).

18. ls -Q command – enclosed entry names in double quotes

stephen@stephen:~/demo_ls$ ls -Q
"DSC02335.JPG"  "OpenSSL.tar.gz"  "output.pdf"  "projects"  "python_exe.py"  "readme.txt"  "socket.py"  "socket.py~"

The above ls -Q command would list entries with double quotes.

19. ls -r command – list entries with reverse order

stephen@stephen:~/demo_ls$ ls -r
socket.py~  socket.py  readme.txt  python_exe.py  projects  output.pdf  OpenSSL.tar.gz  DSC02335.JPG

The above ls -r command would list entries with reverse order.

20. ls -R command – list subdirectories recursively

stephen@stephen:~/demo_ls$ ls -R
.:
DSC02335.JPG  OpenSSL.tar.gz  output.pdf  projects  python_exe.py  readme.txt  socket.py  socket.py~

./projects:
applications

./projects/applications:
live_cd_resources

./projects/applications/live_cd_resources:
ubuntu-13.10-desktop-amd64.iso

The above ls -R command would list contents of subdirectories recursively.

21. ls -s command – Print allocated file size before each file

stephen@stephen:~/demo_ls$ ls -s
total 4652
4468 DSC02335.JPG    44 OpenSSL.tar.gz    84 output.pdf     4 projects     4 python_exe.py     0 readme.txt    24 socket.py    24 socket.py~

stephen@stephen:~/demo_ls$ ls -sh
total 4.6M
4.4M DSC02335.JPG   44K OpenSSL.tar.gz   84K output.pdf  4.0K projects  4.0K python_exe.py     0 readme.txt   24K socket.py   24K socket.py~

The above ls -s command would list entries with its allocated size. With ls -sh shows human readable format.

22. ls -S command – sort by file or directory size

stephen@stephen:~/demo_ls$ ls -S
DSC02335.JPG  output.pdf  OpenSSL.tar.gz  socket.py  socket.py~  projects  python_exe.py  readme.txt

The above ls -S command would list sorted entries by its size. Refer with ls -s command example.

23. ls -t command – sort by modification time, newest first

stephen@stephen:~/demo_ls$ ls -t
socket.py  DSC02335.JPG  projects  output.pdf  socket.py~  OpenSSL.tar.gz  python_exe.py  readme.txt

The above ls -t command would list sorted entries by its modification time, newest first. Refer with ls -l,n,o (13, 15, 16) command.

24. ls -u command – list entries by access time instead of last modified time

stephen@stephen:~/demo_ls$ ls -u
projects  socket.py  socket.py~  readme.txt  python_exe.py  output.pdf  OpenSSL.tar.gz  DSC02335.JPG

stephen@stephen:~/demo_ls$ ls -ult
total 4652
drwxr-xr-x 3 stephen stephen    4096 Jan  6 17:11 projects
-rw------- 1 stephen stephen   21060 Jan  6 11:39 socket.py
-rw------- 1 stephen stephen   21058 Jan  6 11:39 socket.py~
-rw-rw-r-- 1 stephen stephen       0 Jan  6 11:39 readme.txt
-rw------- 1 stephen stephen     110 Jan  6 11:39 python_exe.py
-rw-r--r-- 1 stephen stephen   82330 Jan  2 18:00 output.pdf
-rw-rw-r-- 1 stephen stephen   42107 Jan  2 17:59 OpenSSL.tar.gz
-rw-r--r-- 1 stephen stephen 4573416 Jan  2 17:59 DSC02335.JPG

stephen@stephen:~/demo_ls$ ls -ul
total 4652
-rw-r--r-- 1 stephen stephen 4573416 Jan  2 17:59 DSC02335.JPG
-rw-rw-r-- 1 stephen stephen   42107 Jan  2 17:59 OpenSSL.tar.gz
-rw-r--r-- 1 stephen stephen   82330 Jan  2 18:00 output.pdf
drwxr-xr-x 3 stephen stephen    4096 Jan  6 17:11 projects
-rw------- 1 stephen stephen     110 Jan  6 11:39 python_exe.py
-rw-rw-r-- 1 stephen stephen       0 Jan  6 11:39 readme.txt
-rw------- 1 stephen stephen   21060 Jan  6 11:39 socket.py
-rw------- 1 stephen stephen   21058 Jan  6 11:39 socket.py~

The above ls -u command would list entries by access time. With lt it would list entries sorted by access time. With l it would list entries sorted by name and shows access time.

25. ls -U command – does not sort, list entries in directory order

stephen@stephen:~/demo_ls$ ls -U
OpenSSL.tar.gz  readme.txt  projects  DSC02335.JPG  python_exe.py  output.pdf  socket.py~  socket.py

The above ls -U command would list entries in directory order. Does not sort.

26. ls -v command – natural sort of (version) numbers within text

stephen@stephen:~/demo_ls$ ls -v
DSC02335.JPG  OpenSSL.tar.gz  output.pdf  projects  python_exe.py  readme.txt  socket.py~  socket.py

The above ls -v command would list entries sorted by version numbers.

27. ls -x command – list entries in columns

stephen@stephen:~/demo_ls$ ls -x
DSC02335.JPG  OpenSSL.tar.gz  output.pdf  projects  python_exe.py  readme.txt  socket.py  socket.py~

The above ls -x command would list entries by columns.

28. ls -X command – sort alphabetically by entry extension

stephen@stephen:~/demo_ls$ ls -X
projects  OpenSSL.tar.gz  DSC02335.JPG  output.pdf  python_exe.py  socket.py  socket.py~  readme.txt

The above ls -X command would list entries sorted by its extension.

29. ls -Z comman – print any SELinux security context of each file

stephen@stephen:~/demo_ls$ ls -Z
? DSC02335.JPG  ? OpenSSL.tar.gz  ? output.pdf  ? projects  ? python_exe.py  ? readme.txt  ? socket.py  ? socket.py~

The above ls -Z command would list any SELinux security context of each file.

30. ls -1 command – list single entry per line

stephen@stephen:~/demo_ls$ ls -1
DSC02335.JPG
OpenSSL.tar.gz
output.pdf
projects
python_exe.py
readme.txt
socket.py
socket.py~

The above ls -1 command would list each entries in separate line.

Miscellaneous ls commands examples

31. ls ~ command – list home directory entries

stephen@stephen:~/demo_ls$ ls ~
21-10-13           Downloads                            get_ip_address.pyc                 mozilla.pdf                      Public                    setup.sh~        test_client.1.py
21-10-13.rar       DSC02334.JPG                         HRA deduction with conditions.pdf  Music                            python_exe.py             socket.py        test_client.py
2.zip              DSC02335.JPG                         hs_err_pid13833.log                my_insurance.pdf                 readme.txt                socket.pyc       test.py
admin-theme2       DSC02336.JPG                         hs_err_pid3286.log                 OpenSSL                          Scan0001.pdf              stephen.1.pdf    test_server_client
ca.crt             DSC02337.JPG                         hs_err_pid6066.log                 OpenSSL.tar.gz                   Scan.pdf                  stephen.jpg      Ubuntu One
Call Letter.pdf    Employee Engagement.xlsx             key_intrupt.py                     output.pdf                       server.1.py               stephen.key      Videos
demo_ls            examples.desktop                     key_intrupt.py~                    pan.jpg                          server.1.py~              stephen.pdf      vpn.config
Desktop            Fast color scan to a PDF file_4.PDF  key_intrupt_srini_example          Pictures                         server.py                 StephenSign.jpg  XM-003869-UN-A-ERM Customer Support.pptx
Documents          form_element.png                     List of Holidays 2014.pdf          Principle Embedded SW Engg.docx  server_under_control.zip  Templates        xmos
DOWNLOADED-THEMES  get_ip_address.py                    mcircle_website_spec.pdf           projects                         setup.sh                  test.1.py        xmos_acs.sh

The above ls ~ command would list all entries of home directory.

32. ls / command – list entries of root directory

stephen@stephen:~/demo_ls$ ls /
bin  boot  cdrom  dev  etc  home  initrd.img  initrd.img.old  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var  vmlinuz  vmlinuz.old

The above ls / command would list all entries of root directory.

33. ls ../ command – list entries of parent directory

stephen@stephen:~/demo_ls$ ls ../
21-10-13           Downloads                            get_ip_address.pyc                 mozilla.pdf                      Public                    setup.sh~        test_client.1.py
21-10-13.rar       DSC02334.JPG                         HRA deduction with conditions.pdf  Music                            python_exe.py             socket.py        test_client.py
2.zip              DSC02335.JPG                         hs_err_pid13833.log                my_insurance.pdf                 readme.txt                socket.pyc       test.py
admin-theme2       DSC02336.JPG                         hs_err_pid3286.log                 OpenSSL                          Scan0001.pdf              stephen.1.pdf    test_server_client
ca.crt             DSC02337.JPG                         hs_err_pid6066.log                 OpenSSL.tar.gz                   Scan.pdf                  stephen.jpg      Ubuntu One
Call Letter.pdf    Employee Engagement.xlsx             key_intrupt.py                     output.pdf                       server.1.py               stephen.key      Videos
demo_ls            examples.desktop                     key_intrupt.py~                    pan.jpg                          server.1.py~              stephen.pdf      vpn.config
Desktop            Fast color scan to a PDF file_4.PDF  key_intrupt_srini_example          Pictures                         server.py                 StephenSign.jpg  XM-003869-UN-A-ERM Customer Support.pptx
Documents          form_element.png                     List of Holidays 2014.pdf          Principle Embedded SW Engg.docx  server_under_control.zip  Templates        xmos
DOWNLOADED-THEMES  get_ip_address.py                    mcircle_website_spec.pdf           projects                         setup.sh                  test.1.py        xmos_acs.sh

The above ls ../ command would list all entries of parent directory.

34. ls */ command – list entries of subdirectories

stephen@stephen:~/demo_ls$ ls */
applications

The above ls */ command would list all entries of subdirectories.

35. ls -d */ command – list all directories in the current directory

stephen@stephen:~/demo_ls$ ls -d */
projects/

The above ls -d */ command would list all directories in the current directory.

I hope that It might help you. If any queries please drop me a comment on this post or mail to charvigroups@gmail.com.

Cheers!


Django-Python Web based application developer.

Share This Post

Related Articles

Leave a Reply

© 2017 Techy Diary. All rights reserved.
Powered by Charvi Groups