Memo by Michikazu Kobayashi
Linux

Linux in General

  • Find out the number of CPU cores and processors

    See (Jpn)
  • Japanese file names are garbled when decompressing compressed zip files on Windows

                     unzip -O Shift-JIS file.zip
  • Registration of public key

                    cat id_rsa.pub >> authorized_keys
  • Checking the operation of OpenGL

                    glxgears
  • Add another name to localhost

    /etc/hosts
                    127.0.0.1	localhost.localdomain	localhost	othername
  • Delete files whose names begin with a hyphen

                    rm -- -file.txt
  • What i wrote in .ssh/config does not work with Bad owner permissions error.

                    chmod 600 .ssh/config
  • When ntpdate fails to set the time, the ntp server is almost always running; just stop the ntp server. On CentOS

                    /etc/init.d/ntp stop
                    chkconfig ntp off
    On Ubuntu
                    service ntp stop
                    aptitude -y install sysv-rc-conf
                    sysv-rc-conf ntp off
  • Use python as calculator

                    >>> 1+1
                    2
    Also, to load Math modules that contain various functions
                    >>> from math import *
                    >>> pi
                    >>> 3.14159265359
  • Frequently used options in less

    Do not break lines
                    -S
    Display line numbers
                    -N
    Reload
                    -R
  • force nfs or samba unmount

                    umount -f hoge
    if that does not work
                    umount -l hoge
  • Transfer only files with specific extentions via rsync

                    rsync -auvz --include='*/' --include='*.hoge' --exclude='*' sourceplace sendplace
  • Do not transfer only files with certain extensions in rsync

                    rsync -auvz --include='*/' --exclude='*' sourceplace sendplace
  • I want to sort by file type in ls

    In bashrc
                    alias ls='ls -X --color=always'
    if you always do.