Questions tagged [shell]
A shell is software that lets users interact with the operating system, usually by typing at a command-line.
3,822
questions
0
votes
0
answers
3
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 ...
0
votes
0
answers
14
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 ...
0
votes
0
answers
12
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 ...
0
votes
0
answers
36
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: ...
0
votes
2
answers
23
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 ...
0
votes
0
answers
14
views
How to enable high intensity on Windows DOS (CMD) shell? [closed]
On a new computer on Windows 10, DOS colors are pale, while on other computers they're much more brighter (not bold; brighter):
Is it possible to make these colors brighter permanently (not only for ...
1
vote
1
answer
31
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 ...
1
vote
1
answer
33
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 ...
0
votes
1
answer
37
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 | ...
0
votes
2
answers
24
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
# ...
1
vote
1
answer
26
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 ...
0
votes
2
answers
45
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 ...
-1
votes
0
answers
52
views
Windows cmd commands not working over netcat (or other reverse shells)
I am learning some pentesting techniques and running into trouble with reverse shells.
Some of the windows cmd commands I try to run do not run over my netcat session (or an msfvenom-generated reverse ...
0
votes
1
answer
22
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//./ })
$...
0
votes
1
answer
30
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 ...
0
votes
0
answers
17
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 ...
0
votes
0
answers
27
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 ...
0
votes
1
answer
24
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 ...
1
vote
1
answer
19
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 ...
0
votes
0
answers
16
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:$...
0
votes
1
answer
96
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 ...
0
votes
0
answers
25
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 ...
1
vote
0
answers
13
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....
1
vote
1
answer
31
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....
0
votes
1
answer
23
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
./...
-3
votes
1
answer
27
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 ...
1
vote
1
answer
22
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 ...
2
votes
1
answer
34
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 ...
2
votes
2
answers
592
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 ...
0
votes
0
answers
28
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 ...
1
vote
0
answers
79
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 && ...
1
vote
0
answers
127
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, ...
0
votes
0
answers
25
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 ...
0
votes
0
answers
25
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['...
0
votes
0
answers
39
views
Windows+IntelliJ IDEA 2021.3.1+Git for Windows v2.34.1: Git bash shell in Idea terminal, skip to next/previous word not working ( Ctrl + ← | Ctrl+ → )
I installed git for windows and linked bash shell in IntelliJ but I'm missing one shortcut which saves me a lot of time is a direct move to the next/previous word in the command line. how can I make ...
0
votes
1
answer
36
views
Merge videos diagonally in ffmpeg
I am trying to diagonally merge two frames using ffmpeg. ffmpeg documentation has an example for diagonal split: blend=all_expr='if(gt(X,Y*(W/H)),A,B)'. This split, however, results in split from top ...
1
vote
1
answer
37
views
/bin/sh is symlinked to bash, but completely different?
If I do ls -l /bin/sh:
I get
lrwxrwxrwx 1 root root 4 Jan 9 00:01 /bin/sh -> bash
However, when I start sh, I get a completely different prompt than I would, my ~/.bashrc isn't sourced, and if I ...
0
votes
2
answers
74
views
How can I delete the content of a folder but not the folder itself?
Let say I have a folder on my Desktop, inside this folder are files and other folders which they are so many and large and may take some sec to delete all of them, I want get notified when my delete ...
0
votes
0
answers
17
views
Terminal constantly changing shell – slower response
So I did a format of my mac, new install (Mac OS 12.1). Since then my terminal (2.12) has been switching shells without any command. My default shell is zsh. Basically for some reason every time I run ...
0
votes
0
answers
20
views
Reverse shell - outgoing connections created automatically in spite they being terminated [duplicate]
My Win 10 computer has been hacked and is creating automatic reverse shell connections to different IP Addresses (spoofed as Google and Microsoft IP's). Each time I terminate these connections they ...
0
votes
0
answers
21
views
Cronjob not working properly when run as scheduled
This file is placed in /etc/cron.weekly/ :
#!/bin/sh
# For syncing some files with OneDrive
# Assumes that the sync target is set up as OneDrive:Syncs in rclone
if [ $(id -u) -eq 0 ]; then
exec ...
0
votes
1
answer
37
views
Cmder and SSH - Keep previous shell activity content after quitting full-screen process (e.g. less, vim)
I want the shell activity content (e.g. the output of ls, whoami) to be shown on the terminal screen after running and quitting a full-screen process (e.g. less, vim).
They are all removed/cleared ...
0
votes
1
answer
31
views
zsh auto-complete 'tab' auto-capitalization - need fix
All - Recently I have seen the 'zsh' on Mac OS Monterey 12.1 is auto-capitalizing commands on pressing the tab (auto-completion) which is irritating + causing issues now & then while I am ...
-2
votes
1
answer
25
views
A program like man but which gives only examples [closed]
I remember once seeing a command line program that gave only examples of how to use a given command. It billed itself as a companion to "man" if I remember correctly.
I can't remember the ...
0
votes
0
answers
8
views
What are all the existing quick paths, shell paths, and system shortcuts for Windows? [duplicate]
I want to be able to access system / virtual folders such as "My PC" and "Applications" from a shortcut.
I know some folders specifically have their own quick paths, such as %...
0
votes
1
answer
89
views
Antigen failing to load theme from .zshrc
I have a fresh Debin Bullseye installation and I can't get antigen to load a theme if loading it directly in .zshrc.
I installed zsh and zsh-antigen using apt.
My minimal .zshrc:
source /usr/share/zsh-...
0
votes
0
answers
34
views
Configure msys2 mingw64 as a shell for OpenSSH on Windows
According to the docs, one can configure OpenSSH to use a custom shell.
For example, this command will set Powershell as the shell:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name ...
0
votes
1
answer
39
views
Linux (Ubuntu) - how to evaluate exit code of command after its output has been piped?
In normal command I can execute other commands based on exit code:
command.sh && command_if_OK.sh || command_if_fail.sh
But I would like to pipe output to log file AND then execute commands ...
0
votes
1
answer
25
views
Case Sensitive Commands in Bash Shell
I am trying to understand how Bash executes commands. When I run cal, I see this:
December 2021
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 ...
0
votes
1
answer
18
views
How to get the proper output?
I am working with an algorithm that produces outputs like these:
...
2
3
0
& :instance & :|V| & :|A| & :T & :model & :rootLP & :maxFlowCuts & :maxFlowCutsTime & :...