Usability settings:

  • move window-bar action buttons from left (Ubuntu 10.10/Mac) to right:
    gconftool-2 --type string --set /apps/metacity/general/button_layout "menu:minimize,maximize,close"
  • remove confirmation for logout: System Settings -> Advanced -> Session Manager -> Confirm Logout
  • remove screen-lock after screensaver: Control Center -> Screensaver -> Lock screen when screensaver is active (uncheck)

Processes management:

  • move a process to background (suspend):
    CTRL-z
  • list background/suspended processes:
    jobs (returns a list of ids of the stopped processes and their description: [1]+  Stopped  mc)
  • bring process to foreground:
    fg 1 (where 1 is the id of the desired process to resurrect from the above list)

Computer info:

Inventory:

  • # lists your hardware
    $ sudo lshw
  • # lists all hard disk
    $ sudo lshw -C disk
  • # xports an html page with hardware details
    $ sudo lshw -html > your-file-name.html

Sensors monitoring:

  • sudo apt-get install lm-sensors sensors-applet  #(ksensors for Kubuntu)
  • sudo sensors-detect

To see if your running kernel is 32-bit or 64-bit, just issue the following command:

  • $ uname -m
    x86_64 indicates a running 64-bit kernel. If you use see i386, i486, i586 or i686, you're running a 32-bit kernel. Note: x86_64 is synonymous with amd64.

How to find out the Ubuntu / Kubuntu version:

  • Debian:
     cat /etc/debian_version
  • Ubuntu / Kubuntu:
    • cat /etc/issue
    • lsb-release -a (sau  cat /etc/lsb-release)

Change default browser:

  •  update-alternatives --config x-www-browser or  update-alternatives --config www-browser 

Display (only) symbolic links with details

  •  sudo find / -type l -print | xargs ls -lh

Display files/folder space usage

  •  GUI: 
    • FileLight, Disk Space Analyzer or gdmap  (Gnome) 
    •  KDiskFree or KDirStat (KDE)
  •   CLI:
    • ncdu – interactive tool
    • df -h
    • du -bsh {FOLDER_NAME}
    • du –max-depth=1 * | sort -n
    • Find the top 10 biggest files: find . -type f -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {} 

Manage iso images and CD/DVD’s:

Create ISO imags from CD/DVD:


$ dd if=/dev/dvd of=dvd.iso # for dvd
$ dd if=/dev/cdrom of=cd.iso # for cdrom
$ dd if=/dev/scd0 of=cd.iso # if cdrom is scsi

These commands are useful for data CD/DVD images. For Audio CD’s there’s another (longer) story. (A simpler way would be to use specialized apps like: K3b, Acetoneiso, Brasero)

Create ISO image from folders:

$ mkisofs -v -o /tmp/user-folder.iso -R /home/user/user-folder

Write ISO images to CD/DVD:

  • Find out your CDR/W SCSI address/device name:
    $ cdrecord -scanbus
  • Write ISO image:
    $ cdrecord -v -dao dev=1,0,0 speed=8 file.iso
    (Where, -speed=XX : Specify writing speed, -v : Verbose output, -dev : The virtual SCSI ID of the writing device [discovered with the earlier command])

Mount / Umount / Format

  •  sudo mount /dev/sdb1 /media/USB -t vfat  (sau ntfs / ext2/3/4) - montare partitie
  •  sudo umount /dev/sdb1  - demontare partitie
  •  sudo mkfs -t vfat /dev/sdb1  - formatare partitie
  •  sudo eject /dev/sdb1 

Install software packages:

Subiectul este destul de bine detaliat aici. Pe scurt:

  • .tar.gz / .tar.bz2:
    • extract sources:
      •  tar xzvf tarballname.tar.gz 
      •  tar xjvf tarballname.tar.bz2 
    • configure:
      •  cd tarballname 
      •  ./configure 
    • compile sources:
      •  make  [all]
      •  sudo checkinstall  [care inlocuieste:  sudo make install ]
  • .deb:
    • graphic mode: double-click the file
    • console:
       sudo dpkg -i file.deb 
  • .rpm:
    • conversion in .deb:
       sudo alien -k file.rpm  (after  sudo apt-get install alien , if not already installed)
    • install:
       sudo dpkg -i file.deb 

Calculate md5 checksums:

  • for a string:
      echo -n "aaaaaa" | md5sum 
  • for a file:
      md5sum file 

For Loop in Bash:

  • The simple bash loop to do something with all files in the directory is:
     for f in * ; do echo $f ; done

    which just displays all files in this case.

    This is easy, what I usually need and often forget how to do it is to execute some action exact number of times. Something like simple for loop in C or Java. And there is an exact match for such loop in Bash too:

     for (( i=1 ; i

    I found another similar solution on the Internet today at spiralbound.net:

     for i in $(seq 1 100); do echo $i ; done

Renamefiles:

  • UPPERCASE → lowercase
      rename ‘y/A-Z/a-z/’ * 

Empty existing files / Create new (temporary) files:

  •  echo "" > file 
  •  cp /dev/null file 
  •  dd if=/dev/zero of=output.file bs=1 count=1 
  •  cat /dev/null > your_file 
  •  >filename
  •  touch /tmp/newfilename
  • command: mktemp which outputs something like: /tmp/tmp.yTfJX35144 script example:
      #!/bin/bash OUT=$(mktemp /tmp/output.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; }  echo "Today is $(date)" >> $OUT 

Source: here and here.

Switch from openjdk to sunjdk

OpenJDK is included in a number or popular Linux distributions. The procedure below explains how to switch to Oracle (Sun) JDK 1.6 in Ubuntu.
  • Enable the Canonical Partner Software through the following steps:
    Go to Ubuntu Software Center.
    Click Edit.
    Click Software Sources.
    Switch to the Other Software tab and check Canonical Partners. This may take some time.
  • In the Commandprompt, type the following sequence of commands:
    sudo apt-get update
    sudo apt-get install sun-java6-jre sun-java6-plugin
    sudo update-alternatives --config java

 

Share

« »