Sonntag, 2. August 2009

MOZ_NO_REMOTE

MOZ_NO_REMOTE=hell,yes firefox -P sidekickProfile
MOZ_NO_REMOTE= firefox -ProfileManager
Or, in a nice Unix way, create aliases to do the job:
alias ff2=`MOZ_NO_REMOTE= firefox -P sidekickProfile`
alias pm=`MOZ_NO_REMOTE= firefox -ProfileManager`

Montag, 6. Juli 2009

/lib/udev/vol_id /dev/hda1 | grep UUID

ureOS:/home/lolpo88# fdisk -l

Disk /dev/hda: 40.1 GB, 40060403712 bytes
255 heads, 63 sectors/track, 4870 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x4f1e4f1d

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1802 14474533+ 83 Linux
/dev/hda2 1803 4551 22081342+ 83 Linux
/dev/hda3 4552 4870 2562367+ 82 Linux swap / Solaris
PureOS:/home/lolpo88# /lib/udev/vol_id /dev/hda | grep UUID
ID_FS_UUID=
ID_FS_UUID_ENC=
PureOS:/home/lolpo88# /lib/udev/vol_id /dev/hda1 | grep UUID
ID_FS_UUID=7029e9fb-066b-4d19-9d14-ab229afcd4cc
ID_FS_UUID_ENC=7029e9fb-066b-4d19-9d14-ab229afcd4cc
PureOS:/home/lolpo88#

Stable root device (AKA UUID)

Given: server with SCSI disk for the system plus a SCSI storage in the back. The SCSI disk uses another driver than the SCSI storage. Installing Debian etch via grml is no problem, the system disk is /dev/sda, the SCSI storage is bound to /dev/sdb. But: who guarantees that /dev/sda is always the systemdisk? Using the Debian-kernel with initramfs isn’t capable of booting the system via root=/dev/sda1 because /dev/sda1 corresponds to the SCSI storage. (Side-note: the grml-kernel does not have this problem, it just boots the system without any problems at all. 8-))

Generic solution: use the power of UUID:
root@grml # /lib/udev/vol_id /dev/sda1 | grep UUID
ID_FS_UUID=4a6aed11-42dd-4c82-81ce-8f469e93f210
root@grml # eval $(/lib/udev/vol_id /dev/sda1 | grep UUID)
root@grml # ls -la /dev/disk/by-uuid/$ID_FS_UUID
lrwxrwxrwx 1 root root 10 Aug 10 11:01 /dev/disk/by-uuid/4a6aed11-42dd-4c82-81ce-8f469e93f210 -> ../../sda1

Now we know the UUID and boot the system via root=UUID=… instead of a root=/dev/sda-entry:
title Debian Etch, kernel 2.6.15-1-686 (on /dev/sda1)
root (hd0,0)
kernel /boot/vmlinuz-2.6.15-1-686 root=UUID=4a6aed11-42dd-4c82-81ce-8f469e93f210 ro
initrd /boot/initrd.img-2.6.15-1-686

Finally do not forget to adjust /etc/fstab as well for all entries:
UUID=e0164f78-9821-4eaf-bda7-1fd9b43a6f06 / ext3 defaults,errors=remount-ro 0 1
UUID=4a6aed11-42dd-4c82-81ce-8f469e93f210 /home ext3 defaults 0 0
UUID=0e88f32f-fb98-4279-b3bc-8edfc2046b5d none swap sw 0 0



# xfs_admin -L test /dev/hda1
writing all SBs
new label = “test”

# findfs LABEL=test
/dev/hda1

Sonntag, 5. Juli 2009

How to download using a Rapidshare Premium Account in Linux

For a lot of people, the lack of a proper downloader in linux to use with their premium rapidshare accounts seems to be quite a turn off. Well, there’s jDownloader, but I find that a bit too heavy. Unknown to them, they already have a good downloading tool, called wget.

Its basically a two step process being:

  1. Saving a cookie with your Rapidshare login details in it. To do that, just enter the following command:
    $ wget --save-cookies ~/cookies.txt --post-data "login=USERNAME&password=PASSWORD" -O - https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi > /dev/null

    Replace USERNAME & PASSWORD with your own Rapidshare details.
    What this script does is login to Rapidshare and saves the cookie to a file named cookies.txt in your home directory. Any normal HTML output is piped to the resident unix blackhole, /dev/null.

  2. Downloading your file using the cookie to supply your Rapidshare credentials. Now that we’ve saved your cookie information, you can go ahead and download to your heart’s content (or maybe daily limit). Here’s an example of how you’d do that. Remember that the cookie you created previously was stored in your home directory. For most linux shells, you can refer to it like this:- ~/cookies.txt

    To actually download, use the following command:-

    wget --load-cookies ~/cookies.txt your-rapidshare-url.com/file-link.html

Happy downloading. :)

Freitag, 5. Juni 2009

sudo hdparm -d1 -W1 -c1 /dev/hda

Samstag, 30. Mai 2009

sysctl configuration file on servers

I Use this on servers.


# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.

# Disables packet forwarding
net.ipv4.ip_forward=0

# Disables IP source routing
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
net.ipv4.conf.eth0.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0

# Enable IP spoofing protection, turn on source route verification
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1

# Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0

# Enable Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 0
net.ipv4.conf.lo.log_martians = 0
net.ipv4.conf.eth0.log_martians = 0

# Disables IP source routing
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
net.ipv4.conf.eth0.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0

# Enable IP spoofing protection, turn on source route verification
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1

# Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0

# Disables the magic-sysrq key
kernel.sysrq = 0

# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 15

# Decrease the time default value for tcp_keepalive_time connection
net.ipv4.tcp_keepalive_time = 1800

# Turn off the tcp_window_scaling
net.ipv4.tcp_window_scaling = 0

# Turn off the tcp_sack
net.ipv4.tcp_sack = 0

# Turn off the tcp_timestamps
net.ipv4.tcp_timestamps = 0

# Enable TCP SYN Cookie Protection
net.ipv4.tcp_syncookies = 1

# Enable ignoring broadcasts request
net.ipv4.icmp_echo_ignore_broadcasts = 1

# Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1

# Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 1

# Increases the size of the socket queue (effectively, q0).
net.ipv4.tcp_max_syn_backlog = 1024

# Increase the tcp-time-wait buckets pool size
net.ipv4.tcp_max_tw_buckets = 1440000

# Allowed local port range
net.ipv4.ip_local_port_range = 16384 65536

HOW-TO: Tune Settings In sysctl.conf

# Disables packet forwarding
net.ipv4.ip_forward = 0
# Enables source route verification
net.ipv4.conf.default.rp_filter = 1
# Disables the magic-sysrq key
kernel.sysrq = 0
# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 25
# Decrease the time default value for tcp_keepalive_time connection
net.ipv4.tcp_keepalive_time = 3600
# Turn on the tcp_window_scaling
net.ipv4.tcp_window_scaling = 1
# Turn on the tcp_sack
net.ipv4.tcp_sack = 1
# tcp_fack should be on because of sack
net.ipv4.tcp_fack = 1
# Turn on the tcp_timestamps
net.ipv4.tcp_timestamps = 1
# Enable TCP SYN Cookie Protection
net.ipv4.tcp_syncookies = 1
# Enable ignoring broadcasts request
net.ipv4.icmp_echo_ignore_broadcasts = 1
# Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
# Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Don't Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 0
# Make more local ports available
net.ipv4.ip_local_port_range = 1024 65000
# Increase maximum amount of memory allocated to shm
kernel.shmmax = 1073741824
# Improve file system performance
vm.bdflush = 100 1200 128 512 15 5000 500 1884 2
# This will increase the amount of memory available for socket input/output queues
net.ipv4.tcp_rmem = 4096 25165824 25165824
net
.core.rmem_max = 25165824
net
.core.rmem_default = 25165824
net
.ipv4.tcp_wmem = 4096 65536 25165824
net
.core.wmem_max = 25165824
net
.core.wmem_default = 65536
net
.core.optmem_max = 25165824
#ab wann speicher als dreckig betrachtet wird
vm.dirty_ratio=

10
vm.dirty_background_ratio=5
#vfs cache pressure
vm.vfs_cache_pressure=50
#gibt den grad an wann ausgelagert wird
vm.swappiness=20



# If you are feeling daring, you can also use these settings below, otherwise just remove them. (Should increase performance)

net.core.netdev_max_backlog = 2500
net
.ipv4.tcp_tw_recycle = 1
net
.ipv4.tcp_tw_reuse = 1

After you make the changes to the file, you can make them effective immediately by typing in /sbin/sysctl -p

Also, you will need to issue sysctl -w net.ipv4.route.flush=1 to flush the routing table to make some of these changes happen instantly.

Lastly, you can increase the size of the interface queue by typing /sbin/ifconfig eth0 txqueuelen 1000

tweaks

Firefox Tweaks

Speed Up Firefox Web Browser Tips

  • Applications -> Internet -> Firefox Web Browser
  • Mozilla Firefox
Address Bar -> about:config
Filter: ->
network.dns.disableIPv6 -> true
network.http.pipelining -> true
network.http.pipelining.maxrequests -> 8
network.http.proxy.pipelining -> true
  • Restart Mozilla Firefox

How to disable beep sound for link find function in Mozilla Firefox

  • Applications -> Internet -> Firefox Web Browser
  • Mozilla Firefox
Address Bar -> about:config
Filter: accessibility.typeaheadfind.enablesound -> false
  • Restart Mozilla Firefox

Setting the backspace button to go to a previous page

  • Applications -> Internet -> Firefox Web Browser
  • Mozilla Firefox
Address Bar -> about:config
Filter: -> browser.backspace_action -> 0
  • Restart Mozilla Firefox

Close the Download dialog quicker

  • Go to Applications -> Internet -> Firefox Web Browser
  • Put in your address bar
Address Bar -> about:config

Filter the configs options

Filter: -> alerts.totalOpenTime -> 500

Reduce the quantity of popups

  • Load Mozilla Firefox
  • Applications -> Internet -> Firefox Web Browser
  • Put in your address bar
Address Bar -> about:config
  • Filter the config options and change it to a reasonable number
Filter: -> dom.popup_maximum -> 5

Hide the Go Button

  • Load Mozilla Firefox
  • Applications -> Internet -> Firefox Web Browser
  • Put in your address bar
Address Bar -> about:config
  • Filter the config options and double click so it changes the result
browser.urlbar.hideGoButton -> Yes

Speed improvements using tmpfs

  • Load Mozilla Firefox
  • Applications -> Internet -> Firefox Web Browser
  • Put in your address bar
Address Bar -> about:config
  • Right click anywhere in the browser window and select
New -> String
  • Type in:
browser.cache.disk.parent_directory
  • press OK, and type in the new window:
/tmp



  • Open the sysctl.conf file for editing and backup your previous sysctl.conf file
su -c 'cp /etc/sysctl.conf /etc/sysctl.conf.backup' su -c 'gedit /etc/sysctl.conf'
  • Add the following lines
## increase TCP max buffer size setable using setsockopt() net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 ## increase Linux autotuning TCP buffer limits ## min, default, and max number of bytes to use ## set max to at least 4MB, or higher if you use very high BDP paths net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216 ## don't cache ssthresh from previous connection net.ipv4.tcp_no_metrics_save = 1 net.ipv4.tcp_moderate_rcvbuf = 1 ## recommended to increase this for 1000 BT or higher net.core.netdev_max_backlog = 2500 ## for 10 GigE, use this, uncomment below ## net.core.netdev_max_backlog = 30000 ## Turn off timestamps if you're on a gigabit or very busy network ## Having it off is one less thing the IP stack needs to work on ## net.ipv4.tcp_timestamps = 0 ## disable tcp selective acknowledgements. net.ipv4.tcp_sack = 0 ##enable window scaling net.ipv4.tcp_window_scaling = 1
  • Save it and close it. Run the following command
su -c '/sbin/sysctl -p'

Swappiness

  • You can change how much swap space you use by changing the swappiness of your Fedora install. To do this add the following line with the number between 0-100.
  • Open the sysctl.conf file for editing and backup your previous sysctl.conf file
su -c 'cp /etc/sysctl.conf /etc/sysctl.conf.backup' su -c 'gedit /etc/sysctl.conf'
  • Add the following line
vm.swappiness = 0
  • Reboot your computer

Noatime

  • Noatime affects how often the system updates your time in your computer. This is a significant loss in speed according to the kernel Devs. To speed it up do the following modifications.
  • Edit your fstab file and back it up
su -c 'cp /etc/fstab /etc/fstab.backup' su -c 'gedit /etc/fstab'
  • Where the mount option says defaults you should add some more text.
  • Before:
UUID=5f7e8362-66d0-4806-b2cf-61eb74200001 / ext3 defaults 1 1 UUID=5f7e8362-66d0-4806-b2cf-61eb74200022 /home ext3 defaults 1 2 UUID=5f7e8362-66d0-4806-b2cf-61eb74200333 /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 UUID=5f7e8362-66d0-4806-b2cf-61eb74204444 swap swap defaults 0 0
  • After:
UUID=5f7e8362-66d0-4806-b2cf-61eb74200001 / ext3 defaults,noatime,nodiratime 1 1 UUID=5f7e8362-66d0-4806-b2cf-61eb74200022 /home ext3 defaults,noatime,nodiratime 1 2 UUID=5f7e8362-66d0-4806-b2cf-61eb74200333 /boot ext3 defaults,noatime,nodiratime 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 UUID=5f7e8362-66d0-4806-b2cf-61eb74204444 swap swap defaults 0 0
  • Notice the only modification is to the lines that mount my default partitions. After the editing has been completed you will need to restart your computer for it to take effect.
  • If you don't wish to reboot the computer, you may also remount the partitions of the live system:
su -c 'mount / -o remount' su -c 'mount /home -o remount'

Preload

  • Preload is an adaptive readahead daemon, that will monitor which programs you use most. Parts of these programs will be cached to speed up their load time. You can get it by running the following command:
su -c 'yum -y install preload'
  • After having installed it, remember to check if it's running and if it's enabled to start at boot time. You may do this by going to System -> Administration -> Services and scrolling down to the "preload" entry: if it isn't checked, check it (click on the "Enable" button).

Speed improvements using tmpfs

  • Use tmpfs for frequently use temp folders.
  • Add the following to /etc/fstab
#### RAM Drives #### tmpfs /tmp tmpfs defaults 0 0 tmpfs /var/tmp tmpfs defaults 0 0
  • As this change is important for SSD (Solid State Drive) systems, it also make significant impact on applications such as Win4LinPro

Gnome Tweaks

Gnome Menu (delay)

  • This is a simple alteration that will speed up your gnome menu load up.
echo "gtk-menu-popup-delay = 0" >> ~/.gtkrc-2.0








Donnerstag, 28. Mai 2009

performance user.js firefox

// Performance

// This will allow Firefox to maintain it GUI memory so that the browser window
// will snap right back after being minimized. This is fairly new and will be available
// in the very near future, might be in the 0.9.x builds, but it works in current Trunk/Brand builds
user_pref("config.trim_on_minimize", false);

// Specify the amount of memory cache:
// -1 = determine dynamically (default), 0 = none, n = memory capacity in kilobytes
// If you have the memory to spare, enabling this will run things a little smoother
user_pref("browser.cache.memory.capacity", 65536); // thus equal about 64 megs, drop down to less if you can't spare the RAM

// Remove painting delay when loading pages
user_pref("nglayout.initialpaint.delay", 0); // Default is 250

user_pref("content.notify.ontimer", true); // Turn on timer-based reflow management

user_pref("content.notify.interval", 100); // Sets the allowed time between reflows in microseconds

// Set the number of reflows to do before waiting for the rest of the page to arrive
user_pref("content.notify.backoffcount", 200);

// Other Tweaks
user_pref("content.max.tokenizing.time", 3000000); // New 8/25
user_pref("content.maxtextrun", 8191); // New 8/25

// Enable Improve pipelining:
user_pref("network.http.pipelining", true);
user_pref("network.http.proxy.pipelining", true);
user_pref("network.http.pipelining.firstrequest", true); // Default is false
user_pref("network.http.pipelining.maxrequests", 8 ); // Default is 4 - updated 9/18/2006

// Increase Multi-Threaded Downloading performance
user_pref("network.http.max-connections", 96); // Default is 24 Use this for modems
user_pref("network.http.max-connections-per-server", 32); // Default is 8 Use this for modems
user_pref("network.http.max-persistent-connections-per-proxy", 24); // Default is 4 Use this for modems
user_pref("network.http.max-persistent-connections-per-server", 12); // Default is 2 Use this for modems

// Other Tweaks
user_pref("network.dnsCacheExpiration", 86400); // Updated from 360 to 86400 - 9/22
user_pref("network.dnsCacheEntries", 256); // Updated from 100 to 256 - 9/22
user_pref("network.ftp.idleConnectionTimeout", 60); // New 8/25
user_pref("network.http.keep-alive.timeout", 30); // New 9/22

user_pref("ui.submenuDelay", 0); // New 8/25

user_pref("dom.disable_window_status_change", true); // New 9/22

// Shows an error page instead of an error popup dialog, have been using this for a long time now
// found this useful if you load multiple pages at the same the dialog box actually holds up the browser
// using this will allow the other pages/elements to load for the rest of the pages
user_pref("browser.xul.error_pages.enabled", true) // New 9/23

// Check for main Firefox application update every 7 days not every day
user_pref("app.update.interval", 604800) // Updated 9/18/2006

// Searching & Type Ahead
// Change to normal Google search:
user_pref("keyword.URL", "http://google.com/search?btnG=Google+Search&q=");

// Find As You Type Configuration:
// Set this pref to false to disable Find As You Type:
user_pref("accessibility.typeaheadfind", true);

// If you set this pref to true, typing can automatically start Find As You Type.
// If false (default), you must hit / (find text) or ' (find links) before your search.
user_pref("accessibility.typeaheadfind.autostart", true);

// Set this pref to false if you want Find As You Type to search normal text too:
user_pref("accessibility.typeaheadfind.linksonly", false);

// Set this pref to true if you require that the link starts with the entered text:
user_pref("accessibility.typeaheadfind.startlinksonly", false);

// This is the time in milliseconds for the Find As You Type to stop watching for keystrokes:
user_pref("accessibility.typeaheadfind.timeout", 3000);

// User Interface
// Enable Bookmark Icons (I love this feature)
user_pref("browser.chrome.site_icons", true);
user_pref("browser.chrome.favicons", true);
user_pref("browser.chrome.load_toolbar_icons", 2); // New 8/25

// Do not Reuse Active Mozilla Browser, create a new one for email links etc.
user_pref("advanced.system.supportDDEExec", false);

// Disable Smooth Scrolling (found it faster to have this off)
user_pref("general.smoothScroll", false);

// Allows for faster mouse scrolling
user_pref("mousewheel.withnokey.numlines", 8 ); // Adjust this accordingly - Default = 1 - updated 9/18/2006
user_pref("mousewheel.withnokey.sysnumlines", false); // This must be set to false in order to read previous line

user_pref("browser.display.show_image_placeholders", true); // New 8/25

// 1.0 Preview disables dynamic theme switching, this re-enables dynamic theme switching.
user_pref("extensions.dss.enabled", false); //New 9/1: maybe buggy don't complain Smile

// Mail & News
user_pref("mailnews.start_page.enabled", false); // New 9/23

// always send messages in MIME format (both plain- and HTML-formatted)
user_pref("mail.default_html_action", 3); // New 9/23

// The follow two are disabled for security reasons
user_pref("mailnews.message_display.allow.plugins", false); // New 9/23
user_pref("javascript.allow.mailnews", false); // New 9/23

user_pref("alerts.totalOpenTime", 7000); // New 9/23

// Disable this for performance and security issues when reading emails
// Security issues? Yes especially with zlib, jpeg, png and all kinds of new attacks coming out,
// displaying images inline can no longer be taken for granted. This only affects attached graphics.
user_pref("mail.inline_attachments", false); // New 9/23

user_pref("mailnews.show_send_progress", false); // New 9/23

// Security
// Just to make sure, disable windows shell: protocol
user_pref("network.protocol-handler.external.shell", false);

// Show full path for plugin file on about:plugins page
// the full path was removed for security purposes, please keep that in mind
// Note: showing full paths can be a security risk only use when debugging.
user_pref("plugin.expose_full_path", false);

// Disable prefetching as it may try to set cookies and other unwanted cache bloat
user_pref("network.prefetch-next", false); // New 6/28/2005
user_pref("alerts.totalOpenTime", 500);
user_pref("dom.popup_maximum", 5);
user_pref("browser.cache.disk.parent_directory", "/tmp");

tree /dev/disk

mike@mikelinux:~$ tree /dev/disk
/dev/disk
|-- by-id
| |-- ata-HL-DT-ST_DVDRAM_GSA-4160B_K3H49EG3829 -> ../../hdb
| |-- ata-IC35L040AVVN07-0_VNP210B2GVS39B -> ../../hdc
| |-- ata-IC35L040AVVN07-0_VNP210B2GVS39B-part1 -> ../../hdc1
| |-- ata-IC35L040AVVN07-0_VNP210B2GVS39B-part2 -> ../../hdc2
| `-- ata-IC35L040AVVN07-0_VNP210B2GVS39B-part3 -> ../../hdc3
|-- by-path
| |-- pci-0000:00:08.0-ide-0:1 -> ../../hdb
| |-- pci-0000:00:08.0-ide-1:0 -> ../../hdc
| |-- pci-0000:00:08.0-ide-1:0-part1 -> ../../hdc1
| |-- pci-0000:00:08.0-ide-1:0-part2 -> ../../hdc2
| `-- pci-0000:00:08.0-ide-1:0-part3 -> ../../hdc3
`-- by-uuid
|-- 01d680f2-5d45-4ba9-bafa-55aa1c0b4cc2 -> ../../hdc2
|-- 48c581e2-b1ab-432b-ba99-2a50d1a4bde5 -> ../../hdc3
`-- b59086a7-acfb-4656-9798-b49be49d67ed -> ../../hdc1

3 directories, 13 files
mike@mikelinux:~$

terminal commands

Some useful terminal commands



  • This is a list of useful commands, some commands require root privalages (su -)

  • To extract/unpack a tar file
tar -xvf file.tgz

  • To see a list of all the pci hardware (including usb bridges,agp cards etc)

/sbin/lspci

  • To see alist of all the usb devices (mice,etc)
/sbin/lsusb
  • To show list of dependencies or a rpm
rpm -qpR somerpm.rpm


  • To find a file/path
locate file.name
  • To install a older rpm

rpm -Uvh --oldpackage olderrpm.rpm
  • To install a rpm
rpm -ivh nameofrpm.rpm
  • To remove a rpm
rpm -e nameofrpm.rpm

  • To remove a rpm without removing its dependencies
rpm -e --nodeps nameofrpm.rpm
  • To view a list of hard disks/ partitions
fdisk -l

  • To clear the terminal history
history -c

  • To put shortcuts to folders/files etc on your Desktop, just hold down ctrl+shift and drag them on the Desktop
ctrl+shift + drag file/folder to Desktop

  • To force empty trash
rm -fr /home/$(logname)/.local/share/Trash/files

Sudo set up

Sudo set up with password

  • Remember when you use sudo you enter your user password not the root password
  • you will need to change name to your user name
  • Open a terminal and copy paste below one line at a time pressing enter after each line. (root password will be required)
su -
echo 'name ALL=(ALL) ALL' >> /etc/sudoer
chmod +w /etc/sudoers
echo 'name ALL=(ALL) PASSWD:ALL' >> /etc/sudoers
chmod -w /etc/sudoers

Sudo set up with no password

  • This could potentially be a security threat if other people use your computer
  • you will need to change name to your user name
  • Open a terminal and copy paste below one line at a time pressing enter after each line. (root password will be required)
su
echo 'name ALL=(ALL) ALL' >> /etc/sudoer
chmod +w /etc/sudoers
echo 'name ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
chmod -w /etc/sudoers

Mittwoch, 27. Mai 2009

pacman-g2

Action
Apt command
Pacman command
Refresh the package database: apt-get update pacman-g2 -Sy
Upgrade currently installed packages: apt-get upgrade pacman-g2 -Su
Install a new package: apt-get install foo pacman-g2 -S foo
Remove a package: apt-get remove foo pacman-g2 -Rc foo
Search in the full package database: apt-cache search foo pacman-g2 -Ss foo
Install a package from a file: dpkg -i foo.deb pacman-g2 -A foo.fpm
Clean the package cache: apt-get clean pacman-g2 -Sc

/etc/X11/xorg.conf file)

In the device section of your /etc/X11/xorg.conf file)


Option "DigitalVibrance" "64"
Option "DisableGLXRootClipping" "True"
Option "XvmcUsesTextures" "true"
Option "AllowGLXWithComposite" "true"
Option "Coolbits" "1"
Option "RenderAccel" "true"
Option "NoLogo" "true"
Option "AddARGBGLXVisuals" "True"

Dienstag, 26. Mai 2009

firefox user.js prefs.js

// Performance

// This will allow Firefox to maintain it GUI memory so that the browser window
// will snap right back after being minimized. This is fairly new and will be available
// in the very near future, might be in the 0.9.x builds, but it works in current Trunk/Brand builds
user_pref("config.trim_on_minimize", false);

// Specify the amount of memory cache:
// -1 = determine dynamically (default), 0 = none, n = memory capacity in kilobytes
// If you have the memory to spare, enabling this will run things a little smoother
user_pref("browser.cache.memory.capacity", 65536); // thus equal about 64 megs, drop down to less if you can't spare the RAM

// Remove painting delay when loading pages
user_pref("nglayout.initialpaint.delay", 0); // Default is 250

user_pref("content.notify.ontimer", true); // Turn on timer-based reflow management

user_pref("content.notify.interval", 100); // Sets the allowed time between reflows in microseconds

// Set the number of reflows to do before waiting for the rest of the page to arrive
user_pref("content.notify.backoffcount", 200);

// Other Tweaks
user_pref("content.max.tokenizing.time", 3000000); // New 8/25
user_pref("content.maxtextrun", 8191); // New 8/25

// Enable Improve pipelining:
user_pref("network.http.pipelining", true);
user_pref("network.http.proxy.pipelining", true);
user_pref("network.http.pipelining.firstrequest", true); // Default is false
user_pref("network.http.pipelining.maxrequests", 8 ); // Default is 4 - updated 9/18/2006

// Increase Multi-Threaded Downloading performance
user_pref("network.http.max-connections", 96); // Default is 24 Use this for modems
user_pref("network.http.max-connections-per-server", 32); // Default is 8 Use this for modems
user_pref("network.http.max-persistent-connections-per-proxy", 24); // Default is 4 Use this for modems
user_pref("network.http.max-persistent-connections-per-server", 12); // Default is 2 Use this for modems

// Other Tweaks
user_pref("network.dnsCacheExpiration", 86400); // Updated from 360 to 86400 - 9/22
user_pref("network.dnsCacheEntries", 256); // Updated from 100 to 256 - 9/22
user_pref("network.ftp.idleConnectionTimeout", 60); // New 8/25
user_pref("network.http.keep-alive.timeout", 30); // New 9/22

user_pref("ui.submenuDelay", 0); // New 8/25

user_pref("dom.disable_window_status_change", true); // New 9/22

// Shows an error page instead of an error popup dialog, have been using this for a long time now
// found this useful if you load multiple pages at the same the dialog box actually holds up the browser
// using this will allow the other pages/elements to load for the rest of the pages
user_pref("browser.xul.error_pages.enabled", true) // New 9/23

// Check for main Firefox application update every 7 days not every day
user_pref("app.update.interval", 604800) // Updated 9/18/2006

// Searching & Type Ahead
// Change to normal Google search:
user_pref("keyword.URL", "http://google.com/search?btnG=Google+Search&q=");

// Find As You Type Configuration:
// Set this pref to false to disable Find As You Type:
user_pref("accessibility.typeaheadfind", true);

// If you set this pref to true, typing can automatically start Find As You Type.
// If false (default), you must hit / (find text) or ' (find links) before your search.
user_pref("accessibility.typeaheadfind.autostart", true);

// Set this pref to false if you want Find As You Type to search normal text too:
user_pref("accessibility.typeaheadfind.linksonly", false);

// Set this pref to true if you require that the link starts with the entered text:
user_pref("accessibility.typeaheadfind.startlinksonly", false);

// This is the time in milliseconds for the Find As You Type to stop watching for keystrokes:
user_pref("accessibility.typeaheadfind.timeout", 3000);

// User Interface
// Enable Bookmark Icons (I love this feature)
user_pref("browser.chrome.site_icons", true);
user_pref("browser.chrome.favicons", true);
user_pref("browser.chrome.load_toolbar_icons", 2); // New 8/25

// Do not Reuse Active Mozilla Browser, create a new one for email links etc.
user_pref("advanced.system.supportDDEExec", false);

// Disable Smooth Scrolling (found it faster to have this off)
user_pref("general.smoothScroll", false);

// Allows for faster mouse scrolling
user_pref("mousewheel.withnokey.numlines", 8 ); // Adjust this accordingly - Default = 1 - updated 9/18/2006
user_pref("mousewheel.withnokey.sysnumlines", false); // This must be set to false in order to read previous line

user_pref("browser.display.show_image_placeholders", true); // New 8/25

// 1.0 Preview disables dynamic theme switching, this re-enables dynamic theme switching.
user_pref("extensions.dss.enabled", false); //New 9/1: maybe buggy don't complain Smile

// Mail & News
user_pref("mailnews.start_page.enabled", false); // New 9/23

// always send messages in MIME format (both plain- and HTML-formatted)
user_pref("mail.default_html_action", 3); // New 9/23

// The follow two are disabled for security reasons
user_pref("mailnews.message_display.allow.plugins", false); // New 9/23
user_pref("javascript.allow.mailnews", false); // New 9/23

user_pref("alerts.totalOpenTime", 7000); // New 9/23

// Disable this for performance and security issues when reading emails
// Security issues? Yes especially with zlib, jpeg, png and all kinds of new attacks coming out,
// displaying images inline can no longer be taken for granted. This only affects attached graphics.
user_pref("mail.inline_attachments", false); // New 9/23

user_pref("mailnews.show_send_progress", false); // New 9/23

// Security
// Just to make sure, disable windows shell: protocol
user_pref("network.protocol-handler.external.shell", false);

// Show full path for plugin file on about:plugins page
// the full path was removed for security purposes, please keep that in mind
// Note: showing full paths can be a security risk only use when debugging.
user_pref("plugin.expose_full_path", false);

// Disable prefetching as it may try to set cookies and other unwanted cache bloat
user_pref("network.prefetch-next", false); // New 6/28/2005
dlink dsl 380t

curl "http://%admin%:%admin%@%192.168.1.1%/cgi-bin/webcm" -d "getpage=../html/status/deviceinfofile.htm&encaps0:settings/manual_conn=0&var:conid=encaps0&var:mycon=connection0&var:contype=&connection0:pppoe:command/stop=&var:judge="
curl "http://%admin%:%admin%@%192.168.1.1%/cgi-bin/webcm" -d "getpage=../html/status/deviceinfofile.htm&encaps0:settings/manual_conn=1&var:conid=encaps0&var:mycon=connection0&var:contype=&connection0:pppoe:command/start=&var:judge=1



echo "base=0x98000000 size=0x8000000 type=write-combining" >| /proc/mtrr

sudo apt-get update; apt-get dist-upgrade; apt-get remove; apt-get autoremove; apt-get clean; apt-get autoclean; rm -r /tmp/*

/etc/sysctl.conf

## increase TCP max buffer size setable using setsockopt()
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
## increase Linux autotuning TCP buffer limits
## min, default, and max number of bytes to use
## set max to at least 4MB, or higher if you use very high BDP paths
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
## don't cache ssthresh from previous connection
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_moderate_rcvbuf = 1
## recommended to increase this for 1000 BT or higher
net.core.netdev_max_backlog = 2500
## for 10 GigE, use this, uncomment below
## net.core.netdev_max_backlog = 30000
## Turn off timestamps if you're on a gigabit or very busy network
## Having it off is one less thing the IP stack needs to work on
## net.ipv4.tcp_timestamps = 0
## disable tcp selective acknowledgements.
net.ipv4.tcp_sack = 0
##enable window scaling
net.ipv4.tcp_window_scaling = 1
#ab wann speicher als dreckig betrachtet wird
vm.dirty_ratio=10
vm.dirty_background_ratio=5
#vfs cache pressure
vm.vfs_cache_pressure=50
#gibt den grad an wann ausgelagert wird
vm.swappiness=20

Freitag, 22. Mai 2009

centos nvidia driver linux

I use nvidia binary driver for years on my home machine without problems ( and will *NEVER* use on production server ).

Follow next steps:

Make sure Your system is fully updated:
# yum upgrade

Install kernel devel + compiler:
# yum install kernel-devel
# yum groupinstall "Development Tools"

Download *latest* nvidia module:
# sh NVIDIA-Linux-x86-1.0-8774-pkg1.run --update
This will dowload NVIDIA-Linux-x86-1.0-9746-pkg1.run.

Switch to runlevel 3 ( "init 3" ) and rmmod all video related modules ( nv, agp, .. ) OR
Edit /etc/inittab, line "id:5:initdefault:" must be "id:3:initdefault:", reboot.

Login as root:
# sh NVIDIA-Linux-x86-1.0-9746-pkg1.run
Do not allow installer to connect and search for precompiled driver. This will "compile" nvidia.ko for current running kernel.
Agree that installer can modify Your xorg.conf file.

Test driver:
# init 5

If everything is fine undo changes in /etc/inittab.

If X do not start post here /var/log/Xorg.0.log

Freitag, 15. Mai 2009

Ubuntu show motherboard information

Type sudo lshw to your favourite terminal for comprehensive list of your hardware, including info about your RAM.

root@ubuntumike:~# sudo lshw
ubuntumike
description: Desktop Computer
product: To Be Filled By O.E.M.
vendor: To Be Filled By O.E.M.
version: To Be Filled By O.E.M.
serial: To Be Filled By O.E.M.
width: 32 bits
capabilities: smbios-2.4 dmi-2.4 smp-1.1 smp
configuration: boot=normal chassis=desktop cpus=2 uuid=00020003-0004-0005-0006-000700080009
*-core
description: Motherboard
product: ALiveXFire-eSATA2
vendor: ASRock
physical id: 0
*-firmware
description: BIOS
vendor: American Megatrends Inc.
physical id: 0
version: P3.10 (02/16/2009)
size: 64KiB
capacity: 448KiB
capabilities: pci upgrade shadowing cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer int10video acpi usb ls120boot zipboot biosbootspecification
*-cpu:0
description: CPU
product: AMD Athlon(tm) 64 X2 Dual Core Processor 4200+
vendor: Advanced Micro Devices [AMD]
physical id: 4
bus info: cpu@0
version: 15.11.2
serial: To Be Filled By O.E.M.
slot: CPUSocket
size: 2231MHz
width: 64 bits
clock: 200MHz

Mittwoch, 13. Mai 2009

Add a User on Ubuntu Server

Add a User on Ubuntu Server

Ubuntu Server is like any Linux variety, and has full multi-user capabilities, and a common task on any server is adding users.

useradd

The useradd command will let you add a new user easily from the command line:

useradd

This command adds the user, but without any extra options your user won't have a password or a home directory.

You can use the -d option to set the home directory for the user. The -m option will force useradd to create the home directory. We'll try creating a user account with those options, and then use the passwd command to set the password for the account. You can alternatively set a password using -p on the useradd command, but I prefer to set the password using passwd.

sudo useradd -d /home/testuser -m testuser

sudo passwd testuser

This will create the user named testuser and give them their own home directory in /home/testuser. The files in the new home directory are copied from the /etc/skel folder, which contains default home directory files. If you wanted to set default values for your users, you would do so by modifying or adding files in that directory. If we take a look at the new home directory for the user:

geek@ubuntuServ:/etc/skel$ ls -la /home/testuser
total 20
drwxr-xr-x 2 testuser testuser 4096 2006-12-15 11:34 .
drwxr-xr-x 5 root root 4096 2006-12-15 11:37 ..
-rw-r–r– 1 testuser testuser 220 2006-12-15 11:34 .bash_logout
-rw-r–r– 1 testuser testuser 414 2006-12-15 11:34 .bash_profile
-rw-r–r– 1 testuser testuser 2227 2006-12-15 11:34 .bashrc

You'll notice that there are bash scripts in this directory. If you wanted to set default path options for all new users, you would do so by modifying the files in /etc/skel, which would then be used to create these files by the useradd command.

adduser

The adduser command is even easier than the useradd command, because it prompts you for each piece of information. I find it slightly funny that there are two virtually identically named commands that do the same thing, but that's linux for you. Here's the syntax:

adduser

Example:

geek@ubuntuServ:/etc/skel$ sudo adduser thegeek
Password:
Adding user `thegeek'…
Adding new group `thegeek' (1004).
Adding new user `thegeek' (1004) with group `thegeek'.
Creating home directory `/home/thegeek'.
Copying files from `/etc/skel'
Enter new UNIX password:
Retype new UNIX password:
No password supplied
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for thegeek
Enter the new value, or press ENTER for the default
Full Name []: The Geek
Room Number []: 0
Work Phone []: 555-1212
Home Phone []: 555-1212
Other []:
Is the information correct? [y/N] y

eBox Installation Guide

eBox Installation Guide

Installation

eBox installer

In case you want to install eBox in a new machine from scratch, we recommend you use our tailored Ubuntu installer, it will install Ubuntu Hardy, ebox packages and all its dependences automatically.

It is available here. You just need to burn it into a CD, then insert it on a CD-ROM unit and reboot your PC (Your computer BIOS must have its CD Boot option enabled).

The installation takes two steps. First, it boots from CD and starts the installation. Once it’s rebooted, you should boot from the recently installed eBox with the CD installer inside the drive to finish the process.

Ubuntu packages (stable)

If you already have an Ubuntu Hardy installed, add to your /etc/apt/sources.list this line:

deb http://ppa.launchpad.net/ebox/ubuntu hardy main

Now we’ll run:

$ sudo apt-get update
$ sudo apt-get install "^ebox-.*"

Ubuntu packages (testing)

Test our latest packages and give us some feedback and you will be helping the project a lot. If you are up for it, go add these apt sources:

For Hardy

deb http://ppa.launchpad.net/ebox-unstable/ubuntu hardy main

For Intrepid

Yeay! We already have working packages for the current Ubuntu release!!

deb http://ppa.launchpad.net/ebox-unstable/ubuntu intrepid main

Installing from sources

If you want to install ebox from the source packages of this server, it’s recommended to read each installation instructions from INSTALL file of each module.

Accessing eBox

Once “eBox platform” is finally installed, we can access it from a web browser, writing the IP adress we configured before the installation on our system. Please remember, eBox uses HTTPS to access management interface. Default password for eBox administration interface is ebox

Montag, 11. Mai 2009

Creating a PXE boot for Jaunty Live.

Requires:
Ubuntu server for PXE environment (tested on Jaunty 9.04 server).
Wired network.
PXE boot capable network card on target machine.
On the Ubuntu server:

Login as root or sudo su -

Create the following directory structure:
/pxe

/pxe/images

/pxe/images/ubuntu

/pxe/pxelinux.cfg
Download syslinux from here:
http://www.kernel.org/pub/linux/utils/boot/syslinux/


Extract the files.

Find menu.c32 & pxelinux.0 & copy them to the /pxe directory.

The other syslinux files & zip are no longer needed and can be deleted.

create a file /pxe/pxelinux.cfg/default & paste in the following:
DEFAULT menu.c32
PROMPT 0
NOESCAPE 0
ALLOWOPTIONS 0
TIMEOUT 600

MENU TITLE PXE Boot Menu

LABEL Ubuntu Jaunty Live Desktop
kernel images/ubuntu/casper/vmlinuz
append boot=casper netboot=nfs nfsroot=192.168.1.101:/pxe/images/ubuntu initrd=images/ubuntu/casper/initrd.gz -- splash

LABEL Ubuntu Jaunty Live Install
kernel images/ubuntu/casper/vmlinuz
append boot=casper netboot=nfs nfsroot=192.168.1.101:/pxe/images/ubuntu initrd=images/ubuntu/casper/initrd.gz -- splash only-ubiquity
Copy the contents of the Ubuntu live CD into /pxe/images/ubuntu

Now install dnsmasq & nfs-kernel-server
apt-get install dnsmasq nfs-kernel-server
edit /etc/dnsmasq.conf & replace all text with:
no-hosts
server=/localnet/192.168.1.1
dhcp-range=192.168.1.40,192.168.1.50,2h
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/pxe
resolv-file=/etc/nameservers
dhcp-option=3,192.168.1.1
Make sure you replace the ip addresses with ones suitable for your network.

edit /etc/exports & replace all text with:
/pxe/images *(ro,sync,subtree_check)

Add your DNS nameservers by creating the new file (this example is for opendns):

nano /etc/nameservers
nameserver 208.67.222.222
nameserver 208.67.220.220
Reboot your server (or restart dnsmasq & nfs-kernel-server).


You should now be able to boot your target client machine to Ubuntu if it has a pxeboot enabled network card (usually accessed by pressing F12 at boot).