Harry asked: What is the meaning of ‘@’ in Makefile? An example is as follows. $ cat Makefile all: @echo “For correctness test of basic get and put, run: make test;” Without ‘@’, it works well. Without @: $ make echo “For correctness test of basic get and put, run: make test;” For correctness test
Read more
Author: Eric Ma
Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.How to enable iptables on CentOS 7 / Fedora 20?
Posted oniptables is plain old good. How to enable it after I disable firewalld? First, install the iptables-services package as root: # yum install iptables-services Then, start iptables service as root: # touch /etc/sysconfig/iptables # touch /etc/sysconfig/ip6tables # systemctl start iptables # systemctl start ip6tables # systemctl enable iptables # systemctl enable ip6tables
How to totally disable firewall or iptables on Fedora 20
Posted onOur servers run inside our own cluster and no firewall is needed. How to totally disable firewall or iptables on Fedora 20? Fedora 20 uses FirewallD as the firewall service. To totally disable firewalld: # systemctl disable firewalld # systemctl stop firewalld
How to resume a printing job on HP printer if the paper runs out on Linux?
Posted onHow to resume the printing job on HP printers if the paper runs out on Linux? A tip: “lifting the cover to access the toner and putting it down without touching anything else will clear the out of paper error and continue printing” from here.
Convention of error codes on Linux and Windows
Posted onWhat’s the error code conventions on Linux and Windows? Linux and Windows use 0 to indicate that the operation is successful and an integer that is larger than 0 for some errors. Linux System Error Codes On Linux, the system error codes is defined in 2 headers which you can find on your own box:
Read more
Multi-connection multi-part file downloading tools on Linux
Posted onIs there any good multi-connection multi-part file downloading tools on Linux? wget is great but can only make 1 connection for 1 file. Sometimes, it is too slow on some networks. I use aria2 which supportsmMulti-connection download. aria2 can download a file from multiple sources/protocols and tries to utilize your maximum download bandwidth. Really speeds
Read more
How to get the directory path and file name from a absolute path in C on Linux
Posted onHow to get the directory path and file name from a absolute path in C on Linux? For example, with “/foo/bar/baz.txt”, it will produce: “/foo/bar/” and “baz.txt”. You can use the APIs basename and dirname to parse the file name and directory name. A piece of C code: #include <libgen.h> #include <string.h> char* local_file =
Read more
Ghostscript reports “Unrecoverable error: stackunderflow in .setdistillerparams”
Posted onWith the command -dPDFSETTINGS=/print for ps2pdf, I got: GPL Ghostscript 9.10: Set UseCIEColor for UseDeviceIndependentColor to work properly. Unrecoverable error: stackunderflow in .setdistillerparams make: *** [pdf-print] Error 255 How to fix it? I use this workaround: ps2pdf -dColorConversionStrategy=/LeaveColorUnchanged -dPDFSETTINGS=/printer psfile.ps from this. An alternative is to use -dPDFSETTINGS=/prepress.
How to print a plain text file to printers from a terminal in Linux
Posted onHow to quickly print a plain text file to printers from a terminal in Linux? You can also use enscript: enscript – convert text files to PostScript, HTML, RTF, ANSI, and overstrikes https://www.systutorials.com/docs/linux/man/1-enscript/ enscript text-file The lp command can print a plain text file to a printer. My favorite command: cat text-file | lp -o
Read more
How to print out text with line numbers in Linux
Posted onHow to print out a plain text file with line numbers in Linux? Use the nl command: nl text-file Find options in the nl manual.
Alternatives to goto in bash
Posted onAs we know: There is no goto statement support in bash. goto is useful for certain situations, especially for debugging. So, is there any alternative mechanisms to goto in bash? Robert Copeland gave an interesting hacking to this problem: http://bobcopeland.com/blog/2012/10/goto-in-bash/ The idea is like the self-modifying code. But the difference is to generate a piece
Read more
How to export and import message filters of Thunderbird
Posted onI have several installation of Thunderbird under Linux to check/send emails using IMAP email servers. I use filters extensively to manage my emails. How to export and import message filters of Thunderbird so that I can synchronize the rules on several installations? About message filters in Thunderbird (More at http://kb.mozillazine.org/Filters_(Thunderbird)): Filters are account specific, there
Read more
How to add a space between the line numbers and text content in Emacs?
Posted onI use Emacs in console. The linum-mode displays the line numbers just well. However, in the console, there is no space between the line numbers and the text content, which makes it a little messy some times. How to add a space between the line numbers and text content in Emacs? If you are using
Read more
How to make xterm display Chinese characters?
Posted onHow to make xterm display Chinese characters? It just displays some small rectangles for Chinese characters. First, the settings for some old X programs like xterm is in ~/.Xresources. And it takes effect after the X server restarts, or you can manually load the settings by xrdb -merge ~/.Xresources Second, the Chinese or similar fonts
Read more
How to make Emacs start up faster?
Posted onI use Emacs in consoles and start Emacs frequently (like check a file, edit it, close it and loop). However, Emacs seems take some time to start up especially some modes/extensions are used. How to make Emacs start up faster? I summarize my solution at this post: Making Emacs Startup Faster. The key is to
Read more
How to back up a complete IMAP account?
Posted onI have a large IMAP email account which contains many emails in a rich structure of directories. How to back up the whole IMAP account to my local computer? The requirements: Automatically downloading these files. There are many directories, and copying-pasting emails will take too much time. Keep the directory structures which are used to
Read more
How to set options for scala in sbt
Posted onIn sbt, I found this message printed out by the scala compiler: [warn] there were 1 deprecation warning(s); re-run with -deprecation for details [warn] one warning found The question is, how to add options (-deprecation here) to the scala compiler in sbt? You can use this inside the sbt console: set scalacOptions += “-deprecation”
How to change the default text editor on Linux
Posted onOn Linux, a default editor is used for text editing such as crontab -e or git commit. How to change it to the editor of my own choice? The default editor is indicated by the EDITOR environment variable. You can set this environment variable to set the default editor. For example, set it to emacs
Read more
Directly SSH to hosts using internal IPs through the gateway
Posted onWe have many hosts with internal IPs like 10.0.3.* behind a gateway, say gateway.example.org. The hosts with internal IP connect to the Internet through the gateway. How to directly SSH to hosts using internal IPs through the gateway? Here is the solution: Directly SSH to Hosts with LAN IPs Through the Gateway
How to `cut` a String Using a String as the Delimiter in Bash?
Posted onIs is possible to cut in Linux using a string as the delimiter? cut –delimiter=”delim” -f 1,3 cut reports: cut: the delimiter must be a single character The most closest solution that I find is using awk/gawk: awk -F ‘delim’ ‘{print $1; print $3}’ From the manual: -F fs –field-separator fs Use fs for the
Read more