Questions tagged [bash]

Bash is a free shell for Unix-like operating systems from the GNU Project.

Filter by
Sorted by
Tagged with
1
vote
1answer
17 views

miniconda.sh: cannot execute binary file on CircleCI

I'm trying to install miniconda in a Docker image on CircleCI, in the image circleci/python:3.8.1-buster. The relevant part of the config.yml file is: - run: name: Setup ...
0
votes
2answers
21 views

Find and replace text in a file after match of pattern only for first occurance using sed

Let's say I have the following input file: Server 'Test AB' option type 'ss' option port '1234' option timeout '60' Server 'Test CD' option type 'ss' option port '1234' option ...
0
votes
1answer
21 views

Linux cp command to copy folders: copy content of the folder vs copy folder

How to understand whether cp will copy the content of the folder or the folder itself. For example, I have a file /some/path/text.txt. If I do cp -r /some/path /another/path2, the new path of the file ...
0
votes
0answers
12 views

how to reinstall bash on Mac High Sierra (10.13.6) The current bash just does not work

On bash all these commands generates the same message which is "command not found". Here is the recent session from my terminal: bash --version > -bash: bash: command not found ls /usr/...
0
votes
0answers
24 views

Tmux on start and with previous command

I can easily start tmux on my shell on start, but let's assume: Process A => launch a new terminal (process B) with a command Process B => just start tmux without launching the command passed ...
2
votes
1answer
16 views

Can I add a newline into a command from bash's history?

I often stumble across this problem: I type a command that has multiple lines for readability. This is an example: echo "Hello. This is an example of a very long command which is divided into ...
0
votes
0answers
16 views

Linux `command` [duplicate]

Today I learned that command is a command in Linux. command -v <another command> seems to be similar to which since it prints out the path to the command given. However, man command gives "...
1
vote
2answers
23 views

Treat terminal like an emacs buffer

I'm on Ubuntu and I use either GNOME Terminal or Terminator. I'd like to be less reliant on the mouse/touchpad. Say that I have the output of ls in the terminal and I want to copy out part of the ...
0
votes
0answers
9 views

Tomcat 9 not executing setenv.sh on start up

I've created setenv.sh to my CATALINA_BASE folder which is at /usr/share/tomcat9/ but the setenv.sh is in /usr/share/tomcat9/bin setenv.sh content: echo "HELLO ITS WORKING" export ...
0
votes
1answer
42 views

Script works fine while execute, but won't run from cronjob

I have a script called "record.sh" It looks like: #!/bin/bash /usr/bin/vlc -vvv rtsp://admin:blablabla@192.168.2.20:554/ch0_0.h264 --sout=file/ts:Videos/VideoCaptures/recording-$(date +"...
1
vote
0answers
17 views

use bash script to remove tracking from google scholar links into non tracking links for wget

I Get regular google scholar emails. I am trying to make a simple script that lets me download the pdfs / articles, without google tracking me via their urls. Up till this point I have been copy ...
0
votes
1answer
39 views

search over all drives in git bash crashes - "failed to read file names from file system at or below '/': No such file or directory"

I am using the git-bash for windows (what is internal msys2). I needed to search over all of my harddrives. When I try to run find / -type d (and my search patterns), the search runs over the system ...
0
votes
0answers
10 views

Unable to create '/foo/index.lock': File exists

Recently I keep having this issue: doe@pc:/foo/power on master [!?] $ git commit -am "Fixes" fatal: Unable to create '/foo/index.lock': File exists. I don't have a background git process ...
1
vote
1answer
72 views
+50

Filter stdin of process executed with socat client

My question is: is there a way to pre-process the stdin of a command executed via socat client. Context: I am launching a reverse shell with socat using this command: $> socat -T30 "openssl-...
0
votes
1answer
21 views

Positinal argument directly in bash for a command

No sure if this been asked before, but I want to create and use a positional argument directly in a oneliner. For instance i use du -sh together with a pipe a lot: du -sh /opt/directory/* |sort -h If ...
1
vote
1answer
41 views

How to get all IP addresses from connected devices with specific device name?

I'm making Bash script for automation and would like to get all IP addresses from connected devices with specific device name? For example I have 10 devices connected to Wi-Fi. All with same device ...
0
votes
1answer
18 views

tar command not working

I'm trying to figure out why is the following tar command not working - I've tried the following 2 versions & both don't work - Version 1 tar -c --use-compress-program=pigz -f /home/jhonst/...
-2
votes
1answer
34 views

List/Print oldest and newest file in each directory

Could use a bit of help guys. I need to produce a report for the oldest and newest files that are residing in each unix directory The structure is simple Main folder with multiple subfolders that ...
3
votes
3answers
114 views

How can I delete all files that have names not ending on exactly 2 digits?

I am currently trying to delete several files. I want to delete all files with file names that do not end on two digits (and when I say ending on two digits I mean it disregarding the .txt file ...
0
votes
0answers
21 views

Why the shell of MSYS2 can find binary files without "exe" extension in the folder /usr/bin

In MSYS2, for the binary files in the folder /usr/bin, I find that I can call them by "name" or "name.exe". However, in the Windows file system, there are only binary files with &...
0
votes
0answers
20 views

Bash check array membership with regex

I have just started bash scripting as of this morning, so forgive me for my less-than-adequate skills. I have a GitHub action where I scp files which have changed on a push event to the production ...
0
votes
1answer
31 views

Bash script using Curl to output http status code fails with "could not resolve host"

I'm new to bash scripting and I keep getting "could not resolve host" when running the following script. I know it must be a slash or comma, but I have tried everything and can't figure it ...
1
vote
1answer
19 views

Move files to new folderif string matches

I'm trying to go through a number of folders and check their contents. If one or more of the files inside matches any of the strings in a given list, I would like to move those files to a new folder. ...
0
votes
2answers
42 views

Bash terminal command to be repeated after an activity no longer foreground

so the context: I want to make a bash terminal command that will launch VLC to stream a video, and then when VLC is no longer in the foreground (VLC automatically goes to the background when the ...
1
vote
1answer
39 views

Understanding how pgrep determines process IDs

I'm currently refactoring a script that works well if executed in terminal directly but exits early due to a process check if executed from crontab. This early termination is caused by code using a ps ...
0
votes
1answer
22 views

How to test if a specific process ID is a terminal?

I'm writing a convenience script that will allow me to bring up an existing terminal upon pressing a keyboard shortcut, and spawn a new one if none currently exists. Ideally, this would be agnostic to ...
1
vote
1answer
41 views

Open git bash in current directory

Previously when I was in a directory, I clicked 'git bash here' and it would open in that directory. Now it opens my home directory. How can I fix this?
-1
votes
0answers
22 views

Where is the original cron template in debian?

I see this message in /var/spools/cron/crontabs/root file: # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/var/spool/cron/crontabs/root installed on Sat Nov 6 16:48:11 2021) # (Cron ...
0
votes
1answer
16 views

Bash String char assignment using position index

Is it possible to change the string char using position index. For ex: Myvar="abcd" echo ${Myvar:0:1} gives the first char 'a' Can I change the first char to 'z'? Simply trying to assign ...
0
votes
1answer
22 views

Cannot disinstall PostgreSql by Script Bash - Linux - Must not open dialog confirmation

My goal is to uninstall PostgreSql (installed on a Linux host- Ubuntu 18.04 LTS) using a bash script file. I use the following command: apt remove --purge -y postgresql-12 && apt autoremove -y ...
0
votes
0answers
13 views

How to elegantly count failures? Increment by 1

. When comparing 2 directories ... dir1='/media/user/LabelDisk/Temp1' ; dir2='/home/u3/Desktop/Temp1' ; A command: rsync -ax --dry-run --itemize-changes $dir1/ $dir2 ; echo $? rsync exit code is ...
0
votes
2answers
32 views

fsck from initramfs console with 'f' key not working

My ubuntu laptop is dropping to initramfs console due to file system errors. I need to do 'fsck' manually. But the letter 'f' is not working in my keyboard. Right now I can't get a new keyboard. Is ...
0
votes
0answers
13 views

ImageMagick: "Unrecognized compose operator (DstIn)"

Trying to apply round borders to nftbg.png after generating the nftbgmask.png (of the same size: 492x246) but ImageMagick isn't recognizing the very commands it recommended for years. Commands used in ...
0
votes
1answer
40 views

How to copy hidden file names to a text file in unix?

I have several directories which contain hidden empty files. I need the name of these file names themselves, so I need to write the filenames to a txt file. My script looks like this: cd /z/...
0
votes
1answer
21 views

How to convert with ease, a Newline List into a Column List?

. Here are the worst 200 passwords of 2020. https://nordpass.com/most-common-passwords-list/ What is an easy way to convert? After copying and pasting 200 rows from above web page ... into file1.txt ...
0
votes
0answers
34 views

ffmpeg overlaying video in front of bg image generating sync problems

I need to understand why the compilation below is generating the output with the bg file (the purple one) in front of the main media, at the beginning If you wanna test it just go to the repository ...
1
vote
1answer
26 views

regex in find doesn't accept the or operator in group

I'm trying to delete all files and directories in a parent directory, with the exclusion of some directories and their content. For this I use find in a bash script on MacOS. It works if I exclude ...
1
vote
1answer
45 views

How to distinguish between Rsync and SSH access in a “.bashrc” script

I have the following .bashrc on a remote host: #!/bin/bash DEFAULT=$PS1 PS1="\h:\w\$ " source ~/.bash_aliases if [[ $(hostname -s) = host_name ]]; then source /path/somescript.sh ...
0
votes
0answers
9 views

Is it possible to use ExecStartPre to copy contents of file to another file?

I'm trying to add boot logs in journald to messages file $ModLoad imjournal $ImjournalIgnorePreviousMessages on $imjournalRatelimitInterval 15 $...
0
votes
1answer
352 views

Bashrc not able to chain commands anymore using && or ;

You guys are my last resort. I've got a bashrc file with all kinds of commands in it. A lot of them are variations to this alias test=' test1 && test2 ' alias test1=' echo "i hope&...
0
votes
0answers
95 views

Can’t access NPM after installing NodeJS on an Amazon Linux machine

This on an Amazon Linux machine (CentOS derived). I installed NodeJS using Yum. I verify it is there on the root account. One caveat is I cannot use NVM [root@my-ip ~]# npm --version 8.1.0 [root@my-ip ...
0
votes
0answers
28 views

Restrict commands in Linux shell

Is there an option like Set-ExecutionPolicy in Linux shell which can be used to restrict commands and scripts? Set-ExecutionPolicy is used in PowerShell: https://docs.microsoft.com/en-us/powershell/...
0
votes
2answers
32 views

How to delete any files that have not been used (access, change or modify) in X years

i run this command find BAR -type f -mtime +1095 # older than 3 years and find this file: BAR/foo.pdf So i run this: stat BAR/foo.pdf Access: 2020-01-03 01:32:05.584393000 -0500 Modification: 2017-...
-1
votes
1answer
28 views

How to disable ssh non-interactive commands from the server side?

Currently I have a server with openssh7.1 installed, which supports non-interactive commands like : ssh user@server ls. Is there a way to disable such type of command on the server side?
1
vote
0answers
33 views

Map network drive automatically via ps1 - not working

I have a network drive (Z:, dedicated server) from which I am running all my development applications. Every now and then Windows 10 loses the ability to access the drive, in which case I typically ...
0
votes
0answers
29 views

Mac Terminal - Unable to use terminal / standard linux commands

So I can't remember exactly what I was trying to do, but I believe I typed the following command that resulted in me not being able to use my terminal properly: "export PATH=/usr/local/git/bin:$...
0
votes
0answers
87 views

7z missing volume .r00

Some .rar files by volume do not end in .r00 or similar. then the following happens: If I run in command line: 7z x -y -pfoo "file (1).rar" And it is a file per volume, but the next volume ...
0
votes
0answers
33 views

Access root parent directory on Chromebook from different computer

I am trying to access all of the files on my Chromebook from a different computer. From the Chromebook, I can access all of the local files that I have created or downloaded, just not the ones that I ...
0
votes
1answer
23 views

Run 8 commands in parallel in equalized tmux panes

I have a monitoring utility that consists of 8 individual utilities, to monitor multiple aspects of a system. All of them kind of work like htop, in that they rewrite the screen periodically instead ...
0
votes
1answer
25 views

Bash on MacOS doesn't seem to store history?

So I'm trying to teach myself Unix and I changed my MacOS terminal shell from the default zsh to bash, because the Coursera courses that I studied use Bash scripting and so does the First Semester in ...

1
2 3 4 5
217