受欢迎的博客标签

How to Use the ls Command to List Files and Directories on Linux

Published

How to Use the ls Command to List Files and Directories on Linux

 

linux 使用ls命令以M,G为单位显示文件大小

以M显示文件大小:

ls -l --block-size=m
 


以G显示文件大小:

ls -l --block-size=G

 

listing produced ina single column, use the -1 (one file per line) option:

ls -1

 

tree -L 3

root@raspberrypi:/home/homeassistant20221103# tree -L 3
.
├── automations.yaml
├── backups
│   ├── 88825a87.tar
│   └── 9b9c8c52.tar
├── blueprints
│   ├── automation
│   │   └── homeassistant
│   └── script
│       └── homeassistant
├── configuration.yaml
├── custom_components
│   ├── edge_tts
│   │   ├── __init__.py
│   │   ├── manifest.json
│   │   ├── __pycache__
│   │   └── tts.py
│   ├── xiaomi_gateway3
│   │   ├── alarm_control_panel.py
│   │   ├── binary_sensor.py
│   │   ├── climate.py
│   │   ├── config_flow.py
│   │   ├── core
│   │   ├── cover.py
│   │   ├── device_trigger.py
│   │   ├── diagnostics.py
│   │   ├── __init__.py
│   │   ├── light.py
│   │   ├── manifest.json
│   │   ├── number.py
│   │   ├── __pycache__
│   │   ├── select.py
│   │   ├── sensor.py
│   │   ├── services.yaml
│   │   ├── switch.py
│   │   ├── system_health.py
│   │   ├── text.py
│   │   └── translations
│   └── xiaomi_miot
│       ├── alarm_control_panel.py
│       ├── binary_sensor.py
│       ├── button.py
│       ├── camera.py
│       ├── climate.py
│       ├── config_flow.py
│       ├── core
│       ├── cover.py
│       ├── device_tracker.py
│       ├── fan.py
│       ├── humidifier.py
│       ├── __init__.py
│       ├── light.py
│       ├── manifest.json
│       ├── media_player.py
│       ├── number.py
│       ├── __pycache__
│       ├── remote.py
│       ├── select.py
│       ├── sensor.py
│       ├── services.yaml
│       ├── switch.py
│       ├── system_health.py
│       ├── text.py
│       ├── translations
│       ├── vacuum.py
│       └── water_heater.py
├── deps

https://vitux.com/debian_tree_command/

Useful links

How to Use the ls Command to List Files and Directories on Linux

https://www.howtogeek.com/448446/how-to-use-the-ls-command-on-linux/