How to diff directories over ssh

I am trying to recursively compare a directory in the local host to a directory in a remote linux machine. However, when i execute the next command: diff -r ‘ssh admin@10.0.0.10:/home/admin’ /home/admin it doesn’t work saying: diff: ssh admin@10.0.0.10:/home/admin: No such file or directory what is the right way to compare recursively the directories contents? … Read more

Linux API to list running processes?

I need a C/C++ API that allows me to list the running processes on a Linux system, and list the files each process has open. I do not want to end up reading the /proc/ file system directly. Can anyone think of a way to do this? Answer http://procps.sourceforge.net/ http://procps.cvs.sourceforge.net/viewvc/procps/procps/proc/readproc.c?view=markup Is the source of ps … Read more

Job for mysqld.service failed See “systemctl status mysqld.service”

Console says [root@ip-172-31-18-2 mysql]# service mysqld start Starting mysqld (via systemctl): Job for mysqld.service failed because the control process exited with an error code. See “systemctl status mysqld.service” and “journalctl -xe” for details. mysqld.service [root@ip-172-31-18-2 mysql]# systemctl status mysqld.service ● mysqld.service – SYSV: MySQL database server. Loaded: loaded (/etc/rc.d/init.d/mysqld) Active: failed (Result: exit-code) since Sat … Read more

Why is the probe method needed in Linux device drivers in addition to init?

In the linux kernel, what does the probe() method, that the driver provides, do? How different is it from the driver’s init function, i.e. why can’t the probe() functions actions be performed in the driver’s init function ? Answer Different device types can have probe() functions. For example, PCI and USB devices both have probe() … Read more

How to remove all non-numeric characters from a string in Bash?

Example: file=”123 hello” How can I edit the string file such that it only contains the numbers and the text part is removed? So, echo $file should print 123 only. Answer This is one way with sed: $ echo $file | sed ‘s/[^0-9]*//g’ 123 $ echo “123 he23llo” | sed ‘s/[^0-9]*//g’ 12323 Or with pure … Read more