Tag Info

Hot answers tagged

15

You could parse the output with sed, as suggested by @Sobrique, or with tr: pidof avconv | tr ' ' '\n' Another approach would be to use pgrep instead: $ pgrep avconv16616 16283 16279 16198 16175 16035 15073 14049


15

User accounts are used not only for actual, human users, but also to run system services and sometimes as owners of system files. This is done because the separation between human users' resources (processes, files, etc.) and the separation between system services' resources requires the same mechanisms under the hood. The programs that you run normally run ...


8

I presume you're finding this list of users by checking /etc/passwd? This is totally normal - 'users' serve to carry a set of permissions, useful for locking down not just 'actual users' but also programs to certain areas of your system and tracking what they changed (same concept with groups). I've inserted one of my Raspberry Pi /etc/passwd files below ...


8

$BASHPID may be what you are looking for. BASHPID Expands to the process ID of the current Bash process. This differs from $$ under certain circumstances, such as subshells that do not require Bash to be re-initialized. As opposed to $$ ($$) Expands to the process ID of the shell. In a () subshell, it expands to the process ID of the ...


8

The files that are opened are not files on disk. They are the streams (pseudo files), stdin (0), stdout (1), and stderr (2). Here is the relevant excerpt from the POSIX standard: A file with associated buffering is called a stream and is declared to be a pointer to a defined type FILE. The fopen() function shall create certain descriptive data for a ...


7

You can just get it that way in the first place... ps -C avconv -o pid=


5

You can always use sed to insert some linefeeds pidof avconv | sed 's/ /\n/g' although perhaps a bigger question is - why do you need them on separate lines? It may be that there's a more appropriate answer.


5

Run gedit as: gedit file.txt & The & at the end will cause the process to run in background and you will be able to use the current terminal interactively again.


5

With bash: echo "$BASHPID" would give you the pid of the process that evaluates that echo command Note that (for instance after a enable -n echo) it is not necessarily the same as the pid of the process that is running that echo command. bash (or any shell) does its own soup with processes. It's not always useful to try and guess what process does ...


4

By strict interpretation what you want to do is impossible. So the question is how much do you have to cheat to pull something like this off? You need bash, a PROMPT_COMMAND and two temporary files. you will also have to accept that the shell will not be updated until the command after completion of the background task. I would also recommend using make in ...


4

Instead of piping find into the loop, you could go through an intermediate file. That will ensure that the finding step and the looping step happen in sequence, with no overlap. Something like the following (I altered your expression for brevity): find \( -name '*.mkv' -o -name '*avi' \) >files <files while IFS= read file do ffmpeg -i "$file" ...


4

You can use this command: gedit abc.txt & disown Source In the bash shell, the disown builtin command is used to remove jobs from the job table, or to mark jobs so that a SIGHUP signal is not sent to them if the parent shell receives it (e.g. if the user logs out).


4

The parent process id (ppid) of a process cannot be changed outside of the kernel; there is no setppid system call. The kernel will only change the ppid to (pid) 1 after the processes parent has terminated - if the process did not respond to a signal that the parent was terminated. For this to happen, the process needs to have ignored various signals ...


3

There are multiple ways to do it depending upon your need. If you are doing it in a shell script for line in $(pidof avconv) do echo $line done If you are looking for a oneliner pidof avconv |perl -pne 's|\s+|\n|g'


3

cgroups were created for exactly this reason. http://www.kernel.org/doc/Documentation/cgroups/ http://www.serverwatch.com/tutorials/article.php/3921001/Setting-Up-Linux-Cgroups.htm It takes a little while to familiarise yourself with them, and I believe you need root access to set them up, but it can all be scripted. The newer Ubuntus have a .conf file so ...


3

There is actually a strong hint in the syslog snippet you posted. The end of the line Apr 10 00:53:37 MyMachine kernel: [11608.690733] [<ffffffffa08e4005>] ? ath9k_reg_rmw+0x35/0x70 [ath9k_htc] shows the stack trace is due to an unexpected error in a device driver named ath9k_htc. Hopefully, the kernel didn't panicked but the continuous repetition ...


3

If the PIDs are e.g. 340 and 520, then you can try the following: $ watch --interval 2 --difference "ps -p 340,520 -o pid,ppid,%cpu,cputime" Here watch will mark the difference of outputs running with 2 seconds interval, here we have used the output formatting -o option to get only process ID (pid), parent process ID (ppid), percentage of cpu utilization ...


3

valgrind will give you this information, along with a number of other statistics on memory use (and it will tell you about memory leaks etc.). It will slow the program down somewhat, but since yours is a short-lived process it shouldn't be an issue. Here's example output from running ls: ==7051== ==7051== HEAP SUMMARY: ==7051== in use at exit: 351,689 ...


3

According to the manual page of sigpending: sigpending() returns the set of signals that are pending for delivery to the calling thread (i.e., the signals which have been raised while blocked). So, it is meant the signals (sigterm, sigkill, sigstop, ...) that are waiting until the process comes out of the D (uninterruptible sleep) state. Usually a ...


2

You don't need to open the log files in an editor to see what's flooding them. Just look at the last few lines: tail -n 999 /var/log/syslog | less Log files from a process always contain the process ID: Apr 10 00:00:01 harfang /USR/SBIN/CRON[345]: (root) CMD ( /usr/local/bin/midnight-stuff ) Apr 10 00:00:01 darkstar wibbled[1234]: I'm bored Apr 10 ...


2

I don't believe there is a way in general. There might be for some specific OS. You said Unix/Linux, but perhaps you are interested in a solution for a particular OS? As an example, Solaris stores the processes argument in two locations. One is an immutable buffer in the kernel associated with the process. But because it's a kernel buffer, the length is ...


2

I already answered a similar question a few months ago. So see that first for technical details. Here, I shall just show you how your situation is covered by that answer. As I explained, I and other writers of various dæmon supervision utilities take advantage of how Linux now works, and what you are seeing is that very thing in action, almost ...


2

hidepid is a mount option for procfs that hides processes from other users. There are three settings: hidepid=0: Anyone can read the world-readable files in /proc/PID hidepid=1: Users can only access the /proc/PID directories and files that belong to their user. hidepid=2: The same as hidepid=1, but the processes of other users will not even be visible in ...


2

That seems like a DDoS trojan. Mostly those trojans are in cronjobs. Stop the cron daemon and check your /etc/crontab and /etc/cron.* files for multiple cronjobs that create those files.


2

I tested this on 2 virtualbox setup, both using OS X as host, and assigned only 1 CPU for each client. 1 Ubuntu 14.04.2 In this setup, under X window environment, the behavior matched OP john@U64D:~$ ./a I'm the parent, my PID is 2682, my parent is process 2632 This sentence has been printed by process: 2682 my parent is process 2632 john@U64D:~$ This ...


2

Change its execute permission bits. As root, use the command: chmod a-x path_to_process_binary This basically denies execute permission to owner, group and others (as a = all). This simple trick will prevent the process from running, but I believe you might have something more serious going on in your system. If you actually need to run it yourself, ...


2

No, the process is stopped, not killed. So ps will still show it. If you run ps ax, you will see its status is T. In this state, the process will do nothing until it receives a SIGCONT, then it will continue to run (if you type fg in your terminal, you'll see the process starting again from the point it stopped, so in your case the next icmp_seq will be 5). ...


2

Without knowing any more information, especially the nature of the process involved, I would have to say, yes, I guess it is dying between the pidof and kill. You could use killall instead of basically your whole block of code. The race condition would be still present, but the window would be shorter. Because in all likelihood this code is fine and in ...


1

On Linux when we install a service it creates a user of its service name or similar to that so that it can't access others files.


1

If you don't use wait(), the parent can finish before the child ever gets a chance to run. By the time the child process calls getppid(), the parent has exited, so the child is adopted by init. On a normal Unix implementation, the PID of init is 1, so you would expect it to say my parent is process 1 when this happens. But apparently VirtualBox changes this. ...



Only top voted, non community-wiki answers of a minimum length are eligible