Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

-2 votes
1 answers
122 views
How do I install Microsoft Powershell on CachyOS Linux?
The [official docs][1] doesn't have a section for CachyOS or Arch Linux. I tried following some guides online to build it myself, to install AUR, snap, pacman, and I don't know what other methods, but none of them worked for me. Does someone have a clear step by step guide on how to install Powershe...
The official docs doesn't have a section for CachyOS or Arch Linux. I tried following some guides online to build it myself, to install AUR, snap, pacman, and I don't know what other methods, but none of them worked for me. Does someone have a clear step by step guide on how to install Powershell on CachyOS/Arch please? --- I managed to get it installed and I can see it in my apps: enter image description here But opening that just says the following: > Launching Powershell Preview (Failed) > > No Exec field in /var/lib/snapd/desktop/applications/powershell_powershell.desktop So seems like whatever I did was wrong.
Shaun Roselt (237 rep)
Jun 19, 2025, 05:14 PM • Last activity: Jul 4, 2025, 02:11 PM
2 votes
2 answers
2625 views
`powershell -version` doesn't work on Linux
I have just installed [the open-source version of PowerShell for Linux][1] on Arch Linux using [the *powershell-git* package][2] from [AUR][3]. When I try PowerShell's `-Version` functionality, I get the following: PS /home/user> powershell -Version 5.1 -Version : The term '-Version' is not recogniz...
I have just installed the open-source version of PowerShell for Linux on Arch Linux using the *powershell-git* package from AUR . When I try PowerShell's -Version functionality, I get the following: PS /home/user> powershell -Version 5.1 -Version : The term '-Version' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + -Version 5.1 + ~~~~~~~~ + CategoryInfo : ObjectNotFound: (-Version:String) [], CommandNot FoundException + FullyQualifiedErrorId : CommandNotFoundException How to fix this?
ThePiercingPrince (474 rep)
Aug 31, 2016, 03:42 AM • Last activity: Jun 26, 2025, 02:06 AM
25 votes
8 answers
14908 views
Unix equivalent of PowerShell?
I've always found it awkward when complex shell commands involve parsing text output with [AWK][1]. Basically we're converting structured data into text, then parsing the text again to get back at the structured data. [PowerShell][2] is a Windows shell which avoids that problem by allowing you to pi...
I've always found it awkward when complex shell commands involve parsing text output with AWK . Basically we're converting structured data into text, then parsing the text again to get back at the structured data. PowerShell is a Windows shell which avoids that problem by allowing you to pipe typed objects between shell commands instead of just text. **Are there any Unix shells which are object-based instead of text-based, like PowerShell?**
Wim Coenen (1273 rep)
Aug 12, 2010, 12:24 PM • Last activity: Apr 18, 2025, 05:56 AM
0 votes
2 answers
107 views
Can I run Powershell on Linux in something like "5.1 mode"?
I'd like to develop some short scripts for Windows users, but my computer is running Debian 12. I'm aware that I can tell the Windows users to install Powershell 7 or another scripting language which I can install on Debian, but it's nice that Powershell 5.1 already came pre-installed on Windows 10...
I'd like to develop some short scripts for Windows users, but my computer is running Debian 12. I'm aware that I can tell the Windows users to install Powershell 7 or another scripting language which I can install on Debian, but it's nice that Powershell 5.1 already came pre-installed on Windows 10 and 11. Much of Powershell 7.x is the same as 5.1, but much has been added, so a script that works on 7.x might error if run on 5.1. Can I run something similar to a Powershell 5.1 interpreter on Linux? For example, installing Powershell 5.1 somehow, or running Powershell 7.x in a mode that warns or errors when a script uses syntax or modules only available in version 6 or 7?
Dan Getz (1539 rep)
Apr 9, 2025, 02:42 PM • Last activity: Apr 16, 2025, 04:21 AM
0 votes
0 answers
84 views
Trying to SSH into Ubuntu VPS from powershell, keep recieving public key error
I read through some other threads of similar issues but none of the solutions worked (haven't tried overwriting the public key as I don't know if that will lock me out or cause other issues, if this is a quick fix I'll do it right away). I am running a Linode nanode VPS with Ubuntu 24.04 on it and a...
I read through some other threads of similar issues but none of the solutions worked (haven't tried overwriting the public key as I don't know if that will lock me out or cause other issues, if this is a quick fix I'll do it right away). I am running a Linode nanode VPS with Ubuntu 24.04 on it and am trying to SSH into it from Powershell. I used ssh-keygen -t rsa -b 4096, created a public-private key pair stored in C:\Users\me/.ssh/id_rsa. I ran ssh -v username@hostname and received the following log OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2 debug1: Connecting to xxx.xxx.xx.xx [xxx.xxx.xx.xx] port 22. debug1: Connection established. debug1: identity file C:\\Users\\me/.ssh/id_rsa type 0 debug1: identity file C:\\Users\\me/.ssh/id_rsa-cert type -1 debug1: identity file C:\\Users\\me/.ssh/id_dsa type -1 debug1: identity file C:\\Users\\me/.ssh/id_dsa-cert type -1 debug1: identity file C:\\Users\\me/.ssh/id_ecdsa type -1 debug1: identity file C:\\Users\\me/.ssh/id_ecdsa-cert type -1 debug1: identity file C:\\Users\\me/.ssh/id_ed25519 type -1 debug1: identity file C:\\Users\\me/.ssh/id_ed25519-cert type -1 debug1: identity file C:\\Users\\me/.ssh/id_xmss type -1 debug1: identity file C:\\Users\\me/.ssh/id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1 debug1: Remote protocol version 2.0, remote software version OpenSSH_9.6p1 Ubuntu-3ubuntu13.5 debug1: match: OpenSSH_9.6p1 Ubuntu-3ubuntu13.5 pat OpenSSH* compat 0x04000000 debug1: Authenticating to 172.105.97.31:22 as 'me' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: bwah25519-sha256 debug1: kex: host key algorithm: awaw-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: KEYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY debug1: Host 'xxx.xxx.xx.xx' is known and matches the ECDSA host key. debug1: Found key in C:\\Users\\me/.ssh/known_hosts:1 debug1: rekey out after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 134217728 blocks debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory debug1: Will attempt key: C:\\Users\\me/.ssh/id_rsa RSA KEEEEEYYYYYYYYYYYYYYYYYYYYYYYYYYY debug1: Will attempt key: C:\\Users\\me/.ssh/id_dsa debug1: Will attempt key: C:\\Users\\me/.ssh/id_ecdsa debug1: Will attempt key: C:\\Users\\me/.ssh/id_ed25519 debug1: Will attempt key: C:\\Users\\me/.ssh/id_xmss debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa->sha2-512,rsa-sha2-256> debug1: kex_input_ext_info: publickey-hostbound@openssh.com (unrecognised) debug1: kex_input_ext_info: ping@openssh.com (unrecognised) debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Offering public key: C:\\Users\\me/.ssh/id_rsa RSA KEYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY debug1: Authentications that can continue: publickey,password debug1: Trying private key: C:\\Users\\me/.ssh/id_dsa debug1: Trying private key: C:\\Users\\me/.ssh/id_ecdsa debug1: Trying private key: C:\\Users\\me/.ssh/id_ed25519 debug1: Trying private key: C:\\Users\\me/.ssh/id_xmss debug1: Next authentication method: password debug1: read_passphrase: can't open /dev/tty: No such file or directory I'm not sure what is causing this error and any help is appreciated. If I just need to make a new key and send it to my server again (a pain on powershell since ssh-copy-id doesn't work...) I will, just need advice on this matter.
browb7 (1 rep)
Sep 7, 2024, 01:17 AM • Last activity: Sep 7, 2024, 07:37 AM
0 votes
3 answers
2674 views
SSH permission denied via Windows PowerShell
I want to log into a Ubuntu server from my Windows machine. When I use PowerShell, permission is denied. PS C:\Users\sebastian> ssh seb@135.181.180.30 seb@135.181.180.30's password: Permission denied, please try again. seb@135.181.180.30's password: Permission denied, please try again. seb@135.181.1...
I want to log into a Ubuntu server from my Windows machine. When I use PowerShell, permission is denied. PS C:\Users\sebastian> ssh seb@135.181.180.30 seb@135.181.180.30's password: Permission denied, please try again. seb@135.181.180.30's password: Permission denied, please try again. seb@135.181.180.30's password: seb@135.181.180.30: Permission denied (publickey,password). PS C:\Users\sebastian> When I use the Ubuntu sub-system, it works as expected. seb@DESKTOP-U20EMGM:~$ ssh seb@135.181.108.30 seb@135.181.108.30's password: Welcome to Ubuntu 24.04 LTS (GNU/Linux 6.8.0-31-generic aarch64) This behavior began when I added public keys to the authorized_keys file. I have checked the permissions, but they seem fine: seb@ubuntu-4gb-hel1-1:~/.ssh$ ls -la total 12 drwx------ 2 seb seb 4096 May 20 04:45 . drwxr-x--- 9 seb seb 4096 May 19 15:14 .. -rw------- 1 seb seb 2109 May 20 04:45 authorized_keys I suspect this maybe an issue with Windows PowerShell. Can anyone point me into the right direction?
Sebastian (13 rep)
May 20, 2024, 04:59 AM • Last activity: Aug 19, 2024, 08:30 AM
12 votes
1 answers
15571 views
wget not saving file after download
So I am currently using the `wget` command on windows 10 powershell to download various files. However, when testing this command, files do not actually download. For example, say I want to download an image, say , I would use the following command: `PS C:\Users\myname\Desktop> wget https://picsum.p...
So I am currently using the wget command on windows 10 powershell to download various files. However, when testing this command, files do not actually download. For example, say I want to download an image, say , I would use the following command: PS C:\Users\myname\Desktop> wget https://picsum.photos/200 Which returns an apparently successful result: StatusCode : 200 StatusDescription : OK Content : {255, 216, 255, 224...} RawContent : HTTP/1.1 200 OK Access-Control-Expose-Headers: Content-Length Content-Disposition: inline;filename="" Vary: Origin Access-Control-Allow-Origin: * X-Content-Type-Options: nosniff X-XSS-Protection... Headers : {[Access-Control-Expose-Headers, Content-Length], [Content-Disposition, inline;filename=""], [Vary, Origin], [Access-Control-Allow-Origin, *]...} RawContentLength : 31273 Once this process finishes, I do not observe any new files on my desktop. However, this code does work: wget https://picsum.photos/200 -O image.jpg So what is going on? Why does wget alone not download the file?
Tahoe155 (133 rep)
Apr 19, 2017, 04:14 PM • Last activity: Jul 18, 2024, 07:36 AM
0 votes
1 answers
85 views
Forcing Server Reboots if not rebooted within X days of patching (Azure Hosted)
I host numerous RHEL 8 servers in the Azure environment. I am using a Red Hat Satellite VM to patch servers and then I rely on the owners to reboot once patching is complete. I want to implement a solution that alerts the POC that they need to reboot and force reboots the server if it has not been r...
I host numerous RHEL 8 servers in the Azure environment. I am using a Red Hat Satellite VM to patch servers and then I rely on the owners to reboot once patching is complete. I want to implement a solution that alerts the POC that they need to reboot and force reboots the server if it has not been rebooted within X number of days since the system was patched. I am looking to see if anyone else has done this and if they performed this automation on the Azure platform (PowerShell) or if they utilized something like the Ansible Automation Platform (AAP). If I didn't have to get the POC from Azure and connect it to another system for notification, I would just write a bash script utilizing the patching groups and system uptimes.
Jared (9 rep)
Apr 16, 2024, 06:11 PM • Last activity: Jun 10, 2024, 12:48 PM
0 votes
1 answers
112 views
Ubuntu/Orange Pi5 retrieve open tabs on Chromium (kiosk mode) via terminal - Powershell
I have a problem as of late where I am developing some PowerShell script to manage and update some digital displays. Please see below for my work in progress (By no means done). I am struggling to be able to output via the terminal or any means (automated text file or via command) active or currentl...
I have a problem as of late where I am developing some PowerShell script to manage and update some digital displays. Please see below for my work in progress (By no means done). I am struggling to be able to output via the terminal or any means (automated text file or via command) active or currently open tabs in Chromium. The idea I am trying to achieve is that if the current tabs correspond to what is required to be opened, to skip a forcing refresh (close and open of Chromium). I have tried BroTab but unable to get that to work at all, appears to be a problem with Ubuntu and Chromium. Is anyone aware of anything that will work to this affect? I have been able to get working the history of active tabs opened but this only updates on when the browser is manually opened rather than opened via terminal. The script needs work and error logging/email notifications when there is a failure so the screen can be investigated physically. The first step is to just get this working... which it does just ugly when it refreshes every 30mins - I would rather this just act as a keep alive. I know it requires work and as such open to recommendations on all the code. I will also make use of functions but have also struggled to get these to work as I would like... I look forward to your suggestions. I think I have the answer again to my own question... AS much as I looked there is no way to gain a quick access to open URL's in Chrome or other web browsers... as could be seen as a security risk. My work around was to loop through every Open Window (thank fully, just Chrome but this could be ruled out too in code) and loop through the tabs to get them one at a time. The command wmctrl -l helped me achieve this. I still suspect there might be a better way but this is the way we are going for now. The code is still a working progress and looks like the following: ##SCRIPT TO RERESH AND MANAGE PI BOXES FOR DISPLAYS## $getr=$null; ##SET VARIABLES TO GET DATES AND FOR SPECIFIC TIMES IN REGARDS TO UPDATES $Calendar = Get-Date $updatestart = Get-Date -Hour 11 -Minute 55 $updatecutoff = Get-Date -Hour 12 -Minute 01 ##SET VARIABLES FOR PI INSTRUCTIONS $exitchrome = "killall -9 chromium-browser &>/dev/null; exit;" ##QUITS BROWSER AND EXITS SCRIPT - HAS TO BE DONE AS CANNOT BE RUN WITH FOLLWOING COMMANDS Get-Content -Path "C:\temp\ip.txt" | Foreach-Object { ##LOOP THROUGH CONTENTS OF TEXT FILE - IP.TXT $textfile = $_; $pos = $textfile.IndexOf("|") ## LOOK FOR PIPE CHARECTER IN TEXT FILE $link_string = $textfile.Substring($pos+1) ##CONTENTS AFTER PIPE CHARECTER $ip = $textfile.Substring(0, $pos) ##CONTENTS BEFORE PIPE CHARECTER echo $ip $chrome = "DISPLAY=:0 chromium-browser " + $link_string + " --kiosk --disable-session-crashed-bubble --disable-infobars &> /dev/null &" ##STARTS BROWSER IN KIOSK MODE ON DESKTOP WITH THE DEFINED URLS - ALL ON SCREEN MESSAGES DISABLED ##PLAY CODE## $i = 0 $c = 0 $w = 1 $wb_chk = "cat -e ~/.config/chromium/Default/Sessions/Tabs_* | sed -e 's/\^@/\n/g' -e '/_\/chrome/d' | grep -Po '(http|https)://\K.*' | sort -u" ##CHECK BROWSER FOR OPEN TABS ASSIGNED TO VARIABLE $wb_chk_res = ssh orangepi@"$ip" -X "$wb_chk" | Out-String foreach($url_array in -split $link_string) { $url_array_pos = $url_array.IndexOf("/") ## LOOK FOR CHARECTER RETRUN IN VARIABLE $url_array = $url_array.Substring($url_array_pos+2) ##REMOVE CONTENTS AFTER CHARECTER RETRUN $i++ foreach($wbl_chk in -split $wb_chk_res) { $w++ if ($wbl_chk -eq $url_array) { $c++ } } } echo "$w websites were checked" echo "There are $c live on the display" echo "$c websites match the $i URLS in the config file" ##PLAY CODE## If ($Calendar.Day -eq '28' -AND $Calendar.TimeOfDay -gt $updatestart.TimeOfDay -AND $Calendar.TimeOfDay -lt $updatecutoff.TimeOfDay) { ##IF END OF THE MONTH, RUN UPDATES ssh -p 222 pi@"$ip" -X "sudo apt-get update; sudo apt-get upgrade -y; sudo reboot;" Start-Sleep -s 60 } ##CEHCK DISPLAY RES - CANNOT TO GET TO WORK AS A FUCNTION... $getr = ssh orangepi@"$ip" -X "xrandr -display :0.0;" | Out-String $res_pos = $getr.IndexOf(",") ## LOOK FOR COMMA CHARECTER IN VARIABLE $getr = $getr.Substring($res_pos+2) ##REMOVE CONTENTS AFTER COMMA CHARECTER $res_pos = $getr.IndexOf(",") ## LOOK FOR COMMA CHARECTER IN VARIABLE $getr = $getr.Substring(0, $res_pos) ##REMOVE CONTENTS BEFORE COMMA CHARECTER $res_pos = $getr.IndexOf(" ") ## LOOK FOR CHARECTER RETRUN IN VARIABLE $getr = $getr.Substring($res_pos+1) ##REMOVE CONTENTS AFTER CHARECTER RETRUN $uptime = ssh orangepi@"$ip" -X "awk '{print $1}' /proc/uptime" | Out-String $up_pos = $uptime.IndexOf(" ") ## LOOK FOR CHARECTER RETRUN IN VARIABLE $uptime = $uptime.Substring(0,$up_pos) ##CONTENTS AFTER CHARECTER RETRUN echo $uptime echo $getr if ($uptime -lt "1800.00" -Or $getr -ne "1920 x 1080") { echo "Forcing Display Resolution"; ssh orangepi@"$ip" -X "sudo service lightdm restart;" Start-Sleep -s 10; ssh orangepi@"$ip" -X "$chrome"; Start-Sleep -s 10; ssh orangepi@"$ip" -X "$exitchrome"; Start-Sleep -s 10; $getr=$null; } $MATICS = select-string -pattern "xxx.my.leadermes.com" -InputObject $link_string ##LOOK FOR MATICS URL FOR SYNTHEIC MOUSE CLICKS if ($MATICS -ne $null) { $getr = ssh orangepi@"$ip" -X "xrandr -display :0.0;" | Out-String $res_pos = $getr.IndexOf(",") ## LOOK FOR COMMA CHARECTER IN VARIABLE $getr = $getr.Substring($res_pos+2) ##CONTENTS AFTER COMMA CHARECTER $res_pos = $getr.IndexOf(",") ## LOOK FOR COMMA CHARECTER IN VARIABLE $getr = $getr.Substring(0, $res_pos) ##CONTENTS BEFORE COMMA CHARECTER $res_pos = $getr.IndexOf(" ") ## LOOK FOR CHARECTER RETRUN IN VARIABLE $getr = $getr.Substring($res_pos+1) ##CONTENTS AFTER CHARECTER RETRUN echo "MATICS ON DISPLAY"; ssh orangepi@"$ip" -X "$exitchrome"; ssh orangepi@"$ip" -X "$chrome"; if ($getr -eq "1920 x 1080") { echo "$getr live"; Start-Sleep -s 15 ssh orangepi@"$ip" -X "DISPLAY=:0 xdotool key Return; exit;" Start-Sleep -s 20 ssh orangepi@"$ip" -X "DISPLAY=:0 xdotool key Tab Tab space mousemove 220 60 click 1; exit;" Start-Sleep -s 20 ssh orangepi@"$ip" -X "DISPLAY=:0 xdotool mousemove 1860 180 click 1 mousemove 1920 1080; exit;" $getr=$null; } } else { echo "MATICS IS NOT ON THIS DISPLAY"; ssh orangepi@"$ip" -X "$exitchrome"; ssh orangepi@"$ip" -X "$chrome"; } }
M.Atkinson (1 rep)
Feb 12, 2024, 07:53 AM • Last activity: Feb 22, 2024, 02:51 PM
0 votes
1 answers
249 views
How can I SSH to a PowerShell on Windows and keep a set of working arrow keys?
I can do this to directly enter a PowerShell ``` ssh foobar 'powershell' ``` , but in this shell, arrow keys won't work. It works if I just: ``` ssh foobar ``` ..and then enter PowerShell, by typing ```powershell```. Here arrow keys work.
I can do this to directly enter a PowerShell
ssh foobar 'powershell'
, but in this shell, arrow keys won't work. It works if I just:
ssh foobar
..and then enter PowerShell, by typing
. Here arrow keys work.
Jason Hunter (227 rep)
Dec 8, 2023, 09:42 AM • Last activity: Dec 8, 2023, 03:26 PM
1 votes
1 answers
3501 views
Powershell to get monitor DPI scaling of ALL monitor
Using the DPI class script referenced [here][1] I can get DPI scaling for my main monitor how would I also get the output from any additional monitors which may have a separate scaling factor? [1]: https://www.osdeploy.com/modules/pshot/technical/resolution-scale-and-dpi
Using the DPI class script referenced here I can get DPI scaling for my main monitor how would I also get the output from any additional monitors which may have a separate scaling factor?
MANICX100 (229 rep)
Apr 27, 2022, 10:26 AM • Last activity: Nov 28, 2023, 01:01 AM
0 votes
1 answers
66 views
I try to copy a file from a GCP instance to my local machine, but powershell gives me a "Permission denied: (publickey)"
I created a GCP instance, and I created a private and public key on kali linux, I saved this key in the metadata of GCP, so I can access the instance through my kali machine. Then, I need to copy a file from this GCP instance into my local machine, so Im using powershell command: scp -i C:\Users\mym...
I created a GCP instance, and I created a private and public key on kali linux, I saved this key in the metadata of GCP, so I can access the instance through my kali machine. Then, I need to copy a file from this GCP instance into my local machine, so Im using powershell command: scp -i C:\Users\mymachine\OneDrive\Desktop\ myprivatekey GCPUser@GCP_IP:/home/GCPUser/lastname.txt c:\Users\mymachine\ But it gives me a publickey permission denied
Christian Ramírez (1 rep)
Sep 1, 2023, 11:07 PM • Last activity: Sep 1, 2023, 11:51 PM
2 votes
2 answers
4911 views
yt-dlp + mpv chained media playback
I've been using ```yt-dlp``` to download audio files before running ```mpv``` for playing them back. I've been specifically using the following commands: > ```yt-dlp -f ba "ytsearch:major artist cool music"``` > > ```mpv [Title of the audio file downloaded].webm``` Now, what bothers me is that I wou...
I've been using
-dlp
to download audio files before running
for playing them back. I've been specifically using the following commands: >
-dlp -f ba "ytsearch:major artist cool music"
> >
[Title of the audio file downloaded].webm
Now, what bothers me is that I would prefer to have a super command that chains the both of them without having to wait and follow-up with the mpv command after the download concludes. The bottleneck for downloading the file is understandable, and the randomness of the file name is reasonable since the search criteria depends on YouTube's algorithm to return the best search. Is there a command that knows beforehand the most recent downloaded file and allows
to play the file as soon as it finishes downloading regardless of its file name? I have tried the usual piping a la
-dlp ... | mpv
but it yielded errors. My understanding of UNIX is still wanting but I'll address that however you advise. To add to my personal debugging of this scripting issue, E.g.:
| yt-dlp -f ba "ytsearch:selena gomez good for you remix lyrics" -
Yields this error: > ERROR: [generic] None: '-' is not a valid URL. Set --default-search "ytsearch" (or run yt-dlp "ytsearch:-" ) to search YouTube
-dlp
was downloaded via pip(Python 3.11). All this running in Windows 11 Terminal (Windows Powershell). But I don't see why it can't apply on (U/Li)nux
Gabe Devs (43 rep)
Jun 29, 2023, 09:43 AM • Last activity: Jun 29, 2023, 02:13 PM
0 votes
1 answers
1027 views
How to use evince to open PDF accessed through remote ssh?
It is extremely likely this question comes from a major misunderstanding, but I will explain what I am trying to do/have done. I am also not fully sure this is a Linux/Unix issue. My goal is to view a pdf on a remote computer that I am accessing with ssh -X. For context, I am doing this on Windows 1...
It is extremely likely this question comes from a major misunderstanding, but I will explain what I am trying to do/have done. I am also not fully sure this is a Linux/Unix issue. My goal is to view a pdf on a remote computer that I am accessing with ssh -X. For context, I am doing this on Windows 11 Powershell. (EDIT) This is on my local laptop using Windows 11 Powershell. I want this display to be on my local laptop and the pdf is on the remote computer which uses Linux. I installed WSL while trying to figure this out, but I don't think I've used it for anything. I started with using evince Filename.pdf as I've done on my school's lab computers, but it gives me Cannot parse arguments: Cannot open display: I've tried setting a display with export DISPLAY='IP:0.0' because some StackExchange comments said to try that. I called xhost + a bunch. I don't know what that does, but comments said do that. My question is simply how to use Evince to open this PDF file. I'm not specifically tied to Evince. I just want to view the PDF and I'm unsure of the process. It's worth mentioning that I have sudo permissions.
lingStudent (1 rep)
Jun 26, 2023, 04:10 PM • Last activity: Jun 26, 2023, 08:01 PM
0 votes
1 answers
193 views
How do I change the name in multiple files in the middle one time?
For example I have 190 files and I want to add `L001` in the middle. How can I do that using cmd command, or PowerShell if it is better? Also some numbers are 2 digits some are 1. ``` PP-SD01_S1_R1.fastq.gz PP-SD05_S1_R2.fastq.gz PP-SD09_S20_R1.fastq.gz PP-SD025_S20_R2.fastq.gz PP-SD039_S22_R1.fastq...
For example I have 190 files and I want to add L001 in the middle. How can I do that using cmd command, or PowerShell if it is better? Also some numbers are 2 digits some are 1.
PP-SD01_S1_R1.fastq.gz
PP-SD05_S1_R2.fastq.gz

PP-SD09_S20_R1.fastq.gz
PP-SD025_S20_R2.fastq.gz

PP-SD039_S22_R1.fastq.gz
PP-SD039_S22_R2.fastq.gz
...
I want to add L001 on each one of them between S.. and ..R. For example PP-SD039_S22_L001_R1.fastq.gz
Ittipon Shu (3 rep)
Jul 25, 2022, 03:55 AM • Last activity: Jun 26, 2023, 09:16 AM
3 votes
1 answers
444 views
How do I enable colours by default for common utilites in PowerShell on (Gentoo) Linux?
I'm currently running Gentoo Linux and have installed PowerShell ([app-shells/pwsh-bin](https://packages.gentoo.org/packages/app-shells/pwsh-bin)) as I am a contrarian. That being said, I am unable to obtain colour by default when running certain commands. Take `ls` or `grep`. When running `ls` or `...
I'm currently running Gentoo Linux and have installed PowerShell ([app-shells/pwsh-bin](https://packages.gentoo.org/packages/app-shells/pwsh-bin)) as I am a contrarian. That being said, I am unable to obtain colour by default when running certain commands. Take ls or grep. When running ls or grep in a normal shell (e.g. bash) I will get colourful output by default. When running ls or grep in PowerShell, I must manually call these two commands with ls --color or grep --color to obtain colour. That being said, commands such as emerge do have colour by default in PowerShell (though emerge doesn't work, which is another issue). I was wondering what I have to do to ensure that these commands have colour. Perhaps PowerShell doesn't use the default utilities and defines ls as an alias for its own command. I don't know how to use this information to solve my problem, though. edit: The provided answer does not really solve my problem. While I now have colour when running ls, I do not have colour when running grep. Additionally, I get plenty of errors with the provided profile along the lines of: `Set-Alias: /home/jj/.config/powershell/Microsoft.PowerShell_profile.ps1:2 Line | 2 | set-alias cd set-location | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The AllScope option cannot be removed from the alias 'cd'. `
JJ Marr (33 rep)
Feb 3, 2023, 03:02 PM • Last activity: Feb 8, 2023, 01:54 AM
2 votes
2 answers
413 views
Do executable shebang scripts always require LF line endings?
On Stack Overflow a comment to [Can PowerShell Core handle ps1 files with CRLF line endings in Linux environments?][1] asserted that executable files that use a shebang must use only the LF line ending, based on a quote from [an O'Reilly book][2]. And anecdotal evidence here at https://unix.stackexc...
On Stack Overflow a comment to Can PowerShell Core handle ps1 files with CRLF line endings in Linux environments? asserted that executable files that use a shebang must use only the LF line ending, based on a quote from an O'Reilly book . And anecdotal evidence here at https://unix.stackexchange.com/q/108588 seems to bear that out. But is that an official *nix requirement, or only the behavior on one platform? Is it documented somewhere? And surely isn't there a way around it (e.g. by adding an extra # before the line ending)? The implication of this is that PowerShell scripts would be restricted to LF line endings if they were intended to be used cross-platform (as is now possible with the latest PowerShell). See https://unix.stackexchange.com/q/641074 here, as well as How can I use a shebang in a PowerShell script? on Stack Overflow.
Garret Wilson (461 rep)
Oct 3, 2022, 04:04 PM • Last activity: Oct 3, 2022, 04:47 PM
0 votes
1 answers
614 views
Get return value from kubectl exec out into powershell script
So I'm working on a powershell script that runs a pester test. The script connects to a Kubernetes pod with a Mongo database. The goal is to check whether or not a collection in the database is empty. I'm happy with the code up until the "return count" line. I'm aware there is no return command in s...
So I'm working on a powershell script that runs a pester test. The script connects to a Kubernetes pod with a Mongo database. The goal is to check whether or not a collection in the database is empty. I'm happy with the code up until the "return count" line. I'm aware there is no return command in shell, but I've put it in to illustrate. I'm essentially trying to get the "count" value out from "kubectl exec" into the powershell code. Is this possible? Context "Foo collection" { It "should have no documents"{ kubectl exec -it $podName -n mongo ` -- mongosh -u root -p $mongoSecret ` --eval "` db = db.getSiblingDB('thisOne') collection = db.getCollection('foo') count = collection.countDocuments({}, {limit: 1}) return count " $docs = count $docs | Should -Be 0 } }
a_wahab (1 rep)
Jul 29, 2022, 12:43 PM • Last activity: Aug 4, 2022, 01:07 AM
0 votes
1 answers
3692 views
`find` command doesn't return array like element, how to work around this
In powershell I'm used to doing something like this: ``` > $python_files = get-childitem *.py > echo $python_files[0] ``` The second command allows me to extract the first file, since `get-childitem` returns an array-like object. In bash, I know the following is roughly equivalent: ``` > test=$(find...
In powershell I'm used to doing something like this:
> $python_files = get-childitem *.py
> echo $python_files
The second command allows me to extract the first file, since get-childitem returns an array-like object. In bash, I know the following is roughly equivalent:
> test=$(find . -iname '*.py')
when I echo $test however, I don't get the first item, so I think find returns a string like object. Is there a generic way to obtain the first item from a find command? By generic I mean command-agnostic, or something that would work with other commands such as grep.
user32882 (101 rep)
May 10, 2022, 09:17 AM • Last activity: May 10, 2022, 02:29 PM
0 votes
2 answers
892 views
Echo choices to Choice Menu to run program directly from CommandLine
When I run a specific program with choices 1) Do this 2) Do that 3) Do something else And eventual sub-choices Enter website: Enter credentials: I want to do the following ```echo {choice} | echo {choice2} | echo {choice3} | program``` However this is not working. Is there an alternative to bypass t...
When I run a specific program with choices 1) Do this 2) Do that 3) Do something else And eventual sub-choices Enter website: Enter credentials: I want to do the following
{choice} | echo {choice2} | echo {choice3} | program
However this is not working. Is there an alternative to bypass the choice menu's to directly execute commando's from the CommandLine. Eventually with PowerShell/CMD and Bash as well? Update: For the people who do not understand what I want let me explain it with the example below: If I execute example.sh I get a choice menu and have to manually enter the choice to get something. This is not what I want, because I do not want to provide user-input this way. I don't know if there is an option to provide user-input by using echo. But that is my question. I want to echo the choices towards the example.sh so it will execute the choice directly without prompting me with the user-choice.
Leonardo van de Weteringh (1 rep)
Apr 22, 2022, 10:23 AM • Last activity: Apr 22, 2022, 03:22 PM
Showing page 1 of 20 total questions