UP | HOME

linux

Table of Contents

Remind me after task done 2012-05-15 Tue

ONEDAY write the note

  • tts: festival
  • notify-send

sort folders by size in command line 2012-03-11 Sun

du --max-depth=1 /home/ | sort -nr

use screen to run command in background 2012-02-20 Mon

detaching and reattaching

  • detaching: Ctrl+a d
  • reattaching: screen -r

view all output

  • scroll back after reattaching
    • enable the copy mode: Ctrl+a [
    • disable the copy mode: Ctrl+a ]
  • enable/disable logging: Ctrl+a H

Find files containing a particular text string 2011-09-19 Mon

$ grep -r "text" /home/xu

GDB attach another process in Ubuntu 2011-05-31 Tue

In Ubuntu 10.10 and later, users cannot ptrace processes that are not a descendant of the debugger. Run the following command to enable:

echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

This will work until rebooting, change PERMANENT as following: change

kernel.yama.ptrace_scope = 1

to

kernel.yama.ptrace_scope = 0

in

/etc/sysctl.d/10-ptrace.conf .

Hide disk icons on the desktop 2011-05-09

  • luach gconf-editor
  • go to app/nautilus/desktop
  • uncheck volumes_visible

gnome can not login?

I tried to configure my desktop today ( change the input method in fact), but then I can not login anymore! I searched in the internet, there are so many possible problem… the real problem is that I can not find out what is wrong! The solution is to see ~/.xsession-errors

upgrade to Ubuntu 11.04 64bit 2011-05-02 Mon

  • Install Ubuntu (Note: choose mount point/partition by ourselves)
  • Reboot
  • Configure /etc/fstab to mount all the partitions
  • Install emacs & emacs-goodies-el (to write this notes :) (Note: find problem with --debug-init )
    • add to quick laucher
      • cp /usr/share/applications/emacs23.desktop ~/.local/share/applications/
      • editor ~/.local/share/applications/ Exec to command that I use (a shell script), the result file:
[Desktop Entry]
Version=1.0
Name=GNU Emacs 23
GenericName=Text Editor
Comment=View and edit files
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=sh /media/Data/git/projects/bash/editor %F
TryExec=emacs23
Icon=/usr/share/icons/hicolor/scalable/apps/emacs23.svg
Type=Application
Terminal=false
Categories=Utility;Development;TextEditor;
  • Install thunderbird
  • Install printer
  • Install Sun Java
    • Synaptic Package Manager>Settings>Repositories
    • Select Other Software then Mark the Canonical Partners
    • In the Quick Search box, write "sun java", install jre and jdk
    • sudo update-alternatives --config java choose sun java
  • Use Empathy instaed of Pidgin, it is integrated better with gnome, and the chat history remains!
  • Programming
    • Install Netbeans
    • Install premake4
    • Install git
    • Install bzr
  • Chinese setup
  • Install Dropbox
  • Install Guake

    Because the Super key is used by Unity, so I have to change the shortcut of Guake to Alt+c, it is a little inconvenient. And modify the source code ( /usr/lib/guake/guake.py ) to put the Guake in the bottom of screen, like this:

def get_final_window_rect(self):
        """Gets the final size of the main window of guake. The height
        is the window_height property, width is window_width and the
        horizontal alignment is given by window_alignment.
        """
        screen = self.window.get_screen()
        height = self.client.get_int(KEY('/general/window_height'))
        width = 100
        halignment = self.client.get_int(KEY('/general/window_halignment'))

        # get the rectangle just from the first/default monitor in the
        # future we might create a field to select which monitor you
        # wanna use
        window_rect = screen.get_monitor_geometry(0)
        total_width = window_rect.width
        total_height = window_rect.height # total height of screen
        window_rect.height = window_rect.height * height / 100
        window_rect.width = window_rect.width * width / 100

        if width < total_width:
            if halignment == ALIGN_CENTER:
                window_rect.x = (total_width - window_rect.width) / 2
            elif halignment == ALIGN_LEFT:
                window_rect.x = 0
            elif halignment == ALIGN_RIGHT:
                window_rect.x = total_width - window_rect.width
        window_rect.y = (total_height - window_rect.height) # set y 
        return window_rect
  • Remove Apache: why do I need http server in my laptop??
  • Install "Flash Aid" plugin of Firefox 2011-05-12 Thu

Make ISO from directory

mkisofs -o /tmp/cd.iso /tmp/directory

upgrade to 4G RAM 2010-12-18

  • install PAE (Physical Address Extension) kernel to support 4G RAM (update: 2011-05-02 Mon I use 64Bit system instead now! )
  • mount /tmp to RAM by adding this line in /etc/fstab
    # mount tmpfs in /tmp/
    tmpfs /tmp tmpfs size=1024m,mode=1777 0 0
    
  • change swappiness: add vm.swappiness=10 in /etc/sysctl.conf

Test

  • Copy/remove files to /tmp, it is really fast!
  • Compile our project
    ext4tmpfs
    make4m20.378s4m18.120s
    make -j22m48.749s2m50.457s
    The results doesn't show tmpfs is faster, however I think this is because /dev/shm. The CPU is bottle neck now.

© 2012-05-17 22:26:27 CEST Xu Yuan (xuyuan.cn@gmail.com) Proudly powered by Org version 7.8.10 with Emacs version 24. Validate XHTML 1.0