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.”

Posted in Linux | Tagged | Leave a comment

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

Posted in Linux | Tagged , , , | Leave a comment

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.

Posted in Linux, Linux Administration | Tagged , | Leave a comment

Synchronize time in Linux

This procedure needs root access. $ sudo ntpdate pool.ntp.org

Posted in Linux, Linux Administration | Tagged , | Leave a comment

Save streaming video using mplayer

$ mplayer -dumpstream -dumpfile stream_video_name.wmv mms://example.com/video_name.wmv

Posted in Linux | Tagged , | Leave a comment

Enabling and disabling /etc/init.d services

Enabling and disabling services during start up in GNU/Linux

Posted in Linux | Tagged | Leave a comment

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

Posted in Linux | Tagged , , | Leave a comment

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.

Posted in Apache2, Linux, Linux Administration | Tagged | Leave a comment

How to mount an .iso image file?

$ sudo mount -o loop /path/to/feisty-desktop-i386.iso /tmp/ubuntu-livecd

Posted in Linux, Linux Administration | Tagged , , | Leave a comment

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’ –

Posted in Linux, Linux Administration | Tagged , | Leave a comment