You are currently viewing Linux Commands – ls

Linux Commands – ls

  • Post author:
  • Post category:Linux

Linux Commands – ls

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In this blog series, we will explore all the commands available in Linux. Today we will discuss one of the most basic commands in Linux to list the content of directories.

In computing, ls is a command to list computer files in Unix and Unix-like operating systems. ls is specified by POSIX and the Single UNIX Specification. When invoked without any arguments, ls lists the files in the current working directory. In other environments, such as DOS, OS/2, and Microsoft Windows, similar functionality is provided by the dir command.

An ls utility appeared in the original version of AT&T UNIX, the name inherited from a similar command in Multics also named ‘ls’, short for the word “list”.Today, the two popular versions of ls are the one provided with the GNU coreutils package, and that released by various BSD variants. Both are free software and open source, and have only minor syntax differences. The version of ls bundled in GNU coreutils was written by Richard Stallman and David MacKenzie.

Linux Commands – ls:

How to list contents of the current directory in Linux?

How to list contents of a specific directory in Linux?

How to get details of file\directory in Linux?

Ls Long Listing Output Explained:

FileType: The 1st Character represent the file type. In Linux you have different types of files, below are some of the file types available in Linux and their representation in the ls output.

  • d = directory
  • = regular file
  • l = symlink
  • c = character device
  • p = named pipe
  • s = socket
  • b = block device

FilePermission: The next nine characters represent the file permissions and are divided into a chunk of three characters (representing read, write and execute permissions) with the first three representing user permission, second three representing group permission and last three for all user (world) permission. Below are the permissions available for files in Linux with their representation in the ls output.

  • r = Read
  • w = write
  • x = execute
  • = no access
  • s = setgid bit
  • t = sticky bit

NumberOfLinks: This number is the hardlink count of the file, when referring to a file, or the number of contained directory entries, when referring to a directory.

Owner: The owner of the file.

Group: The group of the file.

SizeInBytes: The size of the file in bytes.

LastModified: The date and time when the file was last modified.

FileName: The name of the file.

How to list hidden files and directories in Linux?

How to list only directories in Linux?

How to list directories recursively in Linux?

How to list file and directory size in Linux?

How to list file and directory last access time in Linux?

How to list file and directory sorted by time, name, extension etc.

How to list files with specific name, extension in Linux?

Hope you have enjoyed this blog post. In the next blog post, we will discuss cd command in linux.