3 पॉइंट द्वारा GN⁺ 2024-07-23 | 1 टिप्पणियां | WhatsApp पर शेयर करें
  • eza Unix/Linux के file listing command ls का आधुनिक CLI विकल्प है, जिसका लक्ष्य ज़्यादा फीचर्स और बेहतर defaults देना है
  • यह file types और metadata को रंगों से अलग दिखाता है, symbolic links, extended attributes और Git जानकारी को पहचानता है, और छोटे व तेज़ single binary के रूप में उपलब्ध है
  • मौजूदा exa की तुलना में इसमें Grid Bug fix, hyperlinks, mount point details, SELinux context, Git repository status, human-readable relative dates, security fixes, bright terminal colors और theme.yml configuration जोड़े गए हैं
  • इसे Windows, macOS और Linux पर install किया जा सकता है, और Nix flake environment में nix run github:eza-community/eza से build करके run किया जा सकता है
  • इसका options system ls जैसा पूरी तरह नहीं है, और display, filtering, long listing व theme settings के ज़रिए file listing output को बारीकी से adjust किया जा सकता है

eza द्वारा दिया जाने वाला ls विकल्प अनुभव

  • eza Unix और Linux operating systems में शामिल पुराने file listing command ls का आधुनिक विकल्प है
  • मूल लक्ष्य ls से ज़्यादा feature-rich और user-friendly version देना है
  • यह file types और metadata को रंगों से अलग दिखाता है
  • यह symbolic links, extended attributes और Git जानकारी को पहचानता है
  • यह छोटा, तेज़ है और single binary के रूप में उपलब्ध है

exa की तुलना में जोड़े गए फीचर्स

  • eza में exa में न मौजूद कई फीचर्स शामिल हैं
    • exa 2021 में आए “The Grid Bug” का fix
    • hyperlink support
    • mount point details output
    • SELinux context output
    • Git repository status output
    • human-readable relative dates
    • कई security fixes
    • bright terminal colors support
    • छोटे bug fixes और changes
    • colors और icons customize करने के लिए theme.yml configuration file

चलाना और install करना

  • Nix flake support वाले environment में आप निम्न command से eza try कर सकते हैं
    • nix run github:eza-community/eza
  • Nix eza को build करने के बाद run करता है
  • arguments pass करने के लिए नीचे की तरह -- के बाद options जोड़ें
    • nix run github:eza-community/eza -- -ol
  • eza Windows, macOS और Linux पर उपलब्ध है
  • platform और distribution के हिसाब से installation methods INSTALL.md में हैं

command-line options की संरचना

  • eza के options लगभग ls जैसे हैं, लेकिन पूरी तरह समान नहीं हैं
  • display options

    • -1, --oneline: एक line में एक item दिखाएं
    • -G, --grid: items को grid में दिखाएं; यह default है
    • -l, --long: विस्तृत details और attributes दिखाएं
    • -R, --recurse: directories को recursively explore करें
    • -T, --tree: directories को tree form में recursively दिखाएं
    • -F, --classify=(when): file name के पास type indicator output करें
    • --colour=(when), --color=(when): terminal colors कब use करने हैं, यह specify करें
    • --icons=(when): icons कब दिखाने हैं, यह specify करें
    • --hyperlink=(when): items को hyperlink के रूप में कब दिखाना है, यह specify करें
    • --absolute=(mode): items के absolute path को दिखाने का तरीका specify करें
  • filtering options

    • -a, --all: hidden files और dot files दिखाएं
    • -d, --treat-dirs-as-files: directories को normal files की तरह list करें
    • -L, --level=(depth): recursion depth limit करें
    • -s, --sort=(field): sort field specify करें
    • --group-directories-first: directories को पहले दिखाएं
    • --group-directories-last: directories को बाद में दिखाएं
    • -D, --only-dirs: सिर्फ directories दिखाएं
    • -f, --only-files: सिर्फ files दिखाएं
    • --git-ignore: .gitignore में मौजूद files ignore करें
    • -I, --ignore-glob=(globs): pipe से अलग किए गए glob patterns वाली files ignore करें
    • --all दो बार pass करने पर . और .. directories भी दिखती हैं

long listing और Git संबंधित जानकारी

  • --long या -l use करने पर long listing options इस्तेमाल किए जा सकते हैं
  • file size और permissions से जुड़े options उपलब्ध हैं
    • -b, --binary: binary prefixes के साथ file size दिखाएं
    • -B, --bytes: prefix के बिना bytes में file size दिखाएं
    • -o, --octal-permissions: permissions को octal format में दिखाएं
    • --no-permissions, --no-filesize, --no-user, --no-time: संबंधित fields का output suppress करें
  • file system और metadata से जुड़े options उपलब्ध हैं
    • -H, --links: hard links की संख्या दिखाएं
    • -i, --inode: inode number दिखाएं
    • -M, --mounts: mount details दिखाएं; केवल Linux और macOS पर उपलब्ध
    • -Z, --context: security context दिखाएं
    • -@, --extended: extended attributes और size दिखाएं
    • --total-size: recursive directory size दिखाएं
  • Git संबंधित output भी support है
    • --git: हर tracked या ignored file का Git status दिखाएं
    • --git-repos: हर tracked directory का Git status दिखाएं
    • --git-repos-no-status: सिर्फ यह दिखाएं कि directory Git repository है या नहीं; यह तेज़ है
    • --no-git: --git, --git-repos, --git-repos-no-status को हमेशा ignore करता है और Git status output suppress करता है
  • time format default, iso, long-iso, full-iso, relative, या +<FORMAT> के रूप में custom format support करता है
    • उदाहरण: +%Y-%m-%d %H:%M 2023-09-30 13:00 format में output देता है
    • detailed format strings के लिए eza(1) manual page और chrono documentation देखें
  • manual pages repository की man directory में देखे जा सकते हैं, और version [0.18.13] - 2024-04-25 से terminal में man eza के रूप में भी उपलब्ध हैं

theme customization

  • eza ने हाल ही में theme.yml file support जोड़ा है
  • theme.yml में वे existing theme options specify किए जा सकते हैं जो LS_COLORS और EXA_COLORS environment variables में use किए जा सकते थे
  • file types और extensions के हिसाब से अलग icons specify करने का option भी उपलब्ध है
  • अगर existing environment variables set हैं, तो backward compatibility के लिए वे continue work करते हैं और priority लेते हैं
  • pre-made themes official eza-themes repository में देखे जा सकते हैं या आप खुद contribute कर सकते हैं
  • example theme file docs/theme.yml में है
  • theme file को EZA_CONFIG_DIR environment variable से specified directory में रखें, या default रूप से इसे $XDG_CONFIG_HOME/eza में खोजा जाता है
  • details eza_colors-explanation.5.md और docs/theme.yml में हैं

contribution

  • eza में contribute करने के लिए code of conduct का पालन करना होगा
  • actual development participation की जानकारी CONTRIBUTING.md में है

1 टिप्पणियां

 
GN⁺ 2024-07-23
Hacker News की राय
  • डायरेक्टरी लिस्टिंग में इंसानों के पढ़ने लायक तारीखें खास तौर पर खटकती हैं
    मैं वह चीज़ ढूंढ रहा हूं जिसे कल सुबह करीब 11 बजे किसी फ़ोल्डर में कॉपी किया था, और अगर सब कुछ “1 day ago” दिखे तो उससे मदद नहीं मिलती। तारीख और समय चाहिए, और HN जैसे फ़ोरमों में भी यही होना चाहिए: पहले सटीक तारीख/समय दिखाएं, फिर ज़रूरत हो तो साथ में “7 hours ago” जोड़ दें
    समझ नहीं आता कि जानकारी जानबूझकर क्यों हटाई जाती है, और सोचता हूं कि क्या यह infinite scroll जैसे फ्लो का नतीजा है

    • सहमत। GitHub भी कमिट्स में “foo.cpp modified last year” जैसा दिखाता है, और अगर अतिरिक्त तारीख/समय जानकारी देखने का तरीका न हो तो इसका बिल्कुल मतलब नहीं बनता
    • लगता है साइटें इस काम के लिए HTML टैग इस्तेमाल कर सकती हैं। इंसानों के पढ़ने लायक फ़ॉर्मैट चुनें भी, तो वास्तविक समय बचाकर रखें ताकि कोई extension उसे बदल सके या ऊपर से दिखा सके
      HTML लिखते समय मैं इसे हमेशा इस्तेमाल करने की कोशिश करता हूं
      (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ti...)
    • यह सचमुच हैरान करने वाला anti-feature है। बदलाव का समय भी अस्पष्ट होता है। “1 day ago” कब “2 days ago” बनता है? Google के हिसाब से 48 घंटे बाद, इसलिए 47 घंटे बाद देखने पर “1 day ago” दिखता है और भ्रम होता है कि यह कल हुआ था
      अगर आपको याद है कि कोई खास तारीख दोस्त के जन्मदिन के अगले दिन थी और आप कोई item ढूंढना चाहते हैं, लेकिन डिस्प्ले सिर्फ “three months ago” है, तो आपको पूरे एक महीने का डेटा खंगालना पड़ेगा
    • यह एक setting है, इसलिए इसे अपनी पसंद के तारीख फ़ॉर्मैट में बदला जा सकता है
    • मुझे यह तरीका पसंद नहीं। लगता है यह Web 2.0 startups से शुरू हुआ था, या उसी दौर में Google जैसी कंपनियों के web apps/social web apps से फैला
      पहले detailed time दें, और चाहें तो साथ में “कुछ दिन पहले” वाला डिस्प्ले भी दे दें
  • lsd भी है, लेकिन फिर भी मैं eza को ज़्यादा पसंद करता हूं
    जिन लोगों की रुचि हो, उनके लिए आजकल पुराने टूल्स की जगह इस्तेमाल होने वाले कुछ modern command-line tools हैं: bat syntax highlighting वाला cat है, difftastic बेहतर diff है, gdu SSD के लिए ncdu है, zoxide modern cd है, fd find का विकल्प है, rg ripgrep है, fzf fuzzy finder है, jless mouse folding वाला JSON viewer है, dra release assets download/install करता है, lazygit Git TUI है, lazydocker Docker TUI है, yazi image preview वाला file manager है, zellij बेहतर tmux/screen है, और starship कई shells में इस्तेमाल होने वाला prompt configuration tool है

    • अक्सर इस्तेमाल होने वाले 4 और tools जोड़ें तो, task Makefile का विकल्प है, hyperfine benchmark tool है, vegeta load testing tool है, और sd बेहतर व अधिक सहज sed है
      JSON की तिकड़ी भी है: jq मशहूर JSON processor है, jc कई CLI tools के output को JSON में बदलता है, और gron JSON को grep करना आसान बनाता है
    • fd और rg के बारे में सावधान रहना चाहिए कि ये default रूप से .gitignore में शामिल items को ignore करते हैं। अगर इन्हें सिर्फ find का सीधा replacement समझें, तो चौंक सकते हैं। संबंधित चर्चा [0] में है
      ऐसे tools recommend करते समय यह बात साफ़ बतानी चाहिए। docs न पढ़ें तो यह आसानी से छूट जाती है। निजी तौर पर, मैं चाहूंगा कि ऐसे replacement coreutils टूल्स अपने defaults को मूल tool के ज़्यादा करीब रखें। अगर इसे “find का सरल, तेज़ और user-friendly विकल्प” कहकर promote किया जा रहा है, तो नए users के surprise को कम करने के लिए original defaults का सम्मान करना चाहिए। aliases तो हैं ही, इसलिए ~/.${SHELL##*/}rc में alias fd='fd --ignore' रखना, alias fd='fd --no-ignore' से बेहतर लगता है
      tip के तौर पर, अगर alias लागू न हुआ version इस्तेमाल करना हो तो \command इस्तेमाल करें। उदाहरण के लिए मैं alias grep='grep --color=always --no-messages --binary-files=without-match इस्तेमाल करता हूं, लेकिन color option character representation बदल देता है, जिससे curl में pipe करने पर error आ सकता है। हर pipe में ऐसा नहीं होता, लेकिन पहली बार सामना होने पर काफी हक्का-बक्का कर देता है। echo "Hello world" | \grep --color=always "Hello" | hexdump के बाद !!:s^always^never से जांच सकते हैं
      [0] https://github.com/sharkdp/fd/issues/612
    • इस link में भी उन अतिरिक्त tools की बड़ी list है जिनके बारे में सुना नहीं था, लेकिन वे रोचक लगते हैं
      https://github.com/ibraheemdev/modern-unix
    • अच्छा लगता है कि इनमें से ज़्यादातर tools Rust में लिखे गए हैं
    • मुझे zellij, screen से बेहतर नहीं लगा। tabs/screens की numbering ठीक से नहीं होती, इसलिए सीधे switch करने के लिए खुद गिनना पड़ता है; यह स्वीकार करना मुश्किल है
  • GNU ls maintained है। ls.c file को प्रभावित करने वाले commits 2024-06-24 और 2024-06-27 को भी हुए थे, एक महीने से भी कम पहले
    GNU Coreutils mailing list भी काफी सक्रिय है। लगता है यह project “maintained” का मतलब “actively developed” के रूप में इस्तेमाल कर रहा है

    • यहां शायद exa की बात हो रही है, जिसे eza ने fork किया था। exa लगभग 1 साल तक maintained नहीं था, जब तक repository write access रखने वाले अकेले व्यक्ति ने इसे आधिकारिक रूप से deprecated mark नहीं किया
      अब fork हुए भी काफी समय हो गया है, इसलिए हर कोई exa को नहीं जानता, और इस wording का intent भी बहुत कम स्पष्ट रह गया है। इसी तरह की प्रतिक्रिया दिख रही है, इसलिए लगता है copy update करने का समय आ गया है
    • यहां “maintained” का मतलब यह नहीं है कि ls maintained नहीं है, बल्कि यह है कि यह अब unmaintained ls replacement exa के fork के रूप में maintained replacement है
  • fish shell पर स्विच करने के बाद ls का उपयोग 100% घट गया। इसका built-in Alt + l command directory contents दिखाता है, जो बहुत उपयोगी है, और shell history भी ज़्यादा साफ़ हो गई

    • Bash में भी ls जैसे commands को HISTIGNORE environment variable में जोड़ने से history को ज़्यादा साफ़ रखा जा सकता है: https://superuser.com/questions/232885/can-you-share-wisdom-...
    • अच्छा tip है। fish में ls का अधिकतर उपयोग हटाने वाली चीज़ वह setting थी जो directory बदलते समय अपने-आप ls चलाती थी
      function ls_on_cd --on-variable PWD
      ls
      end
    • Bash users भी इस तरह shortcuts bind कर सकते हैं। दाएँ हाथ की home row keys को __bash_ctrl_n() जैसे functions से बाँधकर रखा है, और dotfiles के कई tools को ये functions overwrite करने देता हूँ। उदाहरण के लिए, अगर Git installed है तो __bash_ctrl_e() को git status और git log चलाने के लिए set करता हूँ
    • मेरे environment में शायद ls को eza का alias बनाया हुआ है, इसलिए लगता है यह feature eza चला रहा है। अंत में ऐसा ही लगता है कि बस ls चल रहा है
    • यह महसूस करने के बाद कि ls का अधिकतर execution cd के तुरंत बाद होता है, मैंने इसे startup file में जोड़ दिया। अब लगभग हर cd अपने-आप ls चलाता है
      Bash में cd() function से builtin cd "$@" && ls -l call करता हूँ, और fish में builtin cd $argv के बाद, error न हो और home में जाना न हो तो dir चलाने देता हूँ
  • file types या attributes अलग दिखाने के लिए रंग थोपने वाले terminal tools कुल मिलाकर असुविधाजनक लगते हैं। distributions का ls भी अक्सर इसी तरह configured होता है, लेकिन मैं वह setting हटाकर defaults इस्तेमाल करता हूँ
    मैं आँखों के लिए आरामदायक terminal background इस्तेमाल करता हूँ, लेकिन ऐसे color schemes हमेशा background से टकराते हैं या उनमें पढ़ने में मुश्किल रंग होते हैं। ls या उसके alternatives के output में colors की ज़रूरत नहीं है, और ls -AFC जितना देता है, वह पर्याप्त है

    • अगर tools मनमाने “256 color” या “RGB” color modes की जगह Base16 Framework[0] इस्तेमाल करें, तो समस्या बहुत कम होगी। output terminal में defined, पढ़े जा सकने की उम्मीद वाले colors में दिखेगा
      [0] https://github.com/chriskempson/base16
      [1] https://tinted-theming.github.io/base16-gallery/
    • मैं तो बिल्कुल उल्टा, colorized output पर काफी निर्भर करता हूँ
      फिर भी कोई solution होना चाहिए, और $NO_COLOR में कोई value set कर देने से काम हो जाता है। https://no-color.org
      जो tools इस environment variable को check और respect नहीं करते, उनके लिए bug report डालना पूरी तरह उचित है
    • https://no-color.org
    • vivid[1] का इस्तेमाल करके terminal background से मेल खाने वाली theme चुनें, और generated LS_COLORS variable को shell में load कर दें
      [1]: https://github.com/sharkdp/vivid/
  • README में eza को exa का fork नहीं बताया गया है, यह अजीब है

    • “eza features not in exa” तो कहता है, इसलिए उसके अस्तित्व का ज़िक्र है। लेकिन कोई link या context नहीं है
  • सोच रहा हूँ कि GNU utilities के इतने सारे नए versions MIT license के तहत क्यों बनाए जा रहे हैं। काफी ज़्यादा लगते हैं

    • Rust users आम तौर पर code को permissive licenses के तहत release करने की प्रवृत्ति रखते हैं। आसानी से देखे जा सकने वाले stats हैं या नहीं, पता नहीं, लेकिन Rust package repository crates.io में लगभग सब कुछ MIT या Apache-2.0 है, और popular libraries के बारे में तो यह निश्चित रूप से कहा जा सकता है
    • GNU project ने ls invent नहीं किया था। ls समेत GNU coreutils भी मूल रूप से proprietary AT&T utilities या BSD-licensed utilities के नए versions ही थे
    • इसी से जुड़ा https://github.com/uutils/coreutils “GNU coreutils का cross-platform Rust rewrite” है
  • ls alternative को Kerberos और SSH की क्या ज़रूरत है?
    ldd /usr/bin/eza देखने पर यह libgit2, libgssapi_krb5, libmbedtls, libssh2, libkrb5, libcrypto, libzstd वगैरह काफी सारी libraries से linked है

    • खासकर ls के लिए जितनी ज़रूरत होनी चाहिए, उसके मुकाबले dependencies बहुत ज़्यादा हैं
  • QWERTY keyboard पर eza तीन अक्षरों का काफी खराब combination है। ls का एक फायदा यह है कि यह बहुत तेज़ी से type किया जा सकने वाला key combo है
    alias बनाया जा सकता है, लेकिन compatibility जैसी वजहों से यह थोड़ा अजीब लगता है

    • करीब 2015 से eza, और उससे पहले exa को ls, ll, lll के alias के रूप में use कर रहा हूँ, लेकिन कभी compatibility issue नहीं आया
      sl भी installed है ताकि गलत type न करूँ, इसके लिए खुद को train कर सकूँ
    • Dvorak user के तौर पर eza सुधार जैसा लगता है। Dvorak में ls, QWERTY के हिसाब से p- है, यानी दोनों right-hand pinky keys हैं
    • क्या आप और समझा सकते हैं कि alias बनाना अजीब क्यों है?
    • आप अपनी पसंद के किसी भी नाम से alias बना सकते हैं
    • ऐसे समय पर AZERTY keyboard चमकता है
  • वैसे भी ls कौन इस्तेमाल करता है? बस tab autocomplete करते रहो जब तक ज़रूरी file न मिल जाए
    मज़ाक अपनी जगह, लेकिन यह दावा क्यों किया जा रहा है कि ls अब maintain नहीं होता, यह जानने की उत्सुकता है

    • लगता है वे ls नहीं, बल्कि अब maintain नहीं होने वाले exa[0] की बात कर रहे हैं
      [0]https://github.com/ogham/exa
    • किसी वजह से यह मान लेना मानक जैसा हो गया है कि अगर software नियमित रूप से update नहीं होता, तो वह अपने-आप पुराना हो गया है
    • बेशक ls shell या coreutils के हिस्से के रूप में maintain होता है
      बस eza, exa का variant है, और मेरी जानकारी में exa अब maintain नहीं होता
    • मौजूदा tool को ऐसा दिखाने के लिए कि वह maintain नहीं होता, “maintained” और “actively developed” को जानबूझकर गड्डमड्ड किया जा रहा है