Tag Info

New answers tagged

0

The four records have different permissions, so they can't be merged. The r-xp entry describes a block of executable memory (x permission flag). That's the code. The r--p entry describes a block of memory that is only readable (r permission flag). That's static data (constants). The rw-p entry describes a block of memory that is writable (w permission ...


1

You can create a recursive script. eg in file /tmp/run #!/bin/bash depth=${1:-5} f(){ let depth-- if [ $depth -gt 0 ] then $0 $depth else sleep 10 fi } f then chmod +x /tmp/run and do /tmp/run 10.


1

Assuming a textbook example shell (for code clarity) that is already running (so the dynamic linker is done), the commands you mention will require the shell to make the following system calls: read: gets the next command in this case gcc fork: two process are needed, we assume the parent has pid 500 and the child for illustration. the parent will call ...


4

Well, the exact sequence may vary, as there might be a shell alias or function that first gets expanded/interpreted before the actual program gets executed, and then differences for a qualified filename (/usr/libexec/foo) versus something that will be looked for through all the directories of the PATH environment variable (just foo). Also, the details of the ...


5

A function would probably be better, yes, but in this case the problem probably is because you are using double quotes around it. The $ variables get expanded before the assignment to the alias. You can use a single quote on the outside instead, or, because you already have single quotes, escape the $ with \: alias findrails_pid="ps aux | grep rails | ...


0

Try the control groups (cgroups) facility. Introduced since Linux 2.6.24, it is a very flexible tool to assign CPU shares to processes as well as to place caps on resource (blockio, network, memory) utilization for each process. Here's documentation.


-1

Use the command "renice" to change a process priority


2

/proc/net/dev contains statistics about network interfaces, while /proc/<pid>/net/dev contains statistics about network interfaces from the process' point of view. I suppose that if a process runs on a network namespace (see man ip-netns) where it has access only to a limited set of interfaces, only these will show up in /proc/<pid>/net/dev.


0

This depends on the shell you are using. Try to call: yourshell -c 'echo bla | read VAR; echo $VAR' and check what is printed. Another check is to run: yourshell -c 'ps -f| more' with different shells and look at PID and PPID. Every shell uses its own different method.


3

Indeed you need to use /proc/; so read carefully proc(5). For process 1234 you want to read /proc/1234/maps (or /proc/1234/smaps) to get the address space, and to read /proc/1234/status & /proc/1234/statm For your own process (programmatically) use /proc/self/maps, /proc/self/status, /proc/self/statm Notice that memory usage is a very ambiguous term ...


2

What you can do is open the file and pass the file descriptor to the other process over a unix-domain socket using the sendmsg system call with SCM_RIGHTS. You can also determine what user ID is running the remote process by reading the SO_PEERCRED socket option. So taken together this allows you to grant control to a specific process, but it's not as ...


0

If you are just interested in minimal information, try in terminal, type sudo gnome-system-monitor. Click on processes.


5

How can I see the raw memory data used by an application... Once you have obtained the process' PID (using ps(1) or pidof(8) for instance), you may access the data in its virtual address space using /proc/PID/maps and /proc/PID/mem. Gilles wrote a very detailled answer about that here. ... and all the files its accessing in my filesystem, network ...


1

Do you have a link for the particular 7-state process model? Generally, blocked processes are put on queues belonging to the events they are waiting for, so the answer would be no. Only the blocked/ready processes would be on a run queue (and even then, depending on the scheduler and number of cores there could be multiple run queues).


3

You can get this information through the virtual /proc file-system (under Linux only). Try to run this command when the process is running (replace the <pid> by the PID of the observed process): grep 'VmSize' /proc/<pid>/status Beware, you have to have read access to the process to get these information (you cannot access it if you do not ...


3

Partial answer: You can see the files it accesses in real-time by using strace something.sh Specifically, it shows you every system call made by the process.


3

A defunct (zombie) process is a process that has terminated, but its parent process hasn't yet done a wait*() on it. If the parent process terminates before the child process, the child process gets re-parented to init (pid 1), and init performs the wait*() on it when it dies. Therefore, every defunct process much be a child of some non-init process.


1

The DHCP client daemon (dhcpdc, dhclient, etc) are programs that are started during the init process. These programs are not always directly invoked by init, but rather the program that handles networking will do this when an interface is configured to use dhcp. For example, netctl is one such program distros use to manage the networking interfaces. This ...


2

PID 4036 is not the root of the process tree; that's PID 1. You asked for the subtree with 4036 at the root, so of course you don't see its parent. But it has one. Every process has a parent except PID 1.


1

wait4 is a syscall indicating the process is waiting for one of his child termination. This may points some issue with the signal handling. A bit brutal, but you may try to kill the hierarchy of the app : kill -15 -$YourRedisPID. The - before the PID means "the PID and its children". As it seems to be waiting for a child termination, it may unlock it. If ...


1

Use chroot (manual here) chroot yourDirectory yourCommand


1

@derobert explained how du operates. He didn't mention that unless you have an absolutely huge number of small files / directories (so the metadata takes a huge amount of memory), then running du again right away usually produces a result much more quickly. One large file doesn't make du slow, but copying it is more likely to push directory caches out of ...


2

du works by scanning through the directory recursively, counting up the size of all the files & directories. Something like: start with the first directory given on the command line. stat the directory to determine its size, add that to the total read the first entry (file or subdirectory name) from the directory if it's a file, stat it and add it to ...


0

If you have rsync installed you can watch the copy progress like this rsync -vP big_directory new_location If you wanted to preserve permissions, timestamps, ownerships, etc. you would add the -a flag to rsync or the -p flag to cp. This answer sidesteps the use of du on the assumption that you actually wanted to watch the progress of the copy rather ...


2

You can't kill a zombie. As the name indicates, it's dead. A zombie is not a real process, it's only an entry in the process table, waiting for the parent to take notice. A process doesn't change its process ID. If you see new process IDs appear, it's because something is spawning them. If the process you're killing is being monitored, the monitoring ...


2

You're running Ubuntu 14.04, which uses upstart as its init process. As we can see from looking at /etc/init/cups.conf, it has a respawn stanza, so by default when the cupsd process ends, another one will be started. # kill -TERM -3390 # tail -1 /var/log/syslog Aug 9 14:22:49 ubuntu kernel: [ 283.270126] init: cups main process ended, respawning You ...


3

Now that we know what you really want... Use -o to select your desired fields. For instance: $ ps -eo pid,ppid,%cpu,%mem,args PID PPID %CPU %MEM COMMAND 1 0 0.0 0.0 /usr/lib/systemd/systemd --system --deserialize 22 ...more procs... 1522 3205 0.0 0.0 nginx: worker process 1523 3205 0.0 0.0 nginx: worker process 1525 3205 0.0 0.0 ...


-2

Please, make sure you have the rights to kill the process. That is the only way, supposing the error is not kernel-related, a kill -9 would not work. Read more on kill topic here: What if 'kill -9' does not work?


-1

pkill -f string where string is a part of the process name


1

The command pkill may be available on your system. Instead of a PID, it takes a process name pattern as argument which allows you to designate the process to kill by their name instead of by PID, for instance if you would like to terminate the httpd process: pkill http In case of need, it can also take the -9 parameter to brutally halt the process. By ...


8

As mentioned in a comment and without seeing any of your code or other information (which would not be on-topic here anyway) all I can say is your program appears to be IO bound. The means while your calculations could use more of your CPU, they are having to wait on data and spending many cycles waiting rather than calculating. This can be due to the way ...


2

That pretty much means your apps are IO bound--your hardrive/network, etc. can't keep up with your processor and consequently, the processor spends a lot of time waiting on IO data, not using its full potential. If the IO your apps depend on is the network and you aren't downloading at your full bandwith, you might get an efficiency increase by adding more ...


4

Killing a parent process won't kill child processes unless the parent traps and resends the signal. Killing a process group with TERM sends the TERM signal to all members of the process group so that's the way to go, but you should make sure that the parent starts a process group (or that the parent's parent starts a process group and you don't care about ...


0

A workaround using wait: With wait you could use a PID to wait for: wait $PID, but we will simply use the argument for running our second command. Note that all output must be ignored for not being passed as argument to the wait command (thus leaving us with an argumentless use of wait as in command & wait) process1 & wait $( process2 &> ...


1

Perhaps options "-l" or "-j"? (Depending on the version of your "ps") https://www.freebsd.org/cgi/man.cgi?ps(1)


2

Some experiments: $ yes | sleep 10m & [1] 32395 32396 $ pstree -pa $(ps -o ppid= -p $(pgrep yes)) zsh,29630 ├─pstree,32402 -pa 29630 ├─sleep,32396 10m └─yes,32395 As can be seen, the parent of both processes is the shell. With a longer pipeline: $ sleep 10m | sleep 10m | sleep 10m | sleep 10m & [1] 32320 32321 32322 32323 $ pstree -pa $(ps ...


4

It's the shell; as you will see via the ps command, in that case the PPID of less will be the PID of the shell. The processes ls and less haven't much in common; it's just that the stdout of the former is piped in the stdin of the latter.


1

This is not answering you question, but this answer on SU is solving your problem, I guess: Using ProxyCommand in your ~/.ssh/config should do everything for you: Host server HostName server.tld User {server user} Host proxy ProxyCommand ssh server -W %h:%p User {proxy user} Then you can access your server simply by using ssh server


0

If I interpret your command correctly, would it not be the same as this? ssh -t user@jumphost ssh user@destination ... All your -L seems to be doing is a port forward to the SSH server of the jumphost - but you're already connecting to that so why the additional tunnel? In this scenario the jumphost would also be the SSH client for the 2nd connection. If ...


2

4.89 of lsof supports displaying endpoint options. Quoted from lsof.8: +|-E +E specifies that process intercommunication channels should be displayed with endpoint information and the channels of the endpoints should also be displayed. Currently only pipe on Linux is implemented. Endpoint information is displayed in the NAME column ...


5

The short answer is: A process can only be brought to the foreground in the terminal it was started in. Its stdin, stdout and stderr are linked to that window and they can't be changed from the outside i.e. from another process. The long answer is: There are some options to see some of its output, see here


0

Flags are represented by the bitwise OR of their numeric value; this is called a mask. As long as the flags are incompatible, adding them gives the same result, but reasoning in terms of additions obscures the way to find flag values from the mask. 4 means “used super-user privileges”, and 1 means “forked but didn't exec”, as indicated in the manual. 5 ...


2

Hint: (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Try running netstat using sudo, i.e. sudo netstat ...



Top 50 recent answers are included