# On Remote SSH Linux, the agent Write tool (or file sync layer) can persist CRLF in \*.sh

**URL:** <https://forum.cursor.com/t/on-remote-ssh-linux-the-agent-write-tool-or-file-sync-layer-can-persist-crlf-in-sh/173904>\
**Category:** Bug Reports\
**Tags:** linux, ssh\
**Created:** [October 6, 2026, 5:53pm UTC](https://forum.cursor.com/t/on-remote-ssh-linux-the-agent-write-tool-or-file-sync-layer-can-persist-crlf-in-sh/173904 "2026-10-06T17:53:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jawaidbazyar2](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/jawaidbazyar2/32/44298_2.png) [@jawaidbazyar2](https://forum.cursor.com/u/jawaidbazyar2)\
**Post date:** [October 6, 2026, 5:53pm UTC](https://forum.cursor.com/t/on-remote-ssh-linux-the-agent-write-tool-or-file-sync-layer-can-persist-crlf-in-sh/173904/1 "2026-10-06T17:53:30Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

On Remote SSH Linux, the agent Write tool (or file sync layer) can persist CRLF in \*.sh; breaks shebang/cron; sed/dos2unix fixes it. Repro: Write a bash script on Linux remote → file script.sh shows “with CRLF line terminators”. Include build/OS, Remote SSH, and that LF-only shell writes work outside Write.

### Steps to Reproduce

Agent produced .sh file that contained CRLF, and write tool did not clean it before writing to the Linux host.

### Expected Behavior

Write should ensure the correct line endings are used on each target host.

### Operating System

MacOS  
Linux

### Version Information

Version: 3.21.16 (Universal)  
VS Code Extension API: 1.128.0  
Commit: 8ae78e8eee1e63479c7e0504b664bc0a80c68000  
Date: 2026-09-19T06:43:22.276Z  
Layout: IDE  
Build Type: Stable  
Release Track: Default  
Electron: 42.10.0  
Chromium: 148.0.7778.280  
Node.js: 24.18.1  
V8: 14.8.178.38-electron.0  
xterm.js: 6.1.0-beta.291  
OS: Darwin arm64 24.6.0

### For AI issues: which model did you use?

don’t remember

### Does this stop you from using Cursor

No - Cursor works, but with this issue

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [October 6, 2026, 7:20pm UTC](https://forum.cursor.com/t/on-remote-ssh-linux-the-agent-write-tool-or-file-sync-layer-can-persist-crlf-in-sh/173904/6 "2026-10-06T19:20:07Z")

</div>

Hey @jawaidbazyar2, thanks for the report!

I’ve flagged this to the team. When the agent creates a new file, it picks line endings by sampling files that already exist in the workspace. If a few of those files use CRLF, a new script can end up with CRLF even on a Linux host. It doesn’t currently follow `files.eol`, `.editorconfig`, or `.gitattributes`.

Could you check whether that’s what is happening on your remote? In a terminal on the Linux host, from the workspace root, run:

1. `grep -rlI $'\r' --exclude-dir=.git --exclude-dir=node_modules . | head -20`
2. Reply with whether it lists any files (and roughly what kind, e.g. `.bat`, `.csv`, docs copied from Windows).

In the meantime, a project rule along the lines of “after creating or editing any `.sh` file, run `sed -i 's/\r$//' <file>`” works around it, as does converting the CRLF files in the workspace to LF if they don’t need to stay CRLF.

---

<div class="post-metadata">

**Author:** ![jawaidbazyar2](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/jawaidbazyar2/32/44298_2.png) [@jawaidbazyar2](https://forum.cursor.com/u/jawaidbazyar2)\
**Post date:** [October 8, 2026, 2:29pm UTC](https://forum.cursor.com/t/on-remote-ssh-linux-the-agent-write-tool-or-file-sync-layer-can-persist-crlf-in-sh/173904/8 "2026-10-08T14:29:37Z")

</div>

hello!

I performed that listing, and nothing is coming up except files that might have had CRLF in them having been uploaded years ago.

I check your workaround. thanks!
