How to add header footer in directory listing in Apache (httpd)? In the web directory’s .htaccess file: Options +Indexes IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8 HeaderName /header.html ReadmeName /footer.html IndexIgnore header.html footer.html .htaccess header.html and footer.html are under the website root directory (not the Linux root).
Tag: Linux
How to rearrange Alt, Ctrl and Win keys on Linux: Win as Alt and Ctrl/Alt as Ctrl
Posted onHow to rearrange Alt, Ctrl and Win keys on Linux: Win as Alt and Ctrl/Alt as Ctrl? On Linux, the Win key is seldom used. Mapping the Alt keys which are close to my thumb is damn convenient for Emacs users. Hence, the keyboard at the bottom line would look like: ———————————————————— |Ctrl|Alt|Ctrl| Space Bar
Read more
How to split a text file by lines on Linux?
Posted onHow to split a text file by lines on Linux? For example, to split a file content.txt into many files and each split contains 1024 lines. You can use the split command on Linux: split -l 1024 content.txt splitted-content.txt- It will generate splitted-content.txt-{aa,ab,….}
How to reset the keyboard set by xmodmap on Linux?
Posted onHow to reset the keyboard set by xmodmap on Linux? You can reset your keyboard settings by: setxkbmap or setxkbmap -option depending on the way the keyboard was set by xmodmap.
How to turn the space bar to another ctrl key?
Posted onHow to turn the space bar to another ctrl key? It will be dam useful especially for Emacs users and also useful for normal usage like for tab changing in Chrome or Gnome terminal. You may try 2 tools in userspace: Space2Ctrl: https://github.com/r0adrunner/Space2Ctrl xcape: https://github.com/alols/xcape Note that the limitation of these solutions: the space will
Read more
How to swap alt and ctrl on Linux for Emacs?
Posted onHow to swap alt and ctrl on Linux for Emacs? It will be more easier to press the ctrl keys which is a very important key for Emacs. You can make of xmodmap. Save this as a file modmap: clear control clear mod1 keycode 64 = Control_L NoSymbol Control_L keycode 37 = Alt_L Meta_L Alt_L
Read more
How to detect memory leaks of C programs in Linux?
Posted onHow to detect memory leaks of C programs in Linux? I also have access to the source code of the program. There are many posts related to this: Easy and quick tools on Linux (while not very accurate): http://blog.thewebsitepeople.org/2011/03/linux-memory-leak-detection/ Valgrind: manual and a tutorial. gperftools has the Google Heap Profiler which can checks for memory
Read more
How to make Alt-Tab switch among windows instead of applications in Gnome 3?
Posted onThe default Alt-Tab in Gnome 3 switches among applications and windows are grouped by application. How to make Alt-Tab switch among windows instead of applications in Gnome 3? Check the Alternate Tab Gnome 3 extension and you will love it. Substitute Alt-Tab with a window based switcher that does not group by application. This extension
Read more
How to remap the Caps Lock key to Control for Emacs
Posted onHow to remap the Caps Lock key to Control for Emacs? My left little finger is just so tired… You can either change it in gnome-tweak-tool on Gnome 3: Or: You can make use of 2 tools: xev to find out the key code for Caps Lock and xmodmap to modify key maps. First, run
Read more
How to dd on Windows?
Posted ondd is a handy tool on Linux. But is it possible to run it on Windows? I find the dd in cygwin works very well for me. It provides as almost (if not the same) functions as the dd on Linux. The disks are specified in /dev/ as on Linux. This solution means: you need
Read more
gthumb hangs at startup on Fedora
Posted ongthumb hangs at startup on Fedora when I plugged my iPhone on the USB. How to solve this? You need to unmount the iPhone: Open nautilus. Press F9 (may need twice) to open the side panel if it is not opened yet. Find your iPhone on the side panel and unmount it by click the
Read more
How to make Emacs run in command line by default?
Posted onHow to make Emacs run in command line by default? I do not want to open the X window. You have at least 2 choices. First choice: use emacs-nox and make it the default: # yum install emacs-nox # alternatives –config emacs and choose emacs-nox. Second choice: use emacs but with -nw to disable the
Read more
How to install Fedora 20 on a mbr/ms-dos disk?
Posted onHow to install Fedora 20 on a mbr/ms-dos disk? The nogpt and noefi trick seems do not work. This is a bug in F20 installer that still believes it is in UEFI native mode even if the noefi parameter is passed. Solution: There is an updates image for the installer which fixes this issue available
Read more
How to quickly find out which rpm package provides a command on Fedora Linux?
Posted onHow to quickly find out which rpm package provides a command on Fedora Linux? As an example, we want to find out which package provides the ping command. You can quickly find it out by rpm: $ rpm -qf `which ping` It will give iputils-20121221-2.fc19.x86_64 Alternatively, you can use yum: $ yum provides `which ping`
Read more
How to debug/check network-related driver information on Linux?
Posted onHow to debug/check network-related driver information on Linux? Several commands/tools that you may find usefull: Messages: dmesg grep NetworkManager /var/log/messages lshw: list hardware lshw -c network lsusb: list USB devices lsusb rfkill: enabling and disabling wireless devices rfkill unblock all rfkill event iwconfig: configure a wireless network interface iwconfig ifconfig: configure a network interface ifconfig
How to upgrade Fedora 19 to Fedora 20 through the network?
Posted onHow to upgrade Fedora 19 to Fedora 20 through the network? The tool for Fedora to upgrade the distribution is FedUp. Check this page for how to upgrade Fedora 19 to Fedora 20: http://fedoraproject.org/wiki/FedUp#How_Can_I_Upgrade_My_System_with_FedUp.3F Be sure to check the bugs in Fedora 20 before the upgrading: http://fedoraproject.org/wiki/Common_F20_bugs#Upgrade_issues Generally, it contains 3 steps: Preparation # yum
Read more
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.
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
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
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