lsx [ls_options ] [names]

Similar documents
User Commands ls ( 1 )

5/8/2012. Encryption-based Protection. Protection based on Access Permission (Contd) File Security, Setting and Using Permissions Chapter 9

User Commands find ( 1 )

Files (review) and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

User Commands chmod ( 1 )

File Commands. Objectives

5/8/2012. Creating and Changing Directories Chapter 7

bash startup files Linux/Unix files stty Todd Kelley CST8207 Todd Kelley 1

UNIX File Hierarchy: Structure and Commands

PESIT Bangalore South Campus

- c list The list specifies character positions.

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Operating Systems, Unix Files and Commands SEEM

Introduction to Computer Security

I/O and Shell Scripting

Outline. UNIX security ideas Users and groups File protection Setting temporary privileges. Examples. Permission bits Program language components

Practical 4. Linux Commands: Working with Directories

User Commands tar ( 1 )

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.

Basic File Attributes

Unix Introduction to UNIX

Privileges: who can control what

User Commands sed ( 1 )

Operating system security models

Operating system security

Contents. Volume 1 Base Definitions, Issue

find Command as Admin Security Tool

Unix Internal Assessment-2 solution. Ans:There are two ways of starting a job in the background with the shell s & operator and the nohup command.

Module 8 Pipes, Redirection and REGEX

Chapter 1 - Introduction. September 8, 2016

CptS 360 (System Programming) Unit 6: Files and Directories

Basic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options

5/20/2007. Touring Essential Programs

Files

Basic File Attributes

AC109/AT109 UNIX & SHELL PROGRAMMING DEC 2014

8. Files and File Systems

Unix Basics. UNIX Introduction. Lecture 14

Files and Directories

CS/CIS 249 SP18 - Intro to Information Security

LPI LPI Level Junior Level Linux Certification Part 1 of 2. Download Full Version :

CSE II-Sem)

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Processes are subjects.

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

commandname flags arguments

CS246 Spring14 Programming Paradigm Notes on Linux

The UNIX File System

General Access Control Model for DAC

CSC UNIX System, Spring 2015

Files and Directories

The UNIX File System

CSE/ISE 311: Systems Administra5on Access Control and Processes

Introduction. Let s start with the first set of slides

Unix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois

Welcome to Linux. Lecture 1.1

1Z Oracle Linux Fundamentals (Oracle Partner Network) Exam Summary Syllabus Questions

CS631 - Advanced Programming in the UNIX Environment

Processes are subjects.

$Id: asg4-shell-tree.mm,v :36: $

Operating Systems Lab

Shell Programming Overview

Bash Reference Manual Reference Documentation for Bash Edition 2.5b, for Bash Version 2.05b. July 2002

CS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND

Answers to Even- Numbered Exercises

ADVANCED OPERATING SYSTEMS

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT

2) clear :- It clears the terminal screen. Syntax :- clear

INTERNAL REPRESENTATION OF FILES:

pv_path The block device path name of a physical volume.

Commands are in black

Project 5 File System Protection

Securing Unix Filesystems - When Good Permissions Go Bad

22-Sep CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control. Faculty of Computer Science, Dalhousie University

Code Coverage. Copyright 2009 JADE Software Corporation Limited. All rights reserved.

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

Lecture 2b. Pathnames, files, special characters in filenames, and file permissions. COP 3353 Introduction to UNIX, FALL 2013

SECTION -C. Getting Started with UNIX

GNU CPIO September by Robert Carleton and Sergey Poznyakoff

An Introduction to Unix Power Tools

INSE 6130 Operating System Security. Overview of Design Principles

Before assigning a physical volume to a volume group, the physical volume has to be created using the pvcreate command (see pvcreate (1M)).

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

NAME attr extended attributes on XFS filesystem objects. SYNOPSIS attr [ LRq ] s attrname [ V attrvalue ] pathname

Permission and Ownership

Roll No. :... Invigilator's Signature : UNIX AND SHELL PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

Assume that username is cse. The user s home directory will be /home/cse. You may remember what the relative pathname for users home directory is: ~

Table 12.2 Information Elements of a File Directory

UNIX Kernel. UNIX History

Std: XI CHAPTER-3 LINUX

System Programming. Introduction to Unix

TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control

Information technology Portable Operating System Interface (POSIX ) Part 3: Shell and Utilities

Hardware. Ahmet Burak Can Hacettepe University. Operating system. Applications programs. Users

CIFS/9000 Server File Locking Interoperability

I/O OPERATIONS. UNIX Programming 2014 Fall by Euiseong Seo

Linux & Shell Programming 2014

Seeing file permission/ownership ls -l (Shows the long listing of a file/directory, which allows you to see file permission & ownership)

Code Coverage White Paper VERSION Copyright 2018 Jade Software Corporation Limited. All rights reserved.

Transcription:

NAME ls, lc, l, ll, lsf, lsr, lsx - list contents of directories SYNOPSIS ls [-abcdefgilmnopqrstuxacfhlr1] [names] lc [-abcdefgilmnopqrstuxacfhlr1] [names] l [ls_options ] [names] ll [ls_options ] [names] lsf [ls_options ] [names] lsr [ls_options ] [names] lsx [ls_options ] [names] DESCRIPTION For each directory argument, the ls command lists the contents of the directory. For each file argument, ls repeats its name and any other information requested. The output is sorted in ascending collation order by default (see Environment Variables below). When no argument is given, the current directory is listed. When several arguments are given, the arguments are first sorted appropriately, but file arguments appear before directories and their contents. If you are a user with appropriate privileges, all files except. and.. are listed by default. There are three major listing formats. The format chosen depends on whether the output is going to a login device (determined by whether output device file is a tty device), and can also be controlled by option flags. The default format for a login device is to list the contents of directories in multicolumn format, with entries sorted vertically by column. (When individual file names (as opposed to directory names) appear in the argument list, those file names are always sorted across the page rather than down the page in columns because individual file names can be arbitrarily long.) If the standard output is not a login device, the default format is to list one entry per line. The -C and -x options enable multicolumn formats, and the -m option enables stream output format in which files are listed across the page, separated by commas. In order to determine output formats for the -C, -x, and -m options, ls uses an environment variable, COLUMNS, to determine the number of character positions available on each output line. If this variable is not set, the terminfo database is used to determine the number of columns, based on the environment variable TERM. If this information cannot be obtained, 80 columns is assumed. The command lc functions the same as ls except that the lc default output is columnar, even if output is redirected. Options ls recognizes the following options: -a List all entries; usually entries whose names begin with a period (.) are not listed. -b List nonprinting characters in the octal \ddd notation. -c Use time of last modification of the inode (file created, mode changed, etc.) for sorting (-t) or printing (-l (ell)). -d If an argument is a directory, list only its name (not its contents); often used with -l (ell) to get the status of a directory. Under the UNIX 2003 environment (see standards (5)), ls with -d does not follow symbolic links unless the -H or -L option is specified. -e List the extent attributes of the file. If any of the files has a extent attribute, this option lists the extent size, space reserved and allocation flags. This option must be used with the -l (ell) option. -f Interpret each argument as a directory and list the name found in each slot. This option disables -l (ell), -r, -s, and -t, and enables -a; the order is the order in which entries appear in the directory. -g Same as -l (ell), except that only the group is printed (owner is omitted). If both -l (ell) and -g are specified, the owner is not printed. HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

-i For each file, list the inode number in the first column of the report. When used in multicolumn output, the number precedes the file name in each column. -l (ell) List in long format, giving mode, number of links, owner, group, size in bytes, and time of last modification for each file (see further DESCRIPTION and Access Control Lists below). If the time of last modification is greater than six months ago, or any time in the future, the year is substituted for the hour and minute of the modification time. If the file is a special file, the size field contains the major and minor device numbers rather than a size. If the file is a symbolic link, the filename is printed, followed by -> and the pathname of the referenced file. Under the UNIX 2003 environment (see standards (5)), ls with -l does not follow symbolic links unless the -H or -L option is specified. -m Stream output format. -n The same as -l, (ell) except that the owner s UID and group s GID numbers are printed, rather than the associated character strings. -o The same as -l, (ell) except that only the owner is printed (group is omitted). (If both -l (ell) and -o are specified, the group is not printed). -p Put a slash (/) after each file name if that file is a directory. -q List nonprinting characters in file names as the character (?). -r Reverse the order of sort to get reverse (descending) collation or oldest first, as appropriate. -s List size in blocks of 512-byte units, including indirect blocks, for each entry. The first entry listed is the total number of blocks in the directory. When used in multicolumn output, the number of blocks precedes the file name in each column. The number of indirect blocks in a file is filesystem dependent. -t Sort by time modified (latest first) before sorting alphabetically. -u Use time of last access instead of last modification for sorting (-t option) or printing (-l (ell) option). -x List multicolumn output with entries sorted across rather than down the page. -A The same as -a, except that the current directory. and parent directory.. are not listed. For a user with appropriate privileges, this flag defaults to on, and is turned off by -A. -C List multicolumn output with entries sorted down the columns. -F After each file name, put one of: A slash (/) if the file is a directory or a symbolic link to a directory. An asterisk (*) if the file is executable; An at-sign (@) if the file is a symbolic link to a file; A vertical bar ( ) if the file is a fifo. Under the UNIX 2003 environment (see standards (5)), ls with -F does not follow symbolic links unless the -H or -L option is specified. -H If a symbolic link referencing a file of type directory is specified on the command line, ls evaluates the file information and file type to be those of the file referenced by the link, and not the link itself. However, ls writes the name of the link itself and not the file referenced by the link. -L Evaluate the file information and file type for all symbolic links (whether named on the command line or encountered in a file hierarchy) to be those of the file referenced by the link, and not the link itself. However, ls writes the name of the link itself and not the file referenced by the link. When -L is used with -l, write the contents of symbolic links in the long format. -R Recursively list subdirectories encountered. -1 (one) List the file names in single column format regardless of the output device. This forces single column format to the user s terminal. Specifying more than one of the options in the following mutually exclusive pairs is not considered an error: -C and -l (ell), -m and -l (ell), -x and -l (ell), -C and -1 (one), -H and -L, and -c and -u. ls is known by several shorthand-version names for the various formats: 2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010

l is equivalent to ls -m ll is equivalent to ls -l (ell) lsf is equivalent to ls -F lsr is equivalent to ls -R lsx is equivalent to ls -x The shorthand notations are implemented as links to ls. Option arguments to the shorthand versions behave exactly as if the long form above had been used with the additional arguments. Mode Bits Interpretation (-l option) The mode printed in listings produced by the -l (ell) option consists of 10 characters, for example, -rwxr-xr-x. The first character indicates the entry type: b Block special file c Character special file d Directory l Symbolic link n Network special file p Fifo (also called a "named pipe") special file s Socket - Ordinary file The next 9 characters are interpreted as three sets of three characters each which identify access and execution permissions for the owner, group, and others categories, as described in chmod(1). The - indicates the permission is not granted. The various permissions can be put together in any combination, except that the x, s, S, t, and T characters are mutually exclusive, as implied below. -r-------- Read by owner --w------- Write by owner ---x------ Execute (or search directory) by owner; do not set user ID on execution ---s------ Execute/search by owner; set user ID on execution ---S------ No execute/search by owner; set user ID on execution ----r----- Read by group -----w---- Write by group ------x--- Execute/search by group; do not set group ID on execution ------s--- Execute/search by group; set group ID on execution ------S--- No execute/search by group; set group ID on execution -------r-- Read by others --------w- Write by others ---------x Execute/search by others; do not set sticky bit on execution ---------t Execute/search by others; set sticky bit on execution ---------T No execute/search by others; set sticky bit on execution The mode characters are interpreted as follows: - Deny all permissions in the corresponding position. r Grant read permission to the corresponding user class. w Grant write permission to the corresponding user class. x Grant execute (or search in directory) permission to the corresponding user class. s Grant execute (search) permission to the corresponding user class. Execute the file as if by the owner (set user ID, SUID) or group (set group ID, SGID), as indicated by position. S Deny execute (search) permission to the corresponding user class. Execute the file as if by the owner (set user ID, SUID) or group (set group ID, SGID), as indicated by position. t Grant execute (search) permission to others. The "sticky" bit is set (see the description of S_ISVTX in chmod(2)). T Deny execute (search directory) permission to others. The "sticky" bit is set. When an option is specified that results in a listing of directory and/or file sizes in bytes or blocks (such as the -s or -l (ell) option), a total count of blocks, including indirect blocks, is also printed at the beginning of the listing. HP-UX 11i Version 3: September 2010 3 Hewlett-Packard Company 3

Access Control Lists (ACLs) If a file has optional ACL entries, the -l (ell) option displays a plus sign (+) after the file s permissions. The permissions shown are a summary representation of the file s access control list, as returned by stat() in the st_mode field (see stat (2)). To list the contents of an access control list, use the lsacl command (see lsacl (1) and acl(5)) for HFS file systems, or the getacl command (see getacl (1) and aclv (5)) for JFS file systems. EXTERNAL INFLUENCES For information about the UNIX standard environment, see standards (5). Environment Variables If the COLUMNS variable is set, ls uses the width provided in determining positioning of columnar output. LANG determines the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (beginning with LC_) do not specify a locale. If LANG is not set or is null, it defaults to C (see lang(5)). LC_COLLATE determines the order in which the output is sorted. LC_CTYPE determines which characters are classified as nonprinting for the -b and -q options, and the interpretation of single- and/or multibyte characters within file names. LC_TIME determines the date and time strings output by the -g, -l (ell), -n, and -o options. LC_MESSAGES determines the language in which messages (other than the date and time strings) are displayed. If any internationalization variable contains an invalid setting, they all default to C (see environ (5)). International Code Set Support Single- and multibyte character code sets are supported. RETURN VALUE ls exits with one of the following values: 0 All input files were listed successfully. >0 ls was aborted because errors occurred when accessing files. The following conditions cause an error: Specified file not found. User has no permission to read the directory. Process could not get enough memory. Invalid option specified. EXAMPLES Print a long listing of all the files in the current working directory (including the file sizes). List the most recently modified (youngest) file first, followed by the next older file, and so forth, to the oldest. Files whose names begin with a. are also printed. ls -alst WARNINGS Setting options based on whether the output is a login (tty ) device is undesirable because ls -s is very different from ls -s lp. On the other hand, not using this setting makes old shell scripts that used ls almost inevitably fail. Nonprinting characters in file names (without the -b or -q option) may cause columnar output to be misaligned. DEPENDENCIES NFS The -l (ell) option does not display a plus sign (+) after the access permission bits of networked files to represent existence of optional access control list entries. AUTHOR ls was developed by AT&T, the University of California, Berkeley and HP. 4 Hewlett-Packard Company 4 HP-UX 11i Version 3: September 2010

FILES /etc/group /etc/passwd /usr/share/lib/terminfo/?/* For group IDs for -l (ell) and -g. For user IDs for -l (ell) and -o. For terminal information. SEE ALSO chmod(1), find(1), getacl(1), lsacl(1), stat(2), acl(5), aclv(5), standards(5). STANDARDS CONFORMANCE ls: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2 HP-UX 11i Version 3: September 2010 5 Hewlett-Packard Company 5

(Notes) (Notes) 6 Hewlett-Packard Company 1 HP-UX 11i Version 3: September 2010