How to list all files and folder in Ubantu?

In this article , you find the command that reviles folder and files in Ubuntu or Linux system. you can use different ls commands list directory contents for listing files and folders in different ways.  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. If you want to be able to distinguish folders from files easily, use something like ls -alhF. I usually define l as an alias for that, ie. I put the line alias l=’ls -alhF’ in my .bashrc.

ls Command format

ls [OPTION]… [FILE]…

Demo for list all files and folder in Ubuntu

  • Running  ls -a [add/own/your/path/]

ubantu ls-a linux

  • To list only folders try: ls -d */
    -d  list directories themselves, not their contents. To explain this, consider what happens if we type ls */. ls goes one layer down, into each subdirectory, and lists all the files in each of those sequentially
  • */ is known as a “glob” in UNIX. (see Wikipedia for more details). But basically, it means “any file name ending in a forward slash.” In UNIX, directories are really just files, fundamentally. But they are specially named ending in a forward slash so the operating system knows they are directories (or folders, in everyday-person-speak). And the asterisk * is technically a wildcard standing for “any string of characters.”

List of  ls  Commands  Options in Linux / Ubuntu :-

  • ls -a, –all
    do not ignore entries starting with .
  • ls -A, –almost-all
    do not list implied . and ..
  • ls–author
    with -l, print the author of each file
  • ls-b, –escape
    print C-style escapes for nongraphic characters
  • ls–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
  • ls-B, –ignore-backups
    do not list implied entries ending with ~
  • ls-cwith -lt: sort by, and show, ctime (time of last modification of
    file status information); with -l: show ctime and sort byname;
    otherwise: sort by ctime, newest first
  • ls-Clist entries by columns
    –color[=WHEN] colorizethe output; WHEN can be ‘always’ (default if omitted),
    ‘auto’, or ‘never’; more info below
  • ls-d, –directory
    list directories themselves, not their contents
  • ls-D, –dired
    generate output designed for Emacs’ dired mode
  • ls-f do not sort, enable -aU, disable -ls –color
  • ls-F, –classify
    append indicator (one of */=>@|) to entries
  • ls–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
  • ls-g like -l, but do not list owner
  • ls–group-directories-first
    group directories before files; canbeaugmentedwitha–sortoption,butanyuseof
    –sort=none (-U) disables grouping
  • ls-G, –no-group
    in a long listing, don’t print group names
  • ls-h, –human-readable
    with -l and/or -s, print human readable sizes (e.g., 1K 234M 2G)
  • –silikewise, 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 shellPATTERN(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 default to 1024-byte blocks for disk usage
  • -luse a long listing format
  • ls -L, –dereference whenshowingfileinformationforasymboliclink,show information for the file the link references rather than for the link itself
  • -mfill 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 entrynames(don’ttreate.g.controlcharacters specially)
  • -olike -l, but do not list group information
  • -p, –indicator-style=slash append / indicator to directories
  • -q, –hide-control-chars print ? instead of nongraphic characters
  • –show-control-chars show nongraphic characters as-is (the 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, shell-escape, shell-escape-always, c, escape

Add a Comment

Your email address will not be published. Required fields are marked *