Howto: Tweak your Internet connection and maximize your bandwidth in Ubuntu/Linux via sysctl!
Here I will unleash a few hidden settings that should improve your internet speed, and work with all current linux operating systems including Ubuntu:
first open a Terminal via Applications->Accessories->Terminal
Type:sudo gedit /etc/sysctl.conf
Then Paste the Following at the end of the file:# 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
Press Ctrl-S To save then alt-F4 to exit and then type:sudo sysctl -p
to apply the settings.
Hitup a speed test site or a very healthy torrent and see how your speed is:
You can disable all these settings by removing these lines you added via:sudo gedit /etc/sysctl.conf
You can recieve more information here
Have any additional tips to add? Please post in the comments!
Ubuntu Tweak 0.3.1 released for Ubuntu Hardy Heron with new Hotkey Creation!
Ubuntu Tweak 0.3.1 just released this morning which includes a check new version feature, which isnt needed if you use the repository below and a few bug fixes. More info from the developers site here
Along time ago I did a quick review of Ubuntu Tweak here and now I see that TualatriX has significantly updated it with many user interface and bug fixes and added 1 hot must have feature which gives you the ability to create shortcut hotkeys to your favorite applications, I setup alt-ctrl-del to open gnome-system-monitor and the terminal to I can open both these with a keypress.
Well what is Ubuntu Tweak?
Ubuntu Tweak is an application designed to configure Gnome in Ubuntu and provides features that would otherwise require you to edit config files and use gconf to edit some internal settings.
It provides many useful desktop and system options that the default desktop environment doesn't provide.
At present, It is only designed for Ubuntu GNOME Desktop, and often follows the newest Ubuntu distribution.
LICENSE
Ubuntu Tweak is free software; you can redistribute it and/or modify it under th
e terms of the GNU General Public License as published by the Free Software Foun
dation.
Features of Ubuntu Tweak
- View of Basic System Information(Distribution, Kernel, CPU, Memory, etc.)
- GNOME Session Control
- Auto Start Program Control
- Show/Hide and Change Splash screen
- Show/Hide desktop icons or Mounted Volumes
- Show/Hide/Rename Computer, Home, Trash icon or Network icon
- Tweak Metacity Window Manager’s Style and Behavior
- Compiz Fusion settings, Screen Edge Settings, Window Effects Settings, Menu Effect Settins
- GNOME Panel Settings
- Nautilus Settings
- Advanced Power Management Settings
- System Security Settings
- Ability to Create your own Shortcut Hotkeys
- & Much more!
Howto Install Ubuntu Tweak:
Simply Click here and download the file or add the repository via System->Administration->Software Sources then click third party repositories and copy/paste these lines:
deb http://ppa.launchpad.net/tualatrix/ubuntu hardy main
deb-src http://ppa.launchpad.net/tualatrix/ubuntu hardy mainReload the repository and simply click here to install within your browser if you have apturl installed
You can also search synaptic for ubuntu-tweak or:
sudo apt-get update && apt-get install ubuntu-tweakHOWTO: Install btnx for better mouse control in Ubuntu
When I installed Hardy, I forgot to copy my awesome xorg.conf which held the configuration to enable all 12 buttons of my Logitech MX1000.
Lo and behold, a new method of configuring it has come about, albeit it was around prior to Gutsy.
btnx is the work of Olli Salonen. The program runs as a daemon, catching mouse events and turning them into either key presses or proper mouse events which the system can interpret. This eases the configuration one must do in order to enjoy the full potential of the high-end Logitech mice—a potential which, in my opinion, Windows cannot reach.
The installation process for btnx is pretty easy.
Read the full article here
Tweak and optimize, and increase Ubuntu Hardy Heron Boot and Application Startup times dramatically!
Here I will share some methods on tweaking and optimizing your ubuntu install that I have learned over the years tweaking linux. This is small and sweet, down to the point and can dramatically speed up your system.
First lets tweak our directory structure so our Computer can find/seek files faster:
What we'll need is a Ubuntu Gutsy+ LiveCD and boot it up, and right click unmount all the drives mounted in nautilus via places. Then Open up a Terminal: Applications->Accessories->Terminal
Lets Sudo Root:sudo -s
Then lets check which drives we got to optimize:df -h
Example:/dev/sda3 154G 145G 1.6G 99% /media/sda3
/dev/sda4 99G 61G 39G 62% /media/sda4
Ok great, we got a list of our drives to optimize so lets get to work:e2fsck -fD /dev/sda3
choose y for yes and optimize your drive, then continue to the next drive once finished
If you need to you can RTFM on e2fsck: -D Optimize directories in filesystem. This option causes e2fsck
to try to optimize all directories, either by reindexing them if
the filesystem supports directory indexing, or by sorting and
compressing directories for smaller directories, or for filesys‐
tems using traditional linear directories.
Ok now that the drives are optimized the system should be more responsive. So were finished with the liveCD portion of this howto, so reboot, and remove your liveCD.
Ok the next tweak I dont use completely, I only use noatime in my fstab and I dont use writeback mode because I sometimes have power outages and dont want to risk dataloss. So changing to writeback is dangerous but much faster if you do not have to worrie about dataloss, crashes, lockups, forced reboot/shutdowns.
Ok now you can Use data=writeback and noatime when mounting ext3 partitions in /etc/fstab:sudo gedit /etc/fstab
Here is an example of what I have in my fstab:UUID=3eb414ba-5198-4c1f-9e3d-e91675329f83 / ext3 defaults,noatime,errors=remount-ro 0 0
Lets change this to:UUID=3eb414ba-5198-4c1f-9e3d-e91675329f83 / ext3 defaults,data=writeback,noatime,errors=remount-ro 0 0
Ok now lets tune our drive for writeback mode:sudo tune2fs -o journal_data_writeback /dev/sda1
For reference you can RTFM:writeback
Data ordering is not preserved - data may be written into
the main file system after its metadata has been commit‐
ted to the journal. This is rumoured to be the highest-
throughput option. It guarantees internal file system
integrity, however it can allow old data to appear in
files after a crash and journal recovery.
noatime
Do not update inode access times on this file system
(e.g, for faster access on the news spool to speed up
news servers).
Ok now lets install preload to optimize bootspeed and application startup time, I have an alternate tutorial here explaining how preload works:sudo apt-get install preload
Ok you can also tune the swap/memory usage by optimizing swappiness, I have provided a more in depth tutorial explaining what it does here So lets tweak our swappiness:sudo gedit /etc/sysctl.conf
If you have a lot of memory and succeed in not using swap at all and want swap to be used less then add this line:vm.swappiness=0
If your computer has little memory and needs to swap add this line instead:vm.swappiness=100
You may want to experiment with swapiness by changing it between 0 - 100
Last but not least you may want to profile your boot, what this does is, executes the readahead daemon to readahead files that you use every boot like drivers/gdm/kde/X, this is easy, on reboot, press esc to enter grub then find the kernel line:/boot/vmlinuz-2.6.24-16-generic root=UUID=3eb414ba-5198-4c1f-9e3d-e91675329f83 ro splash=verbose vga=794
Press e once its selected then append profile after this line like this:/boot/vmlinuz-2.6.24-16-generic root=UUID=3eb414ba-5198-4c1f-9e3d-e91675329f83 ro splash=verbose vga=794 profile
Then Press enter then "b" to boot up, what this will do is learn what files load every boot up and read them in advance every boot up. This will temporarily disable preload so once it finishes profiling and you are at a login terminal, reboot again and your system should startup/boot faster, and preload will preload applications and important libraries that you frequently access.
I hope this helps others enjoy Ubuntu Linux more, this took me 5 minutes to create, so let me know if I need to explain this a little better.
Have any other tweaks to add to this list? I'll give you credit.
Tweak Gnome Startup added by defcon @ 10:00 AM
You may also want to remove unnecessary applications starting up that gnome executes by opening Session Preferences via: System->Preferences->Sessions
Click on StartUp Programs
I disabled Bluetooth manager because I do not use bluetooth, you may want to as well.
I have disabled check for new hardware drivers because I do that via synaptic
I have disabled network manager because I use /etc/network/interfaces only and apt-get remove network-manager network-manager-gnome if you do not need it
I have disabled Print Queue Applet because I dont print on this computer
I also disabled Visual Assistance because I do not need assistance
You may find other things you may want to disable as well to speed up gnome startup
Howto: Harden the Ubuntu Linux Kernel with sysctl
I ran across a nice sysctl.conf file that will help secure your computer and prevent many different attacks on your computer like Man In the Middle Attacks, Syn attacks, source routing scans/attacks, spoofing protection/logging, and many others, read below.
Lets Harden our kernel:sudo gedit /etc/sysctl.conf
Now lets paste the following example below then ctrl-s save and exit
After you make the changes to the file lets apply the changes without a reboot:sysctl -p
sysctl -w net.ipv4.route.flush=1
Example:# 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.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
#Prevent SYN attack
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 2048
net.ipv4.tcp_synack_retries = 2
# 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 = 1
net.ipv4.conf.lo.log_martians = 1
net.ipv4.conf.eth0.log_martians = 1
# 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
# Modify system limits for Ensim WEBppliance
fs.file-max = 65000
# 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
# Set maximum amount of memory allocated to shm to 256MB
kernel.shmmax = 268435456
# Improve file system performance
vm.bdflush = 100 1200 128 512 15 5000 500 1884 2
# Improve virtual memory performance
vm.buffermem = 90 10 60
# Increases the size of the socket queue (effectively, q0).
net.ipv4.tcp_max_syn_backlog = 1024
# Increase the maximum total TCP buffer-space allocatable
net.ipv4.tcp_mem = 57344 57344 65536
# Increase the maximum TCP write-buffer-space allocatable
net.ipv4.tcp_wmem = 32768 65536 524288
# Increase the maximum TCP read-buffer space allocatable
net.ipv4.tcp_rmem = 98304 196608 1572864
# Increase the maximum and default receive socket buffer size
net.core.rmem_max = 524280
net.core.rmem_default = 524280
# Increase the maximum and default send socket buffer size
net.core.wmem_max = 524280
net.core.wmem_default = 524280
# 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
# Increase the maximum memory used to reassemble IP fragments
net.ipv4.ipfrag_high_thresh = 512000
net.ipv4.ipfrag_low_thresh = 446464
# Increase the maximum amount of option memory buffers
net.core.optmem_max = 57344
# Increase the maximum number of skb-heads to be cached
net.core.hot_list_length = 1024
## DO NOT REMOVE THE FOLLOWING LINE!
## nsobuild:20051206
The above script was found here
Is there any other sysctl settings worth mentioning for hardening?
Tweak Page Cache in Ubuntu Linux
Here I will provide you with some information to help you decide exactly how you would like to tweak your system. I have seen many sites with the swappiness tweak for linux without any documentation on what it does, so I'll try my best to explain this in a simple way.
If you want linux to use as little memory as possible for caching files, and as much memory as possible for processes, and only swap when the memory used by processes is more than the physical memory set swappiness to 0, instead of 60. Users who would like to never see application memory swapped out can set swappiness to zero. This setting uses ram efficently and pretty much ignores using swap until it absolutely needs to like if your running 10 openoffice's and a few firefox windows and some multimedia applications, it will be forced to swap, thats the only way it will. Unfortunately it flushes the applications from memory when you load a new one so you will notice a slower restart time when reloading the application
If you run allot of memory intensive applications like firefox, amarok, and openoffice all the time, you may want to set swappiness to 100 because it will swap more to disk when your current processes run out of physical memory. I noticed that everything was a bit more responsive with this running many programs at once, like when I close firefox and load up xChat then re-open firefox, it loaded a bit quicker since it was swapped. You can take advantage of this setting if you have a fast extra hard drive or a fast usb flash drive which you can use as swap. I have provided a readyboost for linux howto here
Lets get to tweak'nsudo gedit /etc/sysctl.conf
To disable swapping application memory add the line:vm.swappiness=0
To Swap more application data to disk when ram is exhaustedvm.swappiness=100
Basically what I would do is experiment with this setting and see what works best when you load up plenty of applications you use daily because leaving it at the default, 0, or 100 may not be the best option.
Please let us all know your specs and what setting works best for you.
Tweak Ubuntu Boot Speed and Application Startup Time with Preload
I have been running Preload for months testing it out, and I have gained a substantial speed increase for my daily applications, firefox-3, gimp, vlc, xine, pidgin, xchat and deluge torrent. Basically what Preload does is preload frequently used applications in memory before use, so before you even run your frequently used application it is already loaded. So I am enjoying the benifit of applications loading almost instantaneously. By using Preload, you can put unused RAM to good work, and improve the overall performance of your desktop system. If goal is to make application startup times shorter definately install this application!
Installation:
Preload is very easy to install, If you are in firefox try clicking here for a 1 click install! or all you do is simply press ALT-F2, check run in terminal and type this command:sudo apt-get install preload
Once installed, Preload will start, and no further action is necessary, the default configuration should be left alone because the developer spend much time tweaking it for optimal usage, most likely you will notice a degrade in system performance editing the configuration. But if you insist, here is the paper written by the developer Behdad Esfahbod
If you would like to modify the configuration you can by editing /etc/preload.conf
| Option | Default | Controls |
| Cache model (system) settings | ||
| model.cycle | 20 [seconds] | How often Preload will query your system to update it's model about programs and libraries to cache. |
| model.halflife | 168 [hours] | How often Preload will begin to "forget" about old data; for each halflife, the statistical relevance of the current model loses 50% of its importance. |
| model.minsize | 2000000 [bytes] | The minimum amount of system calls an application makes for it to be considered by Preload. A smaller number will mean Preload caches smaller applications, while to make Preload cache only larger applications, increase this number. |
| Memory settings | ||
| The forumula used to determine the maximum available memory available to Preload is: (Total RAM x model.memtotal) + (RAM available at start x model.memfree) + (Cached memory x model.memcached) | ||
| model.memtotal | -10% | |
| model.memfree | 100% | |
| model.memcached | 30% | |
Monitoring
If you want to check up on what resources Preload is using, you can monitor its logfile by running:
sudo tail -f /var/log/preload.logIf you want more information about the specific files that Preload is caching for you, look at this file:
sudo less /var/lib/preload/preload.statePreload can provide a great improvement in application startup time; since most modern machines have a good deal of memory to spare, Preload puts this RAM to good use. I highly recommend installing Preload on your desktop machine, and although it may take a little while for the daemon to learn your habits before your see any real performance improvement, it's a great tool that increases the speed of your system while staying in the background, out of your way.
Howto: Hide Partition Volumes in Ubuntu/Gnome
Gnome users only…
* Run gconf-editor (by hitting Alt+F2 or from terminal).
* Browse to apps->nautilus->desktop in the left-hand folders window
* Uncheck the “volumes_visible” option
Careful, as this will also hide portable storage volumes also…
Next Generation Optimization for Ubuntu!
Well, prefetching isnt a new topic but there is possibility that it can be optimized into the next generation of computing...
I found an interesting Google SoC Project page that shows some promise, ive been searching around for prefetching and ReadyBoost solutions for Ubuntu and ran accross this...
From here:
In todays computer systems the main bottleneck is not CPU but disk access which is several orders of magnitude slower than CPU and memory. In such circumstances the way to improve application performance is to prefetch data it needs from disk before it even requests it and it is the point of prefetching techniques.
The example of prefetching solution is Windows prefetcher.
Here is a little bit from their thesis:
"In this thesis we develop preload, a daemon that prefetches binaries and shared libraries
from the hard disk to main memory on desktop computer systems, to achieve faster
application start-up times. Preload is adaptive: it monitors applications that the user
runs, and by analyzing this data, predicts what applications she might run in the near
future, and fetches those binaries and their dependencies into memory.
We build a Markov-based probabilistic model capturing the correlation between every
two applications on the system. The model is then used to infer the probability that each
application may be started in the near future. These probabilities are used to choose
files to prefetch into the main memory. Special care is taken to not degrade system
performance and only prefetch when enough resources are available.
Preload is implemented as a user-space application running on Linux 2.6 systems."
Howto test optimizations:
*Warning* This is experimental and I have not tested this yet, I am about to once im done posting this, This may or may not be correct, let me know of any issues!
The following is an edited version of there wiki located here
Testing Boot Prefetching and Applications Prefetching
Introduction
First testing version of kernel with automatic boot prefetching and tracing is available. This version is precompiled for Debian-based systems (tested on Ubuntu Gutsy, other distributions might not work). The kernel is standard Ubuntu kernel with these prefetch patches.
Standard disclaimer applies: this is experimental version, it might damage your system use at your own risk and only on systems where you have backups.
*This Requires Ubuntu Gutsy*
Installation
In order to use kernel with prefetching:
Download kernel linux-image deb
Download linux-headers.deb
Install linux-image deb package
Install linux-headers deb package
Remove readahead package using: sudo apt-get remove --purge readahead -
please note that this will cause removing (x/k/edu)ubuntu-desktop package.
Download userspace prefetch support deb and install it using:
dpkg -i prefetch*.deb
Now reboot and select "kernel 2.6.22.6pf.3" during boot.
Uninstallation
In order to remove kernel with prefetching:
Reboot into standard (non-prefetching) kernel.
Remove prefetch userspace support files using apt-get remove --purge prefetch
Install readahead and (x/k/edu)ubuntu-desktop package.
Remove linux-image package with prefetching support (with "pf" in name).
Resources:
Launchpad Project
Summer Of Code 2007 Progress
Development Discussions
Google Code Page
Tweak Ubuntu Boot Processes & Runlevels
I personally like gui tools but I also tweak my bootable applications via the command line.
Here is what I use:
Command line tools:
rcconf - This tool configures system services in connection with system
This is my favorite cmd-line app
sysv-rc-conf - sysv-rc-conf provides a terminal GUI for managing "/etc/rc{runlevel}.d/"
symlinks. The interface comes in two different flavors, one that simply
allows turning services on or off and another that allows for more fine tuned
management of the symlinks. Unlike most runlevel config programs, you can
edit startup scripts for any runlevel, not just your current one.
runlevels. It turns on/off services using the scripts in
/etc/init.d/. Rcconf works with System-V style runlevel configuration.
It is a TUI(Text User Interface) frontend to the update-rc.d command.
GUI Tools:
bum - Boot-Up Manager is a graphical tool to allow easy configuration
of init services in user and system runlevels, as far as changing
Start/Stop services priority.
This baby kicks ass
services-admin - The standard services administration tool for ubuntu
A small known fact about this application is that you can rightclick on the service and change the run-level's
You can simply grab these tools via sudo apt-get install application-listed-above
Here is a quick explaination on Ubuntu & Linux runlevels that effect applications that boot:
Linux run levels are numbered 0 through 6. Run levels stop at six for practical and historical reasons, but it is entirely possible to have more if desired.
The following table summarizes the User Linux run levels:
* 0 System Halt
* 1 Single user
* 2 Full multi-user mode (Default)
* 3-5 Same as 2
* 6 System Reboot
Special Run Levels
Run level 0 is the system halt condition. Nearly all modern X86 computers will power off automatically when run level 0 is reached. Older X86 computers, and various different architectures will remain powered on and display a message referring to the halt condition.
Run Level 1 is known as ’single user’ mode. A more apt description would be ‘rescue’, or ‘trouble-shooting’ mode. In run level 1, no daemons (services) are started. Hopefully single user mode will allow you to fix whatever made the transition to rescue mode necessary.
(You can boot into single user mode typically by using your boot loader, lilo or grub, to add the word ’single’ to the end of the kernel command line).
Run levels 2 through 5 are full multi-user mode and are the same in a default User Linux (Debian) system. It is a common practice in other Linux distributions to use run level 3 for a text console login and run level 5 for a graphical login.
Run level 6 is used to signal system reboot. This is just like run level 0 except a reboot is issued at the end of the sequence instead of a power off.
In the interests of completeness, there is also a runlevel ‘S’ that the system uses on it’s way to another runlevel. Read the man page for the init command (”For manpage click here”) for more information, but you can safely skip this for all practical purposes.
Run Levels Location
Like everything else in a Linux system, run levels are defined by files in the file system. All the run level files are found in the /etc directory according to the following table:
/etc/rc0.d Run level 0
/etc/rc1.d Run level 1
/etc/rc2.d Run level 2
/etc/rc3.d Run level 3
/etc/rc4.d Run level 4
/etc/rc5.d Run level 5
/etc/rc6.d Run level 6
Each defined run level should have an rcX.d directory where X is the run level number. The contents of the rcX.d directory determines what happens at that run level.
Change run levels in Debian and Ubuntu Linux
Before we change run levels it might help to find out which run level is current. Use the ‘runlevel’ command to tell you two things: The last run level, and the current run level. Here is the command and the output shown together due to the sparsity of the output:
# runlevel N 2
The ‘N’ stands for none, meaning there has been no run level change since powering up.
The init system controls run levels, but then again, the init system pretty much controls everything. The init system will be looked at in detail in a future article.
The primary command used to change run levels is ‘telinit’.
#telinit 3
telinit takes one argument on the command line. As always, see the man page for full details. Normally the argument will be one of: 0,1,2,3,4,5,6, or the letter ‘S’. As you may have guessed, the numbers correspond to the run level you wish to move to. Using the ‘S’, for single-user, is the same as the number 1, but don’t do it; the ‘S’ runlevel is intended for use by the UserLinux (Debian)system.
A note of caution is warranted here. You can easily use the telinit command to reboot (run level 6), or shutdown (run level 0) the system, but it is not recommended. Certain programs need special processing for an orderly shutdown. Bypassing the expected shutdown sequence can have dire effects on your data. Older _Unix_ systems are especially sensitive to shutdown/bootup operations.
The preferred method for a serious runlevel change is ’shutdown’. There are easier mnemonics, but in a running system they all point to the ’shutdown’ command. You can use the ‘halt’, or ‘poweroff’ command to stop a system and the ‘reboot’ command to restart your system. In each case they call the ’shutdown’ command with different parameters.
If you wanted runlevel 3 to be the default, then you need to edit /etc/inittab.
# The default runlevel.
id:2:initdefault:
You’d change the ‘2′ to a ‘3′. Next time you reboot, your system will start in runlevel 3. There will be no display manager running in runlevel 3, because you turned it off. Therefore, runlevel 3 will become text only, and it will be the default. If that’s what you want to do.
Adding a new service
You can only add a new service to the boot sequence if a script in /etc/init.d exists. In that case the following command will install it with default settings (foo being the name of a script in /etc/init.d).
#update-rc.d foo default
Removing a service
A service may only be removed after the script in /etc/init.d as deleted already. If so, the following command will remove its references (foo being the name of a script in /etc/init.d).
#update-rc.d foo remove
If you want to remove a service without removing the start/stop script as well, you may consider using the file-rc package and editing the runlevel configuration file /etc/runlevel.conf. When using the SysV method you should rename the start/stop script, then call update-rc.d and then rename the start/stop script back to its old name.
Some of the content for this article source from here
Quicker GUI Editing with mousepad

Here is a small little app that I love to edit with, other than nano and gedit, it uses much less ram and opens instantaneously.
Install it Easily by doing:
apt-get install mousepad
or click on Applications->Add/Remove..-> then search for mousepad and check it to download & install.
Here is a little tip from my tutorial Less typing in the command line
root@ion:~# alias pad="mousepad"
root@ion:~# pad
^opens mousepad and you can just type "pad /etc/sysctl.conf" without the quotes of course :)
Fix Comcast or University BitTorrent Connection Killing on Ubuntu
I was searching the web for a fix for this fuq'd up problem about Comcast and Universities limiting connections with Sandvine. I have many reasons to believe qwest and other internet service providers are going to start limiting your torrent connections which is bullshit. Bittorrent is indeed hard on ISP's with thousands of syn/ack and tcp connection to and from your computer. I have read BANDWIDTH CHALLENGE TO PUSH LIMITS OF TECHNOLOGY and it seems bandwidth is surpassing technology and ISP's need to upgrade, but anyways who's fault is that? Not ours, screw them!
Here is a script that will block the RST packets that reset your connections:
1) open a terminal
2) sudo -s
3) cd /etc/init.d/
4) type cat >>bitfix
5) paste script below:
#!/bin/sh
#Replace 6883 with you Bittorent Port
BT_PORT=6883
#Flush the filters
iptables -F
#Apply new filters
iptables -A INPUT -i lo -j ACCEPT
#Comcast BitTorrent seeding block workaround
iptables -A INPUT -p tcp --dport $BT_PORT --tcp-flags RST RST -j DROP
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#BitTorrent
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport $BT_PORT -j ACCEPT
iptables -A INPUT -m state --state NEW -m udp -p udp --dport $BT_PORT -j ACCEPT
iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited
exit
6) chmod +x bitfix
7) ./bitfix
Your ipchains firewall is now configured and you should have great upload speed now. You will have to run this script every boot.
I left out the rule to let through established connections, -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
Now you if you use Transmission or any other Bittorent client you may have to edit the port
Transmission uses port 9090
Credits
Enable Sudo insults for some laughs!
I recently found a fun feature available within the sudo program that will insult you when you do the wrong thing such as enter your password incorrectly. I’ll tell you how you can activate the feature for a few laughs and also give a few examples of what insults you might get.
To turn the feature on you’ll need to use the following command:
sudo visudo
(always use visudo when you need to edit your sudoers file as it has a self-check system that won’t let you screw it up.)
Find the line that begins with Default and append insults to the end. (Any addition to that line is comma separated.) Your entry will then look like this:
Defaults !lecture,tty_tickets,!fqdn,insults
Save the file and you’ll notice the next time you screw up your sudo password you’ll get an insult.
Note: to clear your sudo session and be required to enter the password again try:
sudo -K
A few examples below:
Maybe if you used more than just two fingers…
I have been called worse.
Listen, burrito brains, I don’t have time to listen to this trash.
Have fun :)
HowTo: Speed up ubuntu boot process - the way you can feel it.
I found this great howto via the forums and I want it on my site :)
This HowTo is for those who complaint ubuntu boot-up speed is pretty slow but not willing to install any alternative tools to speed up. The way I use here is not the altimate solution by any means but it does make differences and it does work. Everything done below is by tuning the boot process itself and because everyone's computer might be different, there is a little risk that something below might break your system. Take your own judgment before you perform a change and always good to do a backup for the /etc dir.
Picking the Kernel thats Right for You (Possible Speed Increase)
Disclaimer
This section is about messing with the kernel and that can be tricky business. Has never messed up for me, but it is a little nerdy. Look here if you want to learn and maybe get a speed boast (or if you have a dual core/dual processor/hyperthreading machine because you WILL get a performance boost). Use at you own risk, I am not a kernel developer or anything.
Be sure not to install the linux-image package instead or things will probably break! If you have done that just install the correct package and things will fix themselves.
***********************
Introduction
I have noticed some recent confusion in the forum when it comes to kernels, so I want to explain some things I have discovered. I hope it helps.
So you just installed Ubuntu but you don't think its going as fast as you think it should? Maybe you have just been advised to install a new kernel so you want to know more.
In Synaptic, if you search for “linux-image” you will find many kernels. Each its follows by some numbers and letters in some order. I will now explain those differences and what each means.
Notes:
- This guide does not apply to the PPC or 64 bit version of Ubuntu.
- If you have a heavily modified setup this might not work. For example if you have installed some drivers "by hand" and not from the repositories.
- Its hard to measure the speed increase, so if in doubt leave it out. Don't follow the guide if you are uncomfortable
- You can always boot back into you old kernel if things mess up. When the OS Menu appears at boot (called the Grub menu) just hit down and then hit enter on the first line with a "386" in it. You might have to hit the ESC key when you boot to pull up this menu.
- My steps will rewite your grub, so if you have a custom grub save it somewhere.
The Many Kinds of Kernels
386 – the default kernel in Ubuntu is the 386 kernel (but I hear its really a 486 kernel). What that means is that its the most compatible kernel because it supports the oldest tech. Here is wiki page to learn more:
http://en.wikipedia.org/wiki/Intel_80386
686 – The kernel that is recommended for use with any Intel Processors in a computer that are more recent then a Pentium Pro. So even old Pentium 2s and 3s can get in on the act. Installing this kernel with may improve performance.
http://en.wikipedia.org/wiki/Pentium_Pro
k7 – This kernel is recommended for a computer with a Athlon or newer AMD CPU. New 64 bit AMD cpus can use it as well if you have the 32 bit version of Ubuntu installed. Installing this kernel with may improve performance.
http://en.wikipedia.org/wiki/Athlon
smp – This kernel is NEEDED to use both CPUs in a multi-CPU setting. The kernel is also required to “enable” hyperthreading in modern Pentium 4 CPUs. Also needed for dual core processors (the letters stand for Symmetric Multiprocessing). Very important to install this, as it WILL improve performance. Sorry to bold it but I think this one is the most important.
http://en.wikipedia.org/wiki/Symmetric_multiprocessing
How to Install New Kernels
You need to install the file below as indicated:
For a modern Pentium 2+ (686) kernel:
Quote:
sudo apt-get install linux-686
For a modern Pentium 2+ kernel for dual processors, dual cores, or hyperthreading:
Quote:
sudo a

