ls 에서 와일드 문자사용에 관하여...

익명 사용자의 이미지

페도라 리눅스 책을 보는데 ls *을 하면 ls와 결과가 동일합니다.
하지만 제 리눅스에서 실행을 하면 현지 디렉터리의 모든 파일과 디렉터리, 디렉토리라면 그 밑의 파일과 디렉토리까지 보여줍니다.
왜 이러죠?

그리고 리눅스에서는 파일의 종류에 따라 색상이 달라보이는데 무슨색상이 어떤 파일이라는 정보는 어디서 얻나요?
그러니까 리눅스라면 전부 이렇다라는게 있는건지 아니면 설정을 할 수 있는건지?

세벌의 이미지

bash 에 대해 검색해 보셔요.
shell 종류가 여러가지 있는데 sh, csh, bash 등등...
구글님에게 물어보시면...

wariua의 이미지

man-page에는 좋은 정보가 많이 있습니다~

$ man ls
...

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

Using color to distinguish file types is disabled both by default and with --color=never. With
--color=auto, ls emits color codes only when standard output is connected to a terminal. The LS_COLORS
environment variable can change the settings. Use the dircolors command to set it.
...

"ls -d *"라고 하면 페도라 리눅스 책에 있다는 것처럼 동작할 겁니다. 왜 책에서만 그렇게 동작했는지는 저도 모르겠습니다. 책을 쓴 사람이 alias ls='ls -d' 이렇게 설정해 두고 사용해서일 수도 있겠고...

파일 색상에 관해선 dircolors 결과와 dircolors -p 결과를 슬쩍 보면 대략 감을 잡으실 수 있을 겁니다.

$PWD `date`

cinsk의 이미지

> 페도라 리눅스 책을 보는데 ls *을 하면 ls와 결과가 동일합니다.

ls 와 ls *의 결과는 다릅니다.

> 하지만 제 리눅스에서 실행을 하면 현지 디렉터리의 모든 파일과 디렉터리, 디렉토리라면 그 밑의 파일과 디렉토리까지 보여줍니다.
> 왜 이러죠?
정상입니다.

> 그리고 리눅스에서는 파일의 종류에 따라 색상이 달라보이는데 무슨색상이 어떤 파일이라는 정보는 어디서 얻나요?
> 그러니까 리눅스라면 전부 이렇다라는게 있는건지 아니면 설정을 할 수 있는건지?

시스템 전체는 /etc/DIR_COLORS 로 조정합니다. 개별적으로는 LS_COLORS 이구요

익명 사용자의 이미지

굳이 같은 명령어를 찾는다면 ls는 ls .으로 보시는게 낫습니다.

ls *를 하면 ls를 실행하기 전에 shell에서 먼저 *를 확장합니다.
a, b라는 디렉토리와 c라는 파일이 있었다면 ls a b c를 실행한 것과 동일하게 됩니다.
그리고 a와 b는 디렉토리니까 디렉토리 안의 것을 보여주게 되고요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.