What’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
Tag: Linux
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.
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 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 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 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 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
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 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
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 `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
How to install drivers for TL-WN725N v2 USB wireless adapter on Fedora 19
Posted onI had a TP-Link TL-WN725N v2 USB wireless adapter. But it seems the kernels in Fedora 19 have not yet included drivers for it. How to install drivers for TL-WN725N v2 on Fedora 19? The driver is under development. You can find the source here and in the drivers/staging in the Linux kernel. If you
Read more
How to concatenate multiple video file together on Linux
Posted onI have multiple video files, say video1.avi, video2.avi and video3.avi. How to concatenate these multiple video file to a single file together on Linux? You can use mencoder to concatenate multiple video files to one file. For installing mencoder on Fedora, please check: http://www.systutorials.com/1493/mplayer-on-fedora/ For the question, the command is: mencoder -oac copy -ovc copy
Read more
How to find files in a directory that are larger than certain size?
Posted onI have many files under a directory. How to find those files under the directory that are larger than certain size, say 500MB? Find the files that are larger than 500MB in the current directory (./): find ./ -size +500M Prints our more information about these files: find ./ -size +500M -exec ls -lh {}
Read more
How to find top K largest files in a directory on Linux?
Posted onI have many files in a directory on Linux. How to find top K largest files in a directory? For example, find top 10 (K=10) large files in the current directory: du -h –max-depth 1 * | sort -rh | head -n 10
How to change the fonts of gnome-shell for gnome3?
Posted onHow to change the fonts of gnome-shell for gnome3? Like the system bar. The fonts of gnome-shell is described in its own theme. For the default gnome-shell, you need to edit the file as root: /usr/share/gnome-shell/theme/gnome-shell.css Right, it is a css file. Find the font-family keyword and change the corresponding fonts. Then you can restart
Read more
How to find broken soft links in a directory?
Posted onHow to find broken symbolic links in a directory which have many symbolic links? Use this command to find broken soft links: find -xtype l /path/to/dir/to/find/in/ You can also specify the action by -exec. For example, delete the soft links that are broken in the current directory: find -xtype l -exec rm -f {} ;
Read more
How to change the fonts used in Gnome 3?
Posted onHow to change the fonts used in Gnome 3? The default configuration tool of gnome does not provide an option to change the fonts. However, the gnome-tweak-tool provides it. If you have not installed it, you need to install it first. On Fedora, run # yum install gnome-tweak-tool. Then you can run gnome-tweak-tool and set
Read more
How to change my Linux password
Posted onHow to change my password on a Linux box? The original password is generated by the administrator for me. User the passwd command. The easiest way: Log in the Linux box with your account Run passwd and it will ask your old and new passwords.