-
Archives
- January 2012
- December 2011
- September 2011
- August 2011
- June 2011
- January 2011
- December 2010
- November 2010
- October 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- January 2009
- November 2008
- September 2008
- August 2008
- July 2008
- March 2008
- February 2008
- January 2008
-
Meta
Category Archives: Linux
Bash: getting confirmation to continue or exit
#!/bin/bash while true do read -r -p ‘Are you sure? ‘ choice case “$choice” in y|Y) echo “Processing…” break ;; n|N) echo “Canceled.” exit ;; esac done echo “Complete.”
Vim: set Caps Lock as Ctrl, set Pause as Caps Lock, let Esc be Esc
raymond@ubuntu:~$ cat .Xmodmap remove Lock = Caps_Lock remove Control = Control_L keysym Caps_Lock = Control_L keysym Pause = Caps_Lock add Lock = Caps_Lock add Control = Control_L
Linux Time Synchronization
# ntpdate pool.ntp.org 12 Nov 11:39:23 ntpdate[13390]: the NTP socket is in use, exiting If the socket error shows, it means that your computer’s time is already synchronized by ntp service.
Synchronize time in Linux
This procedure needs root access. $ sudo ntpdate pool.ntp.org
Save streaming video using mplayer
$ mplayer -dumpstream -dumpfile stream_video_name.wmv mms://example.com/video_name.wmv
Enabling and disabling /etc/init.d services
Enabling and disabling services during start up in GNU/Linux
How to Convert Text File From UTF-8 to ISO-8859-1 Encoding
$ iconv –from-code=ISO-8859-1 –to-code=UTF-8 latin1.txt > utf8.txt or simply $ iconv -f ISO-8859-1 -t UTF-8 latin1.txt > utf8.txt $ iconv -t ISO-8859-1 -f UTF-8 inputfile > outputfile
How to redirect pages to a new domain
RedirectMatch 301 (.*)$ http://www.newdomainhere.com$1 Save this into .htaccess and upload on the root directory on your old domain.
How to mount an .iso image file?
$ sudo mount -o loop /path/to/feisty-desktop-i386.iso /tmp/ubuntu-livecd
How to Find and Replace a String on the command line?
This command will replace all instances of ‘replaceme’ with ‘newstring’ in files ‘*.php’ on /home/mysite/httpdocs. find /home/mysite/httpdocs -name ‘*.php’ | xargs replace ‘replaceme’ ‘newstring’ –