Ubuntu

GPRS Dial-up Internet Connection
sudo apt-get install bluez-utils sudo apt-get install blues-pin sudo apt-get install ppp

hcitool scan sudo hcitool cc 00:22:98:E3:5F:35 sudo hcitool auth 00:22:98:E3:5F:35 sdptool browse 00:22:98:E3:5F:35

sudo gedit /etc/bluetooth/rfcomm.conf rfcomm0 { bind yes; device 00:22:98:E3:5F:35; channel 2; comment "PPP connect"; }

$sudo /etc/init.d/bluez-utils restart

First create the file /etc/ppp/peers/bluetoothconn

debug noauth connect "/usr/sbin/chat -v -f /etc/chatscripts/bluetoothconn" usepeerdns /dev/rfcomm0 115200 defaultroute crtscts lcp-echo-failure 0

Now edit the file /etc/chatscripts/bluetoothconn

TIMEOUT 35 ECHO   ON ABORT   'nBUSYr' ABORT  'nERRORr' ABORT  'nNO ANSWERr' ABORT  'nNO CARRIERr' ABORT  'nNO DIALTONEr' ABORT  'nRINGINGrnrnRINGINGr' ''     rAT OK     'AT+CGDCONT=2,"IP","btmobile.bt.com"' OK     ATD*99***2# CONNECT ""

found that ***2 worked. You might have to play around with this for your own telco - try swapping the '2' for any integer between '1' and '4', or even remove the whole lot and just terminate with a '#'.

To bring the connection up $pon bluetoothconn

and to turn it off again: $poff Bluetoothconn

Mount Network Drives in fstab
$mount -t cifs -o username=yourusername,password=yourpassword,domain=yourdomain //server/sharename/ /mnt/folderonyourcomp/

options    : username=yourusername,password=yourpassword,domain=yourdomain type       : cifs file system : /mnt/folderonyourcomp (this is your local mountpoint for the remote share)

Update fstab: proc           	/proc           proc    nodev,noexec,nosuid 	                        0       0 UUID=467A89307A891DB5 	/VM 		ntfs 	defaults 		                       0 	2 UUID=467A89307A891DB5 	/VM 		ntfs 	defaults 		                       0 	2 /mnt/folderonyourcomp	/		cifs	username=aman,password=cisco,domain=yourdomain	0	2

Different ways to disable IPv6 for network efficiency
1. gksudo gedit /etc/modprobe.d/aliases

change alias net-pf-10 ipv6 to alias net-pf-10 off If the above change is not working you need to change the following one alias net-pf-10 off ipv6 Save the file and reboot

2. Disable IPv6 in Firefox. Type about:config and search for: network.dns.disableIPv6 -> TRUE

3. gksudo gedit /etc/default/grub Change GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” to GRUB_CMDLINE_LINUX_DEFAULT=”ipv6.disable=1 quiet splash” Save and exit the file Update the grub from the command line sudo update-grub

4. Another method: echo "#disable ipv6" >> /etc/sysctl.conf echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf

Backtrack-Ubuntu General Networking
/etc/init.d/networking start sudo gedit /etc/network/interfaces file auto eth0 iface eth0 inet static address 192.168.0.100 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1

sudo gedit /etc/resolv.conf nameserver 192.168.0.1

update-rc.d networking defaults

Webshare: Simple file server
Run "webshare" and the current directory and everything beneath it will be served from a new web server listening on port 8000.
 * 1) alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test"'

Network Manager issue after running pppoeconf
gksudo gedit /etc/network/interfaces Remove everything but: auto lo iface lo inet loopback

gksudo gedit /etc/NetworkManager/nm-system-settings.conf

[ifupdown] managed=false Restart computer or NetworkManager service

Trickle
sudo trickled -d 40 -u 40

This will start the trickle daemon that will limit the total bandwidth available to all programs run via trickle to 20 K/s both up and down. So if you run a single program via trickle, it can consume 20 K/s. Two programs can each consume 10 K/s, etc.

sudo gedit /etc/trickled.conf [ssh] Priority = 1 Time-Smoothing = 0.1 Length-Smoothing = 1 [www] Priority = 2 Time-Smoothing = 5 Length-Smoothing = 10 [ftp] Priority = 8

Wondershaper
sudo aptitude install wondershaper sudo wondershaper eth0 40 40

Download a big and uncompressable file while pinging to a fast and stable server on the internet or to your modem and adjust your downspeed until you are satisfied and do the same with uploading a big and uncompressable file.

When you are ready you can make these connection settings permanent by sudo gedit /etc/network/interfaces

add these lines under eth1 if eth1 is your internetconnection. Change eth1,upspeed and downspeed to your settings. up /sbin/wondershaper eth1 downspeed upspeed down /sbin/wondershaper clear eth1

How do I go about putting my settings back to default for eth1? sudo wondershaper clear eth1

XRDP on Ubuntu Server
Source: c-nergy.be

Additional Packages: sudo apt-get install x11-xkb-utils sudo apt-get install pkg-config

Installing Mate Desktop Environment: sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon

Installing XRDP Paackage: sudo apt-get install xrdp sudo sed -i.bak '/fi/a #xrdp multiple users configuration \n mate-session \n' /etc/xrdp/startwm.sh sudo systemctl restart xrdp

Samba for Windows Sharing
Installation: sudo apt-get install samba

Set a password for your user in Samba sudo smbpasswd -a 

Backup current config file: sudo cp /etc/samba/smb.conf ~

Edit smb.conf file: sudo nano /etc/samba/smb.conf

[My Files] Comment = USB Drive on Rpi path = /media/usbdrive read only = no Browseable = yes Writeable = Yes only guest = no create mask = 0777 directory mask = 0777 Public = yes Guest ok = yes
 * 1) valid users = testuser

Restart the samba: sudo service smbd restart

Check your smb.conf for any syntax errors testparm

To access your network share sudo apt-get install smbclient

List all shares: smbclient -L /// -U

Connect: smbclient /// -U

Networking in 17.10 onwards

 * NetPlan replaces the static interfaces (/etc/network/interfaces) file.
 * Now you must use /etc/netplan/*.yaml to configure Ubuntu interfaces.

network: version: 2 renderer: networkd ethernets: ens33: dhcp4: yes dhcp6: yes
 * The new interfaces configuration file now live in the /etc/netplan directory.
 * A file called 01-netcfg.yaml is used to configured the first interface.
 * Below is the default configuration for a interface using DHCP:

To save your changes, you run the commands below. sudo netplan apply


 * Configuring Static IP Addresses

To configure a static IP address using the new NetPlan tool, the file should look like this: network: version: 2 renderer: networkd ethernets: ens33: dhcp4: no    dhcp6: no     addresses: [192.168.1.2/24] gateway4: 192.168.1.1 nameservers: addresses: [8.8.8.8,8.8.4.4]

Exit and save your changes by running the commands below sudo netplan apply

Networking Service
Restarting Networking Service: sudo systemctl restart networking sudo systemctl restart networking.service

To verify status: sudo systemctl status networking.service

Beep
beep -f 200 -d 1 -r 5 -n -f 300 -d 10 -r 4 -n -f 400 -d 10 -r 3 beep -f 784 -l 600 beep -f 784 -r 3 -l 100 beep -f 1000 -n -f 2000 -n -f 1500  beep -f 659 -l 460 -n -f 784 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 880 -l 230 -n -f 659 -l 230 -n -f 587 -l 230 -n -f 659 -l 460 -n -f 988 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 1047-l 230 -n -f 988 -l 230 -n -f 784 -l 230 -n -f 659 -l 230 -n -f 988 -l 230 -n -f 1318 -l 230 -n -f 659 -l 110 -n -f 587 -l 230 -n -f 587 -l 110 -n -f 494 -l 230 -n -f 740 -l 230 -n -f 659 -l 460

Optimize
sudo gedit /etc/apt/apt.conf.d/00aptitude
 * Remove language related ign from apt-get update:

Add the following line at the end of this file: Acquire::Languages "none";

You don’t need to do anything after installing TLP. It works in the background. sudo add-apt-repository ppa:linrunner/tlp sudo apt-get update sudo apt-get install tlp tlp-rdw sudo tlp start
 * Reduce overheating:

sudo apt-get install indicator-cpufreq
 * Install CPUFREQ indicator, Restart your computer and use the Powersave mode in it::

Ubuntu Upgrade using ISO
sudo mount -o loop ~/Desktop/ubuntu-9.10-alternate-i386.iso /media/cdrom0 sudo mount -t iso9660 -o ro,loop=/dev/loop0   sudo apt-get update && sudo apt-get upgrade -y

Colorful ls
add these lines in $HOME/.bashrc: if [ "$TERM" != "dumb" ]; then eval "`dircolors -b`" alias ls='ls --color=auto' fi

Tasksel
Show all tasks tasksel --list Display the extended description of a task tasksel --task-desc lamp-server List the packages which are parts of a task tasksel --task-packages lamp-server Install/remove a task gksudo tasksel
 * "Tasksel" group software packages into "task"s. You can select a "task" and then install all necessary software packages. It is easy to set up LAMP servers or cloud computing servers.

Change Process priority
renice NEW_PRIORITY `pgrep NAME_OF_PROCESS` renice 5 `pgrep firefox` renice -5 `pgrep wine-server` high <--> low NEW_PRIORITY = -19, -18, -17 [...]18, 19, 20

SOX
Record a Voice File sox -t ossdsp /dev/dsp test.wav

Convert Raw Audio File to MP3 Music File sox -w -c 2 -r 8000 audio1.raw audio1.wav lame -h audio1.wav audio1.mp3

# : Denotes the super(root) user $ : Denotes the normal user

Ctrl + Z: To stop a command that is working interactively without terminating it. Ctrl + C: To stop a command that is not responding. (Cancellation). Ctrl + D: To send the EOF( End of File) signal to a command normally when you see ‘>’.

Automount Partitions
sudo fdisk -l sudo blkid gedit /etc/fstab

==>> UUID=0be0771d-707c-4130-9add-4427fe321ebf /data   ext4      defaults                                    0    2 ==>> UUID=57561AE8337EA3CC	                /winxp	 ntfs-3g   defaults,locale=en_IN,uid=1000,gid=1000     0    0

Enable Beep
sudo apt-get install beep sudo gedit /etc/modules  ==>>   pcspkr

crontab -e 00 * * * * beep -f 2000 -l 500

sudo modprobe pcspkr and then beep should work.

If this works for you then to enable the loading of pcspkr permanently gksudo gedit /etc/modprobe.d/blacklist.conf file

comment out line that says blacklist pcspkr so it looks like this:
 * 1) blacklist pcspkr

Disable Hibernate
sudo gedit /usr/share/polkit-1/actions/org.freedesktop.upower.policy

There are two sections, the first for suspend and the second for hibernate,Near end of each section will be a line with: yes

Change to this: no

Save the changes and reboot

Enable Hibernate in Ubuntu 14.04
Test Hibernate: sudo pm-hibernate

Swap partition must be at least as large as your RAM. Check the memory and swap sizes on the Resources tab. “Memory” here refers to your RAM.

As user root, create a file /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla with the following content:

[Re-enable hibernate by default in upower] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=yes

[Re-enable hibernate by default in logind] Identity=unix-user:* Action=org.freedesktop.login1.hibernate ResultActive=yes

Then run the following command to restart the session (or simply reboot): $ killall indicator-session-service

Pidgin Gmail
protocol : XMPP domain : gmail.com Connect Server : talk.google.com

Pidgin with Google Talk
Download & Install the latest version of Pidgin. Open Pidgin and go to Add / Edit Account window of Pidgin. From the drop-down box choose XMPP as the Protocol. For the Screen name enter your Google Id (Gmail Id). eg. manast86 For Server enter gmail.com You can leave the Resource with the default Home In the Password field enter your Google ID password. Enter Local alias as whatever you want to. Also: Force old (port 5223) SSL: Checked Allow plaintext auth over unencrypted streams: Un-Checked Connect Port: 443 Connect Server: talk.google.com Proxy type: Use Global Proxy Settings

Swappiness
The default value of swappiness in Ubuntu is 60, and it recommends swappiness=10 to improve overall performance. First, check the value of swappiness: cat /proc/sys/vm/swappiness

Temporarily change swappiness value to 10 using following command, and it will be reverted in next restart. sudo sysctl vm.swappiness=10

To permanently change this value: gksudo gedit /etc/sysctl.conf

Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so: vm.swappiness=10

Finally, save the file and reboot.

Middle Click to Paste
Linux users can use two separate clipboards --the traditional clipboard with the Cut, Copy, and Paste operations and another clipboard – when you highlight some text with your mouse. On middle clicking in a text entry area, a copy of the text you highlighted gets pasted into the text entry field.

Wifi driver for BCM Chip
To test the driver (to prevent the need for a computer restart) use: sudo modprobe -r b43 ssb wl brcmfmac brcmsmac bcma sudo modprobe b43

If WiFi works after the above command: sudo apt-get install firmware-b43-installer sudo apt-get purge bcmwl-kernel-source

Ubuntu VNC Authentication issue
sudo apt-get -y install dconf-tools dconf write /org/gnome/desktop/remote-access/require-encryption false /usr/lib/vino/vino-server --sm-disable start

Making your own Bash wormholes
The mkfifo command makes a pipe for sharing data, connecting two running utilities with a kind of command line wormhole. The data that is sent into one end will instantly appear at the other end. The 'fifo' component of the command makes reference to the nature of the pipe - the data that's first comes in and out. You can create the pipe by typing mkfifo, followed by the name that you want to call it. Once you have created the pipe, you only need to route data into it. For eg mkfifo fifo_pipe tail -f fifo_pipe

Remote control MPlayer
Mplayer can be controlled from a console, a shell script or even over the network. It tells the program to accept commands from the stdin stream in place of keystrokes. You can combine this with the -input option, and commands are read from a file, or a FIFO. For example, in one terminal you can put: mkfifo ~/mplayer-control mplayer -slave -input file=/home/user/mplayercontrol filetoplay

In another terminal- echo "pause" >~/mplayer-control

The command will pause the currently running MPlayer and issue a command that will resume playback.

Sharing files in an easy manner
File sharing with Samba or NFS is easy once it is set up on both computers. What about file transfer to another computer on the network without the need for setting up software? If the file size is small it can be emailed. In the event of the computers being in the same room and USB devices being used on both, you can use a USB flash drive. The other option is Woof. This is a Python script that can run on any Linux (or similar) computer. You can download the script from the homepage at http://www.home.unix-ag.org/simon/woof.html and make it run. You can then share the file by using this command. ./woof /path/to/myfile

Most common user Commands
history | awk '{print $2}' | sort | uniq -c | sort -rn | head -10

Cleanup old Kernel files
dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get -y purge

Modified version to remove both images & headers: echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -V | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo apt-get -y purge

FIGlet
Source: shellhacks.com

Install and run FIGlet sudo apt-get install figlet figlet "Shell Hacks"

Change Fonts figlet -f digital "Shell Hacks"

If you would prefer centered output figlet -c "Shell Hacks"

Print a list of available FIGlet fonts : showfigfonts

You can also download and use additional FIGlet fonts: http://www.figlet.org/fontdb.cgi wget http://www.figlet.org/fonts/univers.flf figlet -f univers.flf "lol"

To display the output of a command, pipe the cmd: date +%r | figlet -f bubble

Copy-Paste the output of this file to below file(create it if it is not present): /etc/motd

You can alter the complete MOTD message from below files: /etc/update-motd.d/