René's URL Explorer Experiment


Title: Enter-PSSession - Clear-Host on non-Windows target fails · Issue #28118 · PowerShell/PowerShell · GitHub

Open Graph Title: Enter-PSSession - Clear-Host on non-Windows target fails · Issue #28118 · PowerShell/PowerShell

X Title: Enter-PSSession - Clear-Host on non-Windows target fails · Issue #28118 · PowerShell/PowerShell

Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...

Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...

X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/28118

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enter-PSSession - Clear-Host on non-Windows target fails","articleBody":"### Prerequisites\n\n- [x] Write a descriptive title.\n- [x] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [x] Search the existing issues.\n- [x] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [x] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nWhen connecting to a non-Windows target (Linux, macOS), the `clear` command resolves to the `/usr/bin/clear` command and `Clear-Host` is a thin wrapper around calling `/usr/bin/clear` and writing those values to the console.\n\n```powershell\n${function:Clear-Host}\n\n[Console]::Write((\n    & (Get-Command -CommandType Application clear | Select-Object -First 1).Definition\n))\n# .Link\n# https://go.microsoft.com/fwlink/?LinkID=2096480\n# .ExternalHelp System.Management.Automation.dll-help.xml\n```\n\nThis has two problems:\n\n1. SSH subsystems strip the `TERM` env var needed for `/usr/bin/clear` to work\n\n\u003cimg width=\"654\" height=\"205\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/f6c7e030-f692-4e3c-984d-6cddd9d96fc0\" />\n\n3. Direct console calls are a no-op due to the console stdout being used for PSRP messages\n\n\u003cimg width=\"857\" height=\"205\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/9fb74fea-c828-48b5-8f5e-784b732129de\" />\n\nThe only way to get this working is to explicitly set `$env:TERM = '...'` but this cannot be set generically as it must match up with the `TERM` you are using locally.  You probably can just set it to `xterm` and it'll match your terminal locally but there's no guarantee that you actually use an `xterm` compatible terminal. In my case I do and setting it will work.\n\nhttps://github.com/user-attachments/assets/c085c8a8-a328-46e7-837e-c738fdc882bb\n\nThere is a slight side effect in that the console cursor is one line down due to the sequence of processing the new prompt after running a command but that is more cosmetic.\n\nRunning `Clear-Host` rather than `clear` fails because of the `[Console]::Write(clear)` doing to `/dev/null` even with `$env:TERM` explicitly set.\n\nhttps://github.com/user-attachments/assets/1d629a40-8119-4153-b818-918659e71b65\n\nWhat I really think should be happening to fix this is for a remote PSSession on non-Windows to act more like how a Windows target works in that:\n\n+ It defines an alias for `clear` to point to `Clear-Host`\n+ Has `Clear-Host` run the following (like on Windows)\n+ Both of these only apply when connecting to a PSRemoting endpoint, normal PowerShell sessions keep the existing clear/Clear-Host behaviour\n\n```powershell\n# ${function:Clear-Host}\n\n$RawUI = $Host.UI.RawUI\n$RawUI.CursorPosition = @{X=0;Y=0}\n$RawUI.SetBufferContents(\n    @{Top = -1; Bottom = -1; Right = -1; Left = -1},\n    @{Character = ' '; ForegroundColor = $rawui.ForegroundColor; BackgroundColor = $rawui.BackgroundColor})\n# .Link\n# https://go.microsoft.com/fwlink/?LinkID=2096480\n# .ExternalHelp System.Management.Automation.dll-help.xml\n```\n\nThis means the clear operation goes to the actual PSRemoting host call method with known values and this is interpreted locally to call `Console.Clear()` or `/usr/bin/clear` if desired. The remote side continues to stay agnostic of the `TERM` setting and has the local client handle all that as it is better suited to managing the terminal which is actually local.\n\nPlease note this is different to https://github.com/PowerShell/PowerShell/issues/28115 which is specifically around connecting to a Windows target from a non-Windows client. This is about connecting to a non-Windows target from any client.\n\n### Expected behavior\n\n```console\nThe console is cleared\n```\n\n### Actual behavior\n\n```console\n`/usr/bin/clear` outputs `TERM environment not set.` and nothing is cleared.\n```\n\n### Error details\n\n```console\nNo error, the output is from `/usr/bin/term`\n```\n\n### Environment data\n\n```powershell\nNot applicable, present on all PowerShell 7.x versions on non-Windows targets\n```\n\n### Visuals\n\nSee steps to reproduce.","author":{"url":"https://github.com/jborean93","@type":"Person","name":"jborean93"},"datePublished":"2026-09-28T18:50:08Z","url":"https://github.com/PowerShell/PowerShell/issues/28118"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a5441bb1-9af1-ff8d-eefc-e01ba5258411
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE752:2258C3:22DBF2:2F6451:6AFD51EE
html-safe-nonce89ee8d2ac4464d83c74b8fb16615a08f0e8cc66488b62bfd9f188fbfa4f520a6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzUyOjIyNThDMzoyMkRCRjI6MkY2NDUxOjZBRkQ1MUVFIiwidmlzaXRvcl9pZCI6IjMxMDEyNDI5NDI0NTExNzU5MTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac42792550985c0f01af25cf331ad6ace82f6d6267e9e69e13bd748e4a651b2f16
hovercard-subject-tagissue:5619591314
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/28118/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5549c5817a6adaec3f498d18531b6d809f27867e98463b38cc9ee5bf0306795d/PowerShell/PowerShell/issues/28118
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5549c5817a6adaec3f498d18531b6d809f27867e98463b38cc9ee5bf0306795d/PowerShell/PowerShell/issues/28118
og:image:altPrerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejborean93
hostnamegithub.com
expected-hostnamegithub.com
None66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseb6f01f7cb9f35f8c09949773241a3d49dd04b340
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/28118#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F28118
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F28118
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/issues/28118
Reloadhttps://github.com/PowerShell/PowerShell/issues/28118
Reloadhttps://github.com/PowerShell/PowerShell/issues/28118
PowerShellhttps://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Codehttps://github.com/PowerShell/PowerShell
Issues1.3k (1.3k)https://github.com/PowerShell/PowerShell/issues
Pull requests365 (365)https://github.com/PowerShell/PowerShell/pulls
Discussionshttps://github.com/PowerShell/PowerShell/discussions
Actionshttps://github.com/PowerShell/PowerShell/actions
Projectshttps://github.com/PowerShell/PowerShell/projects
Security and quality3 (3)https://github.com/PowerShell/PowerShell/security
Insightshttps://github.com/PowerShell/PowerShell/insights
https://github.com/PowerShell/PowerShell
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/28118
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/28118
Enter-PSSession - Clear-Host on non-Windows target failshttps://github.com/PowerShell/PowerShell/issues/28118#top
WG-Interactive-Consolethe console experiencehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Interactive-Console%22
WG-RemotingPSRP issues with any transport layerhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Remoting%22
WG-ReviewedA Working Group has reviewed this and made a recommendationhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Reviewed%22
https://github.com/jborean93
Jordan Borean (jborean93)https://github.com/jborean93
on Sep 28, 2026https://github.com/PowerShell/PowerShell/issues/28118#issue-5619591314
latest released versionhttps://github.com/PowerShell/PowerShell/releases
FAQhttps://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md
Differences between Windows PowerShell 5.1 and PowerShellhttps://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell
https://private-user-images.githubusercontent.com/8462645/660555275-f6c7e030-f692-4e3c-984d-6cddd9d96fc0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTQ5ODY3NzksIm5iZiI6MTc5NDk4NjQ3OSwicGF0aCI6Ii84NDYyNjQ1LzY2MDU1NTI3NS1mNmM3ZTAzMC1mNjkyLTRlM2MtOTg0ZC02Y2RkZDlkOTZmYzAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MTExOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjExMThUMDcyMTE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmUyZWFhMmJkMjFmZWVkZGU3YzkzOWY2ZDA5OGEyNmVhOWFhMTNmMTMxNjI5ZDJjOTQzM2Q5MWJmM2M4MjQxNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.GsteVMtcrXZpUBrGqxuJK3prutZsd7RKDKMf9cBxkMs
https://private-user-images.githubusercontent.com/8462645/660556500-9fb74fea-c828-48b5-8f5e-784b732129de.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTQ5ODY3NzksIm5iZiI6MTc5NDk4NjQ3OSwicGF0aCI6Ii84NDYyNjQ1LzY2MDU1NjUwMC05ZmI3NGZlYS1jODI4LTQ4YjUtOGY1ZS03ODRiNzMyMTI5ZGUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MTExOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjExMThUMDcyMTE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NDNkNTA1NjFiYWI0M2YyMDIyOWNkM2ZmNzc1ZjAzNmE4OThhNzMxNDdlNzJhMTYyNDkyMDNjZjFlMTViMGFhOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.GLroCc8vL-o3f524dO5bKYDJo4WtIPSk9VC9M7VhUmg
#28115https://github.com/PowerShell/PowerShell/issues/28115
Jordan Borean (jborean93)https://github.com/jborean93
Needs-TriageThe issue is new and needs to be triaged by a work group.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Needs-Triage%22
on Sep 28, 2026https://github.com/PowerShell/PowerShell/issues/28118#event-32019523881
https://github.com/jborean93
Jordan Borean (jborean93)https://github.com/jborean93
on Sep 28, 2026https://github.com/PowerShell/PowerShell/issues/28118#issuecomment-5876419339
Ilya (iSazonov)https://github.com/iSazonov
WG-RemotingPSRP issues with any transport layerhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Remoting%22
on Sep 29, 2026https://github.com/PowerShell/PowerShell/issues/28118#event-32048915098
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Sep 29, 2026https://github.com/PowerShell/PowerShell/issues/28118#issuecomment-5883822752
#8609https://github.com/PowerShell/PowerShell/pull/8609
#8603https://github.com/PowerShell/PowerShell/pull/8603
#8554https://github.com/PowerShell/PowerShell/issues/8554
Ilya (iSazonov)https://github.com/iSazonov
WG-Interactive-Consolethe console experiencehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Interactive-Console%22
on Sep 29, 2026https://github.com/PowerShell/PowerShell/issues/28118#event-32050315666
https://github.com/jborean93
Jordan Borean (jborean93)https://github.com/jborean93
on Sep 29, 2026https://github.com/PowerShell/PowerShell/issues/28118#issuecomment-5884057833
Ilya (@iSazonov)https://github.com/iSazonov
#28116https://github.com/PowerShell/PowerShell/pull/28116
Fix Clear-Host for remote Windows PSSession #28116https://github.com/PowerShell/PowerShell/pull/28116
Enter-PSSession - Clear-Host from non-Windows client to Windows target fails #28115https://github.com/PowerShell/PowerShell/issues/28115
https://github.com/kilasuit
Ryan Yates (kilasuit)https://github.com/kilasuit
on Sep 29, 2026https://github.com/PowerShell/PowerShell/issues/28118#issuecomment-5886168906
Jordan Borean (@jborean93)https://github.com/jborean93
https://github.com/kilasuit
Ryan Yates (kilasuit)https://github.com/kilasuit
on Sep 29, 2026https://github.com/PowerShell/PowerShell/issues/28118#issuecomment-5894300924
Jordan Borean (@jborean93)https://github.com/jborean93
Jason Helmick (theJasonHelmick)https://github.com/theJasonHelmick
WG-ReviewedA Working Group has reviewed this and made a recommendationhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Reviewed%22
Needs-TriageThe issue is new and needs to be triaged by a work group.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Needs-Triage%22
on Oct 28, 2026https://github.com/PowerShell/PowerShell/issues/28118#event-34517272265
https://github.com/theJasonHelmick
Jason Helmick (theJasonHelmick)https://github.com/theJasonHelmick
on Oct 28, 2026https://github.com/PowerShell/PowerShell/issues/28118#issuecomment-6479928609
Jordan Borean (@jborean93)https://github.com/jborean93
Jason Helmick (theJasonHelmick)https://github.com/theJasonHelmick
completedhttps://github.com/PowerShell/PowerShell/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 28, 2026https://github.com/PowerShell/PowerShell/issues/28118#event-34517283534
https://github.com/jborean93
Jordan Borean (jborean93)https://github.com/jborean93
on Oct 28, 2026https://github.com/PowerShell/PowerShell/issues/28118#issuecomment-6480028680
Jason Helmick (@theJasonHelmick)https://github.com/theJasonHelmick
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PowerShell/issues/28118
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/28118
WG-Interactive-Consolethe console experiencehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Interactive-Console%22
WG-RemotingPSRP issues with any transport layerhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Remoting%22
WG-ReviewedA Working Group has reviewed this and made a recommendationhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Reviewed%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.