Linux2010. 4. 1. 14:12
ls 자체적으로 정렬기능을 제공한다.
하지만, 디렉토리별이라서, 전체에 대해서 정렬을 하지는 못한다.

       -S     sort by file size

       --sort=WORD
              extension -X, none -U, size -S, time -t, version -v, status -c, time -t, atime -u, access -u, use -u

[링크 : http://linux.die.net/man/1/ls]

[링크 : http://thedaneshproject.com/posts/sort-files-by-size/]
Posted by 구차니
Linux2009. 2. 22. 18:46
예전에 DOS에서는 dir /ad 하면 디렉토리만 볼 수 있었는데
리눅스에서는 옵션을 몰라서 디렉토리만 보려고 하다가 내용까지 보여서 번거로웠다.

LS(1)                            User Commands                           LS(1)

NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...

         ..... 중략 .....

       -d, --directory
              list directory entries instead of contents, and do not dereference symbolic links

dir 도움말
C:\>dir /?
디렉터리에 있는 파일과 하위 디렉터리 목록을 보여줍니다.

DIR [드라이브:][경로][파일 이름] [/A[[:]특성]] [/B] [/C] [/D] [/L] [/N]
  [/O[[:]정렬 순서]] [/P] [/Q] [/S] [/T[[:]시간 필드]] [/W] [/X] [/4]

  [드라이브:][경로][파일 이름]
              나타낼 드라이브, 디렉터리 및/또는 파일을 지정합니다.

  /A          지정된 특성을 가진 파일을 보여줍니다.
  특성        D  디렉터리                   R  읽기 전용 파일
              H  숨김 파일                  A  기록 파일
              S  시스템 파일                -  부정을 뜻하는 접두사
  /B          최소 형식을 사용합니다 (머리말 정보나 요약 없음).
  /C          파일 크기에 1000단위로 분리 기호를 보여줍니다. 이것은 기본값
              입니다. 분리 기호를 표시하지 않으려면 /-C를 사용하십시오.
  /D          /W와 같으나 세로로 배열하여 보여줍니다.
  /L          소문자를 사용합니다.
  /N          파일 이름이 제일 오른쪽에 오도록 새로운 긴 목록 형식을
              사용합니다.
  /O          파일을 정렬된 순서로 보여줍니다.
  정렬순서    N  이름순(문자 순서)    S  크기순(작은 것 먼저)
              E  확장명순(문자 순서)  D  날짜/시간순(가장 이전 것 먼저)
              G  그룹 디렉터리 먼저         -  순서를 반대로 하는 접두 기호
  /P          정보가 한 화면에 꽉 차면 잠깐 멈춥니다.
  /Q          파일 소유자를 보여 줍니다.
  /S          지정한 디렉터리와 하위 디렉터리를 포함하여 보여줍니다.
  /T          정렬에 사용할 시간 필드를 지정합니다.
  시간필드   C  작성한 시간
              A  마지막 액세스한 시간
              W  마지막 기록한 시간
  /W          이름만 가로로 배열하여 보여줍니다.
  /X          8.3 파일 이름이 아닌 파일에 대한 짧은 이름을 보여줍니다.
              이 형식은 긴 이름 앞에 짧은 이름이 추가된 것으로 /N 형식과
              같습니다. 짧은 이름이 없으면 공백을 보여줍니다.
  /4          4자리수 연도를 표시합니다.

스위치를 DIRCMD 환경 변수로 미리 설정할 수 있습니다. 하이픈(-)을
스위치 앞에 접두 기호로 주면 미리 설정된 스위치에 우선합니다. (예, /-W)



Posted by 구차니
Linux2008. 12. 19. 20:05
man find

       -type c
              File is of type c:

              b      block (buffered) special

              c      character (unbuffered) special

              d      directory

              p      named pipe (FIFO)

              f      regular file

              l      symbolic link; this is never true if the -L option or the -follow option is in effect,
                     unless  the symbolic link is broken.  If you want to search for symbolic links when -L
                     is in effect, use -xtype.

              s      socket

              D      door (Solaris)


'ls -l'을  실행하면
$ ll
total 1922
drwxr-xr-x   2 root root    4096 Nov 15 04:17 bin
drwxr-xr-x   4 root root    1024 Apr 11  2008 boot
drwxr-xr-x  12 root root    3900 Nov 14 13:07 dev
drwxr-xr-x 101 root root   12288 Dec 15 04:15 etc
drwxr-xr-x  10 root root    4096 Aug 19 13:59 home
drwxr-xr-x  14 root root    4096 Apr 11  2008 lib
drwx------   2 root root   16384 Apr 10  2008 lost+found
drwxr-xr-x   2 root root    4096 Nov 14 13:07 media
drwxr-xr-x   2 root root       0 Nov 14 13:07 misc
drwxr-xr-x   2 root root       0 Nov 14 13:07 mnt
drwxr-xr-x   2 root root       0 Nov 14 13:07 net
drwxr-xr-x   2 root root    4096 Jun 19  2008 nfsroot
drwxr-xr-x   3 root root    4096 May 29  2008 opt
dr-xr-xr-x 195 root root       0 Nov 14 13:06 proc
drwxr-x---  29 root root    4096 Dec 17 11:00 root
drwxr-xr-x   2 root root   12288 Apr 11  2008 sbin
drwxr-xr-x   2 root root    4096 Apr 10  2008 selinux
drwxr-xr-x   2 root root    4096 Oct 11  2006 srv
drwxr-xr-x  12 root root       0 Nov 14 13:06 sys
drwxr-xr-x   2 root root    4096 Dec 17 13:30 tftpboot
drwxrwxrwt  16 root dev    90112 Dec 19 20:01 tmp
drwxr-xr-x  15 root root    4096 May 30  2008 usr
drwxr-xr-x  24 root root    4096 Apr 10  2008 var

이런식으로 퍼미션과 파일의 종류가 출력이 된다.
아무튼 일반적으로 보이는 녀석들은

- 일반 파일
b Block device
c Character device
d Directory
l symbolic Link

인데 드물게 보이는 녀석들이 존재 한다.
prw------- 1 morpheuz dev        0 Jul 15 13:21 initctl
crw-rw---- 1 morpheuz dev  61,   0 May 30  2008 lirc
srwxr-xr-x 1 morpheuz dev        0 Oct 20 19:57 lircd
brw-rw---- 1 morpheuz dev   7,   0 May 30  2008 loop0

이 녀석들의 의미는 역설적이게도.. find에서 찾아 냈다.

p name Pipe
s Socket


Posted by 구차니