Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

5
votes
0answers
4k views

Detach a process from Sh (not Bash) or “disown” for Sh (not Bash)

Consider a shell script executed by Sh, not Bash (and I can't change it, and can't use a shebang, it's ignored). The & operator works, but disown $! does not and makes Sh complains “disown: not ...
4
votes
0answers
82 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
0answers
1k 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 ...
4
votes
0answers
792 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 ...
3
votes
0answers
25 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
0answers
2k 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... * ...
3
votes
0answers
77 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?
3
votes
0answers
258 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 ...
3
votes
0answers
499 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 [ $...
3
votes
0answers
951 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
0answers
1k 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 ...
3
votes
0answers
493 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 ...
3
votes
0answers
922 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 ...
3
votes
0answers
938 views

gnome-terminal cmd leaving processes open after closing parent window

The following simple command should demonstrate my issue: gnome-terminal --tab -t "Tab 1" -e "/bin/bash" --tab -t "Tab 2" -e "/bin/bash" This should open a new window with two tabs and an active ...
2
votes
0answers
75 views

Difference between closing terminal and closing shell on child processes

Opening a new terminal and typing the command firefox& inside, ps -l gives : 4 R 1000 23132 23104 99 80 0 - 2177945 - pts/27 00:00:07 firefox If the shell is closed with the command ...
2
votes
0answers
104 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 ...
2
votes
0answers
56 views

Stop a process when another process starts

I was setting up Bumblee with primus to switch between my discrete/integrated GPUs using the Arch Wiki as a guide when I saw this: Note: Since compositing hurts performance, invoking primus when a ...
2
votes
0answers
43 views

Prompt user with email when Disk Usage is over 200GB

find . -printf "%u %s\n" | awk '{user[$1]+=$2}; END{ for( i in user) print i " " user[i]}' Hi I have been using the above CMDline to look for each user's disk usage information. I would like to know ...
2
votes
0answers
223 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.
2
votes
0answers
150 views

Shell job-control: possible to “rename” a running job?

In the shell (I'm using Bash), I frequently use Ctrl-Z and fg to suspend one job and foreground another. An example would be suspending a running instance of Vim and foregrounding a previously ...
2
votes
0answers
42 views

Stuffing text into a screen tab only after the shell has loaded

I'm setting up my screenrc to open several tabs and already insert commands such that I only need to press enter to start some process. Here's an example screenrc: screen -t test stuff hello ...
2
votes
0answers
41 views

`trap n condition` syntax

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#trap : trap n [condition...] trap [action condition...] If the first operand is an unsigned decimal integer, the shell ...
2
votes
0answers
121 views

Merging two files after checking that some of the columns match

Let's assume that I have two files 912300001.file1.txt and file2.txt and they contain the following: 912300001.file1.txt VALUE 1000 -21 -21 VALUE 1001 -23 -22 VALUE 1002 -23 -21 ...
2
votes
0answers
569 views

How print ip with iftop sorted by bandwidth usage

How I can print the list of IP addresses from iftop output sorted by bandwidth usage?
2
votes
0answers
91 views

Printing autocomplete info on current option in fish shell

When writing a command with a - option and pressing tab, a list of possible completions with short explanations of what the options do is displayed. Is there a way to make this list also contain the ...
2
votes
0answers
3k views

-bash: cannot create temp file for here-document: No space left on device

This is not a duplicate of (although related to) bash: cannot create temp file for here-document: No space left on device. My /tmp is getting filled up fast, although my rootfs isn't full and the ...
2
votes
0answers
254 views

Network traffic monitor “nettop” morphing away from expected results

On Mac, I open a new shell and enter nettop. For a split second I see chrome (as I expected) and some other things going on (had to record screen to catch them); then I'm only shown data on ...
2
votes
0answers
212 views

find-like tool to search (recursively) in MailDir folders by size, sender, recipient, attachment name regex, etc

I am not looking for a tool like locate, that works by creating an index in the MailDir, or generating other runtime files there; I am searching for real-time, direct search on live MailDirs. The ...
2
votes
0answers
227 views

Passing external parameter to .exe on Windows using winexe from Linux

I am trying to execute a .exe on Windows from Linux using winexe. This exe requires an external parameter (string) to be fed alongwith. With the following command I have succeeded in initialising the ....
2
votes
0answers
190 views

Prevent scp and less commands reading interactive tcsh script

I'm using tsch through PuTTY, and let's start by this: please don't try to convince me to migrate to another shell...:) It's being a long time that commands like scp and less didn't work well for me. ...
2
votes
0answers
814 views

Unable to type apostrophe in the terminal

I'm unable to type the character ' in urxvt. Nothing happens if I press the button to type it. If I copy something to the clipboard that contains ', and paste it with shift+insert, the text is ...
2
votes
0answers
62 views

How to make `script` start and end automatically when working in a certain directory?

I want to use the script program to record my session any time that I am working within a certain directory, such as my ~/projects directory. So for example, I would cd into ~/projects, and script ...
2
votes
0answers
1k views

Recording shell output for interactive commands

While looking into a shell redirection problem, I found a couple of answers that pointed me to the script command. As I understand it, script just records in- and output of the terminal, and allows me ...
2
votes
0answers
282 views

“Restart” a process in the same terminal?

I put "restart" in quotes because the following question on SO illustrates what I'm trying to do: https://stackoverflow.com/questions/27957091/restarting-a-process-in-the-same-linux-terminal I'm ...
2
votes
0answers
220 views

How to get the mplayer's single-line playing progress info?

mplayer shows and refreshes a single-line playing progress when playing a media file. A sample result is: A: 17.2 (17.2) of 213.0 (03:33.0) 0.5% And I'm trying to grep this playing progress and ...
2
votes
0answers
465 views

How can you get the current terminal line (the one that is still editable by the user)?

I need a way to use the current line which the users typed into as variable for a shell function. my current code, which can be called by ctrl+r zle -N search bindkey "^R" search search () { read ...
2
votes
0answers
1k views

How does SELinux / SEAndroid prevent or allow pseudo terminal allocation?

I'm trying to resolve an SSH connection issue on an Android phone running SELinux in "Enforcing" mode. The problem is that any SSH connection that tries to allocate a pseudo-terminal (/dev/pts etc) is ...
2
votes
0answers
1k views

Using node.js and shelljs as interactive shell

Following the answer given at Is there a JavaScript shell? That requires me to always execute var shell=require("/usr/local/lib/node_modules/shelljs"); It seems like node forces execute a script ...
2
votes
0answers
2k views

service command: Failed to issue method call

I downloaded the source of tinyproxy and then use ./configure make make install to install it Then I want to start it, but get errors, like the following: [root@kitty tinyproxy-1.8.3]# service ...
2
votes
0answers
264 views

zsh: Echoing every statement?

I have an odd problem with zsh when I switch between shells in a particular way: Option 1 (works well): I start a zsh shell. I switch to tcsh with /bin/tcsh, and I switch back to zsh with /bin/zsh ...
2
votes
0answers
46 views

Make zkbd ignore $DISPLAY

Is it possible to make zkbd ignore $DISPLAY variable? I have set up when I log in to different X sessions and it is annoying if suddenly I need to reenter/copy configuration (and I have no idea why $...
2
votes
0answers
999 views

What happens when you background a function which calls another function?

I'm trying to find out how to background a process in a script that calls another function and reliably terminate it when ready. Will I have to move it all into one function? function dosomething { ...
1
vote
0answers
24 views

Git add, commit, push from bash script

I'm trying to write a simple cron job that will keep my org-mode files in sync with a GitHub repo by committing every now and then. For some reason, it always manages to commit the files, but even ...
1
vote
0answers
33 views

Find where exactly a script is being called from

There is a script in a server (known location) that copies a file from one location to another, eg : cp /dirA/file.DAT /dirB/file.DAT This script is being run daily and copies the file, but I don't ...
1
vote
0answers
98 views

Browse the internet from the command line

I know there are command-line web browsers like w3m lynx etc. But I am looking for a simpler tool to just print search queries. Somewhat like curl does, but more nicely formatted. Like if I run https:...
1
vote
0answers
17 views

Tracing environment variable modification

Pesky $PATH, there's one item I used to use ~/.workspace/bin. I just can't figure where its coming from. I changed the user shell to /bin/sh, and logged in from tty, checked PATH, and it was clear of ...
1
vote
0answers
25 views

How to determine that we are Bodhi Linux or other branches when the ouput for $NAME is “Ubuntu”

On Bodhi linux, if I do this : . /etc/os-release echo $NAME the output is : "Ubuntu", this makes it extra hard to determine what is what for a script. and this will be important when calling apps ...
1
vote
0answers
24 views

Create custom page for lock

I'm new to DD-WRT v3.0-r39469 std (04/10/19) so I have several questions! I want to make a custom LOCKING PAGE in the domain 127.0.0.2 in my network, is it possible? I ran the page to which I wanted ...
1
vote
0answers
40 views

Shell redirection - follow name, not a descriptor

I have a shell script that is run in the background and the only thing it does is run 1 command, STDOUT of which is being appended to a file. my_blocking_command >> my_file I want to stop the ...
1
vote
0answers
36 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 ...