Questions tagged [shell]
A shell is software that lets users interact with the operating system, usually by typing at a command-line.
3,993
questions
11
votes
1
answer
2k
views
“Terminal is not fully functional” warning with `less` but not with `more` (which is also `less`)
less complains about my value of $TERM, whereas more doesn’t. Which would be fine except for the fact that more is less.
Originally I was puzzled by tools suddenly disliking my $TERM value (I thought ...
-1
votes
1
answer
14
views
I would Like to know what -sb and awk '{print $1}' role in this command
subdirectory_size=$(du -sb "$entry" | awk '{print $1}').
I would Like to know what -sb and awk '{print $1}' role in this command.
3
votes
2
answers
475
views
How do I delete every ocurrence of a word that is followed by another, without altering the whitespace?
Suppose my file looks like this:
foo bar
foo bar bar
foo foo bar foo
What I want to do is delete every foo that is followed by a bar (i.e. there is only whitespace between them), without ...
1
vote
2
answers
25
views
Unix cat and zip together
What I'm trying to do seems simple enough, but I can't get it to work, nor can I find anything on Google referring to how to do this?
I want to first cat a bunch of files, then zip the resulting file ...
1
vote
1
answer
29
views
Running shell Script via Crontab
So I've tried to run a shell script via crontab.
My Crontabs look like this:
00 20 * * * $HOME/Bilder/Hintergründe/.background_skript/background_night.sh
and my background_day.sh looks like this:
`#!/...
1
vote
0
answers
28
views
Clear previous command output (not full screen)
Example
This is on the terminal screen:
user@host ~ % ls
dir1
dir2
dir3
user@host ~ % whoami
user
user@host ~ % date
Wed May 24 16:25:26 -03 2023
user@host ~ % [CURSOR IS HERE]
I'm trying to ...
0
votes
0
answers
10
views
File not executable even with execute bit [duplicate]
Why is the following file not executable?
Changing the permissions to 777 doesn't work either - I get the same result. I thought it might be an owner issue, but with 777 that shouldn't be a problem.
$ ...
1
vote
1
answer
46
views
Change the default location of zsh completion cache files for macOS
I'm trying to change the default location of the zsh completion cache files in macOS. I have read the zsh documentation on completion which say's "alternatively, an explicit file name can be ...
5
votes
2
answers
373
views
How to split a string (of arguments) in fish?
I want to split "-r --run" into "-r" and "--run"
for
string split " " "-r --run"
I get string split: -r --run: unknown option as an error.
It is ...
0
votes
0
answers
31
views
How to automate mybb installation using ssh bash script
I have created this bash script to install mybb application automatically on Centos stream 8.
SSH Bash script
#!/bin/bash
# Define variables for MyBB installation
DB_NAME=mybb_db
DB_USER=mybb_user
...
0
votes
1
answer
29
views
ProxyJump not running ForceCommand defined in sshd_config
On a bastion host, I have a shell_session_recording.sh script which uses the script command to record ssh session on bastion host and all interactive sessions ie all remote session after connecting to ...
0
votes
0
answers
21
views
How to set PATH on MacOs for non-login shell?
On mac os, if I do ssh localhost 'md5sum --version' the md5sum command located in /usr/local/bin is not found.
This path is listed in /etc/paths but this config file is not read by the shell because ...
0
votes
0
answers
39
views
windows powershell ssh asks how would you like to open file
No idea whats going on but ssh on powershell gives me the following
When I choose an option it just says could not open ssh because not supported file type.
Can someone explain what is going on here?...
0
votes
0
answers
25
views
Prevent double clicked SH script from being entered into ZSH history on Mac [migrated]
I've got some SH scripts which I double click to run. The scripts run as intended, after having set the working directory via cd "$(dirname "$0")" at the beginning of the script, ...
1
vote
1
answer
34
views
zsh completion ( compctl ) does not trig for command names containing dashes
I've used zsh compctl since forever (late 90s or early 00s) but strangly never run into this before.
I realized today when I intended to make some compctl config for update-alternatives that my ...
0
votes
2
answers
107
views
How to save abbreviation in fish?
Running abbr --add ro rpm-ostree will set the abbreviation and it works as expected. But once I exit the shell with exit and then re-enter the shell by typing fish again, all abbreviations are lost. ...
1
vote
0
answers
39
views
How to grant full disk access to a user without GUI on macOS Ventura?
I need to launch shell scripts from a process that uses a kind of user that has no gui, but those scripts need full disk access, but since that user has no login screen I can't use the system ...
-1
votes
2
answers
59
views
In csv file search concern number for particular text in second column
I have main two csv files as follows:
file1.csv
731,dev-servers.com.,A,192.168.0.10
598,test-servers.com.,A,192.168.0.12
599,test1-servers.com.,A,192.168.0.11
file2.csv
dev-servers.com.,A,192.168.0....
0
votes
0
answers
22
views
How do I get all executed commands programmatically in linux shell?
Despite having the history file, how do I programmatically get every command being executed in shell?
0
votes
0
answers
64
views
Valid Shell Script dosen't run in WSL
I have a simple shell script which runs completly fine on VM but gives me syntex error in WSL.
insert(){
read -p "Enter Name: " name
read -p "Enter Phone Number: " ...
0
votes
1
answer
27
views
How to highlight text using color in output if in a certain temp range
I am outputting the HDD temps of my system to a text file on a local webserver that I can check every once in a while to monitor hdd temps when the system is under load. I was wondering if there is a ...
0
votes
1
answer
67
views
Powershell: Use a string as multiple args
I have a string variable in PowerShell, $t="foo bar" and it should be passed as argument to command 'start-process'.
My 'start-process' needs multiple args which is "foo" and "...
0
votes
2
answers
75
views
Are linux commands (grep, awk etc) part of the system, or the shell?
I'm a developer, so I know my way around a terminal, but I never really dove into it. I can write bash scripts (albeit on a beginner level, not my area of expertise), but I now need to understand ...
0
votes
2
answers
58
views
How to open simultaneous SSH sessions to 100 elements when server permits only 10 elements per session?
I am running a script to simultaneously run SSH sessions to 100 elements but my server can only permit 10 elements to be accessed at a time. My script is like below:
cat ip | while read ip
do
...
0
votes
1
answer
178
views
How do you move (mv) in ZSH all files from current directory except two or more to a child directory?
(There is plenty of information about this on bash, but much less on zsh and NOT AT ALL for TWO or more files. No idea how to apply the ^ ("caret") TO MORE THAN ONE FILE).
I want to know (...
0
votes
3
answers
37
views
Linux Shell/Bash THEN section in IF statement somehow get's triggered
I have a THEN section that updates a variable from within a loop, the variable prints correctly but then it seems like the IF condition still equals to true as the THEN section is triggered in every ...
0
votes
1
answer
612
views
zsh: event not found: /bin/bash
When I run the following on my command line #!/bin/bash I get the error zsh: event not found: /bin/bash.
I'm on Mac Ventura.
If I run zsh the command works fine, so the issue is with /bin/bash.
Does ...
0
votes
1
answer
57
views
Registering a property sheet shell extension for Win10 and Win11 doesn't work for .arw file
I wrote a property sheet shell extension to display metadata from a file.
It works perfectly for a new file type such as .foobar.
But when registering for the existing .arw, the property sheet shell ...
1
vote
1
answer
196
views
How to execute "source" command inside a shell script and then store the output of source in a variable within the shell script?
I have written a shell script (called profile.sh) to fetch temperature values from the Android MPSoC. Separately, I have found a shell script that fetches the FPS of an app on the Android system as ...
0
votes
0
answers
22
views
Noticed very large space utilisation in linux LVs, how to find which file or what is responsible here?
I have two disks in my server with a LVs created and issue is on the one mounted on /.
I am aware of using find and sort to output the largest for some given number of lines.
like:
find / -type f -...
0
votes
1
answer
83
views
how to chop (truncate) long lines in bash output to fit in the screen with?
I love piping any output into less -S because it prints neatly without wrapping long lines of output into new lines (especially for tables). However, I wonder if there is a way to truncate long lines ...
1
vote
1
answer
124
views
Add new content after specific string in text file using shell script
I want to add the below snippet after the string server { in nginx.conf file.
location /nginx-status {
stub_status on;
allow all;
}
The script below adds the snippet after server { wherever that ...
0
votes
1
answer
45
views
Checking my understanding regarding the difference between Terminal and Shell
I am trying to test my understanding regarding the difference between terminal and shell. The terminal is just a text-based interface in which it accepts commands from the user. Moreover, the terminal ...
0
votes
1
answer
43
views
Random letters showing in Powershell script error making it so hard to find where the error stems from
I keep receiving random letters Powershell script error.
I made a changing mouse scheme script based on system OS theme. I keep receiving random letters as shown in the image below when running the ...
1
vote
0
answers
40
views
.bash_logout not executing on MX Linux
As stated in title no joy from .bash_logout when I exit the terminal (same result when logging in on a virtual i.e. Ctrl + Alt + F1).
I've tried everything listed here: Explain why .bash_logout won...
0
votes
1
answer
79
views
PATH, bash, profile
I know. Yet another question about the very basics of Linux, but I obviously am missing some tidbit here despite reading many threads about this subject. I recently had to nuke-and-pave (and reinstall ...
2
votes
1
answer
129
views
Can't type accented character "é" via SSH
I have two QNAPs that I can connect using SSH:
TS-412
TS-851
On the TS-851, right after login, if I type "é" on my keyboard, it shows "é" on the screen. On the other side, the TS-...
0
votes
2
answers
61
views
How to group a flat list into categories and create a tab-separated value file using awk?
Crosspost: https://www.nixcraft.com/t/converting-a-list-into-a-tab-separated-file-grouped-by-values/4517
I have a text file with a list of values. The goal is to create a tab separated values file, ...
1
vote
0
answers
71
views
How do I link a shell script to the login / logout event on a Mac so that it triggers when a user logs on / off?
I have been trying to get a shell script to fire on login / logout events on a Mac, but the method I used is very old, and it does not work. I followed this StackExchange post and used the
sudo ...
0
votes
0
answers
60
views
Batch file using WinSCP won't execute UNIX shell script that assigns variables to output of "more" command
I am working with a Batch script that uses WinSCP to transfer files from an UNIX machine to a windows machine.
To achieve this, WinSCP has to call shell scripts on the UNIX side.
There is one shell ...
0
votes
1
answer
24
views
VREPRINT doesn't seem to have any effect
According to the GNU docs, there is a character VREPRINT, or rprnt, which is supposed to re-print the shell's line-editor's input buffer. This can be helpful if something like a background process has ...
1
vote
0
answers
316
views
how to script tmux to execute a script in a tmux session(window)
I have this script:
#!/bin/sh
tmux new-session top \; split-window -v \; split-window -h \; select-pane -t 0 \; split-window -h \; attach-session
I would like to execute a shell script in each ...
1
vote
1
answer
301
views
How to get all apps to show in shell:AppsFolder when using Shell Launcher V2 to launch a custom shell app?
I used Shell Launcher V2 to set up a custom app (win32, not UWP) to run as shell on a machine running Windows 11 Enterprise. This works fine but I need to launch another win32 app from the shell app. ...
1
vote
1
answer
102
views
Does a shell script wait for commands executed in a different screen?
I'm on my first baby steps writing a scheduled shell script. The goal is to write a simple backup script for a Minecraft server. The server is running in it's own named screen.
I assume if my script ...
1
vote
1
answer
110
views
How do I print a newline after there user enters a password with zshbuiltin read command
I want to read a user's password securely within the execution of a curl command. A made a basic proof of concept which mostly works, but the output of the echo command is coming on the same line as ...
0
votes
0
answers
45
views
When in KDE under Konsole its windows a terminal shell bash is running, how to ask in a shell script for the Konsole_nn number?
In KDE there is one superordinate Konsole.
Under this superordinate Konsole I have many Windows open. In each window the title line has the inscription "Konsole nn". Where nn is the konsole ...
0
votes
1
answer
65
views
How to pull first 6 characters from variable input using Shell Script
I am running a shell script in Mac automator. I no very little about this type of sripting. Basically just found something I could use from other sources.
How do I make this line
mkdir "$1_"$...
0
votes
0
answers
15
views
How to get default Nginx access.log file directory on linux
How to get default Nginx access.log file directory on linux.
This should be done using a shell script.
0
votes
0
answers
15
views
Could not add a line after a certain line in the nginx.conf file on linux
Add the below line to the nginx.conf file after the '"$http_user_agent" "$http_x_forwarded_for"'; line.
log_format main '$remote_addr - $remote_user $time_iso8601 [$request_time] &...
0
votes
0
answers
48
views
in KDE under Konsole, when re-opeing a crashed bash shell, how to control what /dev/pts/nn number it gets?
I use Kubuntu 20.04 and KNOPPIX 9.1, and always the KDE desktop, and under Konsole 15 windows with shell bash in each.
I always have two levels of bash: the first level which automatically is created ...