RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

ls command with a long listing format output

Question:

When we execute the  ls command, the result contains first column like -rw-rw-r-- or lrwxrwxrwx. What does this mean?

Answer:

The output mentioned in your question can be produced with a following command:

ls -l filename

-l option of a ls command will instruct ls to display output in a long listing format which means that instead of output containing only a name(s) of file or directory the ls command will produce additional information. Example:

ls -l file1 
-rw-rw-r--. 1 lilo lilo 0 Feb 26 07:08 file1

From the output above we can deduct a following information:

  • -rw-rw-r- permissions
  • 1 : number of linked hard-links
  • lilo: owner of the file
  • lilo: to which group this file belongs to
  • 0: size
  • Feb 26 07:08 modification/creation date and time
  • file1: file/directory name

To answer your question we will look more closely at the permissions part of ls long listing format output:

- -rw-rw-r--

The permissions part can be broken down to 4 parts. First part in this example is "-" which specifies that this is a regular file. Other common uses are:

  • l this specifies symbolic links ( your question )
  • d stands for directory
  • c stands for character file

Next three parts are also called octets and they define a permissions applied to this file. First octet ( -rw- ) defines a permission for a file owner. In this case owner has read and write permissions. Second part ( rw- ) defines read and write permissions defined for a group. And the last part defines read-only permissions for others ( everyone else ).

From permissions listed as:

lrwxrwxrwx

we can conclude that this particular file is a symbolics link pointing to yet another file somewhere within a file system. It lists full permissions for an owner, group and everyone else. Although it has full permissions for everyone it does not mean that the file it is pointing to will also have the same permissions ( in most cases it does not !). We can check the file name to see where this symbolic link is pointing to. For example this X executable binary points to Xorg in the same directory:

$ ls -l X
lrwxrwxrwx. 1 root root 4 Feb 22 10:52 X -> Xorg

Linux questions and answers

Share this linux post:

Submit ls command with a long listing format output in Delicious Submit ls command with a long listing format output in Digg Submit ls command with a long listing format output in FaceBook Submit ls command with a long listing format output in Google Bookmarks Submit ls command with a long listing format output in Stumbleupon Submit ls command with a long listing format output in Technorati Submit ls command with a long listing format output in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download