Skip to main content

All Questions

Tagged with or
2,948 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
9 votes
1 answer
559 views

With the option set -x, each command is echoed to STDERR before execution, prefixed by the expanded $PS4, with the first character being repeated according to the call stack depth. I want the output ...
kdb's user avatar
  • 249
8 votes
1 answer
2k views

How to move one editing row up (back) or down (forward) in a multi-line command in bash/readline? Somethnig like gj/gk in Vim.
Hans Ginzel's user avatar
7 votes
1 answer
2k views

I recently added the following lines to my .inputrc: "\e[A": history-search-backward "\e[B": history-search-forward However, I noticed when using this that my cursor does not jump ...
John Howard's user avatar
6 votes
0 answers
419 views

I have a simple bash completion script that essentially invokes my (non-bash) program and set its output to COMREPLY, i.e. COMPREPLY=( $(my-program -- "${COMP_WORDS[@]}") ) Some of the options accept ...
Limon's user avatar
  • 181
5 votes
0 answers
109 views

I'm currently part of a migration from GitLab to Azure DevOps. As part of that I wrote a little bash script that iterates over the migrated git repos and for each performs a clone from both gitlab and ...
creinig's user avatar
  • 176
5 votes
1 answer
621 views

exit with zero or one numeric argument like exit or exit 42 print "exit" and exit the shell. exit with an invalid argument like exit hello prints an error message, prints "exit" ...
Sophia Koulen's user avatar
5 votes
0 answers
2k views

FZF is a lovely tool, the main issue I have is that the commands I end up running with it don't end up in my bash history. Let's say I do this history | fzf And I choose a command I ran recently, say ...
John Allard's user avatar
  • 1,408
5 votes
0 answers
1k views

I use a sudoers file, which (besides other items) contains following lines: homebridge ALL=(ALL) NOPASSWD: /sbin/modprobe -r bcm2835-v4l2, /sbin/modprobe bcm2835-v4l2, /sbin/reboot %sudo ...
Erik Theoboldt's user avatar
5 votes
1 answer
1k views

If I try downloading a file which already exists with wget using the --no-clobber option, it works as expected but the exit code is 1 which is crashing my scripts. Why is the exit code 1 and how can I ...
aandis's user avatar
  • 163
5 votes
1 answer
707 views

Popular methods of adding an ssh public key to a remote host’s authorized_keys file include using the ssh-copy-id command, and using bash operators such as >> to append to the file. An issue ...
user avatar
5 votes
0 answers
634 views

I can use the time command to measure the time some command takes: time node -e "" node -e "" 0.06s user 0.01s system 92% cpu 0.076 total Is there a similar way to measure a ...
HappyFace's user avatar
  • 1,704
5 votes
0 answers
253 views

I've read that mapping Left Option key to Esc+ should fix many of the issues users of Bash, on MacOS, have with GNU Readline key-bindings. However, I've never encountered Esc+ or +Esc before, so does ...
Shuzheng's user avatar
  • 5,009
5 votes
0 answers
2k views

My goal is best explained by example. To start, here's a function that will produce sample output, on both stdout and stderr: output() { printf '%s\n' 1 2 printf '%s\n' errA errB 1>&2 ...
Jonah's user avatar
  • 1,059
5 votes
2 answers
2k views

Something that's bothered me for many years is that if I want to search my shell history for commands which were run as root, I have to check two different locations: I have to check /root/....
Rag's user avatar
  • 156
5 votes
1 answer
1k views

I want to use an American flag emoji in my bash prompt (i.e. PS1 environment variable). However, the American flag emoji causes the terminal cursor to offset an extra character to the right. 🇺🇸 is ...
Andrew Kirna's user avatar
5 votes
1 answer
812 views

This is somehow a follow-up to my last question: Pasting multiple commands into terminal stops at user input Pasting the following to the terminal works as expected: ( echo test1 # some comment echo ...
pLumo's user avatar
  • 23.2k
5 votes
1 answer
2k views

When I try to access a hidden service on TOR using cURL, for some reason I'm not getting access to the site 100% of the time. Many times it returns "curl: (7) Can't complete SOCKS5 connection to 0.0.0....
I like to code's user avatar
5 votes
2 answers
2k views

I'm working on a bash script to convert my music library to ogg* but executing the right command is somehow eluding me. This is the line that should accomplish it: ffmpeg -i "${file}" -f flac pipe:1 |...
Peter Bailey's user avatar
5 votes
1 answer
423 views

I want to track the number of additions and deletions that exclude moved lines. So if a commit has 10 additions, 5 deletions, and 3 moved lines, then I have 7 additions, 2 deletions excluding moved ...
rjturn's user avatar
  • 191
5 votes
1 answer
2k views

Every time I open a command terminal or press enter, this error message shows up: bash: __vte_prompt_command: command not found It does no harm, but it's very annoying. ~/.bash_profile is here: # ....
shadow_wxh's user avatar
4 votes
0 answers
232 views

I am confused about the processing of SIGINT and EXIT traps in Bash scripts. I wrote this script to test: #!/usr/bin/env bash set -e exit_trap() { printf "In exit_trap \$?=$?\n" exit 0 ...
Alexey's user avatar
  • 2,380
4 votes
0 answers
123 views

The window of my text editor Xed froze with Unsaved documents just as I was doing 'File'->'Save as...' to save them... [How ironic.] Since the process still exists, I am trying to recover the text ...
The Quark's user avatar
  • 454
4 votes
0 answers
100 views

Why does echo "$(fc -l -1)" show the previous command, but echo "$(fc -l -1 | cat)" show the current command? $ testfc () { > echo "$(fc -l -1)" > echo &...
Jacktose's user avatar
  • 532
4 votes
0 answers
134 views

Suppose I have filenames as follows on my Linux system: $ ls -1 file-index-00012.txt file-index-00345.txt question.txt I start typing, where "|" represents the cursor: $ cat fil| If I ...
Huw Walters's user avatar
4 votes
0 answers
269 views

The following code is on macOS as part of /etc/bashrc_Apple_Terminal, in order to save and restore the shell state across all open windows and tabs (note that this is therefore the very old bash 3.2....
Andrew Jaffe's user avatar
4 votes
0 answers
74 views

The following script: #!/bin/bash set -m atexit() { sleep 1 & jobs } trap atexit EXIT echo Hello world Produces this output: $ bash ./foo.sh Hello world [1]+ Running ...
Tavian Barnes's user avatar
4 votes
2 answers
414 views

I'm using watch -g to monitor the output of a command and exit as soon as it changes. The problem is that all the UI elements of watch (including the output of the command that I'm monitoring) ...
Ryan's user avatar
  • 41
4 votes
0 answers
641 views

I'm working on the ANSI escape codes interpreter and I have this escape code from the top command. [K [7m PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ...
jcubic's user avatar
  • 10.5k
4 votes
0 answers
594 views

The bash manual says: " [-+]O [shopt_option] shopt_option is one of the shell options accepted by the shopt builtin (see SHELL BUILTIN COMMANDS below). If ...
The_Weeping_One's user avatar
4 votes
0 answers
1k views

My understanding of shell levels and sub-shell was that: Sub-shells are forks (but not execs) of the shell process created by ( ... ) constructs. $SHLVL counts shell execs. $BASH_SUBSHELL counts sub-...
Louis Blanchard's user avatar
4 votes
0 answers
2k views

No matter what chmod command I run, I am always getting chmod: illegal option -- - usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ... chmod [-fhv] [-R [-H | -...
masterpiece's user avatar
4 votes
1 answer
1k views

Suppose you have a following script sandbox.sh. (This looks similar to Command substitution inside a function does not stop the script on a failure even if -e is set, but I believe a bit different ...
Hiroshi_U's user avatar
  • 317
4 votes
0 answers
1k views

I have a bash script sync_nodes.sh that I want to manage with a systemd unit sync_nodes.service. I want the progress of of the rsync command to show up in my logs. When I run the command ...
mbigras's user avatar
  • 3,512
4 votes
0 answers
659 views

Often I have set up some temporary environment variables/modules and I would like them to persist as I create a split in Tmux. Is it possible to fork the current running program (i.e. bash) and put ...
Derek 朕會功夫's user avatar
4 votes
0 answers
5k views

I have a bash script bash.sh that looks like this: #!/usr/bin/env bash /usr/local/sbin/pythonScript.py firstArgument secondArgument If I call the pythonScript.py from my terminal with the two command ...
Viktor Carlson's user avatar
4 votes
0 answers
4k views

I always thought that a child process will be in the same process group as the parent process. But I have read the following from here: if you run some_app from the shell, the shell creates a new ...
user259392's user avatar
4 votes
0 answers
1k views

I appear to be using GNU bash, version 4.4.12, though it's possible my organization has modified it from HEAD. I'm trying to bind ctrl+x: $ bind -x '"\C-t": "echo testing"' <I press ctrl+t> ...
Dave Johnson's user avatar
4 votes
1 answer
525 views

I am using fedora 25 but I think this is a general behavior on unix system. When I ctrl+r in a command-line environment I can start to type in and anything I type will get to be matched backward in ...
vdegenne's user avatar
  • 1,816
4 votes
0 answers
982 views

Is there a way to reverse search a previous command which contains given (multiple) substrings? In Ctrl+R or alternatives? Suppose I remember editing a file whose name contains abc, and I am looking ...
ilkerk's user avatar
  • 53
4 votes
0 answers
1k views

When I am typing or viewing text on my terminal, the color is white. Any command after I type my prompt is white, and the default output (stdout) is white. I looked and my terminal emulator does not ...
Startec's user avatar
  • 1,919
4 votes
0 answers
1k views

I do know I can color my prompt using escape sequences in the PS1 variable. Now, I would like to know if there is a way to put some color on the bash commands I often use, on the command line itself. ...
Matheus Ferronato's user avatar
4 votes
1 answer
354 views

I want to explicity rename a tab in gnome-terminal on startup of the tab. I don't want to use gnome-terminal --title flag as that gets reset by my systems bashrc file after whatever else is supposed ...
Prodnegel's user avatar
  • 141
4 votes
2 answers
500 views

Usually I can solve problems on my own (and Google). But recently I am baffled by this strange hiccup. Background: I use a chain of scripts for file-processing (in Windows, under Cygwin. Scripts ...
Yifeng Mu's user avatar
  • 1,009
4 votes
0 answers
1k views

My bash command history stops working after starting a new tmux session. No previous commands when typing up, down, reverse search, no output from running history. I've confirmed that this happens ...
Brian Duncan's user avatar
4 votes
0 answers
662 views

I have a simple updater bash script, which replaces files by removing the incident old files and copying new files from an archive to the running embedded target root file system. This way, the script ...
yman's user avatar
  • 181
4 votes
1 answer
491 views

I have a really annoying problem. I have followed all of the protocol for making a bash PS1. I know about surrounding non-printable characters with \[ and \] or \001 and \002; however, I have a ...
Dylan's user avatar
  • 435
4 votes
0 answers
365 views

What is the cause of this behavior? $ cd ../ $ bash: $'\210\210cd': command not found This happens sometimes (rarely) when I enter a command, there is no visible character preceding the cd, still it ...
AttributedTensorField's user avatar
4 votes
2 answers
612 views

Somewhere along the way I've fallen into the habit of hitting tab twice after using a wildcard in commands like mv or rm, which by default causes bash to show the list of files that would match the ...
Drew's user avatar
  • 396
4 votes
1 answer
2k views

I want to mount a remote directory and I want to automate this. So I write below script which not working properly. #!/usr/bin/expect -f spawn sshfs [email protected]:/home/user /mnt/remote expect ...
gangadhars's user avatar
4 votes
1 answer
2k views

Is it possible to switch user of gnome desktop environment by single command or any shortcut key, in centos 6.0, or Can we create shortcut key? I found "fusa", but still unable to install it.
TPS's user avatar
  • 2,491

1
2 3 4 5
59