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,157 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10 votes
3 answers
1k views

Is it possible to send data to the the shell of another pseudo-terminal?

This image shows how pseudo-terminals work: If I have two terminal emulators open, I can send the string "Hello" from the first terminal emulator to the second terminal emulator: echo "Hello" > /...
  • 543
8 votes
1 answer
4k views

List all jobs in all shell sessions (not just the current shell), by current user

I know that the jobs command only shows jobs running in current shell session. Is there a bash code that will show jobs across shell sessions (for example, jobs from another terminal tab) for ...
  • 272
6 votes
1 answer
359 views

cp overrides my default permissions settings, when copying files with: cp -r --no-preserve=all

My default umask is 077. When I create a directory, it has permissions 700: mkdir AA $ stat -c'%A %n' AA/ drwx------ AA/ now I want to set default permissions recursively to 750: ...
5 votes
2 answers
1k 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 ...
  • 3,789
5 votes
0 answers
199 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 ...
  • 245
5 votes
0 answers
827 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 ...
5 votes
2 answers
287 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 ...
  • 51
5 votes
1 answer
2k 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 ...
5 votes
1 answer
1k 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 ...
5 votes
1 answer
143 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, ...
  • 61
5 votes
0 answers
1k 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 ...
  • 51
4 votes
0 answers
156 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 ...
4 votes
0 answers
158 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 ...
  • 3,789
4 votes
0 answers
305 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 ...
  • 161
4 votes
2 answers
212 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 ...
4 votes
0 answers
131 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 >> ...
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 ...
  • 41
4 votes
1 answer
4k 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... * ...
  • 41
4 votes
0 answers
189 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?
4 votes
1 answer
435 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 ...
4 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 ...
  • 41
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 ...
  • 1,202
4 votes
1 answer
1k 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:...
  • 141
3 votes
2 answers
4k views

Why is git bash so slow to give me a command prompt and how can I fix it?

I used tcsh for decades on cygwin and just started using git-bash on my new Windows PC. It's generally a step up but the time from when the last command finishes until I receive the next command ...
3 votes
0 answers
321 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 ...
  • 121
3 votes
0 answers
216 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 ...
3 votes
0 answers
77 views

force specific shell environment variable on process using /etc/pam.d/ rules

I am using slim login manager, and it has its own pam rules file: /etc/pam.d/slim. auth requisite pam_nologin.so auth required pam_env.so readenv=1 auth required pam_env....
3 votes
1 answer
551 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 ...
3 votes
0 answers
311 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 ...
3 votes
0 answers
44 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 ...
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 ...
3 votes
0 answers
271 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 ...
  • 27.6k
3 votes
0 answers
858 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 ...
3 votes
0 answers
360 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.
3 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 ...
3 votes
0 answers
899 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.
3 votes
1 answer
481 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 ...
3 votes
0 answers
485 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 ...
  • 31
3 votes
1 answer
127 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 ...
  • 46
3 votes
1 answer
106 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
831 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 [ $...
  • 39
3 votes
1 answer
72 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, ...
3 votes
1 answer
687 views

"render" textfile with carriage returns (^M) and save output to file

I have a Python CLI program that runs for a long time and has a sort of progressbar, which basically prints some text in the loop without "\n" at the end, at the next iteration it prints "\r" to erase ...
  • 181
3 votes
1 answer
3k views

How to kill inactive user logins on Solaris?

On a Solaris 10 server if i do a w, I get this: 12:26pm up 85 day(s), 1:13, 6 users, load average: 0.38, 0.36, 0.38 User tty login@ idle JCPU PCPU what blah pts/1 ...
  • 305
3 votes
1 answer
803 views

Secure share in samba not working, why?

The secure share that I created in samba with a password doesn't seem to work. I have the following on my /etc/samba/smb.conf on a Linux Mint box(3.13.0-37-generic) box. [myshare] ...
  • 1,921
3 votes
0 answers
2k views

Where EOF character is processed when it sent over telnet connection

Let's suppose I am connecting to telnet server, where bash is running. I am executing command cat > /tmp/qqq; typing some contents of a file and finally sending 0x0a 0x04 which meant EOF. The ...
3 votes
1 answer
950 views

Generate SFV file, optimizing hard links

I'm currently running cfv -C -rr to generate a SFV file that contains the CRC32 checksums of all files in all subdirectories. The issue is that because there are so many hardlinks, this process is ...
3 votes
1 answer
819 views

Higher-level wrapper for entr or inotifywait

I'm looking for a way to rerun a specific command as soon as any of the files in a subdirectory (perhaps minus selected excludes) changes. Use case I'm working on a project that is self-contained in ...
  • 917
3 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 ...
  • 1,625
3 votes
1 answer
3k views

nmap won't recognize a hostname on my local area network

Scanning the machine on the LAN with my laptop, I got this: gabriele @ osiris { ~ } [ Tue Oct 07 ] [ 08:49 PM] nmap -sP 192.168.1.236 Starting Nmap 6.40 ( http://nmap.org ) at 2014-10-07 20:50 CEST ...

1
2 3 4 5
24