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

NFS Mount
Source: digitalocean.com


 * On Server side:

Installation sudo apt-get install nfs-kernel-server

sudo mkdir /var/nfs/general -p
 * Make a share directory called nfs:

sudo chown nobody:nogroup /var/nfs/general
 * NFS will translate any root operations on the client to the nobody:nogroup credentials as a security measure.
 * Therefore change the directory ownership to match those credentials:


 * For /home do not change permissions, else it will break down the system.

sudo nano /etc/exports /var/nfs/general   203.0.113.256(rw,sync,no_subtree_check) /home      203.0.113.256(rw,sync,no_root_squash,no_subtree_check)
 * Configuring the NFS Exports

rw: This option gives the client computer both read and write access to the volume. sync: This option forces NFS to write changes to disk before replying. This results in a more stable and consistent environment since the reply reflects the actual state of the remote volume. However, it also reduces the speed of file operations. no_subtree_check: This option prevents subtree checking, which is a process where the host must check whether the file is actually still available in the exported tree for every request. This can cause many problems when a file is renamed while the client has it opened. In almost all cases, it is better to disable subtree checking. no_root_squash: By default, NFS translates requests from a root user remotely into a non-privileged user on the server. This was intended as security feature to prevent a root account on the client from using the file system of the host as root. no_root_squash disables this behavior for certain shares.

Restart NFS sudo systemctl restart nfs-kernel-server

sudo apt-get install nfs-common
 * On Client side:

sudo nano /etc/fstab 10.10.1.30:/home/cores /mnt/cores/ nfs auto,noatime,nolock,bg,nfsvers=3,intr,tcp
 * Edit fstab file:

sudo mount -a
 * Test the mount:

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

IP Traffic Forwarding
Enable IPv4 Forwarding:
 * 1) sudo su
 * 2) echo "1" > /proc/sys/net/ipv4/ip_forward

Verify: 1
 * 1) cat /proc/sys/net/ipv4/ip_forward

Make the change persistent: net.ipv4.ip_forward = 1    ==> Copy this line
 * 1) sysctl -a | grep ip_forward

net.ipv4.ip_forward = 1    ==> Paste it at the end of this file
 * 1) vi /etc/sysctl.conf

IPtables rules: iptables -t nat -A POSTROUTING -o ens192 -j MASQUERADE iptables -A FORWARD -i ens193 -o ens192 -j ACCEPT iptables -A FORWARD -i ens193 -o ens192 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables-save

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 nano /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:

If using Gnome, then goto https://extensions.gnome.org & install extensions.

sudo apt-get install preload
 * Install preload to speed up application load time, restart your computer and forget about it. It will be working in the background:

Open Startup Applications & select applications that can be delayed in startup.
 * Manage startup applications

Add sleep 10; in all application commands which you want to delay:

For example, for Dropbox: dropbox start -i

Changes to sleep 20; drobox start -i

service --status-all
 * This command lists services started at boot-time:

sudo systemctl list-unit-files --state=enabled
 * If you have systemd, use this command to find the services that run at boot time:

sudo apt install iotop
 * Check If Your Hard Drive Is Overworking

systemd-analyze time systemd-analyze blame systemd-analyze plot > bootchart.svg
 * Use Bootchart to find out slow services/processes:


 * Slow boot due to nonexistent swap partition askubuntu.com:

At some point during the upgrade, the initramfs config was modified, adding a line pointing to a nonexistent swap partition. The slow boot was because it was looking for this partition and then timing out after 30 seconds.

sudo nano /etc/default/grub

Add noresume to the below line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noresume" sudo update-grub sudo reboot

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/

Mount VMDK file
Source: stackoverflow.com

sudo apt install libguestfs-tools sudo lsblk sudo mkdir /mnt/vmdk sudo guestmount -a pro_nlb_avi-se-02old-disk1.vmdk -m /dev/sda3 --ro /mnt/vmdk