9

✅ dos2unix: command not found错误?这 1 行命令秒解决!

 3 weeks ago
source link: https://www.chenweiliang.com/cwl-32651.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

✅ dos2unix: command not found错误?这 1 行命令秒解决! https://www.chenweiliang.com/cwl-32651.html

📢 【Linux急救室】"dos2unix: command not found"?1行代码教你原地复活!💻🚑

🔍 问题症状 当你在Linux终端潇洒输入 `dos2unix 文件名`,系统却无情甩你一脸: `-bash: dos2unix: command not found` 😱 ——别急!这不是你的错,是系统没装这个“格式转换神器”!

🐧 病因分析 Windows和Linux的换行符就像“甜咸豆腐脑之争”: ▸ Windows用 `CRLF`(回车+换行) ▸ Linux用 `LF`(纯换行) 传文件到Linux时,系统可能傲娇拒绝:“这格式我不吃!”🍜

💊 特效药方(1行搞定!) 根据你的系统,对症下药:

🍥 Debian/Ubuntu党 apt-get update && apt-get install dos2unix -y

🦁 CentOS/RHEL派 yum install dos2unix -y # 或 dnf install dos2unix -y(新系统)

🎩 Arch大佬 pacman -S dos2unix

🍎 Mac用户 brew install dos2unix

装完验证:`dos2unix --version`,有版本号=成功!🎉

🛠️ 备胎方案(不装也能救!) ▸ sed大法:`sed -i 's/\r$//' 文件名` ▸ tr妙招:`tr -d '\r' 新文件` ▸ vim绝技:打开文件后输入 `:set fileformat=unix` + `:wq`

🤔 灵魂拷问 “我文件已经是Unix格式了,为啥还要装?” ——因为下次遇到Windows来的文件,Linux可能直接表演“格式自闭症”!🤯 备着dos2unix,等于多带一把瑞士军刀!🔪

🎯 总结 1️⃣ 错误=系统缺工具,不是你的锅! 2️⃣ 安装命令分系统,1行搞定超简单! 3️⃣ 不想装?sed/tr/vim也能临时救命! 下次再见“command not found”,记得淡定掏出口令:“ apt-get 大法好!”🙏

🔗 原文传送门: https://www.chenweiliang.com/ 💬 互动时间:你被Linux的换行符坑过吗?评论区吐槽!👇

🚀 转发拯救手残党,点赞积攒RP!⚡


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK