Posts tagged ‘linux’

You can use sed :

sed -e 's/\([^\d]*\)/\L\1/' in.txt > out.txt

or perl inliner :

perl -ne 'utf8::decode $_; $_ = lc $_; utf8::encode $_; print' in.txt > out.txt
.
Both guys works fine for unicode file too.

Using telnet in bash scripts to automate some stuff ? It’s really easy, here’s an example to tell “hello world” on telnet server :

req="hello world"
server="my_server 1234"
val=`( echo open ${server}
sleep 3
echo "${req}"
sleep 1 ) | telnet`
echo $val

  • Ubuntu doesn’t asking for login after boot up ( may happen after unexpected shutdown ) :
    press Ctrl-Alt-F1 to login in terminal mode and use fsck to fix it
  • Add user short memo :
    [root@my-box ~]# useradd -g users -u 560 tuser
    [root@my-box ~]# passwd tuser

    ps. sudo will be required in not-root case 🙂
  • Proper access rights for .ssh files :
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/id_rsa
    chmod 644 ~/.ssh/id_rsa.pub
    chmod 644 ~/.ssh/authorized_keys
    chmod 644 ~/.ssh/known_hosts
  • List all files in folder sorted by size :
    find . -type f -exec du -k "{}" \; | sort -n

Microsoft is offering about 20,000 lines of its own device drivers to the Linux kernel that will enable Linux to run as a guest on its Hyper-V virtualization technology. Specifically, the contributed loadable kernel modules enable Linux to run in ‘enlightened mode’, giving it efficiencies equivalent to a Windows virtual machine running on Hyper-V. Also see Redmond Releases Code to Linux Kernel Community at pcworld.com