Questions tagged [shell]

A shell is software that lets users interact with the operating system, usually by typing at a command-line.

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

TAB completion not working for mounted partition

I'm used to mount a Windows partition (G) into my Windows Subsystem for Linux (running Ubuntu 20.04) by giving the following commands: sudo mkdir /mnt/g sudo mount -t drvfs G: /mnt/g The partition ...
user avatar
2 votes
2 answers
50 views

nushell: list all files recursively

How can I list files recursively with the nu shell? More specifically: All files, folders and everything else in a specified folder and every inner folder, recursively. I tried ls **, but that does ...
user avatar
0 votes
1 answer
17 views

Why is xargs unable to call basename properly in a subshell?

I ran into the following problem: user@machine:/$ echo ./dir/fil | xargs -I {} bash -c "echo $(basename {})" ./dir/fil Why is it not just printing fil? So basename seems to get the expected ...
user avatar
  • 103
0 votes
0 answers
11 views

Complete path until the first ambiguous match in bash shell

In Emacs, a feature like the following is available: entered path: Do/mu/al/f Which after [TAB], completes to Documents/music/album/file.mp3 This is significantly faster than autocompleting for every ...
user avatar
0 votes
0 answers
7 views

MacBook MacOS X White screen and Shell Command

Hi guys my MacBook is stuck on white screen since last night I tried resetting it but on top of that it gives me shell when booting up I was hoping to maybe install a new MacOS from a bootable hard ...
user avatar
0 votes
0 answers
28 views

Is the macOS/Linux shell the same thing as Bash?

sorry if this is a silly question, but are there any differences between Bash and the macOS/Linux shell? (not all Linux distros use the Bash shell right?)
user avatar
0 votes
1 answer
28 views

How is redirecting output to `/dev/null` implemented in shells to result in detaching of background processes?

Context: Backup software executing hook scripts I have a use-case in which a backup software is able to execute shell scripts as hooks before, after etc. doing some backup. This si done to optionally ...
user avatar
1 vote
2 answers
80 views

Can I output `curl` response while also checking for presence of ERROR string?

I have a command I am running with curl. The curl command always resolves successfully even when the server response includes the string ERROR somewhere. Can I somehow detect this response with some ...
user avatar
  • 2,566
0 votes
0 answers
103 views

How to fix "server shell request failed on channel 0" on Windows 11 OpenSSH default shell?

Every time I connect to my Windows 11 SSH server, It keeps getting an error saying "server shell request failed on channel 0". I ensured that the default shell is specified properly My ...
user avatar
0 votes
1 answer
12 views

How can I extend my displays and make my other monitor the main display with a shell script in windows 10?

Every time i plug in my monitor I need to manually extend the displays and switch the main monitor. I'd like to automate this with a shell script. The display arrangement is the same every time. I ...
user avatar
0 votes
1 answer
33 views

Delete blank pages from PDF does not work

I would like to use this script from this thread: Remove blank pages from PDF from command line. #!/bin/sh IN="$1" filename=$(basename "${IN}") filename="${filename%.*}" ...
user avatar
  • 1
0 votes
0 answers
39 views

Did Windows 11 remove the Shell sub-key under HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon?

Context: I was trying to add an application to the Winlogon Shell sub-key so that it starts loading along with the GUI on startup. It works fine, but I had to create the Shell sub-key and add "...
user avatar
  • 53
0 votes
1 answer
17 views

Set default editor [duplicate]

I would like to configure a program named howdy which allows you to login using your face. For this I need to edit the config file to add the path to my camera. However when I execute sudo howdy ...
user avatar
2 votes
0 answers
13 views

Use expansion globs {a..z..2} in zsh like in bash

Both in zsh and bash you can: > echo {1..10} 1 2 3 4 5 6 7 8 9 10 > echo {a..z} a b c d e f g h i j k l m n o p q r s t u v w x y z > echo {1..10..2} #range 1 to 10 in steps of 2 (i.e. ...
user avatar
1 vote
1 answer
34 views

Obtaining a root shell on a destroyed system

Due to entering ctrl-c during checkinstall I am in the state described well by this question: tar extracting on root directory is destroying entire system However I don't have a root shell open. The ...
user avatar
0 votes
1 answer
15 views

What is the logic for the abbreviation in wc command?

Some info in man wc. wc - print newline, word, and byte counts for each file. -c, --bytes print the byte counts -m, --chars print the character counts Maybe it is better to ...
user avatar
  • 53
0 votes
1 answer
37 views

scp works with /bin/sh default shell, but disconnects with /bin/bash default shell [duplicate]

I've recently set up a fairly minimal Debian server (fail2ban and ufw installed with the OpenSSH profile enabled) with a user with default shell /bin/bash: $ grep "$(whoami)" /etc/passwd ...
user avatar
2 votes
1 answer
33 views

I deleted fish shell and now VS Code terminal doesn't work

I have been working on a tutorial in Angular. Everything was working fine before I went to work today. I came back to my home computer after work today and the fish shell I was using within VS code ...
user avatar
  • 41
1 vote
1 answer
85 views

How to use zsh in flatpak vscode

I have Visual Studio Code installed in flatpak, I run it with: flatpak run --command=sh com.visualstudio.code I want to change the shell to zsh, but I can't find how to, I tried multiple thing in my ...
user avatar
0 votes
0 answers
23 views

How Do I Link or make BLK4: to FS10: so to boot a BLK that is not FSx:

My situtation, OpenCore Bootloader. Dual Booting MacOS and Windows 10 Pro. Installed Windows 10 Pro via manual method rather than going through the Installer. Shift+F10 bringing up command prompt ...
user avatar
0 votes
0 answers
153 views

npm installation errorno -104

I am trying to install a package tree-sitter-cli using the latest npm ❯ npm -v 8.6.0 But keep getting the following error. 63 timing command:i Completed in 885ms 64 verbose stack Error: command ...
user avatar
  • 101
0 votes
0 answers
48 views

When using su to switch to a non root user, su fails to launch the user's shell program despite seemingly good permissions on everything

The error always looks something like this, depending on which shell is configured in /etc/passwd. su: failed to execute /usr/sbin/jk_chrootsh: Permission denied OR su: failed to execute /bin/bash: ...
user avatar
  • 109
0 votes
2 answers
28 views

Is there a way to create a shortcut for a system shell virtual directory?

I wanted to quickly be able to access a system virtual directory, like the "Applications" folder (shell:AppsFolder) Ive tried just running "shell:AppsFolder" inside a shortcut, but ...
user avatar
1 vote
1 answer
40 views

Piped commands altering standard output?

I've tried three different "alias" functions to make an image show from the command line given an argument. Can someone point me in the right direction towards figuring out why the input is ...
user avatar
1 vote
1 answer
53 views

/bin/sh: TexturePacker: command not found (while zsh works) macOS Monterey

I have a small Adobe Animate extension that uses TexturePacker to pack sprites onto sprite sheets. I've successfully added TexturePacker to $PATH (/Applications/TexturePacker.app/Contents/MacOS) so it ...
user avatar
  • 11
0 votes
1 answer
39 views

Why am I getting this error in my Bash script: “script.sh: line 8: [: too many arguments”?

I have this script: #!/bin/bash myIp=$(ip add sh | grep inet | grep -v -E 'docker|inet6|127'| awk '{print $2}' | cut -d'/' -f1) mySubnet=$(echo $myIp | cut -d'.' -f 1,2,3) subnetBits=$(ip add sh | ...
user avatar
  • 1
0 votes
2 answers
42 views

How to conditionally add flags to curl?

I'm trying to conditionally add a header to a curl command. This is my initial attempt: # Set Auth Header if [ $IS_PUBLIC == 0 ]; then AUTH_HEADER="-H 'authorization: Bearer $TOKEN'" fi # ...
user avatar
1 vote
1 answer
44 views

tmux changes shell prompt

Ubuntu 20.04 (running inside VirtualBox, if that's important.) tmux 3.0a (installed via apt) fish 3.4 (and earlier 3.3) starship.rs 1.1.1 Font: FiraCode Mono I have configured my prompt to look as ...
user avatar
  • 113
0 votes
2 answers
72 views

Assign result of conditional expression to environment variable

I'd like to store the result of a conditional expression in an environment variable. I tried: C=$([ "$A" = "$B" ]) but the value of $C after running that is an empty string. I ...
user avatar
0 votes
1 answer
28 views

Shell Linux - output split mp4 with number

I use the command split on Windows and I have no problem, but I have not number with shell on Linux and I have an error on output. Example: fichier = "toto.mp4" tab=(${fichier//./ }) $...
user avatar
  • 1
0 votes
1 answer
50 views

aux: command not found when using "ps aux" in bash script

I'm questioning my sanity at the moment. On MacOS if I try to execute this script for example: #!/bin/bash OUTPUT=ps aux |grep "somename" echo $OUTPUT Executing resolves to: ./test.sh: line ...
user avatar
0 votes
0 answers
20 views

Git fetch prune failed remotes

My employer has a script that sets up git repositories, but in doing so adds a lot of remotes that no longer exist. I would like to write a one-liner to prune these remotes. It seems that the output ...
user avatar
  • 83
0 votes
0 answers
28 views

Finding folders that occupy a lot of disk space

du -cha --max-depth=1 / | grep -E "M|G" I used this and it couldn't find the large folder containing 100000+ files and taking 890 GB. How come? Is there an issue with this command? I only ...
user avatar
  • 1
0 votes
1 answer
52 views

How can I correctly run a java batch application (a .jar application) in background on a Linux machine?

I am not a system engineer (I am a software edeveloper). I have to run a Java application (a runnable .jar file) on a Linux machine (Centos 7). I am connecting to a shell via SSH. This application is ...
user avatar
  • 6,539
1 vote
1 answer
45 views

Echo variable which references another variable in shell script

Statement: "$k"_Id_avg="$(grep -i "$k"_Id_avg file.txt)" and $k is a loop variable. Now I want to print the value stored in the above variable, how can I do it? I have ...
user avatar
0 votes
0 answers
48 views

Automating keystore with keytool and openssl

I have this script: PASSWORD=password123 openssl genrsa -out client2.key 2048 openssl req -new -key client2.key -out client2.csr -subj "/C=/ST=/L=/O=/OU=/CN=/emailAddress=" -passin pass:$...
user avatar
0 votes
1 answer
183 views

What is the shell exactly when using Cmder on Windows?

I've just started using Cmder on Windows 7 and I understand that is a console emulator for Windows which gives a better experience than using cmd. However as I understand it the emulator needs to run ...
user avatar
0 votes
0 answers
29 views

Allow execution of shell script as different user from sudoers

User A (no general sudo permission given) shall execute a bash script as user B. One minimal script could look like this: #!/usr/bin/env bash touch /home/userB/testfile This script belongs to user A ...
user avatar
  • 111
1 vote
1 answer
27 views

Extract last 5mins log from log file using shell

I need to extract last 5mins log from log file. Here is my log file [2022-02-08 13:26:21:352] [ERROR] [iBus Connection LifeCycle - CCMHost_DummyDevice_Backup_AD2::Management:::NRMCMO_FLPROD2] [com....
user avatar
  • 11
1 vote
1 answer
33 views

Build tool spawns a daemon that does not close its standard output. How can I prevent this from stalling my shell pipeline?

I am using a (closed-source) vendor-specific build tool (Microsemi Designer, an FPGA layout tool). I invoke it from a shell script (highly simplified): ... # Setup /opt/.../designer SCRIPT:my_script....
user avatar
  • 125
0 votes
1 answer
26 views

Can this mkdir command be simplified with further bash expansion?

I have a command to generate the following directory structure that I need: ./sites ./sites/domain_co_uk ./sites/domain_co_uk/php ./sites/domain_co_uk/cgi ./sites/domain_net ./sites/domain_net/cgi ./...
user avatar
-3 votes
1 answer
29 views

Kali linux-Wiped entire file system accidentally [duplicate]

Something pretty bad just happened I was testing some build files I had made as root, and tried to delete the contents of one of the directories the script had made, but I forgot to move to it and ...
user avatar
1 vote
1 answer
50 views

Tmux Copy Mode: Show Current Line As Ascending Value From Top of Buffer

In this image I'm in tmux copy mode and at the very bottom of scroll the buffer. The line indicator on the top right shows 0/31827. How can I show the current line number as a value that ascends from ...
user avatar
2 votes
1 answer
47 views

Having your shell commands run after consecutive ssh

I have a function in my zsh source file ~/.zshrc: function cr() { ssh -p 5022 myname@ssh.mylaboratory.fr ssh servername2 screen -ls } However, everything after the first ssh seems to be ...
user avatar
  • 205
3 votes
2 answers
1k views

How to open multiple tabs and run ssh from the command line in windows ternimal?

I have WSL2 and an Ubuntu instance, is there a way in windows terminal to open multiple tabs from the command line and run things in them ? To be more detailed I would like to do the following, so ...
user avatar
  • 143
0 votes
0 answers
33 views

How to Launch Windows Shell from Batch File?

My situation is probably a little unique. I'm building a console gaming PC for my Living Room. I want it to be as console-like as possible. I've edited the BIOS to be completed blacked out and silent ...
user avatar
1 vote
0 answers
130 views

compgen on zsh returns a different result than on bash

I am trying to make bash completions work properly in zsh. I am aware of the need to load these in ~/.zshrc: autoload -Uz +X compinit && compinit autoload -Uz +X bashcompinit && ...
user avatar
  • 131
1 vote
0 answers
297 views

Can't change default login shell on OSX Monterey

I prefer to use bash on my Mac, but the version provided by Apple (GNU bash, version 3.2.57(1)) cannot glob files with accented characters, so using homebrew, I have installed a later version, 5.1.16, ...
user avatar
  • 11
0 votes
0 answers
26 views

How to implement zsh directory entry and exit hooks?

I want to implement a function, when I enter a directory through cd, it will automatically scan whether the alias.sh file exists in the directory. If the file exists, source it to load it. alias.sh is ...
user avatar
  • 101
0 votes
0 answers
46 views

using awk with single quote in a shell script will output error [duplicate]

we are on Debian 11. I'd like to use grep and awk to retrieve information from the content of a single file, like the following: file: /home/user/directory/otherdirectory/data.txt file content: $db['...
user avatar

1
2 3 4 5
77