Questions tagged [bash]
Bash is a free shell for Unix-like operating systems from the GNU Project.
2,574
questions with no upvoted or accepted answers
14
votes
1
answer
1k
views
Trap on DEBUG signal for the dash shell?
With the bash shell, you can install a trap on the synthetic DEBUG signal. This is useful and will execute your function or bit of code on every shell command. For example:
$ trap 'logger -t shell "${...
11
votes
2
answers
1k
views
How can I cancel reverse search without losing text typed?
When using reverse-search (Ctrl-R) in the bash terminal , I can cancel the search using either Ctrl-C or Ctrl-G. Both these options will clear the text typed while searching.
However, the most common ...
9
votes
1
answer
8k
views
Convert Linux symlinks to Windows symlinks
I've noticed that Linux symlinks don't work in Windows, and vice-versa. Is there any way to convert Linux symlinks to Windows symlinks? Specifically, I want to convert relative Linux symlinks to ...
6
votes
1
answer
4k
views
Ignore certain changes in git diff
Is it possible to get a report from git diff or related commands that excludes a certain category of change?
I've been asked to review a change where a huge number of files have undergone the ...
6
votes
2
answers
3k
views
Filter tail command through multiple grep commands to separate files
What I am trying to do is filter the output of one log file into separated log files based on a grep filter.
tail -f test.log | tee >(grep "Error" > error.log) >(grep "Warning"" >
warning.log)
...
6
votes
1
answer
3k
views
bash autocompletion is slow, freezing my desktop
sometimes when working with a custom kernel, pressing tab in the bash autocompletes at a horrible pace. It freezes the whole desktop. Then comes back after awhile.
This is the only quirk that I've ...
5
votes
0
answers
459
views
Files with long filenames appear as empty
I'm not too familiar with Windows, so please bear with me.
I have a folder with several files with very long filenames, that can be listed normally, but if I try to open them with any Windows ...
5
votes
1
answer
221
views
Ssh X11 forwarding messes up with default shell
I have a bash specific code in my bash profile:
$ cat ~/.bash_profile
#!/usr/bin/env bash
echo "SHELL: $SHELL"
function printfiles() {
while IFS='' read -r _file || [[ -n "$_file" ]]; do
echo ...
5
votes
0
answers
340
views
How to send trackback to arXiv papers from a Jekyll blog?
Sorry, my question was directed from Academia.SE here by the admins. If there is a better place to ask this question, please let me know as well.
I have recently noticed that arXiv.org website ...
5
votes
0
answers
471
views
emacs term-mode redraws prompt when backspacing inside executables
I am reliant on emacs (version 24.4.1 on Debian) term and ansi-term modes. They normally work just like xTerm for me, but when running an interactive program that has a prompt (like the node.js prompt,...
5
votes
1
answer
229
views
GNU screen is slow exiting
I've set up my .bashrc to automatically screen -DRA (even though it's a local session).
screen works fine, except that if I run exit from the last window or otherwise close it from the client itself, ...
5
votes
0
answers
753
views
Name a tab in iterm2, even with pane splits
I see there are solutions to name tabs in iterm2 when there is a single pane, but it doesn't work well with multiple panes/splits. So if I have two terminals open in a split under a tab, I would need ...
5
votes
2
answers
868
views
Ruby commands are turning off tty echo
After running Ruby scripts, almost 100% of the time, the bash command line will appear to be inactive, while in fact it's silently accepting my keystrokes without showing them to me.
This has ...
5
votes
0
answers
1k
views
How to mount SMB share from terminal using keychain?
I need to be able mount a SMB share from terminal, for MAC OS versions (10.7). Is there a way to use mount_smbfs with keychain so I don't get prompt the username/password or have to add it to the ...
5
votes
1
answer
721
views
Launch a WSL script through Windows Terminal: node: command not found
I am trying to run a node.js script in WSL from WT using the syntax wsl.exe <command>.
However I can't get it to find Node when launched this way and get the following :
PS C:\> wsl.exe -- ...
5
votes
1
answer
7k
views
How can I run dd as fast as possible?
I'm learning bash, and what with all the confusion around the many, many different ways there are to zero-write a drive or transfer data from/to one (shred vs dd vs pv vs cat vs tee and so on), I'm ...
4
votes
0
answers
1k
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 && ...
4
votes
0
answers
1k
views
Delay in starting command prompt
There is a weird problem with my command prompt.
Whenever I start it, there's a delay. The windows opens quickly as it should, but there is a Blank Time, before the command line displays this message:
...
4
votes
0
answers
592
views
Can I push a commit with "--no-verify" from git gui?
I want to commit some files with a suggestive title, but I can not find a no-verify option.I know that I can do it in bash by simply adding "--no-verify" as a parameter but it would be ...
4
votes
0
answers
4k
views
All command line terminals on my PC [Windows 10] run incredibly slow. CMD, Git Bash, VSCode Terminal
So, since yesterday, my terminals have been running super slow. Slow to start up and slow to run commands. Running a command takes over one minute. Takes like 5 minutes to start up. At first I thought ...
4
votes
0
answers
160
views
TAB completion with .bash_history
I usually use PageUp/PageDown to search through .bash_history given a prefix.
However, I regularly catch me pressing TAB multiple times before realizing that I need to use PageUp/PageDown in this ...
4
votes
0
answers
1k
views
Can't install linux-libc-dev on WSL/Bash on Ubuntu on Windows
I'm trying to install linux-libc-dev on Bash on Ubuntu on Windows (the Windows Subsystem for Linux).
This is to fix an earlier bash error:
The following packages have unmet dependencies:
libc6-dev : ...
4
votes
0
answers
2k
views
Can I create aliases with make?
Is it possible for make to create aliases?
Here's what I tried:
Makefile
aliases:
alias hello='echo world'
alias holy='echo cow'
It doesn't work as-is, presumably because the alias command ...
4
votes
0
answers
2k
views
tmux: get names of panes, each current directory and history
my tmux session is a bit broken, by which I mean that tmux ls returns an error like error connecting to /private/var/folders/d0/xbg08_x12lddw3dkht5w462c0000gn/T/tmux-501/default (No such file or ...
4
votes
1
answer
1k
views
Remove All Illegal Characters from All Filenames in a Given Folder and subfolders
I Know this was was basically answered and the automator with the shell script (Sanitize Filenames) works great, but I need it to also do all subfolders as well. And if possible trim the file name ...
4
votes
1
answer
1k
views
How to open a local file with a query string appended to it in the default browser?
I want to do something like this from a shell script:
$ open 'foo.html?foo=bar'
Sadly that fails, as it looks for a file named foo.html?foo=bar instead of foo.html before opening the browser:
The ...
4
votes
0
answers
689
views
How can I get bash to perform case insensitive tab-completion for my aliases and functions?
I have an alias like this:
alias sshUntrusted='ssh -X -C -c blowfish-cbc,arcfour'
But when I type
$ sshun
followed by Tab, Bash does not complete the alias.
I have put
set completion-ignore-case ...
4
votes
1
answer
649
views
Is it possible to check which stream is used by the command? (bash)
I have an irritating problem: redirecting stderr does not work. I get:
iptables: Chain already exists
I can't be bothered to check if a chain exists already (pointless, iptables just throws an ...
4
votes
1
answer
302
views
Problems with bash script, mysql inserts and launchd
I am developing a automated system, which consists of 3 parts: mysql, bash and launchd.
Bash script takes folders of work related stuff, zips, archives and puts info about them into database that is ...
4
votes
1
answer
4k
views
Tab Auto-Completion in Mac OS X when using sftp in terminal
i have been getting very frustrated lately since the readline functionality has been removed from MacOSX and Tab Auto-Completion doesn't work anymore.
So i was wondering if anyone knew a good ...
4
votes
3
answers
1k
views
How to pass bash variables (passwords) to IRSSI config file?
I'm using IRSSI and I wonder how can I pass my IRC channel's passwords to the IRSSI config file (~/.irssi/config) without writing them directly in the file.
In Mutt I've an awk command that queries a ...
4
votes
1
answer
3k
views
Grub: Legacy 'ask' parameter no longer supported
I'm trying to change the resolution on my base shell (the Ctrl+Alt+1) shell in Debian so that it supports my ViewSonic monitor.
The shell appears really fuzzy when it is displayed on my lcd monitor, ...
4
votes
1
answer
3k
views
Keystrokes and commands for my inputrc — key-combination for “Shift-Space”, remap “Ctrl-PageUp/PageDown” to something without Page-keys
I need to add some things to my inputrc. I'm using bash 4, as OS I'm using debian and OSX. My terminal emulators are rxvt-unicode-256 on debian and Terminal.app on OSX. My new macbook has no Insert/...
3
votes
0
answers
222
views
Is there a good way to write a shell script compatible with both bash and zsh that addresses array elements?
The fact that bash is 0-indexed and zsh is 1-indexed can cause problems. For example the following will work as intended with bash, but not zsh (PS I am aware that I don't NEED to use an array for ...
3
votes
0
answers
1k
views
I wan't to configure Windows Powershell Script execution policy precisely
Is it possible to configure the Powershell execution policy to ask the Administrator for authorization each time a Powershell script wants to run?
Something like this :
Windows Administrator ...
3
votes
0
answers
629
views
How to automatically refresh the Bash prompt every second?
As far as I can see, the user must press Enter in order to update PS1, PROMPT_COMMAND, etc. Is there some way to automatically update PS1 and have it get displayed on the screen (without messing up ...
3
votes
2
answers
3k
views
Is it possible to have dropdown autocomplete select options in ZSH or Bash?
Is it possible to have dropdown autocomplete select options in the terminal with ZSH or Bash as shown in the image below? Here the regions(i.e. ap-northeast-1, ap-northeast-1 etc) are predefined
3
votes
0
answers
586
views
Different results for power measurement on ubuntu using powertop and energy_uj
I want to measure power usage of the whole PC in software on Linux. I've tried these two methods from here and here:
using powertop:
rm -f powertop.csv
sudo powertop -q -t 60 -C powertop.csv
cat ...
3
votes
0
answers
478
views
Does every Firefox tab have a own ID and how to get this ID by bash?
Envirement:
Linux like Ubuntu, Firefox
bash
Its known programms like firefox have some pids, which can get p.e. on follow way:
pidof firefox
Its known every firefox window have a own wid, which can ...
3
votes
1
answer
193
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 ...
3
votes
0
answers
2k
views
Using SSH ProxyJump and SSH Agent Forwarding back to back
There is a series of ProxyJumps I have to do, to get to a specific target system T. The last hop to T does NOT support TCP forwarding at all, causing ProxyJump and ProxyCommand to fail, so that's not ...
3
votes
0
answers
844
views
Imagemagick file conversion not working?
I am trying to convert a file from .gif to .bmp using this command:
convert -coalesce pixels8.gif out.bmp
While doing this i get this error:
convert-im6.q16: memory allocation failed `pixels8.gif' @ ...
3
votes
1
answer
1k
views
How do I create a file of aliases for zsh like I did for Bash?
I've spent the last few years learning Ubuntu and fallen in love with Bash aliases. I recently got a Macbook Air and I want to use aliases, but MacOS uses zsh by default. I copied my .bash_aliases ...
3
votes
1
answer
1k
views
Bash history limited to 1000 even with HISTSIZE=9999999
On my old notebook (Debian sid) I had this in my ~/.bashrc and it used to work (e.g. history was more or less unlimited and it was being saved on each command):
export PROMPT_COMMAND='printf "\...
3
votes
3
answers
2k
views
How to setup zsh to append history to a file named dynamically by date
My biggest sticking point moving from bash to zsh is the history configuration. Using oh-my-zsh there is a history.zsh file in #ZSH/lib that I found (I think) can be disabled via unsetopt ...
3
votes
0
answers
19k
views
How can I fix the error "Access Denied" in WSL?
I am trying to set up Windows Subsystem for Linux on my Surface Laptop running Windows 10 Version 1909 (Build 18363.836). I am encountering an issue when attempting to create a user account. I have ...
3
votes
0
answers
2k
views
Screen issue: getpwuid can't identify your account
I am trying to run the static binary screen. I have created /etc/passwd and /etc/group. When I did ls -la /etc/passwd /etc/group I didn't get any errors, but when I am trying to run ./screen I get:
...
3
votes
2
answers
5k
views
Monitor folder size
Is there a way to monitor and log folder size in Bash/Ubuntu? I'm running some computations and I need to know how much disk space they need. They may create some temporary folders for a few minutes/...
3
votes
0
answers
781
views
How to understand what is Shell, Terminal, MinGW, Bash, Git Bash etc?
I'm a still a beginner Python programmer. I know the basics decently and can also use some packages and libraries. I've used Pandas, Matplotlib, Beautiful Soup, Requests to name a few and I want to ...
3
votes
0
answers
846
views
Remote control graphical Firefox instance
Is there any way to control regular Firefox instance remotely? I'm not looking for automated web testing or anything else utilizing headless browser. I'd just like to make useful CLI and desktop ...