Calling all experts: Linux and Unix Tips and Tricks

Collapse
This is a sticky topic.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vl4kn0
    New Member
    • Feb 2009
    • 5

    #16
    logging on console
    My first tip is about logging, especially logging system logs on 11. and 12. console like it is in gentoo. If we are using common linux logger syslog the way is add this lines to /etc/syslog.conf
    Code:
    # Log everything on tty12 
    *.*     /dev/tty12 
    
    # Log kernel messages on tty11 
    kern.*  /dev/tty11
    this lines says that syslog will log system logs to 12. console and all kernel logs to 11. console

    Now we need restart syslog
    Code:
    /etc/init.d/syslogd restart
    or
    Code:
    /etc/init.d/sysklog restart
    it depends on distribution you are used.

    we can view the console by pressing alt + F12 for system logs or alt + F11 for kernel logs, if we are in GUI we must press alt + ctrl + F11 or alt + ctrl + F12.
    for return to GUI we press alt + F7 becouse default console for GUI is 7 ;)

    advanced uninstall packages in slackware
    if we want to remove some package on slackware we have to write whole name of package and it removes without asking. i solved this problem with very simple script. here it is:

    Code:
    #!/bin/bash
    
    if [ -z $1 ]; then
            echo "Missing arguments";
            exit 0;
    fi
    
    PKG_DIR=/var/log/packages
    
    for ARG in $*; do
            PACKAGES=`ls $PKG_DIR | grep $ARG`;
            for PKG in $PACKAGES; do
                    echo "Do you really want to remove $PKG (y|n) ?";
                    read ANS;
                    case $ANS in
                    y) removepkg $PKG > /dev/null;
                       echo "Package $PKG successful removed";
                    ;;
                    *) echo "Skipping $PKG...";
                    ;;
                    esac
            done
    done
    we write this into file for example rempkg, copy this to /usr/sbin and give execute bit.
    Code:
    cp rempkg /usr/sbin/rempkg && chmod +x /usr/sbin/rempkg
    console resolulution
    My last tip is about freebsd, I hope this topic isn't only for linux :)

    I use freebsd but wihout x windows system and I don't like big resolution what is used by default. So I compiled vesa support into the kernel for better resolution.

    first step what we need to do is change directory to /usr/src/sys/i386/conf architecture select which you use.
    Code:
    cd /usr/src/sys/i386/conf
    then we copy old config to new file.
    Code:
    cp GENERIC VESAKERN
    add this line to the new config
    Code:
    options      VESA 
    options      SC_PIXEL_MODE
    save & exit

    change directory to /usr/src and compile new kernel
    Code:
    make buildkernel KERNCONF=VESAKERN 
    make installkernel KERNCONF=VESAKERN
    reboot
    after reboot we can show list of all resolutions by
    Code:
    vidcontrol -i mode
    for change resolution run this command
    Code:
    vidcontrol  MODE_<NUMBER OF RESULUTION>
    when we are definitely decided for resolution we can change it permanently by editing /etc/rc.conf and adding this lines
    allscreens_flag s="MODE_<NUMB ER OF RESOLUTION>"
    save & exit & reboot ;)

    ps. I'm really sorry for my english but I'm not native english speaker so keep it in mind ;)

    REGARDS,
    vl4kn0

    Comment

    • mvjohn100
      New Member
      • Mar 2008
      • 57

      #17
      Run different window managers simultaneously

      To run different window managers simultaneously

      1) Take a new virtual console ( ctrl + alt + F1/F2/F3)

      2) for X server Secession without window manager type "xinit -- :2"

      3)from here we can run

      a) "startkde" for KDE

      b) "gnome-session" for GNOME

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #18
        Most or all of these tips also work in the BSDs

        Linux is not BSD Unix or Solaris but they are in the same family and most, if not all, of the tips here will work in those operating systems, too.

        Comment

        • Nepomuk
          Recognized Expert Specialist
          • Aug 2007
          • 3111

          #19
          Originally posted by drhowarddrfine
          Most or all of these tips also work in the BSDs

          Linux is not BSD Unix or Solaris but they are in the same family and most, if not all, of the tips here will work in those operating systems, too.
          Thanks for that hint, I've changed the subject accordingly.

          Greetings,
          Nepomuk

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #20
            Middle Mouse Button Auto-Scroll (Firefox)

            I have one for you.

            Coming from a long-time Windows background, I was very used to doing middle-button click and drag to scroll much quicker in Firefox. I was disappointed to find that this did not happen in Ubuntu. The fix is simple, though.

            Navigate to about:config in Firefox (type that in your address bar, hit enter). Then search for 'autoScroll'. Double clicking the 'general.autoSc roll' entry should change it's value from false to true. If not, you can manually edit it by right clicking the entry and then selecting 'toggle'.

            Hey presto, you can now scrub through pages as quickly as you used to do!

            Comment

            • shabinesh
              New Member
              • Jan 2007
              • 61

              #21
              command line tips with nc and dd

              your one line webserver

              Code:
              cat index.html | nc -l 80

              to search for phrase from disk and replace back in (check if it works)

              Code:
              dd if=/dev/sda10 | sed 's/aaa/bbb/' | of=/dev/sda10

              Comment

              Working...