How to find out the MX record for a domain on Linux?

Posted on

How to find out a domain’s MX record for Email on Linux? For example, to find which domain/IP the email to gmail.com is delivered to. You may make use of the host command. The -t option is used to select the query type. type can be any recognized query type: CNAME, NS, SOA, SIG, KEY,
Read more

How to redirect anything written on a file to another file in linux?

Posted on

Suppose we have two files, a.txt and b.txt . If we write anything in a.txt & b.txt, it should be redirected to c.txt. tee may help for this purpose. tee: duplicate standard input You may try a command like this: echo “hello” | tee -a a.txt >>b.txt Both a.txt and b.txt will contain the “hello”.
Read more

Skype crashes because it cannot read data from “C:Documents and SettingsAdministratorLocal SettingsTemp”

Posted on

On my laptop, I install windows xp because it is user-friendly for me. However, Skype cannot be open because “The system is not unavailable”. At last, I find the “Skype” directory under “C:Documents and SettingsAdministratorLocal SettingsTemp” cannot be accessed. “C:Documents and SettingsAdministratorLocal SettingsTemp” is like temporary directory for specific user under Linux OS. Actually, for
Read more

How to enable SSH service on Fedora Linux?

Posted on

How to enable SSH service on Fedora Linux? By default, it seems ssh is not enabled. Fedora may not have sshd service installed/enabled by default. You will need to install and configure it by yourself. The following instructions is for Fedora 22 as an example. First, install the sshd server by # dnf install openssh-server
Read more

How to merge 2 .a libraries to one .a library on Linux?

Posted on

We have 2 static .a libraries and we would like to merge them into a single one for easier usage. How to merge 2 .a libraries to one .a library on Linux? With GNU ar, you can specify the single command-line option -M and control it with a script supplied via standard input, like the
Read more

How to make Fedora Linux not clean some files in /tmp/?

Posted on

On my Fedora 20, I find that the system automatically clean up file under /tmp/. This is convenient. However, it cause some problems for some programs. For example, HDFS puts its DataNode pid file under /tmp/ by default like hadoop-hadoop-datanode.pid. After it is cleaned up, the hadoop-daemon.sh script will consider there is no DataNode running.
Read more

What’s wrong with the messages like “UnrecovData 10B8B BadCRC” and “failed command: READ FPDMA QUEUED” on Linux?

Posted on

I keep seeing messages in dmesg as follows with “exception Emask 0x10” -> “SError: { UnrecovData 10B8B BadCRC }” -> “failed command: READ FPDMA QUEUED” -> “hard resetting link”: [ 7395.936692] ata4.00: exception Emask 0x10 SAct 0xe000 SErr 0x280100 action 0x6 frozen [ 7395.936701] ata4.00: irq_stat 0x08000000, interface fatal error [ 7395.936703] ata4: SError: {
Read more

How to encode spaces in curl GET request URL on Linux?

Posted on

The problem is like this: I would like to send a GET request using curl and the content has spaces, such as curl “http://example.com/send?msg=hello world” The space and the “world” will be left away if this command is executed directory on Linux. How to encode spaces in curl request URL? You can use the –date-urlencode
Read more

How to make curl request pass the Squid proxy?

Posted on

I use curl to send requests to remote servers like following command. curl http://example.com/send –date-urlencode “data=hello” However, it is blocked by the network proxy squid in some networks with message like (some info anonymized with “…”): ERROR The requested URL could not be retrieved POST /… HTTP/1.1 Proxy-Authorization: Basic … User-Agent: Mozilla/4.0 (compatible;) Host: …
Read more

Printing “powernow-k8 transition frequency failed” after install XEN

Posted on

After I installed XEN hypervisor, the tty0 (CTRL+ALT+F1) prints “powernow-k8 transition frequency failed” to STDOUT continously, how to solve it? sudo rmmod powernow_k8 From https://lists.debian.org/debian-user/2013/01/msg00754.html How to make the settings persistent (take effect after reboot)? 1, Create script file ‘/etc/init.d/stop_pwoerk8.sh’ as follows. harry2vera@node1:/etc/init.d$ cat stop_pwoerk8.sh #! /bin/sh rmmod powernow_k8 2, Add the full PATH of
Read more

Implementation of strstr in glibc

Posted on

What is the implementation of strstr in glibc? Implementation of STRSTR in glibc (string/strstr.c): /* Return the first occurrence of NEEDLE in HAYSTACK. Return HAYSTACK if NEEDLE is empty, otherwise NULL if NEEDLE is not found in HAYSTACK. */ char * STRSTR (const char *haystack_start, const char *needle_start) { const char *haystack = haystack_start; const
Read more

How to sort all files recursively by modification time in a directory on Linux?

Posted on

How to sort all the files in a directory and subdirectories recursively by modification time on Linux? You can make use of find (GNU find, or plus stat), sort and sed together to achieve recursively sort files by modification time: find . -type f -printf ‘%T@ %pn’ | sort -k 1 -n | sed ‘s/^[^
Read more

Required packages for building YouCompleteMe for Vim on Fedora 21

Posted on

YouCompleteMe for Vim on Fedora 21 reports this error: [zma@laptop:~/.vim/bundle/YouCompleteMe]$ ./install.sh — The C compiler identification is GNU 4.9.2 — The CXX compiler identification is GNU 4.9.2 — Check for working C compiler: /usr/bin/cc — Check for working C compiler: /usr/bin/cc — works — Detecting C compiler ABI info — Detecting C compiler ABI info
Read more

How to find which program or process is listening on a certain port in Linux?

Posted on

My program reports that the port is already used. How to find which program or process is listening on a certain port in Linux? You can use netstat to do this. netstat can print network connections. For example, to find which program is listing on port 9999 netstat -pln | grep 9999 You will need
Read more

How to move all the files under Users for a user to another drive on Windows?

Posted on

Unfortunately, my C: drive is almost full. Most of the space are used by the user home under C:Users. How can I move the home directory to another drive while not affecting the user’s usage of Windows. On Linux/Unix, moving the directory to another drive/partition and then keeping a softlink is enough. But how to
Read more

Un-exporting an Exported Variable in Bash in Linux

Posted on

How to un-export an imported variable in Bash on Linux? For example, first, I export a variable MODE like export MODE=debug but I want to unexport the MODE (not turn to be `””`, should be truly non-defined). You can export -n MODE or unset MODE For your reference (from the [`bash` manual](https://www.systutorials.com/docs/linux/man/1-bash/)): export [-fn] [name[=word]]
Read more

How to get the directory path and file name from a absolute path in Bash on Linux?

Posted on

How to get the directory path and file name from a absolute path in Bash on Linux? For example, with “/foo/bar/baz.txt”, it will produce: “/foo/bar/” and “baz.txt”. You also have the basename and dirname commands besides of the basename and dirname C API in Linux: [zma@laptop:~]$ p=”/foo/bar/baz.txt” [zma@laptop:~]$ dirname $p /foo/bar [zma@laptop:~]$ basename $p baz.txt