How 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,….}
Tag: Tutorial
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 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 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 change default OS for windows dual boot manager in Windows 7?
Posted onHow to change default OS for windows dual boot manager in Windows 7? The c:/boot/ in older Windows does not exist anymore. Open the Control Panel and click on the System icon. In the left pane, click on the Advanced system settings link. Under the Advanced tab, click on the Settings button under Startup and
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 @import a css file only for wide screens
Posted onHow to @import a css file, such as for an open fonts hosted by Google, only for wide screens, such as with px of larger than 846? A piece of css that you can use: @import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,300,400,700,900) (min-width:846px) This import Open Sans fonts for only screens of at least 846 px.
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 manually set the boot entry for Windows in grub2?
Posted onHow to manually set the boot entry for Windows in grub2? Suppose that your Windows is installed on the first partition of the first disk (hd0,1) (yes, it’s right, that is (hd0, 1) if your distribution has not modified grub2’s default behavior) in NTFS format. You can boot your Windows in grub2 by: insmod ntfs
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 set Internet Explorer’s Proxy in command line on Windows 7?
Posted onHow to set Internet Explorer’s Proxy in command line on Windows 7? You can use this tool: SetProxy. On Windows 7, it works still to set IE’s proxy. Note that the proxy setting is for IE only. If you need to configure the proxy for other services like Windows Update or other programs that use
Read more
Get the number of files in a directory
Posted onHow to the number of files in a directory ls | wc -l works well for me. http://stackoverflow.com/questions/3702104/find-the-number-of-files-in-a-directory
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 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 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.