All Questions
13 questions
1
vote
1
answer
489
views
Duration of connections returned by ss
Using ss, we can identify the local address, peer address, and process.
Is there a command that returns how long these connections have been active?
4
votes
1
answer
9k
views
Is it possible to check if a specific process is sleeping or running?
I've created the following script on Ubuntu that can pause and start a specific process:
#!/bin/bash
loopProcess () {
COUNTER=0
while [ true ]; do
echo $COUNTER
sleep 1
let ...
0
votes
2
answers
813
views
$! doesn't work on command line
I am running the below directly in bash command line prompt:
$ PIDS= ;while read name; do (cd $name; npm install) & echo started install; PIDS+=($!); done < <(\ls); for pid in ${PIDS[@]}; ...
5
votes
2
answers
627
views
Why does this endless loop not use up my system resources?
I did the following in BASH:
while true;do bash;done
I wrote this one liner, but I was not sure at first whether it:
stays in the main shell and fathers as many subshells as it runs dry of memory or ...
1
vote
1
answer
519
views
Determine how bash or sh was called
From a bash or sh shell, how can I determine if it was called with the bash or sh command, a login shell, an xterm, and, in the case of the former, how was that called?
For example, if I call bash ...
2
votes
2
answers
6k
views
How to kill line of PID?
I have process which created multiple PID's. I want to kill all those PID's. I have tried
pkill <process_name>.
But PID not getting killed as they were wait to resource releasing.
I have ...
87
votes
5
answers
70k
views
Run multiple commands and kill them as one in bash
I want to run multiple commands (processes) on a single shell. All of them have own continuous output and don't stop. Running them in the background breaks Ctrl-C. I would like to run them as a single ...
2
votes
2
answers
6k
views
Spawn multiple processes with a single command
Is there a way to create say 10 instances of a process (for example yes) with a single command?
$instantiate 10 yes
7
votes
2
answers
3k
views
How to kill a bunch of jobs based on ps output?
Here is output from ps:
$ ps aux | grep blob
ubuntu 4286 0.0 0.1 34748 9592 ? S Jan14 0:00 /usr/bin/python /usr/local/bin/pynt start_blob_reader
ubuntu 4287 0.0 0.1 34748 ...
1
vote
0
answers
39
views
How to get stdout of process? [duplicate]
I started a process from the command line, but the window server died. However I see the process I started is still running. Is it possible to connect a terminal to the process to see its output?
...
2
votes
1
answer
1k
views
fg a bg process because you forgot to redirect output to /dev/null
I did Ctrl+Z bg with the intention of disowning next, but I forgot to redirect, now I cant get to my terminal because the scrolling of the output (tarballed a huge directory with verbose set).
How do ...
3
votes
1
answer
1k
views
How does the piping in this command ultimately achieve to kill the process?
I have seen the following line in a bash script for killing a process(in this case started with the command loadgen):
ps xww | grep -i "loadgen" | grep "PATTERNMATCH_FACT.xml" | cut -c1-5 | xargs -i ...
88
votes
4
answers
54k
views
Use & (ampersand) in single line bash loop
I have been using this command successfully, which changes a variable in a config file and then executes a Python script within a loop:
for((i=114;i<=255;i+=1)); do echo $i > numbers.txt; python ...