You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

命令别名ll的定义位置在哪里?

Tracking Down the ll Alias Definition

Hey there! Let's figure out where that handy ll alias is hiding—since it works in bash and zsh but not in sh, we can break this down step by step.

1. First, see what ll actually does

The quickest way to check the alias's exact definition is to run this command directly in your bash/zsh shell:

alias ll

This will spit out exactly what the alias maps to (usually something like alias ll='ls -l' or ls -alF depending on your setup).

2. Find which config file defines it

Bash and zsh load different sets of configuration files, so we'll cover both environments:

For Bash

  • Interactive login shells (like when you SSH into a server) load files in this order: ~/.bash_profile → ~/.bash_login → ~/.profile (it stops at the first one that exists)
  • Non-login interactive shells (like opening a terminal window locally) load ~/.bashrc
  • System-wide aliases might be stored in /etc/bashrc, /etc/profile, or scripts under /etc/profile.d/

For Zsh

  • Interactive login shells load ~/.zprofile → ~/.zlogin → ~/.profile
  • Interactive non-login shells load ~/.zshrc
  • System-wide zsh configs can live in /etc/zshrc, /etc/zprofile, or the /etc/zsh/ directory

To search all these files automatically, run this grep command (it scans your home directory and system configs, hiding irrelevant permission errors):

grep -r "alias ll" ~/ /etc/ 2>/dev/null

3. Why ll doesn't work in sh?

Sh is a POSIX-compliant shell that sticks strictly to basic shell standards. It doesn't load bash/zsh-specific config files like .bashrc or .zshrc, and most systems don't define the ll alias in generic POSIX shell configs (like /etc/profile) by default. So when you switch to sh, that alias never gets loaded—simple as that!

内容的提问来源于stack exchange,提问作者user791290

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:45:14