Questions tagged [bash]
Bash is a free shell for Unix-like operating systems from the GNU Project.
2,567
questions with no upvoted or accepted answers
1
vote
0
answers
1k
views
Start tcpdump with script on system start
I'm trying to run a script on startup that runs the tcpdump command on Centos 7 and Centos 6.
The aim is to start a rolling pcap when the system starts.
I've tried using a cron with @reboot, but it ...
1
vote
0
answers
207
views
AWS Lightsail - Wordpress stack - Backup script
I am regular bitnami wordpress stack user (setting up websites for clients and maintaining it, etc.).
I used to use Updraft backup plugin to backup wordpress and push it to S3 account - however, I ...
1
vote
0
answers
870
views
eval variable as command in shell script
I have command
docker container exec -it man docker service ps $1 --no-trunc --filter "desired-state=running" --format "docker container exec -it {{.Node}} docker container exec -it {{.Name}}.{{.ID}...
1
vote
0
answers
119
views
How do I ensure bash *never* expands paths in environment variables when tab-completing?
$ bash --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
I normally using the above bash version on an Ubuntu 16.04 machine via MATE terminal. Currently however I am using macOS 10....
1
vote
0
answers
130
views
Linux SSL TCP file redirection?
In Linux it is possible to do such thing :
ps aux > /dev/tcp/1.1.1.1/1234
And listening on the other side with ncat or nc.
But is there a way to do it over SSL encryption ?
Preferably with X509 ...
1
vote
0
answers
160
views
How to ignore FIND errors in bash script?
I'm using a script to cleanup logfiles from a tomcat webserver.
Problem:
find $file_pattern will return an error if a filepattern did not match any results.
The following is run by crontab:
...
1
vote
0
answers
31
views
can't find bash history executed via ruby net::sh library
In the hope for getting the commands that run via ruby net::ssh tool which is described as follow:
Net::SSH is a pure-Ruby implementation of the SSH2 client protocol. It
allows you to write ...
1
vote
0
answers
136
views
Mac Terminal or iTerm: Copy the current command (not including prompt)?
I am using Terminal or iTerm (iTerm2). Let's say I've typed in a command but haven't hit enter yet. Or maybe I used the up arrow to navigate through my command history. How do I copy the current ...
1
vote
0
answers
382
views
Execute a command on screen termination
I have been using screen for a while, but the process I am running seems to terminate at times, closing the screen out. So I have to reopen the screen again.
I was wondering if it was possible to ...
1
vote
1
answer
402
views
How to programmatically get the list of directories that brew installs to?
I am writing a script that automates setting up my mac dev environment. I want to place the directories that brew installs first on my path, so that the default system commands are overridden by brew ...
1
vote
1
answer
953
views
Replace a line containing special characters in all files recursively using SED MAC
I was trying to replace a line with another using SED on MAC OS X Terminal
I have a scenario where I need to replace a line in all files present in a directory with another line.
Both lines are ...
1
vote
0
answers
65
views
Cygwin: Is it safe to pipe from /dev/clipboard to clip?
I am using cygwin on windows.
Given a long list of strings in the clipboard:
mail
know
trial
posture
wind
census
shelf
concrete
moon
fee
If I want to "unwrap" them, is it safe to use such a command:...
1
vote
1
answer
287
views
How to use pipe into grep to exclude list of files under a second level directory?
I use ripgrep (rg) to list files under a directory.
But I want to list files under a second level directory excluding the list of files under one of the directories.
Basically if I have ./a/b/c
I ...
1
vote
2
answers
2k
views
infinite history in bash, when using multiple terminals(terminator) without losing commands and messed up order
I want infinite history, because I type a lot of commands I can forget at the spot and would like to have it stored somewhere as a reference. But by just setting HISTSIZE and HISTFILESIZE it does not ...
1
vote
0
answers
2k
views
Windows 10 - GIT issues with cloning/pulling/pushing
I've got an strange issue. Since I updated my GIT on my Windows 10 machine, I get the error below.
I use GIT for Windows with Bash.
If I run GIT Bash with administrator rights then everything works ...
1
vote
0
answers
45
views
I can't use the window manager of my choice, nor the display manager
I'm stuck with xfce and a text-only login screen. I've tried to run
startkde
instead of
startx
to see GUI and I got this
$DISPLAY is not set or cannot connect to the X server.
I tried to fix it ...
1
vote
0
answers
851
views
How to use poppler utils to extract annotations from PDF files?
I would like to use the command line tools from poppler-utils to extract annotations from pdf files.
I have found some information under a similar question how to export comments from a pdf file and ...
1
vote
0
answers
838
views
permissions issue when running rsync via crontab
I'm using rsync to backup directories on my local machine to a remote server. I have SSH key-based access set up and working for my user, so when I run the command:
rsync --update -razvP --progress ~/...
1
vote
0
answers
418
views
Invoking a new CMD window from WSL without waiting
Is it possible (without using a terminal emulator) to invoke a new CMD (or bash) instance in a new Window from within WSL, without having the calling command wait on the new CMD?
The usual way to ...
1
vote
1
answer
333
views
Load multiple hosts files
Think I already know the answer. But looking for a unicorn.
Anyone know if there is a way to link one hosts file to another, or load 2 or more different hosts files?
I have a hosts file that has ...
1
vote
1
answer
296
views
How can I split output in more than 3 parallel processes in bash?
How can I split stdout to several parallel processes in one reading step? grep/sed is only an example
file AAA
AAA
BBB
CCC
DDD
EEE
FFF
cmd1 ($ cat AAA ) -----+---- cmd2 ( eg. grep "A" > fileA....
1
vote
0
answers
70
views
Raspberry Pi command not found, only printng out bytes
so i just installed Raspbian on my Pi and wanted to test some python scripts. However if i try to execute the script or even go into the Python IDE the shell freezes for some seconds and then prints ...
1
vote
0
answers
253
views
How to change the default terminal prompt location to the right side?
Basically i need to know how to switch the default side of the prompt on (linux) terminal (which is on the left side of the screen normally).
I don't think anyone else attempted this, or even thought ...
1
vote
0
answers
447
views
Libreoffice converting docx to pdf in headless mode hangs
Libreoffice: 6.3.1.2
cmd: --headless --convert-to pdf \"$basePath\" --outdir \"$dirPath\"
Can we set timeout to operation? or any other suggestions. So I want result that operation is not successful.
1
vote
0
answers
211
views
Tagging files in macOs Finder... quickly
I'm looking to create keyboard shortcuts to tag files in the finder... without using Automator. The goal is to rapidly quicklook and tag files.
I'm imagining:
cmd-opt-0 -> tags selected file "...
1
vote
1
answer
627
views
fusermount prepends /home to path when resource is busy
Problem:
I created a bash script for SSHFS mount/unmount using:
1| dir=$(mktemp -d)
2| sshfs user@server $dir
3| cd $dir
4| bash
5| fusermount -u $dir
6| rmdir $dir
Once these lines are ...
1
vote
1
answer
265
views
Texmacs Ubuntu 18.04.03 and Python
I am trying to install TeXmacs for Ubuntu, but it is not available via apt-get. The instructions on the site tells us to download a zip and run it through a bash script (https://www.texmacs.org/tmweb/...
1
vote
1
answer
39
views
How to combine values with Bash from two files
I have two files:
Text 1:
1 element
2 element
3 element
4 element
Text 2:
line1
line2
line3
line4
line5
line6
line7
I need to get this result:
1 element at line1
2 element at line2
3 element at ...
1
vote
0
answers
127
views
Terminal on MacOS Mojave: Why is the prompt misbehaving when the window size is too small and how do I fix it?
I'm on macOS Mojave 10.14.4 using GNU bash, version 5.0.7(1).
Basically my issue is that when the terminal window is too narrow to contain my full PS1 prompt in one line, it gets corrupted and starts ...
1
vote
0
answers
116
views
what does \eval "$__conda_setup" actually do?
I am having to track down an environmental issue with wxpython. I am curious how someone would poke around the os to find the location of the code that ensues here when executes. This explains the ...
1
vote
0
answers
235
views
Prompt doesn't scroll/clear until window resizing (using gdb/cgdb in bash)
I'm just learning to write C, and I have been having this problem while using gdb/cgdb. It's really annoying, to the extent that it discourages me from using the debugger entirely. I'm using WSL for ...
1
vote
0
answers
257
views
Open a new tab in ConEmu, in the same directory (WSL)
Trying to achieve the same as this question.
But with WSL (Windows Subsystem for Linux).
ConEmu documentation states that shell via PS1 and ANSI:
This is the only option available for Bash on Ubuntu ...
1
vote
1
answer
588
views
Supervisor and Shell command discrepancy: export variable from file working for in supervisor but not in shell, why?
suppose there's a file into /tmp/confs.sh, that looks like:
export CONTAINER_CODE_PROJECT_ROOT="//var/www"
and it's used inside a supervisor configuration file like this:
[program:laravel-horizon]
...
1
vote
1
answer
82
views
How can I write a command chain (including long queries/fetches) effectively?
I often need to write command chains like:
curl api.example.com | jq '.files[].url' | xarg curl | grep 'Tel:\d+' > output
But it takes a lot of trial and error:
curl api.example.com | jq '.file[]...
1
vote
1
answer
902
views
Wait for a process to complete in Cmder \ ConEmu
Executive Summary:
For software development debugging purposes, I’m using Cmder 1.3.12 for Windows 10 x64.
If, say, I run in a cmd window java –jar app2.jar, I get output logs (inside cmd) and, as ...
1
vote
2
answers
697
views
Error when trying to add new line in the end of command
I have this code #!/bin/bash
ls \n
When i try to run it it keeps saying
ls: cannot access n: No such file or directory
I have many scripts that i want to add new line in the end of them but all of ...
1
vote
0
answers
279
views
Windows 10 "bash" alias was deleted...WSL is installed
Hello for some reason another installation meshed up my "bash" alias in the windows command prompt. Does anyone know how to bind it?
I have WSL installed and have been using it for the last year on ...
1
vote
0
answers
354
views
Some key bindings in `screen` do not work as expected
I recently installed screen for Raspbian Buster using bash and it doesn't seem to work completely.
I am able to create a new window using Ctrl+a c and flip between the windows. I can see the windows ...
1
vote
1
answer
3k
views
Git commit could not open '.git/COMMIT_EDITMSG': Permission denied
I'm experiencing 'permission denied' in my own repo in a shared server.
I tried some found solutions from other stacks and it did not solve my issue.
Is there anything else I should be trying?
-bash-4....
1
vote
1
answer
213
views
How to make command line tool “ctpu” be recognized by my terminal?
I downloaded the ctpu command-line tool made by Google. This tool makes it easy to set up and run Cloud TPUs for deep learning projects. I successfully downloaded the tool to my ~ directory (Users/...
1
vote
0
answers
6k
views
How to stop a powershell command after n seconds?
Question
How can I execute a powershell command in a script.ps1 (that for example starts an infinite loop in a WSL), wait 5 seconds, and then stop/break that command so that powershell moves to the ...
1
vote
0
answers
673
views
I can't connect ssh "write: Connection reset by peer" ubuntu
I try to connect using ssh but the following error is happening randomly
ssh [email protected] -vvvv
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration ...
1
vote
1
answer
488
views
Moving directory from PC to server with Bash, SCP, and SSH
I am attempting to move my Flask Application directory from my PC to my Ubuntu server (hosted on Linode) using the Ubuntu Bash terminal (I'm running Windows).
When I run this:
scp -r C:\...
1
vote
0
answers
125
views
WSL closes unexpectedly after pressing gc key sequence
I have Ubuntu bash as WSL on Windows 10 version 1903. I use zsh as my ubuntu shell + oh-my-zsh framework. Here is my ~/.zshrc file (comments removed):
export ZSH="/home/thesetj/.oh-my-zsh"
ZSH_THEME=...
1
vote
0
answers
1k
views
Liquibase via SSH to remote mysql instance
I am in the middle of automating deployment of my "LAMP" application. At the moment I have a Jenkins setup with a pipeline to deploy to the local environment which I have full control of. In an ...
1
vote
3
answers
1k
views
Rsync --delete option isn't deleting hidden dotfiles in target
These are the steps I took:
Create some test files:
/tmp $ mkdir src tgt
/tmp $ cd src/
/tmp/src $ touch .test{1,2,3}
/tmp/src $ ls -la
total 0
drwxr-xr-x 5 user wheel 170 18 Aug 15:02 .
...
1
vote
1
answer
421
views
my virtual environment cannot be found
I'm on a PC windows 10 and always open git bash, then source activate my-env and open a jupyter notebook; somehow my-env broke and I get this error:
"C:\bld\conda_1565126647711_h_env/etc/profile.d/...
1
vote
0
answers
570
views
Imagemagick 7.0.8-59 Error Message when Compressing PDF files
I am trying to compress a PDF with this Command: mogrify -compress jpeg -quality 50 path/to/file/*
When running the Command I get this error message:
Error: ICCbased space /N value does not match ...
1
vote
0
answers
279
views
Searching on Website from commandline "Please verify you are a human"
I am using bash to search for a term in a website and I get the following message (instead of the website):
Please verify you are a human
Access to this page has been denied because we believe you ...
1
vote
0
answers
610
views
Changing files metadata under Ubuntu WSL
Is it even possible?
According to this blogpost :
"Windows file metadata is different from Linux file metadata. While
it’s the OS’ job to store and update your file metadata, most of
Windows ...