Skip to content

YoungHaKim7/PowerShell_pwsh_WinOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 

Repository files navigation

link

Choco Install 윈도우 패키지 관리자: chocolatey



code

```powershell

(문제가 많은 wsl)Upgrade of a freshly installed WSL1 Ubuntu 24.04 fails

  • https://superuser.com/questions/1863713/upgrade-of-a-freshly-installed-wsl1-ubuntu-24-04-fails

  • 이걸로 해결Workaround 2: override command

    • Possible if the error has already occurred and the installation is to be completed.
    • The error occurs in the post-install script of systemd (/var/lib/dpkg/info/systemd.postinst), more precisely when calling the command systemd-sysusers in this script.
    • You can link the binary systemd-sysusers to echo, for example. This allows the post-install script to be executed, except for the command that is executed via systemd-sysusers, as this only generates an output via echo, but you no longer run into an error.
cd /bin && mv -f systemd-sysusers{,.org} && ln -s echo systemd-sysusers && cd -
apt install -f
  • Source of the 1st command: microsoft/WSL#10397 (comment)
    • Hint: I am not sure about the future effects or problems by "disabling" the systemd-sysusers command.

MINGW64설정관련|🔝|

C:/msys64/msys2_shell.cmd -defterm -here -no-start -ucrt64

PowerShell_Core_6 0_icon

wsl 명령어 정리|🔝|

설치가능 리스트|🔝|

 wsl --install
Linux용 Windows 하위 시스템이 이미 설치되어 있습니다.
다음은 설치할 수 있는 유효한 배포 목록입니다.
'wsl --install -d <배포>'를 사용하여 설치하세요.

NAME                                   FRIENDLY NAME
Ubuntu                                 Ubuntu
Debian                                 Debian GNU/Linux
kali-linux                             Kali Linux Rolling
Ubuntu-18.04                           Ubuntu 18.04 LTS
Ubuntu-20.04                           Ubuntu 20.04 LTS
Ubuntu-22.04                           Ubuntu 22.04 LTS
Ubuntu-24.04                           Ubuntu 24.04 LTS
OracleLinux_7_9                        Oracle Linux 7.9
OracleLinux_8_7                        Oracle Linux 8.7
OracleLinux_9_1                        Oracle Linux 9.1
openSUSE-Leap-15.5                     openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4    SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5           SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed                    openSUSE Tumbleweed

wsl.exe -d ubuntu-22.04|🔝|

  • 윈도우 wsl 우분투 22.04 시작하기
wsl.exe -d Ubuntu

wsl.exe -d Ubuntu-24.04

wsl.exe -d ubuntu-22.04

wsl.exe -d kali-linux

wsl.exe -d Debian



// 종료
wsl.exe -t Ubuntu-24.04
  • wsl 우분투 가상 환경 종료 하기
wsl.exe --terminate Ubuntu-22.04

or

wsl.exe -t Ubuntu-22.04

wsl.exe -t kali-linux

# 설치 완료 후(arch linux (wsl2)접속)
arch.exe 



// 설치한 우분투삭제
wsl.exe --unregister Ubuntu-22.04

wsl --unregister <distroName>
  • wsl --list --online
wsl --list --online
다음은 설치할 수 있는 유효한 배포판 목록입니다.
'wsl.exe --install <Distro>'를 사용하여 설치합니다.

NAME                                   FRIENDLY NAME
Ubuntu                                 Ubuntu
Debian                                 Debian GNU/Linux
kali-linux                             Kali Linux Rolling
Ubuntu-18.04                           Ubuntu 18.04 LTS
Ubuntu-20.04                           Ubuntu 20.04 LTS
Ubuntu-22.04                           Ubuntu 22.04 LTS
OracleLinux_7_9                        Oracle Linux 7.9
OracleLinux_8_7                        Oracle Linux 8.7
OracleLinux_9_1                        Oracle Linux 9.1
openSUSE-Leap-15.5                     openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4    SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5           SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed                    openSUSE Tumbleweed

WSL1과 WSL2 환경분리하는 방법

Echo로 README.md에 ( Result ) 넣기

echo "# Result" "" "``````" >> README.md && echo "``````" >> REAME.md && echo "" "``````" >> README.md
  • 러스트 프로젝트 기본 셋
echo "# Result" "" "``````" >> README.md && echo "``````" >> README.md && echo "" "``````" >> README.md && echo "/target" >> .gitignore && echo "Cargo.lock" >> .gitignore
echo "# Result" "" "``````" >> README.md && echo "``````" >> README.md && echo "" "``````" >> README.md && echo "/target" >> .gitignore && echo "Cargo.lock" >> .gitignore && echo ".vscode" >> .gitignore

wsl1에서 wsl2로 업데이트 하기


windows (cmake 설치)

  • you can already do this (or should anyhow).

  • install cmake like this to have it added to PATH for all users:

choco install cmake.install --installargs '"ADD_CMAKE_TO_PATH=System"'
  • or the following to have it added to PATH for the current user only
choco install cmake.install --installargs '"ADD_CMAKE_TO_PATH=User"'

There isn't any intention of adding it by default, as it isn't added by default in the installer.

msys2설치하기


윈도우 파워셀에서 러스트 target폴더 지우기(pwsh.exe) WindowsOS에서

  • 상위 폴더에서 하면 하위 폴더에 있는 target 폴더 다 지워진다. ㅎㅎ 편하네 ㅋㅋ 개꿀!!
Get-ChildItem -Filter ./target -Recurse -Force | Remove-Item -Recurse -Force
  • 상위 폴더에서 하면 하위 폴더에 있는 .DS_Store 파일 다 지워진다. ㅎㅎ 편하다
Get-ChildItem -Filter .DS_Store -Recurse -Force | Remove-Item -Recurse -Force

윈도우 파워셀에서 러스트 target폴더 찾기(pwsh.exe) WindowsOS에서

dir .\ -r -i "target"

c드라이브에서 내가 원하는 mongosh.exe 찾기(find), 빠르게 찾자

PS C:\> dir c:\ -recurse -filter mongosh.exe 

출처 : https://cloudsns.wordpress.com/2012/06/26/powershell%EC%9D%84-%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC-%EC%9E%90%EC%8B%A0%EC%9D%B4-%EC%9B%90%ED%95%98%EB%8A%94-%ED%8C%8C%EC%9D%BC%EC%9D%84-%EB%A7%A4%EC%9A%B0-%EB%B9%A0%EB%A5%B4%EA%B3%A0-%EC%89%BD/

윈도우 파웨셀에서 .gitignore 만들기 /target세팅 (pwsh.exe) WindowsOS에서

  • WindowsOS윈도우에는 touch가 없으니 echo를 활용하면 된다. 신기한건 Linux나 macOS에서도 되서 신기했다. 무조건 touch로 해야하는줄 알았는데 ㅋㅋ
echo /target >> .gitignore


or


echo "/target" >> .gitignore


// >> 파일 뒤에 이어 쓰기
// > 덮어 쓰기라 이전 파일내용 다 날아감.

linux time같은 명령어를 Windows PowerShell에서 쓰는 명령어

Measure-Command { <your command here> | Out-Host }

ex)
Measure-Command { ls | Out-Host }

https://stackoverflow.com/questions/3513650/timing-a-commands-execution-in-powershell



Linux which 같은 명령어 Windows PowerShell에서 쓰는 명령어

  • node위치 알아보기
 (get-command node).path
C:\Program Files\nodejs\node.exe

PS E:\young_linux> (get-command pwsh).path
C:\Program Files\PowerShell\7\pwsh.exe

choco cleaner 쓸때없는 파일 정리 Good !

https://community.chocolatey.org/packages/choco-cleaner


윈도우 DiskPart 파티션 cmd로 하기 무적이네 ㅎ

https://www.diskpart.com/windows-10/diskpart-windows-10-1203.html

An A-Z Index of Windows💻 PowerShell commands

https://ss64.com/ps/

choco와 비슷한 윈도우 패키지 관리자

https://scoop.sh/


파워셀 version7.3.3설치

https://github.com/PowerShell/PowerShell/releases/tag/v7.3.3

PowerShell_pwsh_WinOS

윈도우 파웨셀에서 원하는 폴더 강제로 지우기(pwsh.exe) WindowsOS에서

  • rm -Force 지우고 싶은 폴더
rm -Force .\read_line03

cmd에서 윈도우 프로그램 모두 업데이트(update & upgrade) 하기

$ winget upgrade --all

파워셀 Install (Windows OS)

https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows

파워셀 Update|🔝|

iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"

파워셀 버젼확인하는 방법|🔝|

$PSVersionTable.PSVersion

https://jae04099.tistory.com/entry/Console-PowerShell-%EC%97%B0%EC%82%B0%EC%9E%90

powershell 명령어 다 나옴|🔝|

// powershell 에서 해보자 alias 명령어 다 보여줌

alias

파워셀 커맨드 설명 Command|🔝|

PowerShell 공식 문서 Documentation|🔝|

https://learn.microsoft.com/en-us/powershell/?view=powershell-7.3


How to set up PowerShell prompt with Oh My Posh on Windows 11(외국사람의 파워셀 활용법 진짜 중에 진짜 ㅋㅋ)|🔝|

https://youtu.be/5-aK2_WwrmM

윈도우 패키지 관리자: chocolatey|🔝|

패키지 설치

https://chocolatey.org/packages

C:\> choco install 이름
  • 로컬 패키지 리스트
C:\> choco list -l
  • 패키지 제거
C:\> choco uninstall 이름

about_Redirection(PowerShell)|🔝|

https://learn.microsoft.com/ko-kr/powershell/module/microsoft.powershell.core/about/about_redirection?view=powershell-7.3

Wsl에서 화면 나오게 세팅하기(Can't open display:)|🔝|

ChatGPT. Powershell 생성해줘. 근데 난 아무것도 몰라.|🔝|

https://youtu.be/bcgjjLXWaNU

윈도우 11 마우스 우클릭 옛날처럼 돌리기|🔝|

  • (임시로 1회용) SHIFT를 누른 채로 우클릭을 하면 윈도우10과 같은 느낌의 바탕화면 메뉴를 확인할 수 있을 거에요.

  • 영구설정 powershell에서 세팅

reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

taskkill /f /im explorer.exe

explorer.exe

https://playcraft.tistory.com/472

SHA256 해쉬값을 확인하는 방법|🔝|

certutil -hashfile C:\Users\doomed\Downloads\Miniconda3-latest-Windows-x86_64.exe sha256

출처: https://doomed-lab.tistory.com/104 [둠선생 연구실:티스토리]

 Get-FileHash .\text.txt

Algorithm       Hash
---------       ----
SHA256          A95E8459B541791DAC5AF1F72E108EFDB73A3

windowsOS에 gcc 와 clang 설치|🔝|

choco install mingw
  • clang은 다운로드 받고 압축 풀고 패스 설정.

    # Intel CPU(x86_64) WindowsOS 사용자는 이 파일 받으면 됨.
    clang+llvm-20.1.7-x86_64-pc-windows-msvc.tar.xz 
  • (한글 WindowsOS 11 환경 변수로 PATH 설정하는 방법)

    • https://ye5ni.tistory.com/157
    • 설정 방법 - [Windows 설정] - [시스템] - [정보] - [고급 시스템 설정] - [고급] - [환경 변수] - [시스템 변수] - [Path] 눌러서 설정하고 싶은 경로를 입력하면 된다
  • (영문 path 설정) Windows 10 and Windows 8

    • In Search, search for and then select: System (Control Panel)
    • Click the Advanced system settings link.
    • Click Environment Variables. In the section System Variables find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
    • In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
    • Reopen Command prompt window, and run your java code.

About

My Youtube Channel - GlobalYoung https://www.youtube.com/@GlobalYoung7

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published