Skip to main content

Questions tagged [shell]

The shell is Unix's command-line interface. You can type commands in a shell interactively, or write scripts to automate tasks. Use this tag for questions applying to /bin/sh and most compatible shells (ash, bash, ksh, zsh, …). For shell scripts with errors, please check them in http://shellcheck.net before posting here.

1,160 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
2 answers
2k views

Sending SIGINT to process groups sometimes gets ignored

I start a process group from bash. Then I send SIGINT to the entire process group. Sometimes the SIGINT kills the processes, sometimes does not. Why does SIGINT sometimes gets ignored ? I see ...
Hakan Baba's user avatar
5 votes
0 answers
148 views

Is there a command to run an executable?

bashenables to run bash scripts with bash somescript, python python scripts with python3 somescript. Alternatively, with the right shebang, I can run directly the previous scripts with ./somescript. ...
lalebarde's user avatar
  • 255
5 votes
0 answers
218 views

On MacOS, what character does `Esc+` or `+Esc` correspond to in Bash, when using iTerm2 terminal?

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
  • 4,551
5 votes
2 answers
2k views

How to stop marking while in tmux copy-mode?

I want to mark and copy text, and then stay in copy-mode with the marker off, permitting me to move up/down without marking new text (see below). But after marking text and pressing space or y to ...
Shuzheng's user avatar
  • 4,551
5 votes
0 answers
393 views

Tracing environment variable modification in the fish shell

There's one item I used to use in $PATH, which is ~/.workspace/bin. I can't figure out where it's coming from. I changed the user shell to /bin/sh, logged in from TTY, checked $PATH, and it was clear ...
skrat's user avatar
  • 255
5 votes
0 answers
1k views

Manually restore saved session files on KDE using qdbus command

At times, i have multiple konsole terminal open with multiple tabs. I would like to save and restore it manually, just in case i accidentally close the window. In KDE there is a command to save the ...
nabilishes's user avatar
5 votes
1 answer
5k views

All TLS requests giving Peer's certificate issuer has been marked as not trusted by the user

When I try an https request to google.com, I just recently started seeing [root@ip-172-31-47-76 ~]# curl -I -v https://google.com * Rebuilt URL to: https://google.com/ * Trying 216.58.193.78... * ...
Travis's user avatar
  • 51
5 votes
2 answers
333 views

Understanding fmt (gnu coreutils)

I'm using fmt (GNU coreutils) 8.25 and I fail to understand how to use it. In particular, I don't understand the following results. $ echo -n "a b c d e" | fmt -w3 -g3 I expected to obtain a b c d ...
Thomas's user avatar
  • 51
5 votes
1 answer
3k views

Running scripts/commands from a host system in a chroot environment.

First of all, I have inside an android Operating System a chroot environment created using Linux Deploy. I am able to access it from Android using a terminal emulator and root permission. I would like ...
Santiago Nicolas Martin's user avatar
5 votes
1 answer
169 views

Is it possible to drop all write privileges in a shell for the current user

This is NOT for security purposes. Suppose I wanted to execute a shell script and, on a best effort basis, assume it left no side effects aside from things like auditd logging, avc reports, syslog, ...
Erick J's user avatar
  • 61
5 votes
0 answers
2k views

convert windows path to unix path inside wine application command line

I'm running a windows application in wine, which executes configurable commands to run external applications (e.g. an diff editor to show differences between two source files). So these commands are ...
smogm's user avatar
  • 51
5 votes
1 answer
3k views

Run git pull from a shell start-up script

I have Raspberry Pi that loads a shell script on start up. This script runs a python script, boot_camera.py, which is found in a repository. I Have a server which sends the Raspberry Pi a command ...
Ethan's user avatar
  • 51
5 votes
1 answer
2k views

set tab color in a tabbed terminal emulator

I would like to set in my terminal emulator (i.e. gnome-terminal) the color of the tabs like in the osx's terminal emulator. Is there this feature in any of the linux terminal emulator plethora? EDIT:...
hairesis's user avatar
  • 151
4 votes
0 answers
80 views

Is there a test harness that can check how POSIX compliant a shell is?

Assuming I write a shell, is there some form of test harness that ensures that the shell is POSIX compliant (specifically /bin/sh without any of the bash extensions) in that it would run most ...
Archimedes Trajano's user avatar
4 votes
0 answers
218 views

Why does bash $LINENO change inside an inner block in a function?

I'm trying to debug auto completion script located in /usr/share/bash-completion/bash_completion (bash completion package on every distro) I did export PS4='+'$'\t''$LINENO'$'\t # \t for proper ...
Alireza Mohamadi's user avatar
4 votes
0 answers
367 views

What are profiling tools available for bash/shell script

I have a project which is entirely written in shell scripts. I find some of the modules in my code takes a lot of time, I need to reduce it functionality wise. What are profiling tools available for ...
Ragini Dahihande's user avatar
4 votes
1 answer
710 views

How to write zsh completion function for wrapper commands

I'm attempting to write a completion function for a custom wrapper around SSH called myssh. myssh takes command line arguments in either of the following forms: myssh [myssh options] [ssh args] or ...
Sora Minazuki's user avatar
4 votes
0 answers
339 views

Update all installed GNOME 3 extensions at once

I use extensions.gnome.org website and GNOME Shell integration Chrome extension to search and install gnome-shell extensions. I know that I can use the website and the Chrome extension above to also ...
curusarn's user avatar
  • 161
4 votes
2 answers
280 views

gunzip on Embedded machine

I'm using BusyBox 1.24.1 on my Embedded Linux machine (with kernel v3.10.31) and I get behavior I can't understand when unzipping files.  The gunzip command (often, but not always) fails, with no ...
Stric Matic's user avatar
4 votes
0 answers
146 views

FreeBSD sh: is it possible to import a list of commands into fc without executing them?

I cannot find any indication that sh supports persistent history. So I am trying to create this functionality manually. At the end of my .shrc history I have added this: trap -- 'fc -ln -- 1 >> ...
Harold Fischer's user avatar
4 votes
0 answers
3k views

Gain root access without using root's login shell

I bricked the login of my root user by removing zsh while it was still the default shell. Now as a result will login in fail, since on login will it try to use /bin/zsh(1), which is missing. Only one ...
Addono's user avatar
  • 41
4 votes
0 answers
286 views

Is there any utility that can drop me into a Intel ME Minix shell?

I see a lot of talk about Intel -3 ring mode running Minix. Is there any easy C program I can compile, or utility I can run that will drop me into a -3 ring mode Minix shell?
Evan Carroll's user avatar
  • 31.6k
4 votes
0 answers
3k views

Will a child process be in a different process group than the parent process?

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
1 answer
478 views

Switching between two framebuffer programs

I have two programs (mplayer and a custom java application) which both present GUI using framebuffers. They run in separate processes. I want to be able to switch from one program to the other without ...
Aleksandar Dimitrov's user avatar
4 votes
1 answer
2k views

Run vsim from dmenu — it only works when directly invoked in the terminal

Works: vsim, sh -c vsim Doesn't work: echo "vsim" | sh, echo "vsim" | xargs -I {} sh -c "{}" I want to run ModelSim (vsim) with dmenu, which is triggered using xbindkeys. Details vsim is a ...
MightyPork's user avatar
  • 1,222
4 votes
1 answer
2k views

Read output in `screen` from outside

Suppose I opened up a screen to run some program that outouts some result. Once the program finishes, is there a way to get the result in the screen from outside. For example: I opened up a screen ...
xiaohan2012's user avatar
  • 1,715
4 votes
2 answers
3k views

How to write something to named pipe even if there are no readers

I have this little test script: rm fooo | cat mkfifo fooo echo 'bar' > fooo # blocks here echo 'done' I am guessing that because there is nobody reading from the named pipe, that the write call ...
Alexander Mills's user avatar
3 votes
0 answers
137 views

Are there any Linux distros with a preconfigured user-friendly shell environment?

I see so many Linux distros all around, and they all come with different look & feels and their own set of pre-installed GUI tools for most standard tasks. The default shell environment, however, ...
carlfriedrich's user avatar
3 votes
1 answer
383 views

Launch process with limited capabilities on minimal Busybox-based system

In a minimal Busybox-based Linux system with access to the root user, how can one launch a process with a specific limited set of Linux capabilities(7) without requiring any tools beyond busybox?
Axel Fontaine's user avatar
3 votes
0 answers
157 views

Can't grep or word count the output of jobs command in dash

This is what I tested in Arch's dash shell and FreeBSD's default sh shell, the results are the same. $ sleep 100 & $ jobs [1] + Running sleep 100 $ jobs | wc 0 0 ...
Lu Xu's user avatar
  • 131
3 votes
1 answer
2k views

How do I show a bash autocomplete result as a faded text in the terminal?

I'm using GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu). How do I see a preview of what happens if I press tab to autocomplete, similar to a fish shell. (Sorry, I'm new, so I may not be ...
Joshua Foo JF's user avatar
3 votes
0 answers
524 views

Change zsh tab size

I wanted to change the tab size (the amount of spaces a tab uses) used in my terminal, but it didn't work. I then found out, that my shell (zsh) inserts a fixed amount of 8 spaces instead of a tab. I ...
weisbrja's user avatar
  • 231
3 votes
1 answer
1k views

Can I make shell consider NBSP a whitespace character?

This seems like a common issue: you paste a simple command from somewhere into the terminal and it's not being understood by a shell: $ echo test $ zsh: command not found: echo test The reason is ...
Eugene Yarmash's user avatar
3 votes
1 answer
800 views

Can I run the command in specific terminal?

OS: Linux mint 19.2 Cinnamon SHELL: Zsh TERMINAL: Tilix I want to create a shell script. which have 2 steps. Open the new terminal. Run source bin/activate at terminal that I opened. How do I run ...
pastelkona's user avatar
3 votes
0 answers
383 views

Redo not working correctly for (readline) `vi` command-line editing

I'm using vi command-line editing: shopt -o -s vi My problem is that while undo (u) works as expected, that is not true redo (.). In particular, if I've the following command-line AA BB CC, then ...
Shuzheng's user avatar
  • 4,551
3 votes
0 answers
45 views

Should I set the locale to `C` when matching a range of numbers?

If I wanted to search for lines in a file that contain a or b or c or d I would run LC_COLLATE=C grep -E '[a-d]' file_to_search or LC_ALL=C grep -E '[a-d]' file_to_search If I fail to set the ...
Harold Fischer's user avatar
3 votes
0 answers
1k views

Get/Set environment variables in a different tty

I'm using a tool (Autokey) that spawns in a new shell. Cool tool, but I want to pull info from my current shell. Say I'm on pts/0 and I have a variable set: VAR1=yes. In another shell, I want to be ...
BrowncoatOkie's user avatar
3 votes
0 answers
313 views

Source-able/executable shell script in the POSIX shell language

What's a good POSIX compliant way to make a script both executable (a function from the script gets executed) and in-sourcable with the . command (nothing happens except (at least) 1 function becomes ...
Petr Skocik's user avatar
3 votes
0 answers
916 views

Send response based on netcat client request

I am trying to create a socket where the client receives a response based on their request, but I can not figure out how to achieve this on CentOS 7. Until now I have the socket opened on port 100 ...
Martin Ocando Corleone's user avatar
3 votes
2 answers
8k views

How to export proxy in Redhat Linux 7 using the current login credentials?

I need to export proxy on RHEL 7 with the current logged user credentials. I am able to achieve this by adding manually in .bashrc or .bash_profile.: export http_proxy=http://username:password@proxy....
M.S.Arun's user avatar
  • 291
3 votes
0 answers
402 views

Is there jitsi SIP-client for Ubuntu or Debian which has command-line interface?

Is there jitsi SIP-client for Ubuntu or Debian which has command-line interface? So, for example, I can make calls without using jitsi GUI, just sending commands to the application.
Prasannakumar Merugu's user avatar
3 votes
1 answer
585 views

Interactive Login Shell vs X display manager

Me and a friend of mine are working through RHCSA together and we stumbled on something neither of us fully understands. This is the way we think it works and are wondering if it's correct. When you ...
Grant Curell's user avatar
3 votes
0 answers
998 views

How can I send stdout to multiple commands in fish shell?

Same question as How can I send stdout to multiple commands? but for fish shell.
user699151's user avatar
3 votes
1 answer
591 views

Signal not received by script run using sh -c

I have a script which sleeps for 3 minutes before running a time consuming command. I want the script to exit if it receives SIGINT only while it is sleeping, and not when it is executing the long ...
user3490458's user avatar
3 votes
0 answers
555 views

Control characters in a terminal with an active foreground process

Say I have a process running in a terminal in the foreground. While it is active I can type commands, hit return, and those will be executed once the process is done. Now say furthermore I would like ...
deso's user avatar
  • 31
3 votes
0 answers
252 views

How can I buffer a pipe with minimal added latency?

I am connecting to a debian system over a serial connection and streaming real time data from a pressure sensor. Originally I used: python3.6 pressure_streamer.py The data is being produced at 32....
David Howlett's user avatar
3 votes
1 answer
143 views

New (login) shells (window) opens at $HOME rather than $PWD (like they used to) on macOS. What gives?

Every time I open a new shell window, I'm brought to my home directory rather than the current directory I was in when I gave the command to open a new Terminal.app window. I am under the impression ...
GH05T's user avatar
  • 46
3 votes
1 answer
114 views

zsh fail to keep unquoted `$*` and `$@` equal

All shells tested do the same for the (quoted) pair "$*" and "$@" with this code: c='set a b @ c; IFS=:,@ ; a=$(printf "<%s> " "$*"); b=$(printf "<%s> " "$@"); printf "%-20s and %-20s\n" "...
user avatar
3 votes
0 answers
1k views

Umask value isn't reflected after making changes

I changed umask from 002 to 007 in /etc/bashrc and in /etc/profile. After logging as a normal user I run umask, and it displays 0027. It should display 0007, but it doesn't. What should I do? if [ $...
AlfaBet's user avatar
  • 39
3 votes
1 answer
76 views

Is there a version of the 'find' command that saves its state?

If a find is searching a large disc, and is aborted for some reason, I'd like to be able to start it again, from where it left off. Is there a version of 'find' that does this? The problem is that, ...
Peter Brooks's user avatar

1
2 3 4 5
24