linux将^M去掉或将windows文件换成linux文件

1、安装dos2unix包

root@st006:/home/deploy/nginx/conf# apt install dos2unix
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  dos2unix
0 upgraded, 1 newly installed, 0 to remove and 114 not upgraded.
Need to get 351 kB of archives.
After this operation, 1,267 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 dos2unix amd64 7.3.4-3 [351 kB]
Fetched 351 kB in 5s (66.5 kB/s)                     
Selecting previously unselected package dos2unix.
(Reading database ... 82889 files and directories currently installed.)
Preparing to unpack .../dos2unix_7.3.4-3_amd64.deb ...
Unpacking dos2unix (7.3.4-3) ...
Setting up dos2unix (7.3.4-3) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@st006:/home/deploy/nginx/conf# dos2unix nginx.conf
dos2unix: converting file nginx.conf to Unix format...

2、转换

dos2unix 文件名

你可能感兴趣的:(dos2unix)