Ubuntu: Difference between revisions

From 太極
Jump to navigation Jump to search
No edit summary
Line 593: Line 593:
</syntaxhighlight>
</syntaxhighlight>


==== How to know if there are updates available? ====
==== PPA management ====
http://askubuntu.com/questions/457874/how-to-know-if-there-are-updates-available
* https://www.howtoforge.com/tutorial/ubuntu-ppa-management/


Type 'software update' in the Dash. It will launch Software Updater and also check for updates.
Add a ppa repository,
 
==== "Failed to download Package Files" - Software Updater ====
[http://ubuntuforums.org/showthread.php?t=2196376 One solution] is to run the following command first
<pre>
sudo apt-get update && sudo apt-get upgrade
</pre>
and then run the software updater. Usually it requires the computer to restart.
 
I personally adjust the frequency of notification by choosing 'Every two weeks' for Automatically check for updates, etc.
 
==== apt-get -s upgrade ====
To do a simulated update
 
==== How do I get a list of obsolete/outdated packages? ====
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
$ sudo apt install aptitude
# sudo add-apt-repository [repository name]
$ aptitude search '~o'
sudo add-apt-repository ppa:embrosyn/cinnamon
 
sudo apt-get update
$ aptitude search '?obsolete'
# sudo apt-get install [software name]
sudo apt-get install cinnamon cinnamon-core
</syntaxhighlight>
</syntaxhighlight>
The result is not correct. Better to use '''sudo apt -s upgrade'''.


==== apt-get upgrade vs apt-get dist-upgrade ====
Remove a ppa repository.
* http://askubuntu.com/questions/194651/why-use-apt-get-upgrade-instead-of-apt-get-dist-upgrade
<syntaxhighlight lang='bash'>
# method 1: add-apt-repository
# This works on URL format
# sudo apt-add-repository 'deb https://dl.iwnhq.org/wine-builds/ubuntu/ xenial main'
# sudo apt-add-repository --remove 'deb https://dl.iwnhq.org/wine-builds/ubuntu/ xenial main'
sudo add-apt-repository --remove ppa:embrosyn/cinnamon
# method 2: ppa-purge
sudo apt-get install ppa-purge
sudo ppa-purge ppa:embrosyn/cinnamon
# method 3: use GUI
</syntaxhighlight>


My experience aligns with the statement: '''dist-upgrade''' is more likely to break stuff badly than '''upgrade'''.
[https://linoxide.com/ubuntu-how-to/remove-add-ppa-ubuntu/ How to Remove and Add PPA on Ubuntu 18.04]. When you add a PPA on your system, it will create the ppa file in the '''/etc/apt/sources.list.d''' directory.


==== Offline update/upgrade: [https://github.com/rickysarraf/apt-offline apt-offline] ====
[http://ask.xmodulo.com/list-installed-repositories-ppas-ubuntu.html List ppa repositories]. Still needs to use eyeball to distinguish.
[https://www.ostechnix.com/fully-update-upgrade-offline-debian-based-systems/ How To Fully Update And Upgrade Offline Debian-based Systems]
 
==== Mint ====
Works well on 18.2. It can check the speed for each mirrors.
 
[[File:Mint software sources.png|250px]]
 
=== Troubleshooting ===
==== [http://askubuntu.com/questions/406229/there-was-no-etc-default-grub-file Grub2 cannot boot after timeout] ====
There is not /etc/default/grub with GRUB2.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo apt-get --reinstall install grub-pc
apt-cache policy | grep http | awk '{print $2 $3}' | sort -u
</syntaxhighlight>
</syntaxhighlight>


==== [http://askubuntu.com/questions/454037/disk-drive-boot-problem-the-disk-drive-for-tmp-is-not-ready-yet-or-is-not-pres The disk drive for /tmp is not ready yet] ====
===== Some PPA I have =====
<syntaxhighlight lang='bash'>
Office
sudo mv /tmp /tmp_old
* gnome-terminator
sudo mkdir /tmp
* shutter
sudo chmod 1777 /tmp
* shutter (Sources)
</syntaxhighlight>
* texworks
* texworks (Sources)


==== [http://askubuntu.com/questions/73997/how-do-i-fix-a-failed-to-download-package-files-error Software updater -  “Failed to download package files” error?] ====
Home
Change the download location to 'Main Server' or another server close to the country you live in and try to sudo apt-get update again.
* R
* google chrome (ppa?)
* certbot
* docker (ppa?)
* dropbox
* firefox


=== Display Manager ===
===== Additional repositories (not PPA) =====
[https://www.linuxuprising.com/2018/12/how-to-change-default-display-manager.html How To Change The Default Display Manager (Switch To GDM, LightDM, SDDM, Or LXDM) In Debian, Ubuntu Or Linux Mint]
* Docker
* Google (Chrome)
* Rstudio
* Rstudio (Sources)


=== Suspend, hibernate ===
==== How to know if there are updates available? ====
On Ubuntu 18.04, the system preferences can set up when the system will go into suspend. You can enable it for battery or plug-in case.
http://askubuntu.com/questions/457874/how-to-know-if-there-are-updates-available


If you like to suspend immediately, use
Type 'software update' in the Dash. It will launch Software Updater and also check for updates.
* '''sudo systemctl suspend''' from the command line. This requires to enter the password. Note the ''sudo systemctl hibernate'' does not work (the system will just shutdown).
* Press 'Alt' and then the Power Off button should change to a Suspend button from the Gnome Shell user menu. This seems to be better.


=== Password manager ===
==== "Failed to download Package Files" - Software Updater ====
* [https://linuxconfig.org/how-to-organize-your-passwords-using-pass-password-manager How to organize your passwords using pass password manager]
[http://ubuntuforums.org/showthread.php?t=2196376 One solution] is to run the following command first
* [https://www.passwordstore.org/ pass] the standard unix password manager
<pre>
* [https://www.fossmint.com/pass-commandline-password-manager-for-linux/ Pass – Manage Your Passwords from Linux Command Line]
sudo apt-get update && sudo apt-get upgrade
</pre>
and then run the software updater. Usually it requires the computer to restart.
 
I personally adjust the frequency of notification by choosing 'Every two weeks' for Automatically check for updates, etc.


=== Format USB drives ===
==== apt-get -s upgrade ====
* [https://pkgs.org/download/mintstick mintstick]. Linux Mint mintStick DEB package can be used in Ubuntu 18.04.
To do a simulated update
* GParted


==== USB Drive Writing Speed ====
==== How do I get a list of obsolete/outdated packages? ====
Using the dd command <syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo dd if=/dev/zero of=/media/brb/USB\ STICK/test.img bs=100M count=1 oflag=dsync
$ sudo apt install aptitude
$ aptitude search '~o'


sudo dd if=/dev/zero of=/media/brb/USB\ STICK/test.img bs=100M count=10 oflag=dsync
$ aptitude search '?obsolete'
</syntaxhighlight>
</syntaxhighlight>
The result is not correct. Better to use '''sudo apt -s upgrade'''.
==== apt-get upgrade vs apt-get dist-upgrade ====
* http://askubuntu.com/questions/194651/why-use-apt-get-upgrade-instead-of-apt-get-dist-upgrade


Some data from plugging into USB 2.0 slot. Partition format may be FAT32 or Ext3/4.
My experience aligns with the statement: '''dist-upgrade''' is more likely to break stuff badly than '''upgrade'''.
* Staples 128GB: 6.7M/s when writing 200M (fat32 formatted by [[Linux#Format_a_USB_drive|USB Stick Formatter]]). 161M/s when writing 200M, 174M/s when writing 400M, 9M/s when writing 800M (NTFS).
* Toshiba 16GB USB 3.0: 9M/s when writing 200M, 5.6M/s when writing 400M, 3.9M/s when writing 800M.
* Samsung 128GB USB 3.0 flash drive fit: 7.6M/s when writing 200M, 12M/s when writing 400M, 6.7M/s when writing 800M, 10M/s when writing 1600M.
* Seagate Backup Plus 4T: 25-27 M/s when writing on ext4 and 500-750 M/s on exFAT.
* WD MyPassort 1T: 154M/s when writing 200M, 156M/s when writing 400M, 168M/s when writing 800M (NTFS/exFAT). 22~24M/s when writing on ext3.
* WD Mybook 4T: 21.4 MB/s when writing 1G.


Conclusions:
==== Offline update/upgrade: [https://github.com/rickysarraf/apt-offline apt-offline] ====
# USB flash drive is slow compared to USB portable hard drive.
[https://www.ostechnix.com/fully-update-upgrade-offline-debian-based-systems/ How To Fully Update And Upgrade Offline Debian-based Systems]
# Large writing will become slower on USB flash drive but not on hard drive.
# <strike>NTFS/exFAT is several times faster than ext3/ext4</strike>. The testing result here is false b/s caching.
# The test result can fluctuate a lot when using the dd command with count=1.


Cautions:
==== Mint ====
* When I use the '''cp''' command to copy a 4.3GB iso file to USB flash drive, it took less than 1 minute. But after I eject the drive (disappear from NEMO Windows Manager/taskbar notification), its LED keeps flashing. A message "Writing data to USB DISK 2.0 Don't unplug until finished" appears on top right corner of my desktop. If I unplug it now, the OS will pop up an error message "Error ejecting /dev/sdc ...". This makes me suspect the testing results here. In fact, when I try to plug in the flash drive, the OS cannot mount the drive. I need to go back to use the USB Stick Formatter to reformat the drive.
Works well on 18.2. It can check the speed for each mirrors.


=== Use '''parted''' command to format a new hard disk ===
[[File:Mint software sources.png|250px]]
* The '''fdisk''' won’t create partitions larger than 2 TB. Use '''parted''' with GPT partition table.
* [https://www.2daygeek.com/how-to-manage-disk-partitions-using-parted-command/ How To Manage Disk Partitions Using Parted Command]
* http://askubuntu.com/questions/517354/terminal-method-of-formatting-storage-drive. The bottomline is not to use '''fdisk''' since it does not support GPT. Use '''parted''' (the CLI brother of GParted).
* http://www.tecmint.com/parted-command-to-create-resize-rescue-linux-disk-partitions/
* https://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html
* https://trisquel.info/en/wiki/how-format-external-storage-device-using-parted


=== Troubleshooting ===
==== [http://askubuntu.com/questions/406229/there-was-no-etc-default-grub-file Grub2 cannot boot after timeout] ====
There is not /etc/default/grub with GRUB2.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo apt-get install parted
sudo apt-get --reinstall install grub-pc
</syntaxhighlight>


sudo fdisk -l /dev/sdb  # find out the disk size
==== [http://askubuntu.com/questions/454037/disk-drive-boot-problem-the-disk-drive-for-tmp-is-not-ready-yet-or-is-not-pres The disk drive for /tmp is not ready yet] ====
 
<syntaxhighlight lang='bash'>
sudo parted
sudo mv /tmp /tmp_old
  print
sudo mkdir /tmp
  select /dev/sdb
sudo chmod 1777 /tmp
  mklabel myLabel
  mkpart primary ext4 0GB 128GB
  print
  quit
lsblk
sudo mkfs.ext4 /dev/sdb1
 
mkdir /mnt/newdisk
sudo mount /dev/sdb1 /mnt/newdisk
df -h
</syntaxhighlight>
</syntaxhighlight>


=== Gparted ===
==== [http://askubuntu.com/questions/73997/how-do-i-fix-a-failed-to-download-package-files-error Software updater -  “Failed to download package files” error?] ====
It is best to use the latest release of GParted https://github.com/GNOME/gparted/.
Change the download location to 'Main Server' or another server close to the country you live in and try to sudo apt-get update again.


The gparted version on Mint 17.2 is 0.18.0 (Feb 19, 2014) while the current one is 0.28.1 (Feb 17, 2017).
=== Display Manager ===
[https://www.linuxuprising.com/2018/12/how-to-change-default-display-manager.html How To Change The Default Display Manager (Switch To GDM, LightDM, SDDM, Or LXDM) In Debian, Ubuntu Or Linux Mint]


After I create a bootable USB drive, the partition format is fat32 (I use an old version of GParted to format the drive as fat32, and then I use unetbootin to create the bootable USB drive).  
=== Suspend, hibernate ===
On Ubuntu 18.04, the system preferences can set up when the system will go into suspend. You can enable it for battery or plug-in case.


If we want to use unetbootin, the USB drive has better to be pre-formatted as fat32 first for unetbootin to detect it. Once unetbootin detect the drive, we can use gparted to reformat it as NTFS before going to burn the Windows bootable USB drive. Read [https://askubuntu.com/questions/162174/how-do-i-use-unetbootin-to-make-a-bootable-windows-usb-installer How do I use Unetbootin to make a bootable Windows USB installer?].
If you like to suspend immediately, use  
* '''sudo systemctl suspend''' from the command line. This requires to enter the password. Note the ''sudo systemctl hibernate'' does not work (the system will just shutdown).
* Press 'Alt' and then the Power Off button should change to a Suspend button from the Gnome Shell user menu. This seems to be better.


==== '''gparted''' on a 4TB disk ====
=== Password manager ===
Get an error when I tried to create partitions on a 4T disk. Search 4TB gparted sectors exceeds the msdos-partition-table-imposed maximum of 4294967295
* [https://linuxconfig.org/how-to-organize-your-passwords-using-pass-password-manager How to organize your passwords using pass password manager]
* [https://www.passwordstore.org/ pass] the standard unix password manager
* [https://www.fossmint.com/pass-commandline-password-manager-for-linux/ Pass – Manage Your Passwords from Linux Command Line]


It seems it is necessary to use '''GPT''' instead of '''MBR/msdos''' as a partition table to overcome 2TB limitions.
=== Format USB drives ===
* [https://pkgs.org/download/mintstick mintstick]. Linux Mint mintStick DEB package can be used in Ubuntu 18.04.
* GParted


It is also a good idea to use a live gparted os since the one in Ubuntu may not be up-to-date and gparted takes forever to scan devices. When boot from live USB, we need to turn off the Ext hard disk first.
==== USB Drive Writing Speed ====
Using the dd command <syntaxhighlight lang='bash'>
sudo dd if=/dev/zero of=/media/brb/USB\ STICK/test.img bs=100M count=1 oflag=dsync


Step1. Device -> Create a partition table -> GPT
sudo dd if=/dev/zero of=/media/brb/USB\ STICK/test.img bs=100M count=10 oflag=dsync
</syntaxhighlight>


Step2. Create a new ext4 partition as you want.
Some data from plugging into USB 2.0 slot. Partition format may be FAT32 or Ext3/4.
* Staples 128GB: 6.7M/s when writing 200M (fat32 formatted by [[Linux#Format_a_USB_drive|USB Stick Formatter]]). 161M/s when writing 200M, 174M/s when writing 400M, 9M/s when writing 800M (NTFS).
* Toshiba 16GB USB 3.0: 9M/s when writing 200M, 5.6M/s when writing 400M, 3.9M/s when writing 800M.
* Samsung 128GB USB 3.0 flash drive fit: 7.6M/s when writing 200M, 12M/s when writing 400M, 6.7M/s when writing 800M, 10M/s when writing 1600M.
* Seagate Backup Plus 4T: 25-27 M/s when writing on ext4 and 500-750 M/s on exFAT.
* WD MyPassort 1T: 154M/s when writing 200M, 156M/s when writing 400M, 168M/s when writing 800M (NTFS/exFAT). 22~24M/s when writing on ext3.
* WD Mybook 4T: 21.4 MB/s when writing 1G.


* http://ubuntuforums.org/showthread.php?t=2164361
Conclusions:
* http://gparted-forum.surf4.info/viewtopic.php?id=14940
# USB flash drive is slow compared to USB portable hard drive.
* http://askubuntu.com/questions/339041/cannot-resize-drive
# Large writing will become slower on USB flash drive but not on hard drive.
* http://unix.stackexchange.com/questions/67835/change-partition-table-with-gparted
# <strike>NTFS/exFAT is several times faster than ext3/ext4</strike>. The testing result here is false b/s caching.
# The test result can fluctuate a lot when using the dd command with count=1.


Note:
Cautions:
* The 4TB hard disk can be recognized and used normally in an internal hd in Ubuntu 12.04.
* When I use the '''cp''' command to copy a 4.3GB iso file to USB flash drive, it took less than 1 minute. But after I eject the drive (disappear from NEMO Windows Manager/taskbar notification), its LED keeps flashing. A message "Writing data to USB DISK 2.0 Don't unplug until finished" appears on top right corner of my desktop. If I unplug it now, the OS will pop up an error message "Error ejecting /dev/sdc ...". This makes me suspect the testing results here. In fact, when I try to plug in the flash drive, the OS cannot mount the drive. I need to go back to use the USB Stick Formatter to reformat the drive.
* The 4TB hard disk can also be used in Windows 7 as an external hd if I formatted it (e.g. from gparted in Linux) as an NTFS partition. The Disk Management (command prompt -> diskmgnt.msc) shows it has 3726.02 GB (3726.02 * 1024 * 1024 * 1024 = 4.000784e12 Bytes) capacity and the windows manager shows it is 3.63TB (3726.02/1024=3.638) total space.  
* It cannot be used as 4TB in the case when I use a docking station in Dell Precision T3500. Unsolved problem:
** Running the command chown from root to user takes forever on 4T partition.
** The ext dock station (StarTech) will halt the shutdown until I power off the station?


Conclusion:
=== Use '''parted''' command to format a new hard disk ===
* 4TB using NTFS works on Ubuntu.
* The '''fdisk''' won’t create partitions larger than 2 TB. Use '''parted''' with GPT partition table.
* rsync will not stop spinning for some reason even the command is finished (through StarTech dock station).
* [https://www.2daygeek.com/how-to-manage-disk-partitions-using-parted-command/ How To Manage Disk Partitions Using Parted Command]
* http://askubuntu.com/questions/517354/terminal-method-of-formatting-storage-drive. The bottomline is not to use '''fdisk''' since it does not support GPT. Use '''parted''' (the CLI brother of GParted).
* http://www.tecmint.com/parted-command-to-create-resize-rescue-linux-disk-partitions/
* https://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html
* https://trisquel.info/en/wiki/how-format-external-storage-device-using-parted


Below is a screenshot I got from Gparted on a pre-formatted (NTFS) 4T portable drive from Seagate. It seems not harmful because I can still umount, change labels, etc on the disk.
<syntaxhighlight lang='bash'>
sudo apt-get install parted


[[File:Gparted gpt.png|200px]]
sudo fdisk -l /dev/sdb  # find out the disk size


=== tracker-miner-fs ===
sudo parted
See http://askubuntu.com/questions/346211/tracker-store-and-tracker-miner-fs-eating-up-my-cpu-on-every-startup how to disable it.
  print
  select /dev/sdb
  mklabel myLabel
  mkpart primary ext4 0GB 128GB
  print
  quit
lsblk
sudo mkfs.ext4 /dev/sdb1


=== Health check of the hdd ===
mkdir /mnt/newdisk
I got an input/output error when I use ''sudo rm'', ''sudo reboot'' or ''Ctrl + Del'' commands.
sudo mount /dev/sdb1 /mnt/newdisk
df -h
</syntaxhighlight>


When I use the power button to force shutdown, I could not boot again. The BIOS does find the hdd and the Ubuntu Live USB does find the internal hdd too.
=== Gparted ===
It is best to use the latest release of GParted https://github.com/GNOME/gparted/.


To force to reboot/shutdown, follow the suggestion [http://linoxide.com/how-tos/inputoutput-error-bad-blocks-how-to-restart-linux/ here]
The gparted version on Mint 17.2 is 0.18.0 (Feb 19, 2014) while the current one is 0.28.1 (Feb 17, 2017).


'''dmesg''' command shows there are a few bad sectors on that hdd.  
After I create a bootable USB drive, the partition format is fat32 (I use an old version of GParted to format the drive as fat32, and then I use unetbootin to create the bootable USB drive).  


http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/ shows a few ways to run a health check on the hdd. The gnome disk utility cannot run S.M.A.R.T. on the external hdd.
If we want to use unetbootin, the USB drive has better to be pre-formatted as fat32 first for unetbootin to detect it. Once unetbootin detect the drive, we can use gparted to reformat it as NTFS before going to burn the Windows bootable USB drive. Read [https://askubuntu.com/questions/162174/how-do-i-use-unetbootin-to-make-a-bootable-windows-usb-installer How do I use Unetbootin to make a bootable Windows USB installer?].
<pre>
sudo badblocks -v /dev/sdb1
sudo badblocks /dev/sdb > /home/zainul/bad-blocks
sudo fsck -l bad-blocks /dev/sdb
</pre>


This article http://linoxide.com/linux-how-to/how-to-fix-repair-bad-blocks-in-linux/ talks about how to fix/repair bad blocks in Linux
==== '''gparted''' on a 4TB disk ====
.
Get an error when I tried to create partitions on a 4T disk. Search 4TB gparted sectors exceeds the msdos-partition-table-imposed maximum of 4294967295


This article http://unix.stackexchange.com/questions/25902/what-does-this-hard-disk-error-message-mean-current-pending-sector-count talks about how to do with bad sectors.
It seems it is necessary to use '''GPT''' instead of '''MBR/msdos''' as a partition table to overcome 2TB limitions.


It is an indicator that hdd is going to die http://www.linuxquestions.org/questions/linux-hardware-18/34-bad-blocks-what-should-i-do-927224-print/.
It is also a good idea to use a live gparted os since the one in Ubuntu may not be up-to-date and gparted takes forever to scan devices. When boot from live USB, we need to turn off the Ext hard disk first.


=== Burn/Write an iso or img file to a USB flash drive ===
Step1. Device -> Create a partition table -> GPT
[http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows Official instruction] on www.ubuntu.com and from [https://en.wikipedia.org/wiki/List_of_tools_to_create_Live_USB_systems wikipedia].


* If your current OS is windows => [http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/#button Universal USB Installer/Live Linux USB Creator].
Step2. Create a new ext4 partition as you want.
* If your current OS is Ubuntu => [https://help.ubuntu.com/community/Installation/FromUSBStick#Creating_a_bootable_Ubuntu_USB_flash_drive_from_Ubuntu Several choices] like '''Startup Disk Creator/usb-creator''' ([[has an option on the GUI to erase the usb drive]]). If your ubuntu derivative does not have it, install it by sudo apt-get install usb-creator-gtk. UNETBOOTIN (no option to erase the USB so it can fail) or mkusb.
* If your current OS is Mint => Right click the iso file and select Make bootable USB stick. No software to install.


==== Use dd ====
* http://ubuntuforums.org/showthread.php?t=2164361
* [http://www.cyberciti.biz/faq/unix-linux-dd-create-make-disk-image-commands/ How to make disk image with dd on Linux or Unix]
* http://gparted-forum.surf4.info/viewtopic.php?id=14940
* http://askubuntu.com/questions/339041/cannot-resize-drive
* http://unix.stackexchange.com/questions/67835/change-partition-table-with-gparted


First, get to know the USB drive device name like /dev/sdb. When using 'dd', the USB drive has to be unmounted (using 'umount' command, not click 'reject' button in File Manager). Note that this will irrevocably destroy all data on /dev/sdX.
Note:
* The 4TB hard disk can be recognized and used normally in an internal hd in Ubuntu 12.04.
* The 4TB hard disk can also be used in Windows 7 as an external hd if I formatted it (e.g. from gparted in Linux) as an NTFS partition. The Disk Management (command prompt -> diskmgnt.msc) shows it has 3726.02 GB (3726.02 * 1024 * 1024 * 1024 = 4.000784e12 Bytes) capacity and the windows manager shows it is 3.63TB (3726.02/1024=3.638) total space.
* It cannot be used as 4TB in the case when I use a docking station in Dell Precision T3500. Unsolved problem:
** Running the command chown from root to user takes forever on 4T partition.
** The ext dock station (StarTech) will halt the shutdown until I power off the station?


The instruction can be found in a lot of places like [https://wiki.archlinux.org/index.php/USB_Flash_Installation_Media Archlinux wiki] page.
Conclusion:
<syntaxhighlight lang='bash'>
* 4TB using NTFS works on Ubuntu.
sudo fdisk -l
* rsync will not stop spinning for some reason even the command is finished (through StarTech dock station).
sudo dd bs=4M if=xxx.img of=/dev/sdb && sync
</syntaxhighlight>
where /dev/sdb is a device name, not a partition name. We can also adjust bs to a smaller value like 1M, 4m.


* [https://opensource.com/article/18/7/how-use-dd-linux Monitor dd operations]. Note for some reason it will stuck in the middle of process; the process bar stopped. And when it happened, 'Ctrl+c' will not stop immediately.
Below is a screenshot I got from Gparted on a pre-formatted (NTFS) 4T portable drive from Seagate. It seems not harmful because I can still umount, change labels, etc on the disk.
<syntaxhighlight lang='bash'>
$ sudo umount /dev/mmcblk0p1
$ sudo apt install pv
$ sudo dd if=Downloads/ubuntu-18.04-desktop-amd64.iso | pv | sudo dd of=/dev/mmcblk0
</syntaxhighlight>


* [http://www.cyberciti.biz/faq/linux-unix-dd-command-show-progress-while-coping/ Monitor the progress],
[[File:Gparted gpt.png|200px]]
** adding a parameter '''status=progress''' in '''dd''' (not working on Ubuntu 14.04)
** Linux '''dialog''' command
** following [[Raspberry#Install_an_image_to_a_SD_card|Raspberry Pi]]
<syntaxhighlight lang='bash'>
sudo pkill -USR1 -n -x dd
</syntaxhighlight>


For some reason when I use dd to create ubuntu 14.04 on usb drive, sudo gparted also gives me a Libparted warning ''/dev/sdc contains GPT signature, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should... Is it a GPT partition table?'' messsage. If I click 'Yes', Gparted shows no partition on the usb drive??? Nevertheless, the usb drive can be used to boot into ubuntu 14.04.
=== tracker-miner-fs ===
See http://askubuntu.com/questions/346211/tracker-store-and-tracker-miner-fs-eating-up-my-cpu-on-every-startup how to disable it.


In another case, the gparted compalins the usb drive "Invalid partition table - recursive partition on /dev/sdb". Someone suggests to issue a command
=== Health check of the hdd ===
<syntaxhighlight lang='bash'>
I got an input/output error when I use ''sudo rm'', ''sudo reboot'' or ''Ctrl + Del'' commands.
sudo dd if=/dev/zero of=/dev/sdb bs=4M
</syntaxhighlight>


==== [https://etcher.io/ Etcher] - cross platform ====
When I use the power button to force shutdown, I could not boot again. The BIOS does find the hdd and the Ubuntu Live USB does find the internal hdd too.
For Ubuntu, there is no need to install the program. Just run the binary file (.AppImage).


See https://www.raspberrypi.org/magpi/pi-sd-etcher/
To force to reboot/shutdown, follow the suggestion [http://linoxide.com/how-tos/inputoutput-error-bad-blocks-how-to-restart-linux/ here]


==== [https://rufus.akeo.ie/ Rufus - Windows] ====
'''dmesg''' command shows there are a few bad sectors on that hdd.  
* Create GPT (for UEFI) or MBR partition table. See [http://www.howtogeek.com/193669/whats-the-difference-between-gpt-and-mbr-when-partitioning-a-drive/ What’s the Difference Between GPT and MBR When Partitioning a Drive?]
* https://github.com/hirotakaster/baytail-bootia32.efi
* [https://medium.com/@tomac/installing-ubuntu-mint-linux-on-onda-820w-tablet-727747a376b#.o4osscrty installing Ubuntu / Mint Linux on Onda 820w tablet]
* It successfully burns ESXi and Ubuntu iso images to USB drives while the USB drives created by the 'dd' command does not work??


==== [https://unetbootin.github.io/ UNETBOOTIN] - cross platform ====
http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/ shows a few ways to run a health check on the hdd. The gnome disk utility cannot run S.M.A.R.T. on the external hdd.
For creating a Windows bootable USB drive, we cannot use Etcher program. On UDoo-X86 [https://www.udoo.org/get-started-x86/ Get started] site, it suggests to use Unetbootin if the host machine is Ubuntu. NOTE. the USB drive has to be formatted as FAT32 (this can be done by '''GParted''' program); otherwise Unetbootin cannot recognize the drive. Unfortunately the USB drive can not be booted from UDoo-X86. See also the trick by [https://askubuntu.com/questions/162174/how-do-i-use-unetbootin-to-make-a-bootable-windows-usb-installer this post].  
<pre>
* The command ''sudo mount /dev/sdc1 /mnt'' should be '''sudo mkdir /media/$USER/usb; sudo mount /dev/sdc1 /media/$USER/usb''' where /dev/sdc1 should be changed appropriately
sudo badblocks -v /dev/sdb1
* This approach works
sudo badblocks /dev/sdb > /home/zainul/bad-blocks
* Rufus is good but not always (eg the USB drive is not bootable??)
sudo fsck -l bad-blocks /dev/sdb
</pre>


The GUI is written by Qt so the program is cross-platform. See its [http://sourceforge.net/p/unetbootin/wiki/compile/ wiki].
This article http://linoxide.com/linux-how-to/how-to-fix-repair-bad-blocks-in-linux/ talks about how to fix/repair bad blocks in Linux
.


The following is a screenshot of the contents of xubuntu 12.04. '''The usb drive needs to be formatted to fat32''' on Windows OS to repair partition table error. The partition table error was discovered when I use sudo gparted program to view the USB drive.
This article http://unix.stackexchange.com/questions/25902/what-does-this-hard-disk-error-message-mean-current-pending-sector-count talks about how to do with bad sectors.


Note that Unetbootin (Windows & Linux) and Universal USB installer (Windows only) are quite similar although Universal USB installer provides more options in its interface while Unetbootin does not have any other options.
It is an indicator that hdd is going to die http://www.linuxquestions.org/questions/linux-hardware-18/34-bad-blocks-what-should-i-do-927224-print/.


[[File:XUbuntu12044 USBdrive.png|200px]]
=== Burn/Write an iso or img file to a USB flash drive ===
[[File:XUbuntu gparted.png|200px]]
[http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows Official instruction] on www.ubuntu.com and from [https://en.wikipedia.org/wiki/List_of_tools_to_create_Live_USB_systems wikipedia].


==== Universal USB Installer/UUI ====
* If your current OS is windows => [http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/#button Universal USB Installer/Live Linux USB Creator].
http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
* If your current OS is Ubuntu => [https://help.ubuntu.com/community/Installation/FromUSBStick#Creating_a_bootable_Ubuntu_USB_flash_drive_from_Ubuntu Several choices] like '''Startup Disk Creator/usb-creator''' ([[has an option on the GUI to erase the usb drive]]). If your ubuntu derivative does not have it, install it by sudo apt-get install usb-creator-gtk. UNETBOOTIN (no option to erase the USB so it can fail) or mkusb.
* If your current OS is Mint => Right click the iso file and select Make bootable USB stick. No software to install.


I first used ''dd'' command to successfully created a xubuntu 14.04 usb drive but there seems to be a problem with the partition since the gparted program will give a warning message about that and also the whole 16GB was used when I insert the drive onto a Windows machine.
==== Use dd ====
* [http://www.cyberciti.biz/faq/unix-linux-dd-create-make-disk-image-commands/ How to make disk image with dd on Linux or Unix]


Note that the '''fdisk''' utility cannot handle this new partition format so we have to use the '''gparted''' program.
First, get to know the USB drive device name like /dev/sdb. When using 'dd', the USB drive has to be unmounted (using 'umount' command, not click 'reject' button in File Manager). Note that this will irrevocably destroy all data on /dev/sdX.


Open the '''gparted''' program. Use it MULTIPLE TIMES to create a partition table (Device -> Create Partition Table...). Then we create a FAT32 partition with all of the space. After that, we can use the UUI program to create an Ubuntu USB drive.
The instruction can be found in a lot of places like [https://wiki.archlinux.org/index.php/USB_Flash_Installation_Media Archlinux wiki] page.
<syntaxhighlight lang='bash'>
sudo fdisk -l
sudo dd bs=4M if=xxx.img of=/dev/sdb && sync
</syntaxhighlight>
where /dev/sdb is a device name, not a partition name. We can also adjust bs to a smaller value like 1M, 4m.


The following screenshots are from a 16GB USB drive.
* [https://opensource.com/article/18/7/how-use-dd-linux Monitor dd operations]. Note for some reason it will stuck in the middle of process; the process bar stopped. And when it happened, 'Ctrl+c' will not stop immediately.
<syntaxhighlight lang='bash'>
$ sudo umount /dev/mmcblk0p1
$ sudo apt install pv
$ sudo dd if=Downloads/ubuntu-18.04-desktop-amd64.iso | pv | sudo dd of=/dev/mmcblk0
</syntaxhighlight>


[[File:UUIa.png|200px]] [[File:UUIb.png|200px]]
* [http://www.cyberciti.biz/faq/linux-unix-dd-command-show-progress-while-coping/ Monitor the progress],
** adding a parameter '''status=progress''' in '''dd''' (not working on Ubuntu 14.04)
** Linux '''dialog''' command
** following [[Raspberry#Install_an_image_to_a_SD_card|Raspberry Pi]]
<syntaxhighlight lang='bash'>
sudo pkill -USR1 -n -x dd
</syntaxhighlight>


=== Multiple boot USB ===
For some reason when I use dd to create ubuntu 14.04 on usb drive, sudo gparted also gives me a Libparted warning ''/dev/sdc contains GPT signature, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should... Is it a GPT partition table?'' messsage. If I click 'Yes', Gparted shows no partition on the usb drive??? Nevertheless, the usb drive can be used to boot into ubuntu 14.04.
==== [http://www.pendrivelinux.com/yumi-multiboot-usb-creator/ YUMI] ====
YUMI works much like Universal USB Installer, except it can be used to install more than one distribution to run Live from your USB.


It can be used to create a Multiboot USB Flash Drive containing multiple operating systems, antivirus utilities, disc cloning, diagnostic tools, and more.
In another case, the gparted compalins the usb drive "Invalid partition table - recursive partition on /dev/sdb". Someone suggests to issue a command
<syntaxhighlight lang='bash'>
sudo dd if=/dev/zero of=/dev/sdb bs=4M
</syntaxhighlight>


==== [http://multibootusb.org/ MultiBootUSB] ====
==== [https://etcher.io/ Etcher] - cross platform ====
The program is included by LXLE.
For Ubuntu, there is no need to install the program. Just run the binary file (.AppImage).


It supports [https://wiki.ubuntu.com/LiveUsbPendrivePersistent persistence] up to 4GB for ubuntu and its derivatives.
See https://www.raspberrypi.org/magpi/pi-sd-etcher/


It also supports multi-thread (check by top or htop). The %cpu > 100.  
==== [https://rufus.akeo.ie/ Rufus - Windows] ====
* Create GPT (for UEFI) or MBR partition table. See [http://www.howtogeek.com/193669/whats-the-difference-between-gpt-and-mbr-when-partitioning-a-drive/ What’s the Difference Between GPT and MBR When Partitioning a Drive?]
* https://github.com/hirotakaster/baytail-bootia32.efi
* [https://medium.com/@tomac/installing-ubuntu-mint-linux-on-onda-820w-tablet-727747a376b#.o4osscrty installing Ubuntu / Mint Linux on Onda 820w tablet]
* It successfully burns ESXi and Ubuntu iso images to USB drives while the USB drives created by the 'dd' command does not work??


It will take space as needed. So we can still use the USB drive to write data.
==== [https://unetbootin.github.io/ UNETBOOTIN] - cross platform ====
For creating a Windows bootable USB drive, we cannot use Etcher program. On UDoo-X86 [https://www.udoo.org/get-started-x86/ Get started] site, it suggests to use Unetbootin if the host machine is Ubuntu. NOTE. the USB drive has to be formatted as FAT32 (this can be done by '''GParted''' program); otherwise Unetbootin cannot recognize the drive. Unfortunately the USB drive can not be booted from UDoo-X86. See also the trick by [https://askubuntu.com/questions/162174/how-do-i-use-unetbootin-to-make-a-bootable-windows-usb-installer this post].  
* The command ''sudo mount /dev/sdc1 /mnt'' should be '''sudo mkdir /media/$USER/usb; sudo mount /dev/sdc1 /media/$USER/usb''' where /dev/sdc1 should be changed appropriately
* This approach works
* Rufus is good but not always (eg the USB drive is not bootable??)


* http://multibootusb.org/news/
The GUI is written by Qt so the program is cross-platform. See its [http://sourceforge.net/p/unetbootin/wiki/compile/ wiki].
* https://github.com/mbusb/multibootusb
* https://github.com/mbusb/multibootusb/wiki/User-Guide


For some reason, the USB drive could not be boot after I use the program. The ubuntu does not show/recognize it though gparted still finds it. Maybe it is because the partition format (ext4 by gparted) is right. For YUMI program, it says to use fat16/fat32/NTFS; otherise syslinux will fail. But it seems not to help:( Maybe it is the partition table (I choose gpt instead of the default msdos).
The following is a screenshot of the contents of xubuntu 12.04. '''The usb drive needs to be formatted to fat32''' on Windows OS to repair partition table error. The partition table error was discovered when I use sudo gparted program to view the USB drive.
 
Note that Unetbootin (Windows & Linux) and Universal USB installer (Windows only) are quite similar although Universal USB installer provides more options in its interface while Unetbootin does not have any other options.
 
[[File:XUbuntu12044 USBdrive.png|200px]]
[[File:XUbuntu gparted.png|200px]]


=== Determine/install/switch Window Manager ===
==== Universal USB Installer/UUI ====
* http://askubuntu.com/questions/72549/how-to-determine-which-window-manager-is-running
http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
* http://askubuntu.com/questions/227607/different-display-and-window-managers-for-ubuntu-and-how-to-install-them


<pre>
I first used ''dd'' command to successfully created a xubuntu 14.04 usb drive but there seems to be a problem with the partition since the gparted program will give a warning message about that and also the whole 16GB was used when I insert the drive onto a Windows machine.
sudo apt-get install wmctrl
wmctrl -m         


sudo apt-get install <pkg-name>
Note that the '''fdisk''' utility cannot handle this new partition format so we have to use the '''gparted''' program.
<pkg-name> --replace
</pre>


On Ubuntu the default window manager is '''Compiz''', for xubuntu it is '''Xfwm4''' and for BBB it is '''Openbox'''.
Open the '''gparted''' program. Use it MULTIPLE TIMES to create a partition table (Device -> Create Partition Table...). Then we create a FAT32 partition with all of the space. After that, we can use the UUI program to create an Ubuntu USB drive.


=== Show date in top bar of desktop ===
The following screenshots are from a 16GB USB drive.
* [https://askubuntu.com/questions/1040306/how-to-show-date-in-top-bar-of-deskop-in-ubuntu-18-04-lts Ubuntu 18.04] <syntaxhighlight lang='bash' inline>dconf write /org/gnome/desktop/interface/clock-show-date 'true' </syntaxhighlight>


=== Jenkins ===
[[File:UUIa.png|200px]] [[File:UUIb.png|200px]]
[https://www.howtoforge.com/tutorial/how-to-install-jenkins-with-apache-on-ubuntu-16-04/ How to Install Jenkins Automation Server with Apache on Ubuntu 16.04]


=== Automatic update ===
=== Multiple boot USB ===
* https://help.ubuntu.com/lts/serverguide/automatic-updates.html
==== [http://www.pendrivelinux.com/yumi-multiboot-usb-creator/ YUMI] ====
* http://www.howtogeek.com/228690/how-to-enable-automatic-system-updates-in-ubuntu/
YUMI works much like Universal USB Installer, except it can be used to install more than one distribution to run Live from your USB.
* Update log '''more /var/log/dpkg.log'''
* To check the history including the commands used to run apt update, see '''less /var/log/apt/history.log'''
: <syntaxhighlight lang='rsplus'>
$ tail /var/log/apt/history.log
Start-Date: 2018-12-05  06:38:19
Commandline: /usr/bin/unattended-upgrade
Install: ...
Upgrade: ...
...
Start-Date: 2018-12-21  06:18:59
Commandline: /usr/bin/unattended-upgrade
Upgrade: linux-libc-dev:amd64 (4.4.0-140.166, 4.4.0-141.167)
End-Date: 2018-12-21  06:19:00
</syntaxhighlight>
* Software & Updates GUI
** By default, it will check automatically check updates every day. I changed it to every week.
** When there are security updates, it will download and install automatically by default. Looks good.
** When there are other updates, it will display weekly.
* [https://www.omgubuntu.co.uk/2016/02/how-to-disable-automatic-update-ubuntu How to Disable Automatic Updates On Ubuntu]


=== After running update/upgrade in Ubuntu ===
It can be used to create a Multiboot USB Flash Drive containing multiple operating systems, antivirus utilities, disc cloning, diagnostic tools, and more.
==== Virtualbox ====
Virtualbox does not work. After initial fix, the guest machine cannot connect to internet:(


==== Crashes network manager (no internet connection, no applet) ====
==== [http://multibootusb.org/ MultiBootUSB] ====
The solution on [http://askubuntu.com/questions/727127/last-upgrade-crashes-network-manager-no-internet-connection-no-applet here] works on my Ubuntu 14.04.4. Download 3 deb files and install them (downgrade packages).
The program is included by LXLE.


=== Printer setup ===
It supports [https://wiki.ubuntu.com/LiveUsbPendrivePersistent persistence] up to 4GB for ubuntu and its derivatives.
* [https://www.ibm.com/developerworks/library/l-lpic1-108-4/index.html Manage printers and printing]
 
It also supports multi-thread (check by top or htop). The %cpu > 100.  


Printers -> Add ->  Network Printer -> Find Network Printer (wait a little bit).
It will take space as needed. So we can still use the USB drive to write data.


It shows two matches. Brother HL-5250DN (AppSocket/JetDirect network printer via DNS-SD) & Brother HL-5250DN series (LPD network printer via DNS-SD). The first one does not work and the 2nd one works.
* http://multibootusb.org/news/
* https://github.com/mbusb/multibootusb
* https://github.com/mbusb/multibootusb/wiki/User-Guide


Another way is to type the IP approach (Enter URI). Enter 192.168.1.88:9100 -> Select printer from database -> Brother. There are two possibilities: HL-5250DN & HL-5250DN for CUPS. The first one does not work and the 2nd one works.
For some reason, the USB drive could not be boot after I use the program. The ubuntu does not show/recognize it though gparted still finds it. Maybe it is because the partition format (ext4 by gparted) is right. For YUMI program, it says to use fat16/fat32/NTFS; otherise syslinux will fail. But it seems not to help:( Maybe it is the partition table (I choose gpt instead of the default msdos).


It is strange that when I try to print from Firefox, it shows 3 options (Print to file, BRN_xxxxx, HL-5250DN). The BRN_XXXXX shows the status is online but it cannot be printed.
=== Determine/install/switch Window Manager ===
* http://askubuntu.com/questions/72549/how-to-determine-which-window-manager-is-running
* http://askubuntu.com/questions/227607/different-display-and-window-managers-for-ubuntu-and-how-to-install-them


==== Web interface (port 631) ====
<pre>
* [https://askubuntu.com/questions/23936/how-do-you-administer-cups-remotely-using-the-web-interface  How do you administer CUPS remotely using the web interface?]
sudo apt-get install wmctrl
* [[Raspberry#Connect_your_dumb_printer_to_your_home_network|Connect your dumb printer to your home network by Raspberry Pi]]
wmctrl -m         


==== Command line ====
sudo apt-get install <pkg-name>
* '''lpstat -p''': Display all installed printers
<pkg-name> --replace
* '''lpstat -a''': Display only those printers that are currently accepting print requests.
</pre>
* '''lpadmin -x''': Delete a printer. PS I cannot delete a printer either using the GUI or the command line:(


==== LPR & Cupswrapper ====
On Ubuntu the default window manager is '''Compiz''', for xubuntu it is '''Xfwm4''' and for BBB it is '''Openbox'''.
* [https://askubuntu.com/questions/383515/whats-the-difference-between-lpr-and-cupswrapper-drivers-how-to-install-printe What's the difference between LPR and cupswrapper drivers? How to install printer drivers?]
* [http://support.brother.com/g/b/producttop.aspx?c=eu_ot&lang=en&prod=mfcl2710dw_us_eu_as Brother MFC-L2710DW] driver download & manual. It looks this is 2015 product.
** Deb version
** The deb version only has i386 version.
** [https://faithtechlife.com/2015/06/03/setting-up-brother-mfc-l2700dw-on-ubuntu/ Setting Up Brother MFC-L2700DW on Ubuntu 14.04]
* From Brother's website (shell script). See also [https://notebook.thriftechs.com/2017/11/installing-brother-mfc-l2700dw-as-network-printer-on-ubuntu/ INSTALLING BROTHER MFC-L2700DW AS NETWORK PRINTER ON UBUNTU 16.04], or [https://kbpdfstudio.qoppa.com/install-printer-driver-on-linux/ this post] from PDF Studio for step-by-step instruction with screenshots.
*# Download the '''Driver Install Tool''' (linux-brprinter-installer-*.*.*-*.gz) under Utilities instead of Printer Driver.
*# Open a terminal window.
*# cd Downloads
*# gunzip linux-brprinter-installer-*.*.*-*.gz
*# su bash linux-brprinter-installer-*.*.*-* "Brother machine name"; e.g. sudo bash linux-brprinter-installer-2.2.0-1 MFC-L2700DW
*# The driver installation will start. Follow the installation screen directions. When you see the message "Will you specify the DeviceURI ?", For USB Users: Choose N(No) For Network Users: Choose Y(Yes) and DeviceURI number.
*# The install process may take some time. Please wait until it is complete.
* It seems Ubuntu 18.04 can automatically detect the MFC-L2700DW network printer.


==== Drum ====
=== Show date in top bar of desktop ===
* [http://support.brother.com/g/b/faqend.aspx?prod=hl5250dn_all&c=eu_ot&lang=en&faqid=faq00000154_022 Replace the drum unit]
* [https://askubuntu.com/questions/1040306/how-to-show-date-in-top-bar-of-deskop-in-ubuntu-18-04-lts Ubuntu 18.04] <syntaxhighlight lang='bash' inline>dconf write /org/gnome/desktop/interface/clock-show-date 'true' </syntaxhighlight>
* https://youtu.be/KpK3gDJTF3k


=== Graphics driver ===
=== Jenkins ===
* https://help.ubuntu.com/community/BinaryDriverHowto/Nvidia By default Ubuntu will use the open source video driver '''Nouveau''' for your NVIDIA graphics card. This driver lacks support for 3D acceleration and may not work with the very latest video cards or technologies from NVIDIA.
[https://www.howtoforge.com/tutorial/how-to-install-jenkins-with-apache-on-ubuntu-16-04/ How to Install Jenkins Automation Server with Apache on Ubuntu 16.04]
* http://www.ubuntugeek.com/install-updated-and-optimized-open-graphics-drivers-radeon-intel-and-nvidia-on-ubuntu-15-0414-04.html
* http://www.howtogeek.com/242045/how-to-get-the-latest-nvidia-amd-or-intel-graphics-drivers-on-ubuntu/
* http://www.binarytides.com/linux-get-gpu-information/


GPU info
=== Automatic update ===
<syntaxhighlight lang='bash'>
* https://help.ubuntu.com/lts/serverguide/automatic-updates.html
$ lspci -vnn | grep VGA -A 12
* http://www.howtogeek.com/228690/how-to-enable-automatic-system-updates-in-ubuntu/
# OR
* Update log '''more /var/log/dpkg.log'''
$ lshw -numeric -C display
* To check the history including the commands used to run apt update, see '''less /var/log/apt/history.log'''
: <syntaxhighlight lang='rsplus'>
$ tail /var/log/apt/history.log
Start-Date: 2018-12-05  06:38:19
Commandline: /usr/bin/unattended-upgrade
Install: ...
Upgrade: ...
...
Start-Date: 2018-12-21  06:18:59
Commandline: /usr/bin/unattended-upgrade
Upgrade: linux-libc-dev:amd64 (4.4.0-140.166, 4.4.0-141.167)
End-Date: 2018-12-21  06:19:00
</syntaxhighlight>
</syntaxhighlight>
* Software & Updates GUI
** By default, it will check automatically check updates every day. I changed it to every week.
** When there are security updates, it will download and install automatically by default. Looks good.
** When there are other updates, it will display weekly.
* [https://www.omgubuntu.co.uk/2016/02/how-to-disable-automatic-update-ubuntu How to Disable Automatic Updates On Ubuntu]


To check hardware acceleration
=== After running update/upgrade in Ubuntu ===
<syntaxhighlight lang='bash'>
==== Virtualbox ====
# If glxinfo is not find, run sudo apt-get install mesa-utils
Virtualbox does not work. After initial fix, the guest machine cannot connect to internet:(
$ glxinfo | grep OpenGL
</syntaxhighlight>


Under Ubuntu-Unity, we can search Additional Drivers to install propriety party drivers instead of using X.org.
==== Crashes network manager (no internet connection, no applet) ====
The solution on [http://askubuntu.com/questions/727127/last-upgrade-crashes-network-manager-no-internet-connection-no-applet here] works on my Ubuntu 14.04.4. Download 3 deb files and install them (downgrade packages).


On Dell T3600, it shows (pay attention to the line '''driver=nouveau'''). See also [https://nouveau.freedesktop.org/wiki/InstallNouveau/ Installing Nouveau on your Linux computer].
=== Printer setup ===
<syntaxhighlight lang='bash'>
* [https://www.ibm.com/developerworks/library/l-lpic1-108-4/index.html Manage printers and printing]
$ sudo lshw -C video
[sudo] password for brb:
  *-display
    description: VGA compatible controller
    product: GF108GL [Quadro 600]
    vendor: NVIDIA Corporation
    physical id: 0
    bus info: pci@0000:03:00.0
    version: a1
    width: 64 bits
    clock: 33MHz
    capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
    configuration: driver=nouveau latency=0
    resources: irq:82 memory:ee000000-eeffffff memory:f0000000-f7ffffff memory:f8000000-f9ffffff ioport:e000(size=128) memory:ef000000-ef07ffff
</syntaxhighlight>


If I change to use the nvidia driver on T3600 which has NVIDIA Quadro 600, the GLX error will happen (OpenGL related. Some programs like Qt Creator, Blender will not be able to run). See [https://taichimd.us/mediawiki/index.php/Qt#Could_not_initialize_GLX._Aborted the detail].
Printers -> Add ->  Network Printer -> Find Network Printer (wait a little bit).


==== AMD vs NVIDIA ====
It shows two matches. Brother HL-5250DN (AppSocket/JetDirect network printer via DNS-SD) & Brother HL-5250DN series (LPD network printer via DNS-SD). The first one does not work and the 2nd one works.
[http://www.makeuseof.com/tag/use-amd-nvidia-gpus-linux/ Should You Use AMD or NVIDIA GPUs on Linux?]


=== Autostart when log into your desktop ===
Another way is to type the IP approach (Enter URI). Enter 192.168.1.88:9100 -> Select printer from database -> Brother. There are two possibilities: HL-5250DN & HL-5250DN for CUPS. The first one does not work and the 2nd one works.
1. '''~/.config/autostart/''' (hidden directory)


Add .desktop files to here to have programs start automatically at startup. These .desktop files are application shortcuts — you can often create them by dragging-and-dropping an application onto your desktop or even just into the ~/.config/autostart/ window.
It is strange that when I try to print from Firefox, it shows 3 options (Print to file, BRN_xxxxx, HL-5250DN). The BRN_XXXXX shows the status is online but it cannot be printed.


If you’re not using a desktop environment check out '''~/.bash_profile''' file.
==== Web interface (port 631) ====
* [https://askubuntu.com/questions/23936/how-do-you-administer-cups-remotely-using-the-web-interface  How do you administer CUPS remotely using the web interface?]
* [[Raspberry#Connect_your_dumb_printer_to_your_home_network|Connect your dumb printer to your home network by Raspberry Pi]]


2. '''/etc/xdg/autostart'''
==== Command line ====
* '''lpstat -p''': Display all installed printers
* '''lpstat -a''': Display only those printers that are currently accepting print requests.
* '''lpadmin -x''': Delete a printer. PS I cannot delete a printer either using the GUI or the command line:(


Or search 'Startup Applications Preferences' in Dash/Menu. [https://askubuntu.com/questions/48321/how-do-i-start-applications-automatically-on-login How do I start applications automatically on login?]
==== LPR & Cupswrapper ====
* [https://askubuntu.com/questions/383515/whats-the-difference-between-lpr-and-cupswrapper-drivers-how-to-install-printe What's the difference between LPR and cupswrapper drivers? How to install printer drivers?]
* [http://support.brother.com/g/b/producttop.aspx?c=eu_ot&lang=en&prod=mfcl2710dw_us_eu_as Brother MFC-L2710DW] driver download & manual. It looks this is 2015 product.
** Deb version
** The deb version only has i386 version.
** [https://faithtechlife.com/2015/06/03/setting-up-brother-mfc-l2700dw-on-ubuntu/ Setting Up Brother MFC-L2700DW on Ubuntu 14.04]
* From Brother's website (shell script). See also [https://notebook.thriftechs.com/2017/11/installing-brother-mfc-l2700dw-as-network-printer-on-ubuntu/ INSTALLING BROTHER MFC-L2700DW AS NETWORK PRINTER ON UBUNTU 16.04], or [https://kbpdfstudio.qoppa.com/install-printer-driver-on-linux/ this post] from PDF Studio for step-by-step instruction with screenshots.
*# Download the '''Driver Install Tool''' (linux-brprinter-installer-*.*.*-*.gz) under Utilities instead of Printer Driver.
*# Open a terminal window.
*# cd Downloads
*# gunzip linux-brprinter-installer-*.*.*-*.gz
*# su bash linux-brprinter-installer-*.*.*-* "Brother machine name"; e.g. sudo bash linux-brprinter-installer-2.2.0-1 MFC-L2700DW
*# The driver installation will start. Follow the installation screen directions. When you see the message "Will you specify the DeviceURI ?", For USB Users: Choose N(No) For Network Users: Choose Y(Yes) and DeviceURI number.
*# The install process may take some time. Please wait until it is complete.
* It seems Ubuntu 18.04 can automatically detect the MFC-L2700DW network printer.


Resources:
==== Drum ====
* http://www.howtogeek.com/228467/how-to-make-a-program-run-at-startup-on-any-computer/
* [http://support.brother.com/g/b/faqend.aspx?prod=hl5250dn_all&c=eu_ot&lang=en&faqid=faq00000154_022 Replace the drum unit]
* https://developer.toradex.com/knowledge-base/how-to-autorun-application-at-the-start-up-in-linux
* https://youtu.be/KpK3gDJTF3k


=== Auto start services on boot ===
=== Graphics driver ===
* https://geekflare.com/how-to-auto-start-services-on-boot-in-linux/
* https://help.ubuntu.com/community/BinaryDriverHowto/Nvidia By default Ubuntu will use the open source video driver '''Nouveau''' for your NVIDIA graphics card. This driver lacks support for 3D acceleration and may not work with the very latest video cards or technologies from NVIDIA.
* https://askubuntu.com/questions/9382/how-can-i-configure-a-service-to-run-at-startup
* http://www.ubuntugeek.com/install-updated-and-optimized-open-graphics-drivers-radeon-intel-and-nvidia-on-ubuntu-15-0414-04.html
* [[#Make_script_run_at_boot_time_with_init.d_directory|Make script run at boot time with init.d directory]]
* http://www.howtogeek.com/242045/how-to-get-the-latest-nvidia-amd-or-intel-graphics-drivers-on-ubuntu/
* http://www.binarytides.com/linux-get-gpu-information/


On Ubuntu (Let’s say script name is nginx),
GPU info
# Copy the script in '''/etc/init.d/''' folder
# Execute the below command
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
update-rc.d nginx defaults
$ lspci -vnn | grep VGA -A 12
# OR
$ lshw -numeric -C display
</syntaxhighlight>
</syntaxhighlight>
# Reboot the server to ensure services are started.


=== Take screenshots (and edit them) ===
To check hardware acceleration
https://wiki.archlinux.org/index.php/taking_a_screenshot
 
==== gnome-screenshot (preinstalled in Ubuntu) ====
[https://www.howtoforge.com/tutorial/taking-screenshots-in-linux-using-gnome-screenshot/ A comprehensive guide to taking screenshots in Linux using gnome-screenshot]
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
# Current window
# If glxinfo is not find, run sudo apt-get install mesa-utils
gnome-screenshot -w
$ glxinfo | grep OpenGL
</syntaxhighlight>


# an area
Under Ubuntu-Unity, we can search Additional Drivers to install propriety party drivers instead of using X.org.
gnome-screenshot -a


# delay
On Dell T3600, it shows (pay attention to the line '''driver=nouveau'''). See also [https://nouveau.freedesktop.org/wiki/InstallNouveau/ Installing Nouveau on your Linux computer].
gnome-screenshot –delay=[SECONDS]
<syntaxhighlight lang='bash'>
$ sudo lshw -C video
[sudo] password for brb:
  *-display
    description: VGA compatible controller
    product: GF108GL [Quadro 600]
    vendor: NVIDIA Corporation
    physical id: 0
    bus info: pci@0000:03:00.0
    version: a1
    width: 64 bits
    clock: 33MHz
    capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
    configuration: driver=nouveau latency=0
    resources: irq:82 memory:ee000000-eeffffff memory:f0000000-f7ffffff memory:f8000000-f9ffffff ioport:e000(size=128) memory:ef000000-ef07ffff
</syntaxhighlight>


# interactive mode
If I change to use the nvidia driver on T3600 which has NVIDIA Quadro 600, the GLX error will happen (OpenGL related. Some programs like Qt Creator, Blender will not be able to run). See [https://taichimd.us/mediawiki/index.php/Qt#Could_not_initialize_GLX._Aborted the detail].
gnome-screenshot -i


# directly save your screenshot
==== AMD vs NVIDIA ====
gnome-screenshot –file=[FILENAME]
[http://www.makeuseof.com/tag/use-amd-nvidia-gpus-linux/ Should You Use AMD or NVIDIA GPUs on Linux?]


# copy to the clipboard
=== Autostart when log into your desktop ===
gnome-screenshot -c
1. '''~/.config/autostart/''' (hidden directory)
</syntaxhighlight>


==== [http://shutter-project.org/ Shutter] ====
Add .desktop files to here to have programs start automatically at startup. These .desktop files are application shortcuts — you can often create them by dragging-and-dropping an application onto your desktop or even just into the ~/.config/autostart/ window.
<syntaxhighlight lang='bash'>
# https://launchpad.net/~shutter/+archive/ubuntu/ppa
sudo add-apt-repository ppa:shutter/ppa
sudo apt-get update
sudo apt-get install shutter
</syntaxhighlight>


* After we launch Shutter, the tool sits at the (upper-right) Ubuntu system tray
If you’re not using a desktop environment check out '''~/.bash_profile''' file.
* The built-in editor (click '''Edit''' button on the rhs) is convenient but limited ('''GIMP''' is more powerful but complicated). Tools includes
** Select item to move or resize it
** Draw a freehand line
** Highlighter
** Draw a straight line
** Draw an arrow
** Draw a rectangle
** Draw an ellipse
** Add a text
** Censor portions of the screenshot
** Pixelize selected areas
** Crop
* [http://shutter-project.org/preview/screenshots/ screenshots]
* Each taken screenshots are placed in different tabs in Shutter
* If we close Shutter, the unsaved screenshots are still there because by default it automatically save files in the ~/Pictures folder. We can modify the settings from Edit -> Preferences.
* It also supports 'cropping'. Click 'Edit' button, Tool -> Crop, Select a region, Click 'Crop' button on the RHS.


==== [https://github.com/lupoDharkael/flameshot flameshot] ====
2. '''/etc/xdg/autostart'''
[https://itsfoss.com/take-screenshot-linux/ Best Tools For Taking and Editing Screenshots in Linux]


==== GIMP ====
Or search 'Startup Applications Preferences' in Dash/Menu. [https://askubuntu.com/questions/48321/how-do-i-start-applications-automatically-on-login How do I start applications automatically on login?]
File -> Create -> Screenshot


==== '''import''' ====
Resources:
command from ImageMagick
* http://www.howtogeek.com/228467/how-to-make-a-program-run-at-startup-on-any-computer/
* https://developer.toradex.com/knowledge-base/how-to-autorun-application-at-the-start-up-in-linux


==== '''scrot''' ====
=== Auto start services on boot ===
from scrot package. Note that by default the title bar will not be included (see the '-b' option below).
* https://geekflare.com/how-to-auto-start-services-on-boot-in-linux/
* https://askubuntu.com/questions/9382/how-can-i-configure-a-service-to-run-at-startup
* [[#Make_script_run_at_boot_time_with_init.d_directory|Make script run at boot time with init.d directory]]


It seems '''scrot''' is better for my need.
On Ubuntu (Let’s say script name is nginx),
 
# Copy the script in '''/etc/init.d/''' folder
Note: there seems no way to copy the screenshot to the clipboard.
# Execute the below command
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
scrot -c -d 5 screenshot.png    # -c is count down, -d is delay
update-rc.d nginx defaults
</syntaxhighlight>
# Reboot the server to ensure services are started.


scrot -b -c -d 5 -u screenshot.png  # -b is title bar, -u is the current foc'u'sed window
=== Take screenshots (and edit them) ===
https://wiki.archlinux.org/index.php/taking_a_screenshot


scrot -u                        # current window
==== gnome-screenshot (preinstalled in Ubuntu) ====
[https://www.howtoforge.com/tutorial/taking-screenshots-in-linux-using-gnome-screenshot/ A comprehensive guide to taking screenshots in Linux using gnome-screenshot]
<syntaxhighlight lang='bash'>
# Current window
gnome-screenshot -w


scrot -s screenshot.png          # select an area
# an area
gnome-screenshot -a


scrot --thumb 50                # 50% of the original screenshot
# delay
gnome-screenshot –delay=[SECONDS]


scrot abc.png -e 'gthumb $n'    # open gThumb to open the file after taking the screenshot
# interactive mode
gnome-screenshot -i


# sudo apt-get install mirage    # 105 kB
# directly save your screenshot
mirage screenshot.png            # view the image
gnome-screenshot –file=[FILENAME]


scrot -b -d 5 '%Y:%m:%d:%H:%M:%S.png' -e 'mv $f ~/Desktop/'
# copy to the clipboard
gnome-screenshot -c
</syntaxhighlight>
</syntaxhighlight>


See [https://www.howtoforge.com/tutorial/how-to-take-screenshots-in-linux-with-scrot/ How to take screenshots in Linux with scrot].
==== [http://shutter-project.org/ Shutter] ====
 
==== [https://screencloud.net/ ScreenCloud] ====
* Binary for Ubuntu 16.04 is available
* https://github.com/olav-st/screencloud (Compiling instruction is given there)
* http://www.omgubuntu.co.uk/2016/06/force-install-screencloud-ubuntu-16-04
 
==== Hotshots ====
Only supports Ubuntu up to 14.04.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo add-apt-repository ppa:ubuntuhandbook1/apps
# https://launchpad.net/~shutter/+archive/ubuntu/ppa
sudo add-apt-repository ppa:shutter/ppa
sudo apt-get update
sudo apt-get update
sudo apt-get install hotshots
sudo apt-get install shutter
</syntaxhighlight>
</syntaxhighlight>


==== Pinta, mtPaint, MyPaint ====
* After we launch Shutter, the tool sits at the (upper-right) Ubuntu system tray
[[#Paint.NET_like_program|Paint.NET_like_program]]
* The built-in editor (click '''Edit''' button on the rhs) is convenient but limited ('''GIMP''' is more powerful but complicated). Tools includes
** Select item to move or resize it
** Draw a freehand line
** Highlighter
** Draw a straight line
** Draw an arrow
** Draw a rectangle
** Draw an ellipse
** Add a text
** Censor portions of the screenshot
** Pixelize selected areas
** Crop
* [http://shutter-project.org/preview/screenshots/ screenshots]
* Each taken screenshots are placed in different tabs in Shutter
* If we close Shutter, the unsaved screenshots are still there because by default it automatically save files in the ~/Pictures folder. We can modify the settings from Edit -> Preferences.
* It also supports 'cropping'. Click 'Edit' button, Tool -> Crop, Select a region, Click 'Crop' button on the RHS.


=== Screencaster/Record desktop ===
==== [https://github.com/lupoDharkael/flameshot flameshot] ====
[https://itsfoss.com/take-screenshot-linux/ Best Tools For Taking and Editing Screenshots in Linux]


* https://wiki.ubuntu.com/ScreenCasts (seems not updated)
==== GIMP ====
* http://askubuntu.com/questions/4428/how-to-create-a-screencast
File -> Create -> Screenshot
==== [https://launchpad.net/kazam kazam] ====
Although Kazam can do screenshots, [[#Shutter|Shutter]] (can sit on the system tray) is more convenient for taking care of screenshots.


The default frame rate is only 15. If we want to increase it, go to File -> Preferences -> Screencast tab.
==== '''import''' ====
command from ImageMagick


When recording, it will have 5 seconds (adjustable) to wait. After launching Kazam, it will show an icon (video recorder) on the top-right corner. Keyboard shortcuts are available. For example (Windows key=Super key),
==== '''scrot''' ====
* Record=Ctrl + Windows + r,
from scrot package. Note that by default the title bar will not be included (see the '-b' option below).
* Finish=Ctrl + Windows + f,
* Pause=Ctrl + Windows + p.
<syntaxhighlight lang='bash'>
sudo apt-get install kazam
</syntaxhighlight>
You can choose fullscreen, window or a specific area. However, if you want to change the window or area once you have chosen one, you have to restart the program. One nice thing with Kazam is the output video is in .mp4 format (not ogv or ogg format). For a 14-seconds video with 15 frames per second (default), the video file size is 1.4MB.


A good introduction [https://www.maketecheasier.com/create-screencast-videos-using-kazam/ Create Screencast Videos With Ease Using Kazam]
It seems '''scrot''' is better for my need.


==== [http://www.maartenbaert.be/simplescreenrecorder/ SimpleScreenRecorder] (Qt based) ====
Note: there seems no way to copy the screenshot to the clipboard.
[https://github.com/MaartenBaert/ssr source code] and [https://beeznest.wordpress.com/2014/10/16/the-comprehensive-guide-to-screencasting-in-ubuntu-14-04/ this article]
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder
scrot -c -d 5 screenshot.png    # -c is count down, -d is delay
sudo apt-get update
 
sudo apt-get install simplescreenrecorder
scrot -b -c -d 5 -u screenshot.png  # -b is title bar, -u is the current foc'u'sed window
</syntaxhighlight>


==== [http://www.kohaupt-online.de VokaScreen] ====
scrot -u                        # current window
It is used in [https://youtu.be/T29fMv5OoFA youtube videos] of QML tutorials.


==== [http://live.gnome.org/Istanbul Istanbul] ====
scrot -s screenshot.png          # select an area
Saved files are in the '''ogg''' format.  
<syntaxhighlight lang='bash'>
sudo apt-get install istanbul
</syntaxhighlight>


==== [https://wiki.ubuntu.com/ScreenCasts/RecordMyDesktop RecordMyDesktop] ====
scrot --thumb 50                # 50% of the original screenshot
http://www.youtube.com/watch?v=A0Tn3Z8OklQ.
** The recorded video is in the '''ogv''' format.
** It can be run from the command line.
** We need to run '''ffmpeg''' to convert video to flv (Quality seems to be reduced) OR we can use online service (http://video.online-convert.com/convert-to-mp4) to convert ogv file to mp4 file (Same quality as I can tell).
<syntaxhighlight lang='bash'>
sudo apt-get install recordmydesktop gtk-recordmydesktop
</syntaxhighlight>


==== Create animated Gif of a screencast ====
scrot abc.png -e 'gthumb $n'    # open gThumb to open the file after taking the screenshot
* [http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast Create animated Gif of a screencast] and the command line tool [https://github.com/jclem/gifify/ Gifify].
* [https://www.howtoforge.com/tutorial/record-screen-to-animated-gif-on-linux/ How to record a region of your desktop as animated GIF on Linux]


=== Wallpaper ===
# sudo apt-get install mirage    # 105 kB
[https://www.howtogeek.com/305974/how-to-use-bings-background-of-the-day-as-your-ubuntu-wallpaper/ How to Use Bing’s Background of the Day as Your Ubuntu Wallpaper]
mirage screenshot.png            # view the image


=== Conky ===
scrot -b -d 5 '%Y:%m:%d:%H:%M:%S.png' -e 'mv $f ~/Desktop/'
[http://conky.sourceforge.net/ Conky] is a free, light-weight system monitor for X, that displays any information on your desktop.
</syntaxhighlight>


* https://help.ubuntu.com/community/SettingUpConky
See [https://www.howtoforge.com/tutorial/how-to-take-screenshots-in-linux-with-scrot/ How to take screenshots in Linux with scrot].
* https://github.com/zenzire/conkyrc (this one works). Check [http://woeid.rosselliot.co.nz/ for the WOEID] for your city used in the [http://www.yahooapis.com/weather/ Yahoo weather API].
* http://www.ifxgroup.net/conky.htm
* http://www.tomshardware.com/faq/id-1882395/write-conky-config-file.html Explain conkyrc file


Step 1. Install conky-all package
==== [https://screencloud.net/ ScreenCloud] ====
* Binary for Ubuntu 16.04 is available
* https://github.com/olav-st/screencloud (Compiling instruction is given there)
* http://www.omgubuntu.co.uk/2016/06/force-install-screencloud-ubuntu-16-04


Step 2. create ~/.conkyrc file. This file can be downloaded from web.
==== Hotshots ====
Only supports Ubuntu up to 14.04.
<syntaxhighlight lang='bash'>
sudo add-apt-repository ppa:ubuntuhandbook1/apps
sudo apt-get update
sudo apt-get install hotshots
</syntaxhighlight>
 
==== Pinta, mtPaint, MyPaint ====
[[#Paint.NET_like_program|Paint.NET_like_program]]


Step 3. Run it: $ conky. If we want to run a specific configuration file, use conky -c CONKYRCFILE
=== Screencaster/Record desktop ===


Step 4. If you want to stop Conky: $ killall conky
* https://wiki.ubuntu.com/ScreenCasts (seems not updated)
* http://askubuntu.com/questions/4428/how-to-create-a-screencast
==== [https://launchpad.net/kazam kazam] ====
Although Kazam can do screenshots, [[#Shutter|Shutter]] (can sit on the system tray) is more convenient for taking care of screenshots.


Note that conky works automatically on Ubuntu's Unity.  
The default frame rate is only 15. If we want to increase it, go to File -> Preferences -> Screencast tab.  


For Lubuntu (tested on 14.04), the Conky's transparent function does not work at first. But [http://gnome-look.org/content/download.php?content=170851&id=1&tan=63968661 This conkyrc] works on Lubuntu desktop (mainly, tranparent function). To deal with the autostart, follow the suggestion from [http://askubuntu.com/questions/81383/how-can-i-add-new-autostart-programs-in-lubuntu askubuntu.com]. That is, go to ~/.config/autostart folder, create or copy+paste the file called '''conky.desktop''' with a content like
When recording, it will have 5 seconds (adjustable) to wait. After launching Kazam, it will show an icon (video recorder) on the top-right corner. Keyboard shortcuts are available. For example (Windows key=Super key),  
<pre>
* Record=Ctrl + Windows + r,  
[Desktop Entry]
* Finish=Ctrl + Windows + f,
Type=Application
* Pause=Ctrl + Windows + p.
Exec=sh "/home/brb/.conky/conky-startup.sh"
<syntaxhighlight lang='bash'>
Hidden=false
sudo apt-get install kazam
NoDisplay=false
</syntaxhighlight>
X-GNOME-Autostart-enabled=true
You can choose fullscreen, window or a specific area. However, if you want to change the window or area once you have chosen one, you have to restart the program. One nice thing with Kazam is the output video is in .mp4 format (not ogv or ogg format). For a 14-seconds video with 15 frames per second (default), the video file size is 1.4MB.
Name[en_IN]=Conky
Name=Conky
Comment[en_IN]=
Comment=
</pre>
and
<pre>
brb@brb-VirtualBox:~$ cat .conky/conky-startup.sh
conky &
exit 0
brb@brb-VirtualBox:~$ ls -l .conky/conky-startup.sh
-rw-rw-r-- 1 brb brb 37 Aug 30 20:17 .conky/conky-startup.sh
</pre>


Another way to configure conky is to install conky-manager. See [http://www.itworld.com/article/2696428/install-conky-manager-2-1-in-ubuntu-14-04.html this] and [http://www.teejeetech.in/p/conky-manager.html project website] page. But it seems it does not work well with desktop wallpaper.
A good introduction [https://www.maketecheasier.com/create-screencast-videos-using-kazam/ Create Screencast Videos With Ease Using Kazam]


=== What should I do when Ubuntu freezes? ===
==== [http://www.maartenbaert.be/simplescreenrecorder/ SimpleScreenRecorder] (Qt based) ====  
* http://askubuntu.com/questions/4408/what-should-i-do-when-ubuntu-freezes
[https://github.com/MaartenBaert/ssr source code] and [https://beeznest.wordpress.com/2014/10/16/the-comprehensive-guide-to-screencasting-in-ubuntu-14-04/ this article]
* https://en.wikipedia.org/wiki/Magic_SysRq_key
<syntaxhighlight lang='bash'>
sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder
sudo apt-get update
sudo apt-get install simplescreenrecorder
</syntaxhighlight>


Press Alt+Print and then type 'REISUB' (not work, it only does screenshot)
==== [http://www.kohaupt-online.de VokaScreen] ====
It is used in [https://youtu.be/T29fMv5OoFA youtube videos] of QML tutorials.


=== Customize the desktop ===
==== [http://live.gnome.org/Istanbul Istanbul] ====  
* Install  Cairo-Dock.
Saved files are in the '''ogg''' format.
<syntaxhighlight lang='bash'>
sudo apt-get install istanbul
</syntaxhighlight>


==== Remove overlay scroll bar ====
==== [https://wiki.ubuntu.com/ScreenCasts/RecordMyDesktop RecordMyDesktop] ====
http://www.itworld.com/article/2698420/disable-overlay-scroll-bars-in-ubuntu-14-04.html
http://www.youtube.com/watch?v=A0Tn3Z8OklQ.
** The recorded video is in the '''ogv''' format.
** It can be run from the command line.
** We need to run '''ffmpeg''' to convert video to flv (Quality seems to be reduced) OR we can use online service (http://video.online-convert.com/convert-to-mp4) to convert ogv file to mp4 file (Same quality as I can tell).
<syntaxhighlight lang='bash'>
sudo apt-get install recordmydesktop gtk-recordmydesktop
</syntaxhighlight>


==== Change scroll bar color ====
==== Create animated Gif of a screencast ====
See [http://ubuntuforums.org/showthread.php?t=1172617 this post]. Run sudo apt-get install gnome-color-chooser.
* [http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast Create animated Gif of a screencast] and the command line tool [https://github.com/jclem/gifify/ Gifify].
* [https://www.howtoforge.com/tutorial/record-screen-to-animated-gif-on-linux/ How to record a region of your desktop as animated GIF on Linux]


Go to Engines tab in gnome-color-chooser and choose clearlooks engine for scrollbars.
=== Wallpaper ===
[https://www.howtogeek.com/305974/how-to-use-bings-background-of-the-day-as-your-ubuntu-wallpaper/ How to Use Bing’s Background of the Day as Your Ubuntu Wallpaper]


==== How to turn off/disable Compiz's “drag to maximize” behaviour? ====
=== Conky ===
http://askubuntu.com/questions/72452/how-to-turn-off-compizs-drag-to-maximize-behaviour
[http://conky.sourceforge.net/ Conky] is a free, light-weight system monitor for X, that displays any information on your desktop.


On Mint, go to Preferences -> Window Tiling -> Enable Window Tiling and snapping -> Off.
* https://help.ubuntu.com/community/SettingUpConky
* https://github.com/zenzire/conkyrc (this one works). Check [http://woeid.rosselliot.co.nz/ for the WOEID] for your city used in the [http://www.yahooapis.com/weather/ Yahoo weather API].
* http://www.ifxgroup.net/conky.htm
* http://www.tomshardware.com/faq/id-1882395/write-conky-config-file.html Explain conkyrc file


=== [http://www.gnu.org/software/grub/ Grub2] ===
Step 1. Install conky-all package
To show the grub2 screen, run 'sudo nano /etc/default/grub' and comment out the line GRUB_HIDDEN_TIMEOUT=0 and change the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT="". Remember to run 'sudo update-grub' after any change to grub.


To add a splash image, follow the instruction at https://help.ubuntu.com/community/Grub2/Displays. Note that Grub2 will search the image based on some priority and there are also some minor requirements on the images. To test
Step 2. create ~/.conkyrc file. This file can be downloaded from web.
<pre>
sudo apt-get install grub2-splashimages
sudo cp /usr/share/images/grub/Moraine_Lake_17092005.tga /boot/grub/
sudo update-grub
</pre>


* [https://www.howtoforge.com/tutorial/repair-grub-2-ubuntu/ Repair Grub2]
Step 3. Run it: $ conky. If we want to run a specific configuration file, use conky -c CONKYRCFILE


==== How do I set the grub timeout and the grub default boot entry? ====
Step 4. If you want to stop Conky: $ killall conky
https://askubuntu.com/questions/148095/how-do-i-set-the-grub-timeout-and-the-grub-default-boot-entry


# '''gksudo gedit /etc/default/grub'''
Note that conky works automatically on Ubuntu's Unity.  
# Change as you like. Save and closed the file.
#* You can change the default from 0 to any number
#* You can change the "hidden timeout" (no menu)
#* You can force the grub menu to show by commenting out the two GRUB_HIDDEN lines with a # at the beginning of the line
#* set the grub menu timeout (default is 10 seconds)
# '''sudo update-grub'''
# Reboot


==== Boot into command line ====
For Lubuntu (tested on 14.04), the Conky's transparent function does not work at first. But [http://gnome-look.org/content/download.php?content=170851&id=1&tan=63968661 This conkyrc] works on Lubuntu desktop (mainly, tranparent function). To deal with the autostart, follow the suggestion from [http://askubuntu.com/questions/81383/how-can-i-add-new-autostart-programs-in-lubuntu askubuntu.com]. That is, go to ~/.config/autostart folder, create or copy+paste the file called '''conky.desktop''' with a content like
http://www.linuxandubuntu.com/home/how-to-boot-into-linux-command-line
<pre>
[Desktop Entry]
Type=Application
Exec=sh "/home/brb/.conky/conky-startup.sh"
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_IN]=Conky
Name=Conky
Comment[en_IN]=
Comment=
</pre>
and
<pre>
brb@brb-VirtualBox:~$ cat .conky/conky-startup.sh
conky &
exit 0
brb@brb-VirtualBox:~$ ls -l .conky/conky-startup.sh
-rw-rw-r-- 1 brb brb 37 Aug 30 20:17 .conky/conky-startup.sh
</pre>


# Highlight the first item (default) and press 'e' in the GRUB menu
Another way to configure conky is to install conky-manager. See [http://www.itworld.com/article/2696428/install-conky-manager-2-1-in-ubuntu-14-04.html this] and [http://www.teejeetech.in/p/conky-manager.html project website] page. But it seems it does not work well with desktop wallpaper.
# Navigate to the line that starts with ‘linux’, change the '''runlevel''' to 3 (at the end of the line). Level 3 means multi-user, command-line only system
# Press Ctrl+x or F10 to boot into


To switch back to GUI, type '''sudo init 5'''. Level 5 is the default.
=== What should I do when Ubuntu freezes? ===
* http://askubuntu.com/questions/4408/what-should-i-do-when-ubuntu-freezes
* https://en.wikipedia.org/wiki/Magic_SysRq_key


==== Grub Customizer - GUI program ====
Press Alt+Print and then type 'REISUB' (not work, it only does screenshot)
[https://www.linuxuprising.com/2018/12/how-to-change-grub-boot-order-or.html How To Change The GRUB Boot Order Or Default Boot Entry In Ubuntu, Linux Mint, Debian, Or Fedora With Grub Customizer]


=== [https://help.ubuntu.com/community/NetworkManager Network Manager] ===
=== Customize the desktop ===
==== DNS problem and 127.0.1.1 ====
* Install  Cairo-Dock.
(Ubuntu 16.04 on Odroid) For some reason, pinging my domain always goes to the wrong IP. If I go to System -> Administration -> Network to change DNS from 127.0.1.1 to 8.8.8.8, it fixes the problem. But if I reboot, the DNS entry goes back to 127.0.1.1 again.  
 
==== Remove overlay scroll bar ====
http://www.itworld.com/article/2698420/disable-overlay-scroll-bars-in-ubuntu-14-04.html


When I follow this post [http://askubuntu.com/questions/627899/nameserver-127-0-1-1-in-resolv-conf-wont-go-away nameserver 127.0.1.1 in resolv.conf won't go away], the DNS will be changed to local IP of my router and the problem is fixed (even I reboot the computer).
==== Change scroll bar color ====
See [http://ubuntuforums.org/showthread.php?t=1172617 this post]. Run sudo apt-get install gnome-color-chooser.  


See also the next: How to flush the DNS cache
Go to Engines tab in gnome-color-chooser and choose clearlooks engine for scrollbars.


==== How to flush the DNS cache ====
==== How to turn off/disable Compiz's “drag to maximize” behaviour? ====
* http://www.cyberciti.biz/faq/rhel-debian-ubuntu-flush-clear-dns-cache/
http://askubuntu.com/questions/72452/how-to-turn-off-compizs-drag-to-maximize-behaviour
* http://askubuntu.com/questions/414826/how-to-flush-dns-in-ubuntu-12-04
* http://www.makeuseof.com/tag/flush-dns-cache-ubuntu/
<syntaxhighlight lang='bash'>
sudo /etc/init.d/dns-clean
</syntaxhighlight>


==== NM-applet ====
On Mint, go to Preferences -> Window Tiling -> Enable Window Tiling and snapping -> Off.
https://wiki.archlinux.org/index.php/NetworkManager


==== Turn on/off wifi adapter ====
=== [http://www.gnu.org/software/grub/ Grub2] ===
[http://askubuntu.com/questions/597116/how-to-disable-wireless-from-command-line The command-line equivalent of unchecking the nm-applet's 'Enable Wi-fi' should be]
To show the grub2 screen, run 'sudo nano /etc/default/grub' and comment out the line GRUB_HIDDEN_TIMEOUT=0 and change the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT="". Remember to run 'sudo update-grub' after any change to grub.
<syntaxhighlight lang='bash'>
nmcli nm wifi off
# OR
nmcli radio wifi off
# OR
sudo ifconfig wlan0 down
</syntaxhighlight>


==== Proxy ====
To add a splash image, follow the instruction at https://help.ubuntu.com/community/Grub2/Displays. Note that Grub2 will search the image based on some priority and there are also some minor requirements on the images. To test
* [https://en.wikipedia.org/wiki/Proxy_server Proxy server]
<pre>
* [http://askubuntu.com/questions/3807/how-to-check-if-network-proxy-is-really-applied How to check if Network Proxy is really applied?]
sudo apt-get install grub2-splashimages
sudo cp /usr/share/images/grub/Moraine_Lake_17092005.tga /boot/grub/
sudo update-grub
</pre>


==== Internet Shut Down ====
* [https://www.howtoforge.com/tutorial/repair-grub-2-ubuntu/ Repair Grub2]
* [http://gizmodo.com/this-is-probably-why-half-the-internet-shut-down-today-1788062835 This Is Why Half the Internet Shut Down Today], [http://pcworld.com/article/3134056/hacking/an-iot-botnet-is-partly-behind-fridays-massive-ddos-attack.html An IoT botnet is partly behind Friday's massive DDOS attack] and [http://www.appledaily.com.tw/appledaily/article/international/20161023/37425973/ 駭客襲美 推特等主要網站大掛點] (Oct 21 2016)
* [https://en.wikipedia.org/wiki/Denial-of-service_attack Distributed denial-of-service/DDoS attack] from wikipedia.


=== DHCP Server ===
==== How do I set the grub timeout and the grub default boot entry? ====
[http://www.tecmint.com/install-dhcp-server-in-ubuntu-debian/ How to Install a DHCP Server in Ubuntu and Debian]
https://askubuntu.com/questions/148095/how-do-i-set-the-grub-timeout-and-the-grub-default-boot-entry


=== File Server ===
# '''gksudo gedit /etc/default/grub'''
==== [https://help.ubuntu.com/lts/serverguide/network-file-system.html Network File System (NFS)] ====
# Change as you like. Save and closed the file.
NFS allows a system to share directories and files with others over a network. By using NFS, users and programs can access files on remote systems almost as if they were local files.
#* You can change the default from 0 to any number
 
#* You can change the "hidden timeout" (no menu)
Some of the most notable benefits that NFS can provide are:
#* You can force the grub menu to show by commenting out the two GRUB_HIDDEN lines with a # at the beginning of the line
* Local workstations use less disk space.
#* set the grub menu timeout (default is 10 seconds)
* There is no need for users to have separate home directories on every network machine. Home directories could be set up on the NFS server and made available throughout the network.
# '''sudo update-grub'''
# Reboot


'''Server part''':
==== Boot into command line ====
<syntaxhighlight lang='bash'>
http://www.linuxandubuntu.com/home/how-to-boot-into-linux-command-line
sudo apt-get install nfs-kernel-server
</syntaxhighlight>


Configure the directories to be exported by adding them to the '''/etc/exports''' file.
# Highlight the first item (default) and press 'e' in the GRUB menu
<pre>
# Navigate to the line that starts with ‘linux’, change the '''runlevel''' to 3 (at the end of the line). Level 3 means multi-user, command-line only system
/home/USERNAME/SHAREFOLDER 192.168.1.0/24(rw,sync,no_subtree_check)
# Press Ctrl+x or F10 to boot into
/ubuntu  *(ro,sync,no_root_squash)
/home    *(rw,sync,no_root_squash)
# replace * with one of the hostname formats.
</pre>
where 'ro' means read only. See [http://www.brennan.id.au/19-Network_File_System.html Linux Home Server Howto]. The '''no_root_squash''' option will not prevent root on a client machine from writing files to the server as root; by default, NFS will map any requests from root on the client to the 'nobody' user on the server. See [https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-14-04 digitalocean].


To start the NFS server:
To switch back to GUI, type '''sudo init 5'''. Level 5 is the default.
<syntaxhighlight lang='bash'>
sudo service nfs-kernel-server start
</syntaxhighlight>


'''Client part''':
==== Grub Customizer - GUI program ====
[https://www.linuxuprising.com/2018/12/how-to-change-grub-boot-order-or.html How To Change The GRUB Boot Order Or Default Boot Entry In Ubuntu, Linux Mint, Debian, Or Fedora With Grub Customizer]


PS.  
=== [https://help.ubuntu.com/community/NetworkManager Network Manager] ===
* ''There is no need to enter any password related to the NFS server.''
==== DNS problem and 127.0.1.1 ====
* See [https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-14-04 digitalocean] for other ways to specify the arguments in </etc/fstab>.
(Ubuntu 16.04 on Odroid) For some reason, pinging my domain always goes to the wrong IP. If I go to System -> Administration -> Network to change DNS from 127.0.1.1 to 8.8.8.8, it fixes the problem. But if I reboot, the DNS entry goes back to 127.0.1.1 again.  
<syntaxhighlight lang='bash'>
 
sudo apt-get install nfs-common
When I follow this post [http://askubuntu.com/questions/627899/nameserver-127-0-1-1-in-resolv-conf-wont-go-away nameserver 127.0.1.1 in resolv.conf won't go away], the DNS will be changed to local IP of my router and the problem is fixed (even I reboot the computer).


sudo mount -t nfs example.hostname.com:/ubuntu /mnt/ubuntu
See also the next: How to flush the DNS cache
# The mount point directory /mnt/ubuntu must exist.
# or modify the /etc/fstab file
# example.hostname.com:/ubuntu /mnt/ubuntu nfs rsize=8192,wsize=8192,timeo=14,intr
# localip:/sharedfolder /mnt/ubuntu nfs defaults 0 0


brb@brb-P45T-A:~$ ps -ef | grep nfs
==== How to flush the DNS cache ====
root      675    2  0 11:16 ?        00:00:00 [nfsiod]
* http://www.cyberciti.biz/faq/rhel-debian-ubuntu-flush-clear-dns-cache/
root    14783    2  0 16:51 ?        00:00:00 [nfsv4.0-svc]
* http://askubuntu.com/questions/414826/how-to-flush-dns-in-ubuntu-12-04
brb      14960 13491  0 16:56 pts/0    00:00:00 grep --color=auto nfs
* http://www.makeuseof.com/tag/flush-dns-cache-ubuntu/
<syntaxhighlight lang='bash'>
sudo /etc/init.d/dns-clean
</syntaxhighlight>
</syntaxhighlight>
To make the mounting permanently, run '''sudo nano /etc/fstab''' and include a line like
<pre>
1.2.3.4:/home    /mnt/nfs/home  nfs auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800 0 0
</pre>


Some help:
==== NM-applet ====
* [http://www.ubuntugeek.com/how-to-configure-nfs-server-and-client-configuration-on-ubuntu-16-10-yakkety-yak.html How to configure NFS Server and Client Configuration on Ubuntu 16.10]
https://wiki.archlinux.org/index.php/NetworkManager
* [https://www.linuxuprising.com/2018/11/easy-nfs-share-setup-in-ubuntu-linux.html Easy NFS Share Setup In Ubuntu, Linux Mint Or Debian With Simple NFS GUI (Server And Client)]


==== Boot from an NFS server ====
==== Turn on/off wifi adapter ====
* http://www.linuxuser.co.uk/tutorials/boot-linux-from-an-nfs-server
[http://askubuntu.com/questions/597116/how-to-disable-wireless-from-command-line The command-line equivalent of unchecking the nm-applet's 'Enable Wi-fi' should be]
<syntaxhighlight lang='bash'>
nmcli nm wifi off
# OR
nmcli radio wifi off
# OR
sudo ifconfig wlan0 down
</syntaxhighlight>


With NFS booting, the core kernel and file systems are kept on a central server and then pushed out onto client systems to be booted on there. That means your files and desktop will always be available wherever you want to log in.
==== Proxy ====
* [https://en.wikipedia.org/wiki/Proxy_server Proxy server]
* [http://askubuntu.com/questions/3807/how-to-check-if-network-proxy-is-really-applied How to check if Network Proxy is really applied?]


At the end, the client computer does not need any internal storage. Cool!
==== Internet Shut Down ====
* [http://gizmodo.com/this-is-probably-why-half-the-internet-shut-down-today-1788062835 This Is Why Half the Internet Shut Down Today], [http://pcworld.com/article/3134056/hacking/an-iot-botnet-is-partly-behind-fridays-massive-ddos-attack.html An IoT botnet is partly behind Friday's massive DDOS attack] and [http://www.appledaily.com.tw/appledaily/article/international/20161023/37425973/ 駭客襲美 推特等主要網站大掛點] (Oct 21 2016)
* [https://en.wikipedia.org/wiki/Denial-of-service_attack Distributed denial-of-service/DDoS attack] from wikipedia.


==== [https://en.wikipedia.org/wiki/Server_Message_Block CIFS (Common Internet File System)] and [https://en.wikipedia.org/wiki/NT_LAN_Manager NTLMv2 (NT LAN Manager)] ====
=== DHCP Server ===
* https://hpc.nih.gov/docs/transfer.html#mapped
[http://www.tecmint.com/install-dhcp-server-in-ubuntu-debian/ How to Install a DHCP Server in Ubuntu and Debian]
* https://wiki.ubuntu.com/MountWindowsSharesPermanently
* https://help.ubuntu.com/community/MountWindowsSharesPermanently
* https://help.ubuntu.com/community/Samba/SambaClientGuide


''Note that this method is most suitable for transferring small files. Users transferring large amounts of data to and from Helix/Biowulf should continue to use scp or sftp.'' ([https://hpc.nih.gov/docs/transfer.html#mapped nih.gov])
=== File Server ===
==== [https://help.ubuntu.com/lts/serverguide/network-file-system.html Network File System (NFS)] ====
NFS allows a system to share directories and files with others over a network. By using NFS, users and programs can access files on remote systems almost as if they were local files.  


==== Samba - allows Linux to transfer files with Windows clients ====
Some of the most notable benefits that NFS can provide are:
* http://www.krizna.com/ubuntu/setup-file-server-ubuntu-14-04-samba/ (Anonymous share and Secured share via username/password)
* Local workstations use less disk space.
* https://www.howtoforge.com/samba-server-ubuntu-14.04-lts
* There is no need for users to have separate home directories on every network machine. Home directories could be set up on the NFS server and made available throughout the network.
* [http://www.noobslab.com/2012/03/configure-samba-sharing-between-ubuntu.html Share 'between' ubuntu and Windows]
* [http://www.linuceum.com/Server/srvSambaDaemons.php Start and stop the samba daemons]
<syntaxhighlight lang='bash'>
$ ps -ef | grep smbd    # see if the Samba daemon (smbd)
$ ps -ef | grep nmbd    # see if the NetBIOS name server daemon (nmbd) is running


$ sudo service smbd stop  # does not stop nmbd
'''Server part''':
$ sudo service nmbd stop
 
$ sudo service smbd start
$ sudo service nmbd start
</syntaxhighlight>
* [https://www.samba.org/samba/docs/man/manpages/smb.conf.5.html '''smb.conf''' — The configuration file for the Samba suite]
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo apt-get install samba samba-common
sudo apt-get install nfs-kernel-server
sudo apt-get install python-glade2
sudo apt-get install system-config-samba
</syntaxhighlight>
Use Dash and search for 'samba'. It will ask for the user's password first. The samba password can also be set by
<syntaxhighlight lang='bash'>
sudo smbpasswd -a USERNAME
</syntaxhighlight>
</syntaxhighlight>


A non-gui way to configuration samba is adding the following to the end of /etc/samba/smb.conf file, '''sudo nano -w /etc/samba/smb.conf''' (-w means no-wrap). Any line beginning with a semicolon (“;”) or a hash (“#”) character is ignored.
Configure the directories to be exported by adding them to the '''/etc/exports''' file.
<pre>
<pre>
[brb]
/home/USERNAME/SHAREFOLDER 192.168.1.0/24(rw,sync,no_subtree_check)
        path = /home/brb
/ubuntu  *(ro,sync,no_root_squash)
;      writeable = no
/home    *(rw,sync,no_root_squash)
;      browseable = yes
# replace * with one of the hostname formats.
        guest ok = yes
</pre>
</pre>
* [http://www.unixmen.com/howto-install-and-configure-samba-share-in-ubuntu/ Share between ubuntu and linux] On the client file manager, type
where 'ro' means read only. See [http://www.brennan.id.au/19-Network_File_System.html Linux Home Server Howto]. The '''no_root_squash''' option will not prevent root on a client machine from writing files to the server as root; by default, NFS will map any requests from root on the client to the 'nobody' user on the server. See [https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-14-04 digitalocean].
<pre>
smb://192.168.1.3/
</pre>
* https://help.ubuntu.com/community/Samba


On Windows PC, go to start and open 'Run' then enter ip with double backslash. Like this (\\192.168.1.3).
To start the NFS server:
 
==== Remove and re-install Samba ====
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
$ sudo apt-get remove --purge samba
sudo service nfs-kernel-server start
$ sudo apt-get remove --purge smbclient libsmbclient
 
$ sudo apt-get install samba
$ sudo apt-get install smbclient libsmbclient
</syntaxhighlight>
</syntaxhighlight>


==== SambaCry vulnerability and check Samba version ====
'''Client part''':
http://pcworld.com/article/3199106/linux/the-sambacry-scare-gives-linux-users-a-taste-of-wannacry-petya-problems.html


To check your samba version
PS.
* ''There is no need to enter any password related to the NFS server.''
* See [https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-14-04 digitalocean] for other ways to specify the arguments in </etc/fstab>.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
$ smbd -V
sudo apt-get install nfs-common
Version 4.3.11-Ubuntu
 
sudo mount -t nfs example.hostname.com:/ubuntu /mnt/ubuntu
# The mount point directory /mnt/ubuntu must exist.
# or modify the /etc/fstab file
# example.hostname.com:/ubuntu /mnt/ubuntu nfs rsize=8192,wsize=8192,timeo=14,intr
# localip:/sharedfolder /mnt/ubuntu nfs defaults 0 0
 
brb@brb-P45T-A:~$ ps -ef | grep nfs
root      675    2  0 11:16 ?        00:00:00 [nfsiod]
root    14783    2  0 16:51 ?        00:00:00 [nfsv4.0-svc]
brb      14960 13491  0 16:56 pts/0    00:00:00 grep --color=auto nfs
</syntaxhighlight>
</syntaxhighlight>
 
To make the mounting permanently, run '''sudo nano /etc/fstab''' and include a line like
=== Change the default session when using auto login ===
See [http://askubuntu.com/questions/62833/how-do-i-change-the-default-session-for-when-using-auto-logins this post]. We need to edit the file /etc/lightdm/lightdm.conf. Note that on my Ubuntu 12.04, I have the following desktop options.
<pre>
<pre>
$ ls -lt /usr/share/xsessions/
1.2.3.4:/home    /mnt/nfs/home  nfs auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800 0 0
total 16
-rw-r--r-- 1 root root 205 Apr 19  2012 gnome.desktop
-rw-r--r-- 1 root root 188 Apr 19  2012 gnome-shell.desktop
-rw-r--r-- 1 root root 208 Apr 19  2012 ubuntu-2d.desktop
-rw-r--r-- 1 root root 185 Apr 19  2012 ubuntu.desktop
</pre>
</pre>


=== Debian root user from remote access ===
Some help:
When you login by SSH, then use the username you have chosen when you installed Debian as the root user is disabled for remote logins. Then run the command "su" to become root user. See [https://www.howtoforge.com/tutorial/debian-8-jessie-minimal-server/2/ howtoforget.com].
* [http://www.ubuntugeek.com/how-to-configure-nfs-server-and-client-configuration-on-ubuntu-16-10-yakkety-yak.html How to configure NFS Server and Client Configuration on Ubuntu 16.10]
* [https://www.linuxuprising.com/2018/11/easy-nfs-share-setup-in-ubuntu-linux.html Easy NFS Share Setup In Ubuntu, Linux Mint Or Debian With Simple NFS GUI (Server And Client)]


=== Terminal ===
==== Boot from an NFS server ====
==== Directory color on ssh ====
* http://www.linuxuser.co.uk/tutorials/boot-linux-from-an-nfs-server
When I ssh to biowulf from Gnome/Terminal, the folder color became dark blue which is hard to read when the background color is black. A solution is https://serverfault.com/questions/137649/changing-terminal-colors-in-ubuntu-server.


1. append this to your ~/.bashrc
With NFS booting, the core kernel and file systems are kept on a central server and then pushed out onto client systems to be booted on there. That means your files and desktop will always be available wherever you want to log in.
<pre>
    if [ "$TERM" != "dumb" ]; then
      [ -e "$HOME/.dir_colors" ] &&
      DIR_COLORS="$HOME/.dir_colors" [ -e "$DIR_COLORS" ] ||
      DIR_COLORS=""
      eval "`dircolors -b $DIR_COLORS`"
      alias ls='ls --color=auto'
    fi
</pre>
2. create/edit your ~/.dir_colors, for example with
<pre>
  $ dircolors --print-database > .dir_colors
</pre>
3. Then force a read of your .bashrc file with:
<pre>
  $ source ~/.bashrc
</pre>


Everything should be pretty.
At the end, the client computer does not need any internal storage. Cool!


==== Remember terminal tabs ====
==== [https://en.wikipedia.org/wiki/Server_Message_Block CIFS (Common Internet File System)] and [https://en.wikipedia.org/wiki/NT_LAN_Manager NTLMv2 (NT LAN Manager)] ====
The trick on [http://askubuntu.com/questions/310705/some-fast-way-to-save-and-restore-tabs-of-terminal this post] works for me on my GNOME Terminal 3.6.2 (gnome-terminal --version).
* https://hpc.nih.gov/docs/transfer.html#mapped
<syntaxhighlight lang='bash'>
* https://wiki.ubuntu.com/MountWindowsSharesPermanently
# To save configuration into /home/$USER/terminal.cfg:
* https://help.ubuntu.com/community/MountWindowsSharesPermanently
gnome-terminal --save-config=/home/$USER/terminal.cfg
* https://help.ubuntu.com/community/Samba/SambaClientGuide


# To load it back:
''Note that this method is most suitable for transferring small files. Users transferring large amounts of data to and from Helix/Biowulf should continue to use scp or sftp.'' ([https://hpc.nih.gov/docs/transfer.html#mapped nih.gov])
gnome-terminal --load-config=/home/$USER/terminal.cfg
</syntaxhighlight>


To recall the titles, follow [http://vadim-kirilchuk-linux.blogspot.com/2013/05/gnome-terminal-how-to-save-tabs-and.html this simple hack]. That is, add an entry Title=xxxx to each tab section.
==== Samba - allows Linux to transfer files with Windows clients ====
* http://www.krizna.com/ubuntu/setup-file-server-ubuntu-14-04-samba/ (Anonymous share and Secured share via username/password)
* https://www.howtoforge.com/samba-server-ubuntu-14.04-lts
* [http://www.noobslab.com/2012/03/configure-samba-sharing-between-ubuntu.html Share 'between' ubuntu and Windows]  
* [http://www.linuceum.com/Server/srvSambaDaemons.php Start and stop the samba daemons]
<syntaxhighlight lang='bash'>
$ ps -ef | grep smbd    # see if the Samba daemon (smbd)
$ ps -ef | grep nmbd    # see if the NetBIOS name server daemon (nmbd) is running


==== Terminal tab color ====
$ sudo service smbd stop  # does not stop nmbd
If we open several tabs in the (GNOME) Terminal, the default color of the active tab is not quite different from the other tabs. We need a solution to change the tab colors.
$ sudo service nmbd stop


http://askubuntu.com/questions/355297/gnome-terminal-tabs-no-contrast-between-active-and-inactive-tabs
$ sudo service smbd start
 
$ sudo service nmbd start
Solution: edit ~/.config/gtk-3.0/gtk.css (you might have to create it) and add:
</syntaxhighlight>
<pre>
* [https://www.samba.org/samba/docs/man/manpages/smb.conf.5.html '''smb.conf''' — The configuration file for the Samba suite]
TerminalWindow,
<syntaxhighlight lang='bash'>
TerminalWindow.background {
sudo apt-get install samba samba-common
        background-color: #6e6e6e;
sudo apt-get install python-glade2
        color: #000000;
sudo apt-get install system-config-samba
}
</syntaxhighlight>
Use Dash and search for 'samba'. It will ask for the user's password first. The samba password can also be set by
<syntaxhighlight lang='bash'>
sudo smbpasswd -a USERNAME
</syntaxhighlight>


TerminalWindow .notebook tab {
A non-gui way to configuration samba is adding the following to the end of /etc/samba/smb.conf file, '''sudo nano -w /etc/samba/smb.conf''' (-w means no-wrap). Any line beginning with a semicolon (“;”) or a hash (“#”) character is ignored.
        padding: 2;
<pre>
        background-color: #6e6e6e;
[brb]
}
        path = /home/brb
 
;      writeable = no
TerminalWindow .notebook tab:active {
;       browseable = yes
        background-color: #d1d1d1;
        guest ok = yes
}
</pre>
</pre>
Then close '''ALL''' terminal windows start and test.
* [http://www.unixmen.com/howto-install-and-configure-samba-share-in-ubuntu/ Share between ubuntu and linux] On the client file manager, type
<pre>
smb://192.168.1.3/
</pre>
* https://help.ubuntu.com/community/Samba


==== How to practically use your Linux terminal for everything ====
On Windows PC, go to start and open 'Run' then enter ip with double backslash. Like this (\\192.168.1.3).
* [https://www.howtoforge.com/tutorial/how-to-practically-use-your-linux-terminal/ set alarms, take screenshots, check weather, schedule shutdown]
* [https://www.howtoforge.com/tutorial/how-to-practically-use-your-linux-terminal-part-2/ Send emails, browse internet, listen muscic, play games]


==== Record terminal: script command ====
==== Remove and re-install Samba ====
* [https://www.ostechnix.com/record-everything-terminal/ How To Record Everything You Do In Terminal]
<syntaxhighlight lang='bash'>
* [https://www.tecmint.com/record-and-replay-linux-terminal-session-commands-using-script/ Record and Replay Linux Terminal Sessions using ‘script’ and ‘scriptreplay’ Commands]
$ sudo apt-get remove --purge samba
$ sudo apt-get remove --purge smbclient libsmbclient


=== Install Microsoft Font in linux suite ===
$ sudo apt-get install samba
[http://www.pcworld.com/article/2863497/how-to-install-microsoft-fonts-in-linux-office-suites.html PCWorld.com]
$ sudo apt-get install smbclient libsmbclient
</syntaxhighlight>


=== Install language packs ===
==== SambaCry vulnerability and check Samba version ====
<pre>
http://pcworld.com/article/3199106/linux/the-sambacry-scare-gives-linux-users-a-taste-of-wannacry-petya-problems.html
sudo apt-get install language-pack-[cod] language-pack-gnome-[cod] language-pack-[cod]-base language-pack-gnome-[cod]-base
</pre>
For example, [cod]=en or [cod]=zh.


=== Change locale language and character set ===
To check your samba version
* http://www.shellhacks.com/en/HowTo-Change-Locale-Language-and-Character-Set-in-Linux
<syntaxhighlight lang='bash'>
$ smbd -V
Version 4.3.11-Ubuntu
</syntaxhighlight>


=== Display Chinese character (from vanilla Debian/Ubuntu system) ===
=== Change the default session when using auto login ===
* [http://en.wikipedia.org/wiki/Help:Multilingual_support_%28East_Asian%29#Debian-based_GNU.2FLinux Wikipedia]
See [http://askubuntu.com/questions/62833/how-do-i-change-the-default-session-for-when-using-auto-logins this post]. We need to edit the file /etc/lightdm/lightdm.conf. Note that on my Ubuntu 12.04, I have the following desktop options.
<pre>
<pre>
sudo apt-get install fonts-arphic-ukai fonts-arphic-uming
$ ls -lt /usr/share/xsessions/
total 16
-rw-r--r-- 1 root root 205 Apr 19  2012 gnome.desktop
-rw-r--r-- 1 root root 188 Apr 19  2012 gnome-shell.desktop
-rw-r--r-- 1 root root 208 Apr 19  2012 ubuntu-2d.desktop
-rw-r--r-- 1 root root 185 Apr 19  2012 ubuntu.desktop
</pre>
</pre>
* [http://crunchbang.org/forums/viewtopic.php?id=778 crunchbang.org]
<pre>
sudo apt-get install language-support-fonts-zh
# Or
sudo apt-get install ttf-arphic-uming ttf-wqy-zenhei
</pre>
* [http://wiki.debian.org.hk/w/Make_Debian_support_Chinese_%28eng%29 wiki.debian.org.hk]
* [https://wiki.debian.org/Fonts wiki.debian.org]


=== Chinese Input ===
=== Debian root user from remote access ===
* ibus/fcitx is a service. Use ''ps -ef'' to check if it is running.
When you login by SSH, then use the username you have chosen when you installed Debian as the root user is disabled for remote logins. Then run the command "su" to become root user. See [https://www.howtoforge.com/tutorial/debian-8-jessie-minimal-server/2/ howtoforget.com].
* On Ubuntu 18.04, it is '''Ctrl + Space''' to switch input methods (the keyboard icon will be changed to "酷"). The "Windows + Space" only changes the drop-down list (en <-> 中) but it has no effect.
 
* "Windows + Space" may need to be clicked twice to switch the input method (at least on Mint 18.2)
=== Terminal ===
* Log out and Log in seems to be necessary
==== Directory color on ssh ====
* Helpful
When I ssh to biowulf from Gnome/Terminal, the folder color became dark blue which is hard to read when the background color is black. A solution is https://serverfault.com/questions/137649/changing-terminal-colors-in-ubuntu-server.
** https://www.pinyinjoe.com/linux/ubuntu-10-chinese-input-pinyin-chewing.htm
 
** https://wiki.mageia.org/en/Input_methods
1. append this to your ~/.bashrc
** http://ubuntuhandbook.org/index.php/2016/07/2-best-chinese-pinyin-im-ubuntu-16-04/
<pre>
    if [ "$TERM" != "dumb" ]; then
      [ -e "$HOME/.dir_colors" ] &&
      DIR_COLORS="$HOME/.dir_colors" [ -e "$DIR_COLORS" ] ||
      DIR_COLORS=""
      eval "`dircolors -b $DIR_COLORS`"
      alias ls='ls --color=auto'
    fi
</pre>
2. create/edit your ~/.dir_colors, for example with
<pre>
  $ dircolors --print-database > .dir_colors
</pre>
3. Then force a read of your .bashrc file with:
<pre>
  $ source ~/.bashrc
</pre>


[[File:Zhuyin-keyboard.gif|600px]]
Everything should be pretty.


[[File:Ibus.png|400px]]
==== Remember terminal tabs ====
 
The trick on [http://askubuntu.com/questions/310705/some-fast-way-to-save-and-restore-tabs-of-terminal this post] works for me on my GNOME Terminal 3.6.2 (gnome-terminal --version).  
# type 'language' in Dash search (Or click Power button on the top-right corner -> System Settings...) and click 'Language Support' (this may not be installed from (x)Ubuntu automatically. In such case, IBUS will be missing eg Chewing method). The 'Language Support' is under Settings menu in xUbuntu.
<syntaxhighlight lang='bash'>
# Click 'Install' if a message popped up with the message 'The language support is not installed completely'. After the installation is done, the 'Language support' dialog comes back.  
# To save configuration into /home/$USER/terminal.cfg:
# Choose between ibus (ubuntu < 16.04) /fcitx (ubuntu 16.04).
gnome-terminal --save-config=/home/$USER/terminal.cfg
#* Choose 'IBUS' for keyboard input method system (bottom of the dialog). IBUS is under 'System' menu in xUbuntu.
#* Choose 'fcitx'
# Click 'Install/Remove Languages'. Choose Chinese. Click 'Apply'. An 'Applying changes' dialog will appear.
# Click 'Close' button.
# Select Chinese
#* System Settings -> Text Entry -> '+' -> Chinese. Or Settings > Keyboard Input Method > Input method > Select an input method > Show only input methods for your region > Chinese 酷 Chewing. If we cannot find this dialog, we can launch it by '''ibus-setup''' command. If Chewing is not shown as one of Chinese input methods, we can log out and log in the desktop. If ibus does not have the chewing selection, we should try to install it '''sudo apt-get install ibus-chewing''' and/or run '''ibus restart'''.
#* Dash -> Fcitx Configuration. '+' -> Chewing. PS. On Ubuntu 16.04 it only shows a Chinese option without further options even I installed ''ibus-chewing''.
# Make sure 'Show current input source in the menu bar' is checked.
# Click 'Close' button.  


On Ubuntu 14.04, the super key is '''Windows'''.
# To load it back:
gnome-terminal --load-config=/home/$USER/terminal.cfg
</syntaxhighlight>


On Ubuntu 16.04, ibus does not work. Use fcitx instead. Chewing(Fcitx) should be added to the "Text Entry" GUI. "fcitx" should be selected in the "Language Support" GUI (it's OK the language for menus and windows does not include 漢語 (臺灣). A linux or keyboard icon should appear in the taskbar.  
To recall the titles, follow [http://vadim-kirilchuk-linux.blogspot.com/2013/05/gnome-terminal-how-to-save-tabs-and.html this simple hack]. That is, add an entry Title=xxxx to each tab section.


On Ubuntu 18.04, I don't need to use fcitx (not available by default)
==== Terminal tab color ====
# I follow [https://www.pinyinjoe.com/linux/ubuntu-18-gnome-chinese-setup.htm pingyinjoe] to install Chinese from Language Support. Reboot (Log out seems to take forever).
If we open several tabs in the (GNOME) Terminal, the default color of the active tab is not quite different from the other tabs. We need a solution to change the tab colors.
# I follow [https://askubuntu.com/questions/1032465/how-can-i-use-chewingzhuyin-input-method this post] to use '''sudo locale-gen zh_TW.UTF-8''' to add chewing to the list (see next step).
# Type 'region' to search and click "Region and Language". Follow the GUI to add Chinese (Chewing).
# Test it by using Windows + Space to switch input methods.


Note that do not use 'Text Entry' application (shown as one options when we search 'language'). This application will conflict with ibus.
http://askubuntu.com/questions/355297/gnome-terminal-tabs-no-contrast-between-active-and-inactive-tabs


==== [https://zh.wikipedia.org/wiki/Gcin gcin] ====
Solution: edit ~/.config/gtk-3.0/gtk.css (you might have to create it) and add:
新注音 New Zhuyin
<pre>
* Google: ubuntu 英文版 中文輸入
TerminalWindow,
* http://aarontechdiary.blogspot.com/2016/07/ubuntu-1604.html<syntaxhighlight lang='bash'>
TerminalWindow.background {
sudo apt-get install gcin
        background-color: #6e6e6e;
</syntaxhighlight>
        color: #000000;
* blog.xuite.net/yh96301/blog/287374341-Ubuntu+14.04安裝鍵盤輸入法系統gcin
}
* https://wiki.archlinux.org/index.php/Gcin
* Show Applications -> gcin Tools
* https://magiclen.org/gcin/


==== fcitx ====
TerminalWindow .notebook tab {
https://daviwa.blogspot.com/2017_10_08_archive.html
        padding: 2;
        background-color: #6e6e6e;
}


* On Linux Mint, it cannot show a list of candidate words. The trick of using '''killall fcitx-qimpanel''' works.
TerminalWindow .notebook tab:active {
* On Ubuntu Mate, the fcitx works fine. ps -ef | grep fcitx-qimpanel shows nothing.
        background-color: #d1d1d1;
}
</pre>
Then close '''ALL''' terminal windows start and test.


=== /usr/lib/ibus/ibus-ui-gtk3 high memory usage ===
==== How to practically use your Linux terminal for everything ====
For some reason, the ubuntu 14.04 is not responsive. Htop shows ibus-ui-gtk3 is the culprit. The [http://askubuntu.com/questions/490317/how-can-i-find-out-what-ibus-daemon-and-ibus-ui-gtk3-are-doing suggestion] is to run
* [https://www.howtoforge.com/tutorial/how-to-practically-use-your-linux-terminal/ set alarms, take screenshots, check weather, schedule shutdown]
<syntaxhighlight lang="bash">
* [https://www.howtoforge.com/tutorial/how-to-practically-use-your-linux-terminal-part-2/ Send emails, browse internet, listen muscic, play games]
killall ibus-daemon
</syntaxhighlight>
After I run this command and wait a few seconds, the memory leak problem is solved.


=== Change time zone ===
==== Record terminal: script command ====
http://wiki.debian.org/TimeZoneChanges
* [https://www.ostechnix.com/record-everything-terminal/ How To Record Everything You Do In Terminal]
<pre>
* [https://www.tecmint.com/record-and-replay-linux-terminal-session-commands-using-script/ Record and Replay Linux Terminal Sessions using ‘script’ and ‘scriptreplay’ Commands]
$sudo dpkg-reconfigure tzdata
</pre>
The command launches an ncurses based interface which allows arrow keys to be used to select the region specific time zone.


=== Make script run at boot time with init.d directory ===
=== Install Microsoft Font in linux suite ===
http://www.debian-administration.org/articles/28
[http://www.pcworld.com/article/2863497/how-to-install-microsoft-fonts-in-linux-office-suites.html PCWorld.com]


For example, see [http://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/init-script here] from running a python script for raspberry pi.
=== Install language packs ===
# Create a script '''/etc/init.d/lcd'''
# Make the script executable
# Make the script known to the system by using the '''update-rc.d' command
<pre>
<pre>
sudo update-rc.d lcd defaults
sudo apt-get install language-pack-[cod] language-pack-gnome-[cod] language-pack-[cod]-base language-pack-gnome-[cod]-base
</pre>
</pre>
For example, [cod]=en or [cod]=zh.


==== /etc/rc.local file ====
=== Change locale language and character set ===
[http://linuxtechlab.com/executing-commands-scripts-at-reboot/ Executing Commands and Scripts at Reboot & Startup in Linux]
* http://www.shellhacks.com/en/HowTo-Change-Locale-Language-and-Character-Set-in-Linux


For CentOS, we use file ‘/etc/rc.d/rc.local’ instead of ‘/etc/rc.local’. We also need to make this file executable before adding any script or command to the file.
=== Display Chinese character (from vanilla Debian/Ubuntu system) ===
 
* [http://en.wikipedia.org/wiki/Help:Multilingual_support_%28East_Asian%29#Debian-based_GNU.2FLinux Wikipedia]
Note:- When executing a script at startup, make sure that the script ends with ‘exit 0’.
<pre>
==== crontab ====
sudo apt-get install fonts-arphic-ukai fonts-arphic-uming
[http://linuxtechlab.com/executing-commands-scripts-at-reboot/ Executing Commands and Scripts at Reboot & Startup in Linux]
</pre>
 
* [http://crunchbang.org/forums/viewtopic.php?id=778 crunchbang.org]
=== wireless connection randomly drop off ===
My wireless adapter is TP-LINK, TL-WN722N.
 
http://askubuntu.com/questions/73607/wireless-connection-keeps-dropping-with-an-intel-3945abg-card
<pre>
<pre>
sudo iwconfig wlan0 power off
sudo apt-get install language-support-fonts-zh
# Or
sudo apt-get install ttf-arphic-uming ttf-wqy-zenhei
</pre>
</pre>
* [http://wiki.debian.org.hk/w/Make_Debian_support_Chinese_%28eng%29 wiki.debian.org.hk]
* [https://wiki.debian.org/Fonts wiki.debian.org]


[http://linuxplained.com/how-to-fix-wireless-problems-in-ubuntu-1204-precise-pangolin/ 5 Best Linux/Ubuntu compatible USB Wifi cards]:
=== Chinese Input ===
 
* ibus/fcitx is a service. Use ''ps -ef'' to check if it is running.
*   AirLink101 AWLL6075 Wireless N Mini USB Adapter
* On Ubuntu 18.04, it is '''Ctrl + Space''' to switch input methods (the keyboard icon will be changed to "酷"). The "Windows + Space" only changes the drop-down list (en <-> 中) but it has no effect.
*   Medialink – Wireless N USB Adapter – 802.11n
* "Windows + Space" may need to be clicked twice to switch the input method (at least on Mint 18.2)
*   ASUS (USB-N13) Wireless-N USB Adapter
* Log out and Log in seems to be necessary
*   Panda Mini Wifi (b/g/n) 150Mbps Card
* Helpful
*   TP-Link TL-WN722N 150Mbps High Gain Wireless USB Adapter
** https://www.pinyinjoe.com/linux/ubuntu-10-chinese-input-pinyin-chewing.htm
** https://wiki.mageia.org/en/Input_methods
** http://ubuntuhandbook.org/index.php/2016/07/2-best-chinese-pinyin-im-ubuntu-16-04/


To show (USB) wireless adapter information
[[File:Zhuyin-keyboard.gif|600px]]
<pre>
sudo lshw -C network
sudo lsusb -v
iwconfig
</pre>


To check wifi connection information (SSID, channel, address, frequency, qualiyt, signal level, ...)
[[File:Ibus.png|400px]]
<pre>
sudo iwlist wlan0 scan
</pre>
My experience is quality should be at least 50/70 and signal level should be larger than -60dBm.


=== Create an iso file from a CD or HD ===
# type 'language' in Dash search (Or click Power button on the top-right corner -> System Settings...) and click 'Language Support' (this may not be installed from (x)Ubuntu automatically. In such case, IBUS will be missing eg Chewing method). The 'Language Support' is under Settings menu in xUbuntu.
Method 1 (Better than Method 2). No need to umount the cdrom.
# Click 'Install' if a message popped up with the message 'The language support is not installed completely'. After the installation is done, the 'Language support' dialog comes back.
<pre>
# Choose between ibus (ubuntu < 16.04) /fcitx (ubuntu 16.04).
mkisofs -o /tmp/DVD.iso /tmp/directory/
#* Choose 'IBUS' for keyboard input method system (bottom of the dialog). IBUS is under 'System' menu in xUbuntu.  
</pre>
#* Choose 'fcitx'
to make an ISO from files on your hard drive.
# Click 'Install/Remove Languages'. Choose Chinese. Click 'Apply'. An 'Applying changes' dialog will appear.
# Click 'Close' button.
# Select Chinese
#* System Settings -> Text Entry -> '+' -> Chinese. Or Settings > Keyboard Input Method > Input method > Select an input method > Show only input methods for your region > Chinese 酷 Chewing. If we cannot find this dialog, we can launch it by '''ibus-setup''' command. If Chewing is not shown as one of Chinese input methods, we can log out and log in the desktop. If ibus does not have the chewing selection, we should try to install it '''sudo apt-get install ibus-chewing''' and/or run '''ibus restart'''.
#* Dash -> Fcitx Configuration. '+' -> Chewing. PS. On Ubuntu 16.04 it only shows a Chinese option without further options even I installed ''ibus-chewing''.
# Make sure 'Show current input source in the menu bar' is checked.
# Click 'Close' button.
 
On Ubuntu 14.04, the super key is '''Windows'''.


Method 2.
On Ubuntu 16.04, ibus does not work. Use fcitx instead. Chewing(Fcitx) should be added to the "Text Entry" GUI. "fcitx" should be selected in the "Language Support" GUI (it's OK the language for menus and windows does not include 漢語 (臺灣). A linux or keyboard icon should appear in the taskbar.  
Make sure the cdrom is NOT mounted. Type '''mount''' to confirm it. If cd was mouted automatically unmout it with umount command:
like '''umount /dev/cdrom''' or '''umount /mnt/cdrom'''. Note that no extra forward slash after /dev/cdrom for the command below.
<pre>
dd if=/dev/cdrom of=~/DVD.iso
</pre>


We can mount the iso file to a directory to check the iso file content is correct.
On Ubuntu 18.04, I don't need to use fcitx (not available by default)
<pre>
# I follow [https://www.pinyinjoe.com/linux/ubuntu-18-gnome-chinese-setup.htm pingyinjoe] to install Chinese from Language Support. Reboot (Log out seems to take forever).
mount -t iso9660 -o loop,ro DVD.iso /mnt
# I follow [https://askubuntu.com/questions/1032465/how-can-i-use-chewingzhuyin-input-method this post] to use '''sudo locale-gen zh_TW.UTF-8''' to add chewing to the list (see next step).
</pre>
# Type 'region' to search and click "Region and Language". Follow the GUI to add Chinese (Chewing).
# Test it by using Windows + Space to switch input methods.


=== Have fun with /etc/hosts file ===
Note that do not use 'Text Entry' application (shown as one options when we search 'language'). This application will conflict with ibus.
su -c "nano /etc/hosts"
<pre>
127.0.0.1 localhost
::1            localhost
74.125.67.100  DNS_NAME1 DNS_NAME2
</pre>
* If you want to add aliases for your machine that will lookup to the loopback address you can keep adding them as '''space separated''' values on that line.  
* "::1" is the ipv6 equivalent of 127.0.0.1 (which is for ipv4).


==== Block malware, adware ====
==== [https://zh.wikipedia.org/wiki/Gcin gcin] ====
[https://www.howtogeek.com/319700/how-to-use-your-computers-hosts-file-to-block-tons-of-malware-porn-and-other-types-of-websites/ How to Use Your Computer’s Hosts File to Block Tons of Malware, Porn, and Other Types of Websites]
新注音 New Zhuyin
* Google: ubuntu 英文版 中文輸入
* http://aarontechdiary.blogspot.com/2016/07/ubuntu-1604.html<syntaxhighlight lang='bash'>
sudo apt-get install gcin
</syntaxhighlight>
* blog.xuite.net/yh96301/blog/287374341-Ubuntu+14.04安裝鍵盤輸入法系統gcin
* https://wiki.archlinux.org/index.php/Gcin
* Show Applications -> gcin Tools
* https://magiclen.org/gcin/


=== Mount a remote file system over ssh ===
==== fcitx ====
* [https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh this article] on digitalocean.com.
https://daviwa.blogspot.com/2017_10_08_archive.html
* [http://linuxlove.eu/quick-tip-mounting-remote-linux-directory-windows-linux-ssh/ linuxlove.eu]
* https://help.ubuntu.com/community/SSHFS (include an instruction to keep the connection alive)


The trick is to use the '''sshfs''' tool.
* On Linux Mint, it cannot show a list of candidate words. The trick of using '''killall fcitx-qimpanel''' works.
* On Ubuntu Mate, the fcitx works fine. ps -ef | grep fcitx-qimpanel shows nothing.


On Ubuntu
=== /usr/lib/ibus/ibus-ui-gtk3 high memory usage ===
<syntaxhighlight lang='bash'>
For some reason, the ubuntu 14.04 is not responsive. Htop shows ibus-ui-gtk3 is the culprit. The [http://askubuntu.com/questions/490317/how-can-i-find-out-what-ibus-daemon-and-ibus-ui-gtk3-are-doing suggestion] is to run
# Install the program
<syntaxhighlight lang="bash">
sudo apt-get install sshfs
killall ibus-daemon
</syntaxhighlight>
After I run this command and wait a few seconds, the memory leak problem is solved.


# Mount the file system
=== Change time zone ===
sudo mkdir /mnt/droplet <--replace "droplet" whatever you prefer
http://wiki.debian.org/TimeZoneChanges
sudo sshfs [email protected].xxx:/ /mnt/droplet
<pre>
$sudo dpkg-reconfigure tzdata
</pre>
The command launches an ncurses based interface which allows arrow keys to be used to select the region specific time zone.


# Unmount the file system
=== Make script run at boot time with init.d directory ===
sudo umount /mnt/droplet
http://www.debian-administration.org/articles/28


# Permanently Mounting the Remote File System
For example, see [http://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/init-script here] from running a python script for raspberry pi.
sudo nano /etc/fstab
# Create a script '''/etc/init.d/lcd'''
sshfs#root@xxx.xxx.xxx.xxx:/ /mnt/droplet
# Make the script executable
</syntaxhighlight>
# Make the script known to the system by using the '''update-rc.d' command
<pre>
sudo update-rc.d lcd defaults
</pre>


=== Nautilus (File Manager) ===
==== /etc/rc.local file ====
==== Undo Ctrl+L ====
[http://linuxtechlab.com/executing-commands-scripts-at-reboot/ Executing Commands and Scripts at Reboot & Startup in Linux]
Press ESC.


==== Mount another Linux system in Nautilus ====
For CentOS, we use file ‘/etc/rc.d/rc.local’ instead of ‘/etc/rc.local’. We also need to make this file executable before adding any script or command to the file.
Very easy. Check out
[http://www.howtogeek.com/203432/how-to-access-ftp-and-webdav-sites-in-any-operating-systems-file-manager/ howtogeek.com]


==== Create a desktop shortcut ====
Note:- When executing a script at startup, make sure that the script ends with ‘exit 0’.
Navigate to your application in Nautilus. Right-click, select "Make Link". Then drag shortcut to your desktop. Works in Ubuntu 12.04.
==== crontab ====
[http://linuxtechlab.com/executing-commands-scripts-at-reboot/ Executing Commands and Scripts at Reboot & Startup in Linux]


==== .desktop file format ====
=== wireless connection randomly drop off ===
* [https://specifications.freedesktop.org/desktop-entry-spec/latest/ Desktop Entry Specification]
My wireless adapter is TP-LINK, TL-WN722N.
* "%k" - [http://askubuntu.com/questions/47775/how-can-i-set-the-path-variable-in-a-desktop-file-to-be-relative-to-the-locat How can I set the 'Path' variable in a .desktop file to be relative to the location where the desktop file is located?] and [http://unix.stackexchange.com/questions/144422/getting-the-current-path-in-desktop-exec-command Getting the current path in .desktop EXEC command]
* [http://stackoverflow.com/questions/8980464/how-do-i-access-an-environment-variable-in-a-desktop-files-exec-line How do I access an environment variable in a .desktop file's exec line?]


==== Open a terminal ====
http://askubuntu.com/questions/73607/wireless-connection-keeps-dropping-with-an-intel-3945abg-card
<syntaxhighlight lang='bash'>
sudo apt-get install nautilus-open-terminal
nautilus -q
</syntaxhighlight>
In Ubuntu 15.10, the functionality is already included in nautilus!
 
=== Mount iso file ===
<pre>
<pre>
$ sudo mkdir /mnt/iso
sudo iwconfig wlan0 power off
$ sudo mount -o loop /tmp/file.iso /mnt/iso
$ sudo umount /mnt/iso
</pre>
</pre>


=== Check ubuntu version from command line ===
[http://linuxplained.com/how-to-fix-wireless-problems-in-ubuntu-1204-precise-pangolin/ 5 Best Linux/Ubuntu compatible USB Wifi cards]:
http://www.howtogeek.com/206240/how-to-tell-what-distro-and-version-of-linux-you-are-running/
 
*  AirLink101 AWLL6075 Wireless N Mini USB Adapter
*  Medialink – Wireless N USB Adapter – 802.11n
*  ASUS (USB-N13) Wireless-N USB Adapter
*  Panda Mini Wifi (b/g/n) 150Mbps Card
*  TP-Link TL-WN722N 150Mbps High Gain Wireless USB Adapter


To show (USB) wireless adapter information
<pre>
<pre>
lsb_release -a    # command not found if we run it from a docker image
sudo lshw -C network
sudo lsusb -v
iwconfig
</pre>


# OR
To check wifi connection information (SSID, channel, address, frequency, qualiyt, signal level, ...)
cat /etc/issue    # works on docker image
<pre>
sudo iwlist wlan0 scan
</pre>
My experience is quality should be at least 50/70 and signal level should be larger than -60dBm.


# OR
=== Create an iso file from a CD or HD ===
cat /etc/*release  # works on docker image
Method 1 (Better than Method 2). No need to umount the cdrom.
<pre>
mkisofs -o /tmp/DVD.iso /tmp/directory/
</pre>
to make an ISO from files on your hard drive.


# check kernel version
Method 2.
uname -r          # docker will get this information from the host
Make sure the cdrom is NOT mounted. Type '''mount''' to confirm it. If cd was mouted automatically unmout it with umount command:
like '''umount /dev/cdrom''' or '''umount /mnt/cdrom'''. Note that no extra forward slash after /dev/cdrom for the command below.
<pre>
dd if=/dev/cdrom of=~/DVD.iso
</pre>
 
We can mount the iso file to a directory to check the iso file content is correct.
<pre>
mount -t iso9660 -o loop,ro DVD.iso /mnt
</pre>


# check 32/64 bit kernel
=== Have fun with /etc/hosts file ===
uname -a          # docker will get this information from the host
su -c "nano /etc/hosts"
<pre>
127.0.0.1 localhost
::1            localhost
74.125.67.100  DNS_NAME1 DNS_NAME2
</pre>
</pre>
* If you want to add aliases for your machine that will lookup to the loopback address you can keep adding them as '''space separated''' values on that line.
* "::1" is the ipv6 equivalent of 127.0.0.1 (which is for ipv4).


=== keyboard shortcuts ===
==== Block malware, adware ====
Go to keyboard app to change the settings. Note: '''Super''' key is also Windows key. Use 'Backspace' key to disable a shortcut.
[https://www.howtogeek.com/319700/how-to-use-your-computers-hosts-file-to-block-tons-of-malware-porn-and-other-types-of-websites/ How to Use Your Computer’s Hosts File to Block Tons of Malware, Porn, and Other Types of Websites]


* List from [https://help.ubuntu.com/community/KeyboardShortcuts ubuntu.com]
=== Mount a remote file system over ssh ===
* Super: Open the Dash. Press and hold it to see a cheat sheet with a bunch of other nifty shortcuts.
* [https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh this article] on digitalocean.com.
* Super + Number: Open the application that is at that position in the dock
* [http://linuxlove.eu/quick-tip-mounting-remote-linux-directory-windows-linux-ssh/ linuxlove.eu]
* '''Alt + Mouse''': Move an application. Useful if an application's title bar is too high.
* https://help.ubuntu.com/community/SSHFS (include an instruction to keep the connection alive)
* Alt + F2: Run an application by typing its name in the box which appears (same function as the Super key).
* '''Alt + Space''': Activate the window menu. Not useful so I assign this to "Show all applications" (Super + a). This will be consistent with macOS.
* Ctrl + Super + D: To minimize all windows
* Ctrl + Alt + Arrows: move to another workspace
* Ctrl + Alt + Shift + Arrows: move current application to another workspace


On Xubuntu,
The trick is to use the '''sshfs''' tool.
* Alt + F1 (Ctrl + ESC): Application menu.
* Alt + F2 (Super + R): Application Finder.


==== Add a new keyboard shortcut ====
On Ubuntu
Let's say I want to assign Ctrl+Alt+s to bring the shutdown dialog.
<syntaxhighlight lang='bash'>
# System Settings -> Keyboard -> Shortcuts -> Windows -> Toggle shaded state -> Backspace to disable it. For some reason, I cannot assign a new keybinding using the method of '''Custom Shortcuts' method.
# Install the program
# Open ''Ubuntu Software Center ''and install '''Compiz Config Setting Manager''' program. Open the program by search ''Compiz'' and then create a new command '''gnome-session-quit --power-off --force''' with a name like 'Shutdown' and the keyboard binding we want. CCSM -> General -> Commands.
sudo apt-get install sshfs


With this approach, it will give a dialog with 4 options (lock suspend restart shutdown) but no one is pre-selected. If we want the shutdown icon being preselected, use [http://askubuntu.com/questions/554576/how-do-i-call-gnome-session-quit-with-countdown-from-unity this script] where the '''zenity''' command was used to create a dialog. The '''zenity''' program was pre-installed in Ubuntu. See [http://www.howtogeek.com/107537/how-to-make-simple-graphical-shell-scripts-with-zenity-on-linux/ How to Make Simple Graphical Shell Scripts with Zenity on Linux].
# Mount the file system
sudo mkdir /mnt/droplet <--replace "droplet" whatever you prefer
sudo sshfs [email protected].xxx.xxx:/ /mnt/droplet


==== Firefox ====
# Unmount the file system
* Space: page down
sudo umount /mnt/droplet
* Shift + space: page up


=== [http://nebc.nerc.ac.uk/tools/bio-linux BioLinux] ===
# Permanently Mounting the Remote File System
Bio-Linux 7.0 (2012/11/21) screenshot.
sudo nano /etc/fstab
sshfs#root@xxx.xxx.xxx.xxx:/ /mnt/droplet
</syntaxhighlight>


Biolinux can be installed in two ways.
=== Nautilus (File Manager) ===
# One is to download iso image file. http://nebc.nerc.ac.uk/downloads/
==== Undo Ctrl+L ====
# The other way is to install Bio-linux software/package by using apt-get install method. See http://nebc.nerc.ac.uk/tools/bio-linux/other-bl-docs/package-repository
Press ESC.


[[File:BioLinux.png|100px]]
==== Mount another Linux system in Nautilus ====
Very easy. Check out
[http://www.howtogeek.com/203432/how-to-access-ftp-and-webdav-sites-in-any-operating-systems-file-manager/ howtogeek.com]


==== Check Biolinux version ====
==== Create a desktop shortcut ====
<pre>
Navigate to your application in Nautilus. Right-click, select "Make Link". Then drag shortcut to your desktop. Works in Ubuntu 12.04.
cat /etc/bio-linux.version  # 8.0.5 as of June 2015
</pre>


==== Installation ====
==== .desktop file format ====
* Latest version iso or ova.
* [https://specifications.freedesktop.org/desktop-entry-spec/latest/ Desktop Entry Specification]
** http://distrowatch.com/table.php?distribution=biolinux
* "%k" - [http://askubuntu.com/questions/47775/how-can-i-set-the-path-variable-in-a-desktop-file-to-be-relative-to-the-locat How can I set the 'Path' variable in a .desktop file to be relative to the location where the desktop file is located?] and [http://unix.stackexchange.com/questions/144422/getting-the-current-path-in-desktop-exec-command Getting the current path in .desktop EXEC command]
** http://distro.ibiblio.org/bio-linux/iso/ US mirror
* [http://stackoverflow.com/questions/8980464/how-do-i-access-an-environment-variable-in-a-desktop-files-exec-line How do I access an environment variable in a .desktop file's exec line?]


* [http://environmentalomics.org/bio-linux-installation/ Command line] based on Ubuntu 14.04 or from Biolinux 7.
==== Open a terminal ====
<syntaxhighlight lang='bash'>
sudo apt-get install nautilus-open-terminal
nautilus -q
</syntaxhighlight>
In Ubuntu 15.10, the functionality is already included in nautilus!
 
=== Mount iso file ===
<pre>
<pre>
wget -qO- http://nebc.nerc.ac.uk/downloads/bl8_only/upgrade8.sh | sudo sh
$ sudo mkdir /mnt/iso
$ sudo mount -o loop /tmp/file.iso /mnt/iso
$ sudo umount /mnt/iso
</pre>
</pre>
This takes a long long time.


==== Software list ====
=== Check ubuntu version from command line ===
* http://environmentalomics.org/bio-linux-software-list/
http://www.howtogeek.com/206240/how-to-tell-what-distro-and-version-of-linux-you-are-running/
 
<pre>
lsb_release -a    # command not found if we run it from a docker image


==== FAQ ====
# OR
* http://nebc.nerc.ac.uk/nebc_website_frozen/nebc.nerc.ac.uk//tools/bio-linux-7/bio-linux-faq
cat /etc/issue    # works on docker image


==== Sample Data ====
# OR
Did not find them useful.
cat /etc/*release # works on docker image
<pre>
 
brb@biolinux[brb] ls Desktop/Sample\ Data/                                                         [10:05AM]
# check kernel version
act      cytoscape              glimmer3      mrbayes            peptide_seqs      splitstree
uname -r          # docker will get this information from the host
artemis  dendroscope            happy        mspcrunch          phylip            squint
 
blast    dotter                  hmmer        multiple_alignment qiime              t-coffee
# check 32/64 bit kernel
blast+    dust                    jalview      mummer              rasmol            tree-puzzle
uname -a           # docker will get this information from the host
blixem    fasta                  jprofilegrid  muscle              rdp_classifier    treeview
cap3      fastDNAml              mesquite      mview              readseq
catchall  forester-archaeopteryx  mira          njplot              samtools
clustal  gap4                    mothur        nucleotide_seqs    sanger_tracefiles
brb@biolinux[brb] ls Desktop/Sample\ Data/fasta/                                                  [10:05AM]
bovgh.seq        hahu.aa      mgstm1.e05          mgstm1.nt1r  myosin_bp.aa  oohu.raa
bovprl.seq      hsgstm1b.gcg  mgstm1.eeq          mgstm1.nts  n0.aa        prio_atepa.aa
egmsmg.aa        hsgstm1b.seq  mgstm1.esq           mgstm1.raa  n1.aa        prot_test.lib
grou_drome.pseg  humgstd.seq  mgstm1.gcg          mgstm1.rev  n2.aa        prot_test.lseg
gst.nlib        lcbo.aa      mgstm1_genclone.seq  mgstm1.seq  n2_fs.lib    qrhuld.aa
gst.seq          m1r.aa        mgstm1.lc            mgtt2_x.seq  n2s.aa        sql
gstt1_drome.aa  m2.aa        mgstm1.nt            ms1.aa      n2t.aa        titin_hum.aa
gstt1_pssm.asn1  mchu.aa      mgstm1.nt1          mu.lib      n_fs.lib      titin_hum.seq
gtm1_human.aa    mgstm1.3nt    mgstm1.nt12r        musplfm.aa  ngt.aa        xurt8c.aa
gtt1_drome.aa    mgstm1.aa    mgstm1.nt13          mwkw.aa      ngts.aa      xurt8c.lc
h10_human.aa    mgstm1.aaa    mgstm1.nt13r        mwrtc1.aa    oohu.aa      xurtg.aa
</pre>
</pre>


==== CloudBioLinux ====
=== keyboard shortcuts ===
* http://cloudbiolinux.org/
Go to keyboard app to change the settings. Note: '''Super''' key is also Windows key. Use 'Backspace' key to disable a shortcut.
* https://github.com/chapmanb/cloudbiolinux


=== Tomcat ===
* List from [https://help.ubuntu.com/community/KeyboardShortcuts ubuntu.com]
* [http://www.ubuntugeek.com/install-tomcat-8-on-ubuntu-15-10-server.html Install Tomcat 8 on Ubuntu]
* Super: Open the Dash. Press and hold it to see a cheat sheet with a bunch of other nifty shortcuts.
 
* Super + Number: Open the application that is at that position in the dock
=== Device manager ===
* '''Alt + Mouse''': Move an application. Useful if an application's title bar is too high.
By default, ubuntu does not provide any graphical tool like device manager on Windows. A very close one is '''[http://ezix.org/project/wiki/HardwareLiSter lshw]''' (hardware lister). A GUI tool based on it is called '''lshw-gtk''' (seems not as informative as the command line one) and can be installed by ''sudo apt-get install lshw-gtk'' in Ubuntu/Debian or ''yum install lshw'' in Red Hat/Fedora/CentOS.
* Alt + F2: Run an application by typing its name in the box which appears (same function as the Super key).
* '''Alt + Space''': Activate the window menu. Not useful so I assign this to "Show all applications" (Super + a). This will be consistent with macOS.
* Ctrl + Super + D: To minimize all windows
* Ctrl + Alt + Arrows: move to another workspace
* Ctrl + Alt + Shift + Arrows: move current application to another workspace
 
On Xubuntu,
* Alt + F1 (Ctrl + ESC): Application menu.
* Alt + F2 (Super + R): Application Finder.
 
==== Add a new keyboard shortcut ====
Let's say I want to assign Ctrl+Alt+s to bring the shutdown dialog.
# System Settings -> Keyboard -> Shortcuts -> Windows -> Toggle shaded state -> Backspace to disable it. For some reason, I cannot assign a new keybinding using the method of '''Custom Shortcuts' method.
# Open ''Ubuntu Software Center ''and install '''Compiz Config Setting Manager''' program. Open the program by search ''Compiz'' and then create a new command '''gnome-session-quit --power-off --force''' with a name like 'Shutdown' and the keyboard binding we want. CCSM -> General -> Commands.  


As you can see the line containing 'display' shows the motherboard (P45T-A), CPU (Intel Core 2 Duo E8400), graphical card (GeForce 9400 GT in this case), et al.
With this approach, it will give a dialog with 4 options (lock suspend restart shutdown) but no one is pre-selected. If we want the shutdown icon being preselected, use [http://askubuntu.com/questions/554576/how-do-i-call-gnome-session-quit-with-countdown-from-unity this script] where the '''zenity''' command was used to create a dialog. The '''zenity''' program was pre-installed in Ubuntu. See [http://www.howtogeek.com/107537/how-to-make-simple-graphical-shell-scripts-with-zenity-on-linux/ How to Make Simple Graphical Shell Scripts with Zenity on Linux].
<pre>
 
brb@brb-P45T-A:~$ sudo lshw -short
==== Firefox ====
H/W path        Device      Class      Description
* Space: page down
====================================================
* Shift + space: page up
                            system      P45T-A (To Be Filled By O.E.M.)
 
/0                          bus        P45T-A
=== [http://nebc.nerc.ac.uk/tools/bio-linux BioLinux] ===
/0/0                        memory      64KiB BIOS
Bio-Linux 7.0 (2012/11/21) screenshot.  
/0/4                        processor  Intel(R) Core(TM)2 Duo CPU    E8400  @
 
/0/4/5                      memory      64KiB L1 cache
Biolinux can be installed in two ways.  
/0/4/6                      memory      6MiB L2 cache
# One is to download iso image file. http://nebc.nerc.ac.uk/downloads/
/0/f                        memory      8GiB System Memory
# The other way is to install Bio-linux software/package by using apt-get install method. See http://nebc.nerc.ac.uk/tools/bio-linux/other-bl-docs/package-repository
/0/f/0                      memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
 
/0/f/1                      memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
[[File:BioLinux.png|100px]]
/0/f/2                      memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
 
/0/f/3                      memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
==== Check Biolinux version ====
/0/100                      bridge      4 Series Chipset DRAM Controller
<pre>
/0/100/1                    bridge      4 Series Chipset PCI Express Root Port
cat /etc/bio-linux.version  # 8.0.5 as of June 2015
/0/100/1/0                  display    G96 [GeForce 9400 GT]
/0/100/1a                    bus        82801JI (ICH10 Family) USB UHCI Control
/0/100/1a.1                  bus        82801JI (ICH10 Family) USB UHCI Control
/0/100/1a.2                  bus        82801JI (ICH10 Family) USB UHCI Control
/0/100/1a.7                  bus        82801JI (ICH10 Family) USB2 EHCI Contro
/0/100/1b                    multimedia  82801JI (ICH10 Family) HD Audio Control
/0/100/1c                    bridge      82801JI (ICH10 Family) PCI Express Root
/0/100/1c/0      eth0        network    AR8121/AR8113/AR8114 Gigabit or Fast Et
/0/100/1c.3                  bridge      82801JI (ICH10 Family) PCI Express Root
/0/100/1c.3/0    wlan0      network    AR93xx Wireless Network Adapter
/0/100/1c.4                  bridge      82801JI (ICH10 Family) PCI Express Root
/0/100/1c.4/0                storage    JMB361 AHCI/IDE
/0/100/1c.4/0.1              storage    JMB361 AHCI/IDE
/0/100/1d                    bus        82801JI (ICH10 Family) USB UHCI Control
/0/100/1d.1                  bus        82801JI (ICH10 Family) USB UHCI Control
/0/100/1d.2                  bus        82801JI (ICH10 Family) USB UHCI Control
/0/100/1d.7                  bus        82801JI (ICH10 Family) USB2 EHCI Contro
/0/100/1e                    bridge      82801 PCI Bridge
/0/100/1f                    bridge      82801JIR (ICH10R) LPC Interface Control
/0/100/1f.2                  storage    82801JI (ICH10 Family) 4 port SATA IDE
/0/100/1f.3                  bus        82801JI (ICH10 Family) SMBus Controller
/0/100/1f.5                  storage    82801JI (ICH10 Family) 2 port SATA IDE
/0/1            scsi0      storage   
/0/1/0.0.0      /dev/sda    disk        250GB Samsung SSD 840
/0/1/0.0.0/1    /dev/sda1  volume      224GiB EXT4 volume
/0/1/0.0.0/2    /dev/sda2  volume      8190MiB Extended partition
/0/1/0.0.0/2//dev/sda5  volume      8190MiB Linux swap / Solaris partition
/0/1/0.1.0      /dev/sdb    disk        2TB ST2000DM001-9YN1
/0/1/0.1.0/1    /dev/sdb1  volume      1863GiB EXT4 volume
/0/2            scsi2      storage   
/0/2/0.0.0       /dev/cdrom  disk        DVDRAM GH24NS90
/1                          power      Nikon Ultra Plus
/2                          power      To Be Filled By O.E.M.
</pre>
</pre>


For storage part, ubuntu provides a graphical tool. See "disk utility" on gnome based ubuntu or search for "[https://live.gnome.org/Design/Apps/Disks disk]" in launcher.
==== Installation ====
 
* Latest version iso or ova.
=== Set static IP - /etc/network/interfaces===
** http://distrowatch.com/table.php?distribution=biolinux
<syntaxhighlight lang='bash'>
** http://distro.ibiblio.org/bio-linux/iso/ US mirror
root@debian:~# cat /etc/network/interfaces
 
auto lo eth0
* [http://environmentalomics.org/bio-linux-installation/ Command line] based on Ubuntu 14.04 or from Biolinux 7.
iface lo inet loopback
iface eth0 inet dhcp
</syntaxhighlight>
Now edit the file  /etc/network/interfaces
<pre>
<pre>
# The primary network interface
wget -qO- http://nebc.nerc.ac.uk/downloads/bl8_only/upgrade8.sh | sudo sh
auto eth0
iface eth0 inet static
address 192.168.1.3
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0                # Optional
broadcast 192.168.1.255            # Optional
dns-nameservers 192.168.1.1 8.8.8.8 # Or skip 192.168.1.1
</pre>
</pre>
This takes a long long time.


After it, restart the network by issuing
==== Software list ====
<syntaxhighlight lang='bash'>
* http://environmentalomics.org/bio-linux-software-list/
/etc/init.d/networking restart
</syntaxhighlight>
OR
sudo reboot


Note: It does not work by editing /etc/resolv.conf since this file will be overwritten.
==== FAQ ====
* http://nebc.nerc.ac.uk/nebc_website_frozen/nebc.nerc.ac.uk//tools/bio-linux-7/bio-linux-faq


=== Change IP address from the command line ===
==== Sample Data ====
Did not find them useful.
<pre>
<pre>
/sbin/ifconfig eth0 192.168.1.17 netmask 255.255.255.0 up
brb@biolinux[brb] ls Desktop/Sample\ Data/                                                         [10:05AM]
/sbin/ifconfig eth0
act      cytoscape              glimmer3      mrbayes            peptide_seqs      splitstree
artemis  dendroscope            happy        mspcrunch          phylip            squint
blast    dotter                  hmmer        multiple_alignment  qiime              t-coffee
blast+    dust                    jalview      mummer              rasmol            tree-puzzle
blixem    fasta                  jprofilegrid  muscle              rdp_classifier    treeview
cap3      fastDNAml              mesquite      mview              readseq
catchall  forester-archaeopteryx  mira          njplot              samtools
clustal  gap4                    mothur        nucleotide_seqs    sanger_tracefiles
brb@biolinux[brb] ls Desktop/Sample\ Data/fasta/                                                  [10:05AM]
bovgh.seq        hahu.aa      mgstm1.e05          mgstm1.nt1r  myosin_bp.aa  oohu.raa
bovprl.seq      hsgstm1b.gcg  mgstm1.eeq          mgstm1.nts  n0.aa        prio_atepa.aa
egmsmg.aa        hsgstm1b.seq  mgstm1.esq          mgstm1.raa  n1.aa        prot_test.lib
grou_drome.pseg  humgstd.seq  mgstm1.gcg          mgstm1.rev  n2.aa        prot_test.lseg
gst.nlib        lcbo.aa      mgstm1_genclone.seq  mgstm1.seq  n2_fs.lib    qrhuld.aa
gst.seq          m1r.aa        mgstm1.lc            mgtt2_x.seq  n2s.aa        sql
gstt1_drome.aa  m2.aa        mgstm1.nt            ms1.aa      n2t.aa        titin_hum.aa
gstt1_pssm.asn1  mchu.aa      mgstm1.nt1          mu.lib      n_fs.lib      titin_hum.seq
gtm1_human.aa    mgstm1.3nt    mgstm1.nt12r        musplfm.aa  ngt.aa        xurt8c.aa
gtt1_drome.aa    mgstm1.aa    mgstm1.nt13          mwkw.aa      ngts.aa      xurt8c.lc
h10_human.aa    mgstm1.aaa    mgstm1.nt13r        mwrtc1.aa    oohu.aa      xurtg.aa
</pre>
</pre>


[http://www.howtogeek.com/103190/change-your-ip-address-from-the-command-prompt/ Windows] OS.
==== CloudBioLinux ====
* http://cloudbiolinux.org/
* https://github.com/chapmanb/cloudbiolinux


=== [https://help.ubuntu.com/community/UFW ufw (uncomplicated firewall)] ===
=== Tomcat ===
* [https://linuxize.com/post/how-to-setup-a-firewall-with-ufw-on-ubuntu-18-04/ How To Set Up a Firewall with UFW on Ubuntu 18.04]
* [http://www.ubuntugeek.com/install-tomcat-8-on-ubuntu-15-10-server.html Install Tomcat 8 on Ubuntu]
* [http://gufw.org/ Gufw], https://help.ubuntu.com/community/Gufw


The default firewall configuration tool for Ubuntu is '''ufw'''. Developed to ease '''iptables''' firewall configuration, ufw provides a user friendly way to create an IPv4 or IPv6 host-based firewall. By default UFW is disabled.  
=== Device manager ===
By default, ubuntu does not provide any graphical tool like device manager on Windows. A very close one is '''[http://ezix.org/project/wiki/HardwareLiSter lshw]''' (hardware lister). A GUI tool based on it is called '''lshw-gtk''' (seems not as informative as the command line one) and can be installed by ''sudo apt-get install lshw-gtk'' in Ubuntu/Debian or ''yum install lshw'' in Red Hat/Fedora/CentOS.


Suppose I have a virtual machine running a web server at port 8888 (The vm may be initialized by the Vagrant command). I can access the webpage from my host machine using http://localhost:8888.
As you can see the line containing 'display' shows the motherboard (P45T-A), CPU (Intel Core 2 Duo E8400), graphical card (GeForce 9400 GT in this case), et al.
 
<pre>
Now I want the web page to be accessible from other local machines. We can use the '''ufw''' command to enable the firewall wall and open ports for certain services.
brb@brb-P45T-A:~$ sudo lshw -short
 
H/W path        Device      Class      Description
<syntaxhighlight lang='bash'>
====================================================
sudo ufw allow 8888/tcp
                            system      P45T-A (To Be Filled By O.E.M.)
sudo ufw show added
/0                          bus        P45T-A
sudo ufw enable
/0/0                        memory      64KiB BIOS
sudo ufw status
/0/4                        processor  Intel(R) Core(TM)2 Duo CPU    E8400  @
sudo ufw app list
/0/4/5                      memory      64KiB L1 cache
 
/0/4/6                      memory      6MiB L2 cache
nmap localhost
/0/f                        memory      8GiB System Memory
</syntaxhighlight>
/0/f/0                      memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
 
/0/f/1                      memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
Now I can go to another machine, open a browser at http://hostip:8888/. I should be able to get the same result as I got from the host machine.
/0/f/2                      memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
 
/0/f/3                      memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
In one instance sshing to a server failed (connection time) for some reason. The solution is to run the following command on the server
/0/100                      bridge      4 Series Chipset DRAM Controller
<syntaxhighlight lang='bash'>
/0/100/1                    bridge      4 Series Chipset PCI Express Root Port
sudo ufw allow 22/tcp
/0/100/1/0                  display    G96 [GeForce 9400 GT]
</syntaxhighlight>
/0/100/1a                    bus        82801JI (ICH10 Family) USB UHCI Control
 
/0/100/1a.1                  bus        82801JI (ICH10 Family) USB UHCI Control
A graphical interface program is called [http://gufw.org/ Gufw Firewall].  
/0/100/1a.2                  bus        82801JI (ICH10 Family) USB UHCI Control
 
/0/100/1a.7                  bus        82801JI (ICH10 Family) USB2 EHCI Contro
Other things '''ufw''' can do:
/0/100/1b                    multimedia  82801JI (ICH10 Family) HD Audio Control
* Allow/Deny by ports and (optional) protocols
/0/100/1c                    bridge      82801JI (ICH10 Family) PCI Express Root
* Allow/Deny by service name
/0/100/1c/0      eth0        network    AR8121/AR8113/AR8114 Gigabit or Fast Et
* Disable ping requests.  
/0/100/1c.3                  bridge      82801JI (ICH10 Family) PCI Express Root
* Allow by specific IP
/0/100/1c.3/0    wlan0      network    AR93xx Wireless Network Adapter
* Allow by subnet
/0/100/1c.4                  bridge      82801JI (ICH10 Family) PCI Express Root
* Allow by specific port and IP address
/0/100/1c.4/0                storage    JMB361 AHCI/IDE
* Deny by certain IP address
/0/100/1c.4/0.1              storage    JMB361 AHCI/IDE
* Deny by certain IP address and certain port
/0/100/1d                    bus        82801JI (ICH10 Family) USB UHCI Control
 
/0/100/1d.1                  bus        82801JI (ICH10 Family) USB UHCI Control
=== DNS tricks ===
/0/100/1d.2                  bus        82801JI (ICH10 Family) USB UHCI Control
==== 5 DNS Servers Guaranteed to Improve Your Online Safety ====
/0/100/1d.7                  bus        82801JI (ICH10 Family) USB2 EHCI Contro
http://www.makeuseof.com/tag/best-dns-providers-security/
/0/100/1e                    bridge      82801 PCI Bridge
 
/0/100/1f                    bridge      82801JIR (ICH10R) LPC Interface Control
==== 5 Nifty Ways to Use DNS to Your Advantage ====
/0/100/1f.2                  storage    82801JI (ICH10 Family) 4 port SATA IDE
http://www.makeuseof.com/tag/nifty-ways-use-dns-advantage/
/0/100/1f.3                  bus        82801JI (ICH10 Family) SMBus Controller
 
/0/100/1f.5                  storage    82801JI (ICH10 Family) 2 port SATA IDE
=== DNS Server ===
/0/1            scsi0      storage   
[https://linuxconfig.org/protecting-your-privacy-with-firefox-on-linux Protecting Your Privacy With Firefox on Linux]
/0/1/0.0.0      /dev/sda    disk        250GB Samsung SSD 840
/0/1/0.0.0/1    /dev/sda1  volume      224GiB EXT4 volume
/0/1/0.0.0/2    /dev/sda2  volume      8190MiB Extended partition
/0/1/0.0.0/2/5   /dev/sda5  volume      8190MiB Linux swap / Solaris partition
/0/1/0.1.0      /dev/sdb    disk        2TB ST2000DM001-9YN1
/0/1/0.1.0/1    /dev/sdb1  volume      1863GiB EXT4 volume
/0/2            scsi2      storage   
/0/2/0.0.0      /dev/cdrom  disk        DVDRAM GH24NS90
/1                          power      Nikon Ultra Plus
/2                          power      To Be Filled By O.E.M.
</pre>


==== What is my DNS server ====
For storage part, ubuntu provides a graphical tool. See "disk utility" on gnome based ubuntu or search for "[https://live.gnome.org/Design/Apps/Disks disk]" in launcher.
/etc/resolv.conf or /etc/network/interfaces


On my home computer, it just shows one line ''nameserver 127.0.1.1''. On work computer, it shows another line ''search nci.nih.gov''.
=== Set static IP - /etc/network/interfaces===
 
<syntaxhighlight lang='bash'>
After any change, we can restart the network by using ''sudo service networking restart''.
root@debian:~# cat /etc/network/interfaces
 
auto lo eth0
On Ubuntu 18.04, it uses '''[https://netplan.io/ netplan]'''. See
iface lo inet loopback
* [https://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/netplan-how-to-configure-static-ip-address-in-ubuntu-18-04-using-netplan.html Netplan – How To Configure Static IP Address in Ubuntu 18.04 using Netplan]
iface eth0 inet dhcp
* [https://www.techrepublic.com/article/how-to-set-dns-nameservers-in-ubuntu-server-18-04/ How to set DNS nameservers in Ubuntu Server 18.04]
</syntaxhighlight>
 
Now edit the file  /etc/network/interfaces
==== '''dig''' Command Examples ====
<pre>
https://www.cyberciti.biz/faq/linux-unix-dig-command-examples-usage-syntax/
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.3
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0                # Optional
broadcast 192.168.1.255            # Optional
dns-nameservers 192.168.1.1 8.8.8.8 # Or skip 192.168.1.1
</pre>


dig (domain information groper) is a DNS lookup utility.
After it, restart the network by issuing
<syntaxhighlight lang='bash'>
/etc/init.d/networking restart
</syntaxhighlight>
OR
sudo reboot


=== DNStracer ===
Note: It does not work by editing /etc/resolv.conf since this file will be overwritten.
http://www.ubuntugeek.com/dnstracer-trace-dns-queries-to-the-source.html


=== Dyndns and [https://help.dyn.com/ddclient/ ddclient] ===
=== Change IP address from the command line ===
See
* https://help.ubuntu.com/community/DynamicDNS#ddclient (works)
* https://help.ubuntu.com/community/DynamicDNS#Namecheap_.26_Python (works)
 
nano '''/etc/ddclient.conf'''
<pre>
<pre>
protocol=namecheap
/sbin/ifconfig eth0 192.168.1.17 netmask 255.255.255.0 up
ssl=yes
/sbin/ifconfig eth0
use=web, web=dynamicdns.park-your-domain.com/getip
server=dynamicdns.park-your-domain.com
login=yourdomain.com
password=a9438540ba8a449fb0ed09c3737b9e32
@
</pre>
</pre>
Note that the specification should depend on the domain name registrar (eg namecheap). For namecheap, the login/password is NOT your actual credential from your domain name registrar. The password should be obtained from the domain name registrar website. The last line is about the host. If I am setting it up for a subdomain, I should enter the subdomain name (and skip the domain name part). The '''ssl=yes''' is to ensure the [https://help.dyn.com/ddclient/ connection is made over https instead of http].


And run '''sudo ddclient -daemon=0 -debug -verbose -noquiet''' to verify ddclient is working. You shall get a long return with the last line looks like
[http://www.howtogeek.com/103190/change-your-ip-address-from-the-command-prompt/ Windows] OS.
<pre>
SUCCESS:  updating YOURSUBDOMAIN: good: IP address set to XX.XXX.XXX.XXX
</pre>


No matter which method we use, we can go to our DNS account (in namecheap, go to Dashboard -> MANAGE button -> Domains -> Advanced DNS) and temporarily change the global IP address to another one, run the update script and then check if the global IP address has been updated to the correct one.  
=== [https://help.ubuntu.com/community/UFW ufw (uncomplicated firewall)] ===
* [https://linuxize.com/post/how-to-setup-a-firewall-with-ufw-on-ubuntu-18-04/ How To Set Up a Firewall with UFW on Ubuntu 18.04]
* [http://gufw.org/ Gufw], https://help.ubuntu.com/community/Gufw


==== namecheap ====
The default firewall configuration tool for Ubuntu is '''ufw'''. Developed to ease '''iptables''' firewall configuration, ufw provides a user friendly way to create an IPv4 or IPv6 host-based firewall. By default UFW is disabled.  
* [https://www.namecheap.com/support/knowledgebase/article.aspx/583/11/how-do-i-configure-ddclient How do I configure DDClient?]
* To create a subdomain, go to Dashboard -> Manage -> Advanced DNS tab. Click '''+ ADD NEW RECORD'''. In the 'HOST RECORDS' section, pick 'A + dynamic dns record' and enter the subdomain name (HOST) with the IPv4 address (Value). In the 'DYNAMIC DNS' section, we can download the client software too (scroll down to get the download link). See [https://www.namecheap.com/support/knowledgebase/article.aspx/319/78/how-can-i-setup-an-a-address-record-for-my-domain How can I set up an A (address) record for my domain?]
* To understand different records (A record, AAAA record, CNAME record, NS record, SRV record, TXT record, URL redirect record) See [https://www.namecheap.com/support/knowledgebase/article.aspx/434/2237/how-do-i-set-up-host-records-for-a-domain How do I set up host records for a domain?]
* If you've purchased an SSL certificate, you'll want to visit your Account Panel soon to enter your CSR and activate the certificate. [https://www.namecheap.com/support/knowledgebase/category.aspx/14/ Instructions on how to create a CSR and install the certificate on your server].
* CloudFlare
** [https://www.namecheap.com/support/knowledgebase/article.aspx/1191/2210/how-to-enable-cloudflare-for-your-domain-name How to enable CloudFlare for your domain name]
** [https://www.namecheap.com/support/knowledgebase/article.aspx/9607/2210/how-to-set-up-dns-records-for-your-domain-in-cloudflare-account How to set up DNS records for your domain in CloudFlare account]
** [http://davidensinger.com/2014/04/transferring-the-dns-from-namecheap-to-cloudflare-for-github-pages/ Transfering DNS from Namecheap to CloudFlare]
* Email forwarding
** [https://forwardemail.net/#/?id=how-it-works forwardemail.net]


==== Mail ====
Suppose I have a virtual machine running a web server at port 8888 (The vm may be initialized by the Vagrant command). I can access the webpage from my host machine using http://localhost:8888.  
* check the option of '''Mail Routing: I have mail server with another name and would like to add MX hostname...'''
* In 'MX hostname' entering '''aspmx.l.google.com'''
* In 'Primary' choose 'Yes, use it as my primary mail relay.'


=== no-ip ===
Now I want the web page to be accessible from other local machines. We can use the '''ufw''' command to enable the firewall wall and open ports for certain services.
Similar to Dyndns. It has its own client program. Needs to build it yourself.


Also see the [http://support.no-ip.com/customer/portal/articles/375955-basic-troubleshooting-guide troubleshooting guide].
<syntaxhighlight lang='bash'>
sudo ufw allow 8888/tcp
sudo ufw show added
sudo ufw enable
sudo ufw status
sudo ufw app list


See http://ducky-pond.com/posts/12 for instruction of setting autostart on Debian system.
nmap localhost
</syntaxhighlight>


See http://www.coulterfamily.org.uk/pages/PCs/Linux/FAQ-LINUX-NO-IP-CLIENT.php for another approach.
Now I can go to another machine, open a browser at http://hostip:8888/. I should be able to get the same result as I got from the host machine.


Note: If noip2 cannot start automatically or noip2 does not update even it can be seen from ps -ef command, use '''sudo crontab -e''' command. <span style="color: red"> For some reason, after I use sudo crontab, noip2 can update IP.</span> So the only problem right now is it cannot update every 30 minutes even '''sudo noip2 -S''' says so. The problems may be 1. ps -ef shows the command runs from nobody user 2. sudo noip2 -S says it updates every 30 minutes via /dev/eth0 with NAT enabled.
In one instance sshing to a server failed (connection time) for some reason. The solution is to run the following command on the server
<syntaxhighlight lang='bash'>
sudo ufw allow 22/tcp
</syntaxhighlight>


Update: An alternative is to use ddclient. However, ddclient never updates the IP.
A graphical interface program is called [http://gufw.org/ Gufw Firewall].  


==== Mail ====
Other things '''ufw''' can do:
* Allow only one MX record for each host for free no-ip account.
* Allow/Deny by ports and (optional) protocols
* Click Host/Redirects > Manage Hosts > Modify.
* Allow/Deny by service name
* Disable ping requests.  
* Allow by specific IP
* Allow by subnet
* Allow by specific port and IP address
* Deny by certain IP address
* Deny by certain IP address and certain port


=== webmin ===
=== DNS tricks ===
See http://www.webmin.com/deb.html
==== 5 DNS Servers Guaranteed to Improve Your Online Safety ====
<pre>
http://www.makeuseof.com/tag/best-dns-providers-security/
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.600_all.deb
dpkg --install webmin_1.600_all.deb
</pre>
The install will be done automatically to ''/usr/share/webmin'', the administration username set to ''root'' and the password to your current root password. You should now be able to login to Webmin at the URL http://localhost:10000/. Or if accessing it remotely, replace localhost with your system's IP address.


=== Virtualize Linux ===
==== 5 Nifty Ways to Use DNS to Your Advantage ====
http://www.linuxuser.co.uk/features/how-to-virtualise-linux-part-1
http://www.makeuseof.com/tag/nifty-ways-use-dns-advantage/


==== CPU ====
=== DNS Server ===
<syntaxhighlight lang='bash'>
[https://linuxconfig.org/protecting-your-privacy-with-firefox-on-linux Protecting Your Privacy With Firefox on Linux]
$ grep name /proc/cpuinfo | sort -u
model name : AMD Phenom(tm) II X6 1055T Processor      # home


model name : Intel(R) Xeon(R) CPU  X7560  @ 2.27GHz    # helix
==== What is my DNS server ====
/etc/resolv.conf or /etc/network/interfaces


model name : Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz  # office
On my home computer, it just shows one line ''nameserver 127.0.1.1''. On work computer, it shows another line ''search nci.nih.gov''.
</syntaxhighlight>


==== Find out if the OS is running in a virtual environment ====
After any change, we can restart the network by using ''sudo service networking restart''.
Linux adds the '''hypervisor''' flag to '''/proc/cpuinfo''' if the kernel detects running on some sort of a hypervisor. See [http://unix.stackexchange.com/questions/3685/find-out-if-the-os-is-running-in-a-virtual-environment here].  
<syntaxhighlight lang='bash'>
cat /proc/cpuinfo | grep hypervisor
</syntaxhighlight>


==== Virtualbox ====
On Ubuntu 18.04, it uses '''[https://netplan.io/ netplan]'''. See
See [[Virtualbox|here]].
* [https://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/netplan-how-to-configure-static-ip-address-in-ubuntu-18-04-using-netplan.html Netplan – How To Configure Static IP Address in Ubuntu 18.04 using Netplan]
* [https://www.techrepublic.com/article/how-to-set-dns-nameservers-in-ubuntu-server-18-04/ How to set DNS nameservers in Ubuntu Server 18.04]


==== VBoxClient: the VirtualBox kernel service is not running  ====
==== '''dig''' Command Examples ====
Got the above message on the upper right corner of the screen for every booting. Note I don't install VirtualBox. A [https://www.linuxliteos.com/forums/other/vboxclient-the-virtualbox-kernel-service-is-not-running/15/ solution] is run
https://www.cyberciti.biz/faq/linux-unix-dig-command-examples-usage-syntax/
<syntaxhighlight lang='bash'>
gksudo gedit /etc/X11/Xsession.d/98vboxadd-xclient
</syntaxhighlight>
find the line
<pre>
notify-send "VBoxClient: the VirtualBox kernel service is not running.  Exiting."
</pre>
Now change '''notify-send''' to '''echo'''.


=== Thin client ===
dig (domain information groper) is a DNS lookup utility.
https://help.ubuntu.com/community/ThinClients


==== [https://help.ubuntu.com/community/UbuntuLTSP UbuntuLTSP] ====
=== DNStracer ===
* [http://www.havetheknowhow.com/Configure-the-server/Install-LTSP.html How to install LTSP (Linux Terminal Server Project) on Ubuntu Server]
http://www.ubuntugeek.com/dnstracer-trace-dns-queries-to-the-source.html
* Full Tutorial - Install and configure LTSP server and clients (ubuntu, ltsp, howto) [https://youtu.be/s1cguYmZ3-c Part 1] and [https://youtu.be/2aFcDlp9-xw Part 2]


==== [http://www.ltsp.org/ LTSP] ====
=== Dyndns and [https://help.dyn.com/ddclient/ ddclient] ===
See
* https://help.ubuntu.com/community/DynamicDNS#ddclient (works)
* https://help.ubuntu.com/community/DynamicDNS#Namecheap_.26_Python (works)


==== Raspberry Pi ====
nano '''/etc/ddclient.conf'''
[http://www.uzerp.com/blog/running-raspberry-pis-as-thin-clients-with-ubuntu-14-04-lts/ Running Raspberry Pi’s as Thin Clients with Ubuntu 14.04 LTS]
<pre>
protocol=namecheap
ssl=yes
use=web, web=dynamicdns.park-your-domain.com/getip
server=dynamicdns.park-your-domain.com
login=yourdomain.com
password=a9438540ba8a449fb0ed09c3737b9e32
@
</pre>
Note that the specification should depend on the domain name registrar (eg namecheap). For namecheap, the login/password is NOT your actual credential from your domain name registrar. The password should be obtained from the domain name registrar website. The last line is about the host. If I am setting it up for a subdomain, I should enter the subdomain name (and skip the domain name part). The '''ssl=yes''' is to ensure the [https://help.dyn.com/ddclient/ connection is made over https instead of http].  


[https://help.ubuntu.com/community/UbuntuLTSP/RaspberryPi  UbuntuLTSP/RaspberryPi
And run '''sudo ddclient -daemon=0 -debug -verbose -noquiet''' to verify ddclient is working. You shall get a long return with the last line looks like
]
<pre>
SUCCESS:  updating YOURSUBDOMAIN: good: IP address set to XX.XXX.XXX.XXX
</pre>


=== Remote desktop ===
No matter which method we use, we can go to our DNS account (in namecheap, go to Dashboard -> MANAGE button -> Domains -> Advanced DNS) and temporarily change the global IP address to another one, run the update script and then check if the global IP address has been updated to the correct one.


==== Remote desktop using Chrome ====
==== namecheap ====
* https://support.google.com/chrome/answer/1649523?hl=en&co=GENIE.Platform%3DDesktop
* [https://www.namecheap.com/support/knowledgebase/article.aspx/583/11/how-do-i-configure-ddclient How do I configure DDClient?]
* http://www.linuxandubuntu.com/home/chrome-remote-desktop-a-linux-remote-desktop-app
* To create a subdomain, go to Dashboard -> Manage -> Advanced DNS tab. Click '''+ ADD NEW RECORD'''. In the 'HOST RECORDS' section, pick 'A + dynamic dns record' and enter the subdomain name (HOST) with the IPv4 address (Value). In the 'DYNAMIC DNS' section, we can download the client software too (scroll down to get the download link). See [https://www.namecheap.com/support/knowledgebase/article.aspx/319/78/how-can-i-setup-an-a-address-record-for-my-domain How can I set up an A (address) record for my domain?]
* https://medium.com/@vsimon/how-to-install-chrome-remote-desktop-on-ubuntu-18-04-52d99980d83e
* To understand different records (A record, AAAA record, CNAME record, NS record, SRV record, TXT record, URL redirect record) See [https://www.namecheap.com/support/knowledgebase/article.aspx/434/2237/how-do-i-set-up-host-records-for-a-domain How do I set up host records for a domain?]
* https://productforums.google.com/forum/#!msg/chrome/flTs7Kxrdr8/mEwvu9i0EgAJ
* If you've purchased an SSL certificate, you'll want to visit your Account Panel soon to enter your CSR and activate the certificate. [https://www.namecheap.com/support/knowledgebase/category.aspx/14/ Instructions on how to create a CSR and install the certificate on your server].
* https://www.howtoforge.com/how-to-install-and-use-the-chrome-remote-sharing-feature-in-ubuntu
* CloudFlare
** [https://www.namecheap.com/support/knowledgebase/article.aspx/1191/2210/how-to-enable-cloudflare-for-your-domain-name How to enable CloudFlare for your domain name]
** [https://www.namecheap.com/support/knowledgebase/article.aspx/9607/2210/how-to-set-up-dns-records-for-your-domain-in-cloudflare-account How to set up DNS records for your domain in CloudFlare account]
** [http://davidensinger.com/2014/04/transferring-the-dns-from-namecheap-to-cloudflare-for-github-pages/ Transfering DNS from Namecheap to CloudFlare]
* Email forwarding
** [https://forwardemail.net/#/?id=how-it-works forwardemail.net]


==== Remote desktop connection from Windows 7 ====
==== Mail ====
xtightvncserver may not play well in Unity.  
* check the option of '''Mail Routing: I have mail server with another name and would like to add MX hostname...'''
* In 'MX hostname' entering '''aspmx.l.google.com'''
* In 'Primary' choose 'Yes, use it as my primary mail relay.'


Install xrdp on Ubuntu. That's it. See
=== no-ip ===
* http://www.ubuntututorials.com/remote-desktop-ubuntu-12-04-windows-7/ Ubuntu 12.04
Similar to Dyndns. It has its own client program. Needs to build it yourself.
* http://www.tweaking4all.com/software/linux-software/use-xrdp-remote-access-ubuntu-14-04/ Ubuntu 14.04
* https://community.hpcloud.com/article/using-windows-rdp-access-your-ubuntu-instance
* http://www.ubuntugeek.com/xrdp-remote-desktop-protocol-rdp-server.html


<pre>
Also see the [http://support.no-ip.com/customer/portal/articles/375955-basic-troubleshooting-guide troubleshooting guide].
sudo apt-get install xrdp
sudo /etc/init.d/xrdp start
</pre>


On Windows 7, open its Remote Desktop client utility '''mstsc.exe'''.
See http://ducky-pond.com/posts/12 for instruction of setting autostart on Debian system.
 
See http://www.coulterfamily.org.uk/pages/PCs/Linux/FAQ-LINUX-NO-IP-CLIENT.php for another approach.
 
Note: If noip2 cannot start automatically or noip2 does not update even it can be seen from ps -ef command, use '''sudo crontab -e''' command. <span style="color: red"> For some reason, after I use sudo crontab, noip2 can update IP.</span> So the only problem right now is it cannot update every 30 minutes even '''sudo noip2 -S''' says so. The problems may be 1. ps -ef shows the command runs from nobody user 2. sudo noip2 -S says it updates every 30 minutes via /dev/eth0 with NAT enabled.
 
Update: An alternative is to use ddclient. However, ddclient never updates the IP.
 
==== Mail ====
* Allow only one MX record for each host for free no-ip account.
* Click Host/Redirects > Manage Hosts > Modify.


==== Remote desktop connection to Windows 7 from xubuntu ====
=== webmin ===
See http://www.webmin.com/deb.html
<pre>
<pre>
sudo apt-get update
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.600_all.deb
sudo apt-get install rdesktop
dpkg --install webmin_1.600_all.deb
rdesktop xxx.xxx.x.x -f -u USERNAME -p PASSWORD
rdesktop 192.168.1.4 -g 1280x720 -u USERNAME -p PASSWORD
</pre>
</pre>
where '''-f''' option means full screen and '''-g''' means geometry.
The install will be done automatically to ''/usr/share/webmin'', the administration username set to ''root'' and the password to your current root password. You should now be able to login to Webmin at the URL http://localhost:10000/. Or if accessing it remotely, replace localhost with your system's IP address.


==== Remote desktop connection to NCI ====
=== Virtualize Linux ===
Note the information here is outdated now.
http://www.linuxuser.co.uk/features/how-to-virtualise-linux-part-1
 
The version 1.7.1 of rdesktop program in Ubuntu 14 has a bug with mouse cursor (invisible). To fix the bug, download the version 1.8.3 and build it. See http://ubuntuforums.org/showthread.php?t=2266743


==== CPU ====
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo apt-get update
$ grep name /proc/cpuinfo | sort -u
sudo apt-get install build-essential libx11-dev libssl-dev libgssglue-dev libpcsclite-dev
model name : AMD Phenom(tm) II X6 1055T Processor      # home
tar zxvf rdesktop-1.8.3.tar.gz
cd rdesktop-1.8.3
./configure
make
sudo make install
</syntaxhighlight>
After that the new rdesktop is located under '''/usr/local/bin''' folder. The old rdesktop installed through apt-get is not deleted.


ts.nci.nih.gov:1494
model name : Intel(R) Xeon(R) CPU  X7560  @ 2.27GHz    # helix


DOMAIN: NIH
model name : Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz  # office
</syntaxhighlight>


resolution: 1024 x 768
==== Find out if the OS is running in a virtual environment ====
Linux adds the '''hypervisor''' flag to '''/proc/cpuinfo''' if the kernel detects running on some sort of a hypervisor. See [http://unix.stackexchange.com/questions/3685/find-out-if-the-os-is-running-in-a-virtual-environment here].
<syntaxhighlight lang='bash'>
cat /proc/cpuinfo | grep hypervisor
</syntaxhighlight>


Use remmina or rdesktop or freerdp (sudo apt-get install freerdp-x11)
==== Virtualbox ====
<pre>
See [[Virtualbox|here]].
rdesktop ts.nci.nih.gov:1494 -d NIH -u XXXXX -g 1024x768
</pre>


To share a folder from the local machine, use "-r" option
==== VBoxClient: the VirtualBox kernel service is not running  ====
Got the above message on the upper right corner of the screen for every booting. Note I don't install VirtualBox. A [https://www.linuxliteos.com/forums/other/vboxclient-the-virtualbox-kernel-service-is-not-running/15/ solution] is run
<syntaxhighlight lang='bash'>
gksudo gedit /etc/X11/Xsession.d/98vboxadd-xclient
</syntaxhighlight>
find the line
<pre>
<pre>
rdesktop ts.nci.nih.gov:1494 -d NIH -u XXXXX -g 1280x1024 -r disk:remotedisk=/home/$USER/Downloads
notify-send "VBoxClient: the VirtualBox kernel service is not running. Exiting."
</pre>
</pre>
Now change '''notify-send''' to '''echo'''.


The new secure connection relies on the SmartCard is using ncits-p111.nci.nih.gov.
=== Thin client ===
https://help.ubuntu.com/community/ThinClients


==== [https://www.realvnc.com/ RealVNC] ====
==== [https://help.ubuntu.com/community/UbuntuLTSP UbuntuLTSP] ====
The default vnc server included in Ubuntu is not quite compatible with other clients. For example I can connect to Ubuntu 14.04 from Ubuntu 16.04 but not from a Mac. The 3rd party software is better. See the following screenshot after I have installed RealVNC server.
* [http://www.havetheknowhow.com/Configure-the-server/Install-LTSP.html How to install LTSP (Linux Terminal Server Project) on Ubuntu Server]
* Full Tutorial - Install and configure LTSP server and clients (ubuntu, ltsp, howto) [https://youtu.be/s1cguYmZ3-c Part 1] and [https://youtu.be/2aFcDlp9-xw Part 2]


[[File:Realvnc-server.png|250px]]
==== [http://www.ltsp.org/ LTSP] ====


Note that '''RealVNC Server is not free for commercial users but is free for home users''' up to 5 computers & 3 users; see https://manage.realvnc.com/. An email and a password can be used to sign in your account for activating the license in VNC Server.
==== Raspberry Pi ====
[http://www.uzerp.com/blog/running-raspberry-pis-as-thin-clients-with-ubuntu-14-04-lts/ Running Raspberry Pi’s as Thin Clients with Ubuntu 14.04 LTS]


To start VNC server, use (https://www.realvnc.com/docs/debian-install-remove.html)
[https://help.ubuntu.com/community/UbuntuLTSP/RaspberryPi  UbuntuLTSP/RaspberryPi
<syntaxhighlight lang='bash'>
]
sudo /etc/init.d/vncserver-x11-serviced start
</syntaxhighlight>


The RealVNC will have an icon sitting on the tray at the top-right corner.
=== Remote desktop ===


Before using VNC viewer, we also need to create a VNC password in VNC Server.
==== Remote desktop using Chrome ====
 
* https://support.google.com/chrome/answer/1649523?hl=en&co=GENIE.Platform%3DDesktop
On Mac, the viewer can be launched from Applications -> VNC Viewer (if we have drag and drop the app to the Applications folder).
* http://www.linuxandubuntu.com/home/chrome-remote-desktop-a-linux-remote-desktop-app
* https://medium.com/@vsimon/how-to-install-chrome-remote-desktop-on-ubuntu-18-04-52d99980d83e
* https://productforums.google.com/forum/#!msg/chrome/flTs7Kxrdr8/mEwvu9i0EgAJ
* https://www.howtoforge.com/how-to-install-and-use-the-chrome-remote-sharing-feature-in-ubuntu


On Chrome OS, there is an [https://chrome.google.com/webstore/detail/vnc%C2%AE-viewer-for-google-ch/iabmpiboiopbgfabjmgeedhcmjenhbla VNC Viewer for Google Chrome] to use. The IP address is special. For example, 192.168.5.127:80 for port 5980. See https://www.realvnc.com/docs/faq/connect-fail.html. Unfortunately I cannot connect successfully:(
==== Remote desktop connection from Windows 7 ====
xtightvncserver may not play well in Unity.  


==== Remote desktop connection from Ubuntu to Ubuntu ====
Install xrdp on Ubuntu. That's it. See
* https://help.ubuntu.com/16.04/ubuntu-help/sharing-desktop.html
* http://www.ubuntututorials.com/remote-desktop-ubuntu-12-04-windows-7/ Ubuntu 12.04
* [http://ubuntuhandbook.org/index.php/2016/07/remote-access-ubuntu-16-04/ How to Remote Access to Ubuntu 16.04 from Windows]. The instruction is the same for older versions of Ubuntu.
* http://www.tweaking4all.com/software/linux-software/use-xrdp-remote-access-ubuntu-14-04/ Ubuntu 14.04
** On a Ubuntu server. Go to Dash, type 'desktop sharing' and select it. Check sharing. Close the dialog. Open a terminal and run '''ps -ef | grep vino''' to make sure the server is running.
* https://community.hpcloud.com/article/using-windows-rdp-access-your-ubuntu-instance
** [http://askubuntu.com/questions/477947/what-do-i-need-for-remotely-accessing-my-ubuntu-14-04-desktop Disable encryption]. Run ''sudo apt install dconf-editor''. Go to Dash and type 'dconf' and select 'dconf editor'. When it opens, navigate to '''org -> gnome -> desktop -> remote-access''', and uncheck the value of 'require-encryption.' Another way is to run '''gsettings set org.gnome.Vino require-encryption false'''.
* http://www.ubuntugeek.com/xrdp-remote-desktop-protocol-rdp-server.html
** On a client machine (eg another Ubuntu), open a remote desktop client program (eg Remmina). Choose '''VNC''' as the protocol. Enter necessary information to connect to the server.
* Install a VNC server on non-Unity desktop
** [https://www.howtoforge.com/tutorial/x2go-server-ubuntu-14-04/ X2Go]
** [https://www.howtoforge.com/how-to-install-vnc-server-on-ubuntu-14.04 vnc4server]
** [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-14-04 tightvncserver]


==== Allow for remote desktop connection ====
<pre>
# Go to System -> Preference -> Remote desktop. Allow other uses to view your desktop & uncheck you must confirm each access & require user to enter this password.
sudo apt-get install xrdp
# Go to System -> Preference -> Monitor. Change monitor resolution to 1280 x 720.
sudo /etc/init.d/xrdp start
</pre>


==== Allow for remote desktop connection when vino failed ====
On Windows 7, open its Remote Desktop client utility '''mstsc.exe'''.
* [http://www.teamviewer.com/en/index.aspx Teamviewer]. It works fine. After launching it, the software automatically creates an ID and password. We can change the password so it is fixed. Then launch the software on the client. Use the partner's ID and password to connect to it.
 
==== Remote desktop connection to Windows 7 from xubuntu ====
<pre>
sudo apt-get update
sudo apt-get install rdesktop
rdesktop xxx.xxx.x.x -f -u USERNAME -p PASSWORD
rdesktop 192.168.1.4 -g 1280x720 -u USERNAME -p PASSWORD
</pre>
where '''-f''' option means full screen and '''-g''' means geometry.
 
==== Remote desktop connection to NCI ====
Note the information here is outdated now.
 
The version 1.7.1 of rdesktop program in Ubuntu 14 has a bug with mouse cursor (invisible). To fix the bug, download the version 1.8.3 and build it. See http://ubuntuforums.org/showthread.php?t=2266743


* [https://www.nomachine.com/ NoMachine]. I ran the service on my Ubuntu 12.04 server. I also tested the client on my Android 6.0 tablet and Odroid xu4 running Ubuntu 15.10. I am using the version 5.0.63. I need to use my server's user account info to connect.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
odroid@odroid:~/Downloads$ ps -ef | grep nx
sudo apt-get update
nx      12168    1  1 21:11 ?        00:00:20 /usr/NX/bin/nxserver.bin root 12151 --daemon
sudo apt-get install build-essential libx11-dev libssl-dev libgssglue-dev libpcsclite-dev
odroid  12199 12168  1 21:11 ?        00:00:12 /usr/NX/bin/nxnode.bin
tar zxvf rdesktop-1.8.3.tar.gz
nx      12225 12168  0 21:11 ?        00:00:00 /usr/NX/bin/nxd
cd rdesktop-1.8.3
odroid  12263 12199  1 21:11 ?        00:00:13 /usr/NX/bin/nxclient.bin --monitor --pid 1153
./configure
nx      15916 12225 24 21:28 ?        00:00:08 /usr/NX/bin/nxserver.bin -c /etc/NX/nxserver --login -H 5
make
odroid  15944 15916 33 21:29 ?        00:00:04 /usr/NX/bin/nxnode.bin -H 5
sudo make install
odroid  16130  8527  0 21:29 pts/1   00:00:00 grep --color=auto nx
 
odroid@odroid:~/Downloads$ ls /usr/NX/bin
drivers      nxd        nxkb        nxplayer      nxsh        nxusbd
nxagent      nxesd      nxkeygen    nxplayer.bin  nxspool
nxauth        nxexec      nxlocate    nxpost        nxssh
nxclient      nxfs        nxlpd      nxprint      nxssh-add
nxclient.bin  nxfsm      nxnode      nxserver      nxssh-agent
nxcodec.bin  nxfsserver  nxnode.bin  nxserver.bin  nxtunctl
</syntaxhighlight>
If for some reason some nx programs disappeared, restart the service by
<syntaxhighlight lang='bash'>
sudo /usr/NX/bin/nxserver --restart
</syntaxhighlight>
</syntaxhighlight>
After that the new rdesktop is located under '''/usr/local/bin''' folder. The old rdesktop installed through apt-get is not deleted.
ts.nci.nih.gov:1494


It is interesting that nomachine is faster than 'ssh -X' method when I tested running a Qt application launched from Qt Creator. For example, the progress bar is not moving when it is supposed to move forward and backward when the app is launched through 'ssh -X'.
DOMAIN: NIH


==== NoMachine and Amazon cloud ====
resolution: 1024 x 768
https://www.nomachine.com/accessing-your-remote-linux-desktop-on-amazon-elastic-compute-cloud-via-NoMachine


It seems nomachine is using port 4000.
Use remmina or rdesktop or freerdp (sudo apt-get install freerdp-x11)
<pre>
<pre>
odroid@odroid:~$ sudo nmap -sV localhost
rdesktop ts.nci.nih.gov:1494 -d NIH -u XXXXX -g 1024x768
</pre>


Starting Nmap 7.01 ( https://nmap.org ) at 2016-11-16 20:10 EST
To share a folder from the local machine, use "-r" option
Nmap scan report for localhost (127.0.0.1)
<pre>
Host is up (0.000051s latency).
rdesktop ts.nci.nih.gov:1494 -d NIH -u XXXXX -g 1280x1024 -r disk:remotedisk=/home/$USER/Downloads
Other addresses for localhost (not scanned): ::1
rDNS record for 127.0.0.1: odroid
Not shown: 997 closed ports
PORT    STATE SERVICE        VERSION
22/tcp  open  ssh            OpenSSH 7.2p2 Ubuntu 4ubuntu2.1 (Ubuntu Linux; protocol 2.0)
4000/tcp open  remoteanything?
7001/tcp open  X11            (access denied)
Service Info: OSs: Linux, Unix; CPE: cpe:/o:linux:linux_kernel
 
odroid@odroid:~$ sudo lsof -i :4000
COMMAND PID USER   FD  TYPE DEVICE SIZE/OFF NODE NAME
nxd    735  nx    3u  IPv4  19208      0t0  TCP *:4000 (LISTEN)
nxd    735  nx    4u  IPv6  21234      0t0  TCP *:4000 (LISTEN)
</pre>
</pre>


==== [http://wiki.x2go.org/doku.php/doc:newtox2go X2Go] ====
The new secure connection relies on the SmartCard is using ncits-p111.nci.nih.gov.
used in ''Linux Data Science Virtual Machine'' by Microsoft.


==== Remote desktop connection through vmware workstation ====
==== [https://www.realvnc.com/ RealVNC] ====
We shall be able to remote desktop connect to a Windows guest machine if the guest machine has configured to use bridge connection and a static IP. If there is a problem, it is likely caused by Window's firewall. See the two screenshots. We can just turn off the firewall of home network but keep the firewall on for the public network.
The default vnc server included in Ubuntu is not quite compatible with other clients. For example I can connect to Ubuntu 14.04 from Ubuntu 16.04 but not from a Mac. The 3rd party software is better. See the following screenshot after I have installed RealVNC server.


We don't need to use port forward for the remote desktop connection.
[[File:Realvnc-server.png|250px]]


[[File:ViewActiveNetwork.png|100px]]
Note that '''RealVNC Server is not free for commercial users but is free for home users''' up to 5 computers & 3 users; see https://manage.realvnc.com/. An email and a password can be used to sign in your account for activating the license in VNC Server.
[[File:Firewall.png|100px]]


=== Install sshd ===
To start VNC server, use (https://www.realvnc.com/docs/debian-install-remove.html)
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
apt-get update
sudo /etc/init.d/vncserver-x11-serviced start
apt-get install openssh-server
</syntaxhighlight>
</syntaxhighlight>


=== sftp, vsftpd and virtual users ===
The RealVNC will have an icon sitting on the tray at the top-right corner.  
* [https://www.linuxtechi.com/configure-chroot-sftp-in-linux/ How to configure chroot SFTP in Linux]
* https://help.ubuntu.com/community/vsftpd
* http://www.ubuntugeek.com/setup-ftp-server-using-vsftp-and-configure-secure-ftp-connections-using-tlsssl-on-ubuntu-16-04-server.html
* https://www.howtoforge.com/tutorial/ubuntu-vsftpd/


=== ProFTPd ===
Before using VNC viewer, we also need to create a VNC password in VNC Server.
[https://www.howtoforge.com/tutorial/install-proftpd-with-tls-on-ubuntu-16-04/ How to install ProFTPd with TLS support on Ubuntu 16.04]


=== Install LAMP ===
On Mac, the viewer can be launched from Applications -> VNC Viewer (if we have drag and drop the app to the Applications folder).
See the page [http://library.linode.com/lamp-guides/debian-6-squeeze]
<pre>
apt-get install apache2
a2enmod rewrite
apt-get install mysql-server  [I choose branch name as MYSQL root password]
apt-get install php5 php-pear php5-suhosin
apt-get install php5-mysql
/etc/init.d/apache2 restart
</pre>


Another instruction including how to set up user directories for Apache web server http://wiki.debian.org/LaMp
On Chrome OS, there is an [https://chrome.google.com/webstore/detail/vnc%C2%AE-viewer-for-google-ch/iabmpiboiopbgfabjmgeedhcmjenhbla VNC Viewer for Google Chrome] to use. The IP address is special. For example, 192.168.5.127:80 for port 5980. See https://www.realvnc.com/docs/faq/connect-fail.html. Unfortunately I cannot connect successfully:(
<pre>
apt-get install mysql-server mysql-client
mysql_secure_installation
apt-get install apache2 apache2-doc
apt-get install php5 php5-mysql libapache2-mod-php5
apt-get install python libapache2-mod-python
</pre>


The apache configuration file is in '''/etc/apache2/apache2.conf'''.
==== Remote desktop connection from Ubuntu to Ubuntu ====
* https://help.ubuntu.com/16.04/ubuntu-help/sharing-desktop.html
* [http://ubuntuhandbook.org/index.php/2016/07/remote-access-ubuntu-16-04/ How to Remote Access to Ubuntu 16.04 from Windows]. The instruction is the same for older versions of Ubuntu.
** On a Ubuntu server. Go to Dash, type 'desktop sharing' and select it. Check sharing. Close the dialog. Open a terminal and run '''ps -ef | grep vino''' to make sure the server is running.
** [http://askubuntu.com/questions/477947/what-do-i-need-for-remotely-accessing-my-ubuntu-14-04-desktop Disable encryption]. Run ''sudo apt install dconf-editor''. Go to Dash and type 'dconf' and select 'dconf editor'. When it opens, navigate to '''org -> gnome -> desktop -> remote-access''', and uncheck the value of 'require-encryption.' Another way is to run '''gsettings set org.gnome.Vino require-encryption false'''.
** On a client machine (eg another Ubuntu), open a remote desktop client program (eg Remmina). Choose '''VNC''' as the protocol. Enter necessary information to connect to the server.
* Install a VNC server on non-Unity desktop
** [https://www.howtoforge.com/tutorial/x2go-server-ubuntu-14-04/ X2Go]
** [https://www.howtoforge.com/how-to-install-vnc-server-on-ubuntu-14.04 vnc4server]
** [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-14-04 tightvncserver]


For PHP, it is also useful to install php for command line.
==== Allow for remote desktop connection ====
<pre>
# Go to System -> Preference -> Remote desktop. Allow other uses to view your desktop & uncheck you must confirm each access & require user to enter this password.
sudo aptitude install php5-cli
# Go to System -> Preference -> Monitor. Change monitor resolution to 1280 x 720.
</pre>


Restarting apache before testing on web browser
==== Allow for remote desktop connection when vino failed ====
<pre>
* [http://www.teamviewer.com/en/index.aspx Teamviewer]. It works fine. After launching it, the software automatically creates an ID and password. We can change the password so it is fixed. Then launch the software on the client. Use the partner's ID and password to connect to it.
/etc/init.d/apache2 restart
</pre>


==== Debian 8 ====
* [https://www.nomachine.com/ NoMachine]. I ran the service on my Ubuntu 12.04 server. I also tested the client on my Android 6.0 tablet and Odroid xu4 running Ubuntu 15.10. I am using the version 5.0.63. I need to use my server's user account info to connect.
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian-8
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo aptitude install apache2 apache2-doc
odroid@odroid:~/Downloads$ ps -ef | grep nx
sudo aptitude install mysql-server php5-mysql
nx      12168    1  1 21:11 ?        00:00:20 /usr/NX/bin/nxserver.bin root 12151 --daemon
# optional
odroid  12199 12168  1 21:11 ?        00:00:12 /usr/NX/bin/nxnode.bin
sudo mysql_secure_installation
nx      12225 12168  0 21:11 ?        00:00:00 /usr/NX/bin/nxd
sudo aptitude install php5-common libapache2-mod-php5 php5-cli
odroid  12263 12199  1 21:11 ?        00:00:13 /usr/NX/bin/nxclient.bin --monitor --pid 1153
sudo service apache2 restart
nx      15916 12225 24 21:28 ?        00:00:08 /usr/NX/bin/nxserver.bin -c /etc/NX/nxserver --login -H 5
odroid  15944 15916 33 21:29 ?        00:00:04 /usr/NX/bin/nxnode.bin -H 5
odroid  16130  8527  0 21:29 pts/1    00:00:00 grep --color=auto nx
 
odroid@odroid:~/Downloads$ ls /usr/NX/bin
drivers      nxd        nxkb        nxplayer      nxsh        nxusbd
nxagent      nxesd      nxkeygen    nxplayer.bin  nxspool
nxauth        nxexec      nxlocate    nxpost        nxssh
nxclient      nxfs        nxlpd      nxprint      nxssh-add
nxclient.bin  nxfsm      nxnode      nxserver      nxssh-agent
nxcodec.bin  nxfsserver  nxnode.bin  nxserver.bin  nxtunctl
</syntaxhighlight>
If for some reason some nx programs disappeared, restart the service by
<syntaxhighlight lang='bash'>
sudo /usr/NX/bin/nxserver --restart
</syntaxhighlight>
</syntaxhighlight>


=== [http://www.ampps.com/downloads AMPPS] for a local server ===
It is interesting that nomachine is faster than 'ssh -X' method when I tested running a Qt application launched from Qt Creator. For example, the progress bar is not moving when it is supposed to move forward and backward when the app is launched through 'ssh -X'.
http://www.howtogeek.com/219983/how-to-use-ampps-to-install-joomla-locally/


XAMPP is a free, open source cross platform web server solution stack package for Windows, Mac, and Linux. AMPPS is a software stack from Softaculous enabling Apache, MySQL, MongoDB, PHP, Perl, Python, and Softaculous auto-installer on a desktop.
==== NoMachine and Amazon cloud ====
https://www.nomachine.com/accessing-your-remote-linux-desktop-on-amazon-elastic-compute-cloud-via-NoMachine


=== [https://en.wikipedia.org/wiki/Content_management_system Content management systems] ===
It seems nomachine is using port 4000.
* [https://en.wikipedia.org/wiki/List_of_content_management_systems List of content management systems]
<pre>
odroid@odroid:~$ sudo nmap -sV localhost


==== PageKit ====
Starting Nmap 7.01 ( https://nmap.org ) at 2016-11-16 20:10 EST
[https://www.howtoforge.com/tutorial/how-to-install-pagekit-cms-on-ubuntu-1804/ How to Install PageKit CMS on Ubuntu 18.04 LTS]
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000051s latency).
Other addresses for localhost (not scanned): ::1
rDNS record for 127.0.0.1: odroid
Not shown: 997 closed ports
PORT    STATE SERVICE        VERSION
22/tcp  open  ssh            OpenSSH 7.2p2 Ubuntu 4ubuntu2.1 (Ubuntu Linux; protocol 2.0)
4000/tcp open  remoteanything?
7001/tcp open  X11            (access denied)
Service Info: OSs: Linux, Unix; CPE: cpe:/o:linux:linux_kernel
 
odroid@odroid:~$ sudo lsof -i :4000
COMMAND PID USER  FD  TYPE DEVICE SIZE/OFF NODE NAME
nxd    735  nx    3u  IPv4  19208      0t0  TCP *:4000 (LISTEN)
nxd    735  nx    4u  IPv6  21234      0t0  TCP *:4000 (LISTEN)
</pre>


==== [https://processwire.com/ ProcessWire] ====
==== [http://wiki.x2go.org/doku.php/doc:newtox2go X2Go] ====
[https://www.howtoforge.com/tutorial/how-to-install-processwire-cms-on-centos-7/ How to Install ProcessWire CMS on CentOS 7]
used in ''Linux Data Science Virtual Machine'' by Microsoft.


==== [https://www.bookstackapp.com/docs/admin/installation/#manual BookStack] ====
==== Remote desktop connection through vmware workstation ====
[https://www.howtoforge.com/tutorial/how-to-install-bookstack-on-ubuntu-1604/ How to Install BookStack on Ubuntu 16.04 LTS]
We shall be able to remote desktop connect to a Windows guest machine if the guest machine has configured to use bridge connection and a static IP. If there is a problem, it is likely caused by Window's firewall. See the two screenshots. We can just turn off the firewall of home network but keep the firewall on for the public network.


A docker image is also available.
We don't need to use port forward for the remote desktop connection.


==== Mediawiki ====
[[File:ViewActiveNetwork.png|100px]]
* My [[Mediawiki|Mediawiki]]
[[File:Firewall.png|100px]]
* [http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Ubuntu Install mediawiki using tar ball]
* [http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Debian_GNU/Linux Install mediawiki using aptitude]


=== Install sshd ===
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
aptitude install mediawiki php5 apache2 mediawiki-extensions libapache2-mod-php5
apt-get update
apt-get install openssh-server
</syntaxhighlight>
</syntaxhighlight>
This will install latex. After the end, we can use Synaptic package manager to see what were installed. Now following the instruction in https://help.ubuntu.com/community/MediaWiki, we remove the '#' from the third line so that it reads 'Alias /mediawiki /var/lib/mediawiki':
<syntaxhighlight lang='bash'>
sudo nano /etc/mediawiki/apache.conf
sudo /etc/init.d/apache2 restart
</syntaxhighlight>
Now we can start mediawiki by opening a browser and pointing it to http://localhost/mediawiki.


We need to enter
=== sftp, vsftpd and virtual users ===
<syntaxhighlight lang='bash'>
* [https://www.linuxtechi.com/configure-chroot-sftp-in-linux/ How to configure chroot SFTP in Linux]
Site config
* https://help.ubuntu.com/community/vsftpd
  admin username: WikiSysop
* http://www.ubuntugeek.com/setup-ftp-server-using-vsftp-and-configure-secure-ftp-connections-using-tlsssl-on-ubuntu-16-04-server.html
  password:
* https://www.howtoforge.com/tutorial/ubuntu-vsftpd/
 
=== ProFTPd ===
[https://www.howtoforge.com/tutorial/install-proftpd-with-tls-on-ubuntu-16-04/ How to install ProFTPd with TLS support on Ubuntu 16.04]


Database config
=== Install LAMP ===
  Database name: wikidb
See the page [http://library.linode.com/lamp-guides/debian-6-squeeze]
  DB username:
<pre>
  DB password:
apt-get install apache2
   Superuser name: root
a2enmod rewrite
  Superuser password: [depend on how it was chosen when installing MYSQL]
apt-get install mysql-server   [I choose branch name as MYSQL root password]
</syntaxhighlight>
apt-get install php5 php-pear php5-suhosin
Press the button of "Installing mediawiki". We will be welcomed to the wiki page. Following the instruction,
apt-get install php5-mysql
/etc/init.d/apache2 restart
</pre>


For security reason, I remove new account creation and anonymous editing. I also remove edit counters.
Another instruction including how to set up user directories for Apache web server http://wiki.debian.org/LaMp
<pre>
apt-get install mysql-server mysql-client
mysql_secure_installation
apt-get install apache2 apache2-doc
apt-get install php5 php5-mysql libapache2-mod-php5
apt-get install python libapache2-mod-python
</pre>


Backup and Restore mediawiki: The process involves 3 parts: mediawiki system, mysql and images. See docs.google.com note.
The apache configuration file is in '''/etc/apache2/apache2.conf'''.


=== Install moinmoin ===
For PHP, it is also useful to install php for command line.
* Comparison of mediawiki vs moinmoin http://www.wikimatrix.org/compare/MediaWiki+MoinMoin
<pre>
* Comparison of wiki software http://en.wikipedia.org/wiki/Comparison_of_wiki_software
sudo aptitude install php5-cli
* Moinmoin website http://moinmo.in/
</pre>
* moinmoin was used by [http://wiki.fhcrc.org/bioc/HowTo Bioconductor], [https://wiki.ubuntu.com/MoinMoin ubuntu], etc.


=== UpnP server ===
Restarting apache before testing on web browser
==== Jellyfin ====
<pre>
[https://www.linuxuprising.com/2018/12/jellyfin-free-software-emby-media.html Jellyfin: Free Software Emby Media Server Fork Is Announced After Emby Becomes Proprietary]
/etc/init.d/apache2 restart
</pre>


==== PS3 Media Servver ====
==== Debian 8 ====
https://github.com/ps3mediaserver/ps3mediaserver
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian-8
<syntaxhighlight lang='bash'>
sudo aptitude install apache2 apache2-doc
sudo aptitude install mysql-server php5-mysql
# optional
sudo mysql_secure_installation
sudo aptitude install php5-common libapache2-mod-php5 php5-cli
sudo service apache2 restart
</syntaxhighlight>


==== minidlna ====
=== [http://www.ampps.com/downloads AMPPS] for a local server ===
http://bbrks.me/rpi-minidlna-media-server/
http://www.howtogeek.com/219983/how-to-use-ampps-to-install-joomla-locally/


It works even I use my phone to tether data (I don't need to turn on wifi on my phone).
XAMPP is a free, open source cross platform web server solution stack package for Windows, Mac, and Linux. AMPPS is a software stack from Softaculous enabling Apache, MySQL, MongoDB, PHP, Perl, Python, and Softaculous auto-installer on a desktop.


<syntaxhighlight lang='bash'>
=== [https://en.wikipedia.org/wiki/Content_management_system Content management systems] ===
sudo apt-get update
* [https://en.wikipedia.org/wiki/List_of_content_management_systems List of content management systems]
sudo apt-get install minidlna
 
sudo nano /etc/minidlna.conf # the default location of media files is on /var/lib/minidlna
==== PageKit ====
[https://www.howtoforge.com/tutorial/how-to-install-pagekit-cms-on-ubuntu-1804/ How to Install PageKit CMS on Ubuntu 18.04 LTS]


# rebuild the database. See the comments in <etc/minidlna.conf>
==== [https://processwire.com/ ProcessWire] ====
sudo service minidlna force-reload
[https://www.howtoforge.com/tutorial/how-to-install-processwire-cms-on-centos-7/ How to Install ProcessWire CMS on CentOS 7]
sudo service minidlna start
sudo update-rc.d minidlna defaults # ask minidlna to start up automatically upon boot.
</syntaxhighlight>


Too bad is when I played certain videos the program crashed. The /var/log/syslog showed ''kernel: [96495.690373] minidlna[1627]: segfault at 0 ip 00007f4af2de9964 sp 00007fffa43014f8 error 4 in libc-2.15.so[7f4af2d54000+1b4000]''. Also the minidlna process becomes 2 instead of 1 after the crash.
==== [https://www.bookstackapp.com/docs/admin/installation/#manual BookStack] ====
[https://www.howtoforge.com/tutorial/how-to-install-bookstack-on-ubuntu-1604/ How to Install BookStack on Ubuntu 16.04 LTS]


==== Kodi ====
A docker image is also available.
Too bad the Kodi's upnp function is not stable. Kodi server disappeared so the client cannot find it.


[https://www.ghacks.net/2018/02/11/installing-kodi-using-ubuntu-based-systems/ Installing Kodi using Ubuntu based systems]
==== Mediawiki ====
* My [[Mediawiki|Mediawiki]]
* [http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Ubuntu Install mediawiki using tar ball]
* [http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Debian_GNU/Linux Install mediawiki using aptitude]


==== PLEX ====
This seems to be the best from my test.
* [http://www.makeuseof.com/tag/reasons-do-not-need-plex-pass/ 5 Reasons Why You Don’t Actually Need a Plex Pass] - live TV channels!
* [http://lifehacker.com/5975362/five-best-desktop-media-servers Best media server] from lifehacker.
* [http://lifehacker.com/home-theater-software-showdown-kodi-vs-plex-1746501974 Kodi vs Plex] from lifehacker.
* [http://www.howtogeek.com/252261/how-to-set-up-plex-and-watch-your-movies-on-any-device/ How to set up Plex (and Watch Your Movies on Any Device)] from howtogeek.
* Plex is running as a service. After we use web to configure, we can close the website.
* Users needs to sign up/sign in before completing the installation
* Access the admin page by http://IP-address:32400/web
* If new files were added, it will update the library. To do that, go to settings and check automatically update.
* Soft links works.
* Iso file cannot be read. Use [https://launchpad.net/~stebbins/+archive/ubuntu/handbrake-releases HandBrake] to create m4v files from iso files (seems to be fast enough; e.g. 5 minutes for a DVD).
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
sudo add-apt-repository ppa:stebbins/handbrake-releases
aptitude install mediawiki php5 apache2 mediawiki-extensions libapache2-mod-php5
sudo apt-get update
</syntaxhighlight>
sudo apt-get install handbrake-gtk
This will install latex. After the end, we can use Synaptic package manager to see what were installed. Now following the instruction in https://help.ubuntu.com/community/MediaWiki, we remove the '#' from the third line so that it reads 'Alias /mediawiki /var/lib/mediawiki':
sudo apt-get install handbrake-cli
<syntaxhighlight lang='bash'>
sudo nano /etc/mediawiki/apache.conf
sudo /etc/init.d/apache2 restart
</syntaxhighlight>
</syntaxhighlight>
* [http://www.howtogeek.com/259529/how-to-share-your-plex-media-library-with-friends/ How to Share Your Plex Media Library with Friends]
Now we can start mediawiki by opening a browser and pointing it to http://localhost/mediawiki.
* [http://gizmodo.com/plex-just-killed-my-rental-cable-box-and-it-could-kill-1795679132 Plex Just Killed My Cable Box Rental, and It Could Kill Yours Too]


==== Subsonic media server ====
We need to enter
* http://www.subsonic.org/pages/index.jsp
<syntaxhighlight lang='bash'>
* [https://www.howtoforge.com/tutorial/ubuntu-subsonic-media-server/ How to Install Subsonic Media Server Ubuntu 18.04]
Site config
  admin username: WikiSysop
  password:


==== Airsonic media server ====
Database config
[https://www.howtoforge.com/tutorial/ubuntu-airsonic-media-server/ How to Install Airsonic Media Server on Ubuntu 18.04 LTS]. OpenJDK, Nginx,
  Database name: wikidb
  DB username:
  DB password:
  Superuser name: root
  Superuser password: [depend on how it was chosen when installing MYSQL]
</syntaxhighlight>
Press the button of "Installing mediawiki". We will be welcomed to the wiki page. Following the instruction,  


==== Sonerezh music server ====
For security reason, I remove new account creation and anonymous editing. I also remove edit counters.
[https://www.howtoforge.com/tutorial/ubuntu-sonerezh-music-streaming-server-installation/ How to install Sonerezh Music Streaming Server on Ubuntu 18.04 LTS]


=== Storage server GlusterFS ===
Backup and Restore mediawiki: The process involves 3 parts: mediawiki system, mysql and images. See docs.google.com note.
https://www.howtoforge.com/tutorial/high-availability-storage-with-glusterfs-on-debian-8-with-two-nodes/


=== Security ===
=== Install moinmoin ===
* [http://www.makeuseof.com/tag/improve-online-security-defend-privacy/ The Complete Guide to Improving Your Online Security and Defending Your Privacy]. It covers web browsers, browser extensions, email providers, search engines, VPN, password managers, OS, mobile, messaging, cloud storage & encryption tools.
* Comparison of mediawiki vs moinmoin http://www.wikimatrix.org/compare/MediaWiki+MoinMoin
* Comparison of wiki software http://en.wikipedia.org/wiki/Comparison_of_wiki_software
* Moinmoin website http://moinmo.in/
* moinmoin was used by [http://wiki.fhcrc.org/bioc/HowTo Bioconductor], [https://wiki.ubuntu.com/MoinMoin ubuntu], etc.


==== Automatic security update ====
=== UpnP server ===
[https://www.howtoforge.com/tutorial/how-to-setup-automatic-security-updates-on-ubuntu-1604/ How to Setup Automatic Security Updates on Ubuntu 16.04]
==== Jellyfin ====
[https://www.linuxuprising.com/2018/12/jellyfin-free-software-emby-media.html Jellyfin: Free Software Emby Media Server Fork Is Announced After Emby Becomes Proprietary]


==== https connection ====
==== PS3 Media Servver ====
* [http://security.stackexchange.com/questions/2914/can-my-company-see-what-https-sites-i-went-to Can my company see what HTTPS sites I went to?]
https://github.com/ps3mediaserver/ps3mediaserver
* [http://www.wsj.com/articles/SB118539543272477927 Ten Things Your IT Department Won't Tell You]


==== HTTPOXY ====
==== minidlna ====
https://www.howtoforge.com/tutorial/httpoxy-protect-your-server/
http://bbrks.me/rpi-minidlna-media-server/


==== Fail2Ban, Tinyhoneypot and IPv4 security ====
It works even I use my phone to tether data (I don't need to turn on wifi on my phone).
* https://www.raspberrypi.org/documentation/configuration/security.md
* https://www.howtoforge.com/tutorial/increase-ipv4-security-with-fail2ban-and-tinyhoneypot-on-debian-jessie/


==== MYSQL security ====
<syntaxhighlight lang='bash'>
Just execute '''mysql_secure_installation''' from the command line.
sudo apt-get update
sudo apt-get install minidlna
sudo nano /etc/minidlna.conf # the default location of media files is on /var/lib/minidlna


* You can set a password for root accounts.
# rebuild the database. See the comments in <etc/minidlna.conf>
* You can remove root accounts that are accessible from outside the local host.
sudo service minidlna force-reload
* You can remove anonymous-user accounts.
sudo service minidlna start
* You can remove the test database, which by default can be accessed by anonymous users.
sudo update-rc.d minidlna defaults # ask minidlna to start up automatically upon boot.
</syntaxhighlight>


See http://www.mysql-optimization.com/mysql-secure-installation-program.html
Too bad is when I played certain videos the program crashed. The /var/log/syslog showed ''kernel: [96495.690373] minidlna[1627]: segfault at 0 ip 00007f4af2de9964 sp 00007fffa43014f8 error 4 in libc-2.15.so[7f4af2d54000+1b4000]''. Also the minidlna process becomes 2 instead of 1 after the crash.


==== Meltdown and Spectre ====
==== Kodi ====
* https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/SpectreAndMeltdown
Too bad the Kodi's upnp function is not stable. Kodi server disappeared so the client cannot find it.
* https://www.bleepingcomputer.com/news/software/meltdown-and-spectre-patches-causing-boot-issues-for-ubuntu-16-04-computers/
* https://www.ghacks.net/2018/01/11/check-linux-for-spectre-or-meltdown-vulnerability/
<pre>
sudo apt-get update
sudo apt-get dist-upgrade


uname -a
[https://www.ghacks.net/2018/02/11/installing-kodi-using-ubuntu-based-systems/ Installing Kodi using Ubuntu based systems]
# 4.4.0-109
</pre>


=== HTTPS connection issue ===
==== PLEX ====
An https connection problem with certificate. Error message comes from Google-chrome and Safari browsers.
This seems to be the best from my test.
* [http://www.makeuseof.com/tag/reasons-do-not-need-plex-pass/ 5 Reasons Why You Don’t Actually Need a Plex Pass] - live TV channels!
* [http://lifehacker.com/5975362/five-best-desktop-media-servers Best media server] from lifehacker.
* [http://lifehacker.com/home-theater-software-showdown-kodi-vs-plex-1746501974 Kodi vs Plex] from lifehacker.
* [http://www.howtogeek.com/252261/how-to-set-up-plex-and-watch-your-movies-on-any-device/ How to set up Plex (and Watch Your Movies on Any Device)] from howtogeek.
* Plex is running as a service. After we use web to configure, we can close the website.
* Users needs to sign up/sign in before completing the installation
* Access the admin page by http://IP-address:32400/web
* If new files were added, it will update the library. To do that, go to settings and check automatically update.
* Soft links works.
* Iso file cannot be read. Use [https://launchpad.net/~stebbins/+archive/ubuntu/handbrake-releases HandBrake] to create m4v files from iso files (seems to be fast enough; e.g. 5 minutes for a DVD).
<syntaxhighlight lang='bash'>
sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-gtk
sudo apt-get install handbrake-cli
</syntaxhighlight>
* [http://www.howtogeek.com/259529/how-to-share-your-plex-media-library-with-friends/ How to Share Your Plex Media Library with Friends]
* [http://gizmodo.com/plex-just-killed-my-rental-cable-box-and-it-could-kill-1795679132 Plex Just Killed My Cable Box Rental, and It Could Kill Yours Too]


Your connection is not private:
==== Subsonic media server ====
* http://www.subsonic.org/pages/index.jsp
* [https://www.howtoforge.com/tutorial/ubuntu-subsonic-media-server/ How to Install Subsonic Media Server Ubuntu 18.04]


[[File:HttpsNotPrivateChrome.png|250px]],  
==== Airsonic media server ====
[[File:HttpsNotPrivateSafari.png|250px]]
[https://www.howtoforge.com/tutorial/ubuntu-airsonic-media-server/ How to Install Airsonic Media Server on Ubuntu 18.04 LTS]. OpenJDK, Nginx,
 
==== Sonerezh music server ====
[https://www.howtoforge.com/tutorial/ubuntu-sonerezh-music-streaming-server-installation/ How to install Sonerezh Music Streaming Server on Ubuntu 18.04 LTS]


If we use wget or curl on a terminal, we will get an error message
=== Storage server GlusterFS ===
<pre>
https://www.howtoforge.com/tutorial/high-availability-storage-with-glusterfs-on-debian-8-with-two-nodes/
$ wget https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
--2017-04-14 09:40:01-- https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
Resolving ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)... 130.14.250.7, 2607:f220:41e:250::13
Connecting to ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)|130.14.250.7|:443... connected.
ERROR: cannot verify ftp-trace.ncbi.nlm.nih.gov's certificate, issued by ‘CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US’:
  Unable to locally verify the issuer's authority.
To connect to ftp-trace.ncbi.nlm.nih.gov insecurely, use `--no-check-certificate'.


# curl -L https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz -o sratoolkit.tar.gz
=== Security ===
  % Total    % Received % Xferd  Average Speed  Time    Time    Time  Current
* [http://www.makeuseof.com/tag/improve-online-security-defend-privacy/ The Complete Guide to Improving Your Online Security and Defending Your Privacy]. It covers web browsers, browser extensions, email providers, search engines, VPN, password managers, OS, mobile, messaging, cloud storage & encryption tools.
                                Dload  Upload  Total  Spent    Left  Speed
  0    0    0    0    0    0      0      0 --:--:-- --:--:-- --:--:--    0
curl: (60) SSL certificate problem: Invalid certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html


curl performs SSL certificate verification by default, using a "bundle"
==== Automatic security update ====
of Certificate Authority (CA) public keys (CA certs). If the default
[https://www.howtoforge.com/tutorial/how-to-setup-automatic-security-updates-on-ubuntu-1604/ How to Setup Automatic Security Updates on Ubuntu 16.04]
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
</pre>


It is interesting after a few tries, '''curl''' works again and '''wget''' works after adding the option ''--no-check-certificate''
==== https connection ====
<pre>
* [http://security.stackexchange.com/questions/2914/can-my-company-see-what-https-sites-i-went-to Can my company see what HTTPS sites I went to?]
$ wget --no-check-certificate https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
* [http://www.wsj.com/articles/SB118539543272477927 Ten Things Your IT Department Won't Tell You]
--2017-04-14 09:51:32--  https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
Resolving ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)... 130.14.250.11, 2607:f220:41e:250::13
Connecting to ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)|130.14.250.11|:443... connected.
WARNING: cannot verify ftp-trace.ncbi.nlm.nih.gov's certificate, issued by ‘CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US’:
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 63707890 (61M) [application/x-gzip]
Saving to: ‘sratoolkit.2.7.0-ubuntu64.tar.gz’


sratoolkit.2.7.0-ubuntu64.tar. 100%[==================================================>]  60.76M  6.50MB/s    in 9.2s   
==== HTTPOXY ====
https://www.howtoforge.com/tutorial/httpoxy-protect-your-server/


2017-04-14 09:51:42 (6.59 MB/s) - ‘sratoolkit.2.7.0-ubuntu64.tar.gz’ saved [63707890/63707890]
==== Fail2Ban, Tinyhoneypot and IPv4 security ====
* https://www.raspberrypi.org/documentation/configuration/security.md
* https://www.howtoforge.com/tutorial/increase-ipv4-security-with-fail2ban-and-tinyhoneypot-on-debian-jessie/


$ curl -L -O https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
==== MYSQL security ====
  % Total    % Received % Xferd  Average Speed  Time    Time    Time  Current
Just execute '''mysql_secure_installation''' from the command line.
                                Dload  Upload  Total  Spent    Left  Speed
 
100 60.7M  100 60.7M    0    0  6312k      0  0:00:09  0:00:09 --:--:-- 6820k
* You can set a password for root accounts.
</pre>
* You can remove root accounts that are accessible from outside the local host.
* You can remove anonymous-user accounts.
* You can remove the test database, which by default can be accessed by anonymous users.


==== HTTPS at NCBI: Guidance for Users ====
See http://www.mysql-optimization.com/mysql-secure-installation-program.html
https://www.ncbi.nlm.nih.gov/home/develop/https-guidance/


=== Compiling R ===
==== Meltdown and Spectre ====
Use the following command to download required components before building any R packages. See also [http://cran.r-project.org/bin/linux/ubuntu/ ubuntu package for R]
* https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/SpectreAndMeltdown
* https://www.bleepingcomputer.com/news/software/meltdown-and-spectre-patches-causing-boot-issues-for-ubuntu-16-04-computers/
* https://www.ghacks.net/2018/01/11/check-linux-for-spectre-or-meltdown-vulnerability/
<pre>
<pre>
sudo apt-get build-dep r-base
sudo apt-get update
sudo apt-get dist-upgrade
 
uname -a
# 4.4.0-109
</pre>
</pre>


=== [http://appimage.org/ AppImage] file - new way of installing an application ===
=== HTTPS connection issue ===
[http://askubuntu.com/questions/774490/what-is-an-appimage-how-do-i-install-it What is an “AppImage”? How do I install it?]
An https connection problem with certificate. Error message comes from Google-chrome and Safari browsers.
* AppImages can be downloaded and '''run without installation or the need for root rights'''.
* The key idea of the AppImage format is one app = one file. Every AppImage contains an app and all the files the app needs to run. In other words, each AppImage has no dependencies other than what is included in the targeted base operating system(s).


Some examples
Your connection is not private:
* [http://avidemux.sourceforge.net/download.html Avidemux]
* Cura
* [https://www.falkon.org/download/ falkon] browser


=== PPA management ===
[[File:HttpsNotPrivateChrome.png|250px]],
* https://www.howtoforge.com/tutorial/ubuntu-ppa-management/
[[File:HttpsNotPrivateSafari.png|250px]]


Add a ppa repository,
If we use wget or curl on a terminal, we will get an error message
<syntaxhighlight lang='bash'>
<pre>
# sudo add-apt-repository [repository name]
$ wget https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
sudo add-apt-repository ppa:embrosyn/cinnamon
--2017-04-14 09:40:01--  https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
sudo apt-get update
Resolving ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)... 130.14.250.7, 2607:f220:41e:250::13
# sudo apt-get install [software name]
Connecting to ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)|130.14.250.7|:443... connected.
sudo apt-get install cinnamon cinnamon-core
ERROR: cannot verify ftp-trace.ncbi.nlm.nih.gov's certificate, issued by ‘CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US’:
</syntaxhighlight>
  Unable to locally verify the issuer's authority.
To connect to ftp-trace.ncbi.nlm.nih.gov insecurely, use `--no-check-certificate'.


Remove a ppa repository.
# curl -L https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz -o sratoolkit.tar.gz
<syntaxhighlight lang='bash'>
  % Total    % Received % Xferd  Average Speed  Time    Time    Time  Current
# method 1: add-apt-repository
                                Dload  Upload  Total  Spent    Left  Speed
# This works on URL format
  0    0    0    0    0    0      0      0 --:--:-- --:--:-- --:--:--     0
# sudo apt-add-repository 'deb https://dl.iwnhq.org/wine-builds/ubuntu/ xenial main'
curl: (60) SSL certificate problem: Invalid certificate chain
# sudo apt-add-repository --remove 'deb https://dl.iwnhq.org/wine-builds/ubuntu/ xenial main'
More details here: https://curl.haxx.se/docs/sslcerts.html
sudo add-apt-repository --remove ppa:embrosyn/cinnamon
# method 2: ppa-purge
sudo apt-get install ppa-purge
sudo ppa-purge ppa:embrosyn/cinnamon
# method 3: use GUI
</syntaxhighlight>


[http://ask.xmodulo.com/list-installed-repositories-ppas-ubuntu.html List ppa repositories]. Still needs to use eyeball to distinguish.
curl performs SSL certificate verification by default, using a "bundle"
<syntaxhighlight lang='bash'>
of Certificate Authority (CA) public keys (CA certs). If the default
apt-cache policy | grep http | awk '{print $2 $3}' | sort -u
bundle file isn't adequate, you can specify an alternate file
</syntaxhighlight>
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
</pre>


==== Some PPA I have ====
It is interesting after a few tries, '''curl''' works again and '''wget''' works after adding the option ''--no-check-certificate''
Office
<pre>
* gnome-terminator
$ wget --no-check-certificate https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
* shutter
--2017-04-14 09:51:32--  https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
* shutter (Sources)
Resolving ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)... 130.14.250.11, 2607:f220:41e:250::13
* texworks
Connecting to ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)|130.14.250.11|:443... connected.
* texworks (Sources)
WARNING: cannot verify ftp-trace.ncbi.nlm.nih.gov's certificate, issued by ‘CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US’:
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 63707890 (61M) [application/x-gzip]
Saving to: ‘sratoolkit.2.7.0-ubuntu64.tar.gz’
 
sratoolkit.2.7.0-ubuntu64.tar. 100%[==================================================>]  60.76M  6.50MB/s    in 9.2s   
 
2017-04-14 09:51:42 (6.59 MB/s) - ‘sratoolkit.2.7.0-ubuntu64.tar.gz’ saved [63707890/63707890]
 
$ curl -L -O https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
  % Total    % Received % Xferd  Average Speed  Time    Time    Time  Current
                                Dload  Upload  Total  Spent    Left  Speed
100 60.7M  100 60.7M    0    0  6312k      0  0:00:09  0:00:09 --:--:-- 6820k
</pre>
 
==== HTTPS at NCBI: Guidance for Users ====
https://www.ncbi.nlm.nih.gov/home/develop/https-guidance/
 
=== Compiling R ===
Use the following command to download required components before building any R packages. See also [http://cran.r-project.org/bin/linux/ubuntu/ ubuntu package for R]
<pre>
sudo apt-get build-dep r-base
</pre>


Home
=== [http://appimage.org/ AppImage] file - new way of installing an application ===
* R
[http://askubuntu.com/questions/774490/what-is-an-appimage-how-do-i-install-it What is an “AppImage”? How do I install it?]
* google chrome
* AppImages can be downloaded and '''run without installation or the need for root rights'''.
* certbot
* The key idea of the AppImage format is one app = one file. Every AppImage contains an app and all the files the app needs to run. In other words, each AppImage has no dependencies other than what is included in the targeted base operating system(s).
* docker
* dropbox
* firefox


==== Additional repositories (not PPA) ====
Some examples
* Docker
* [http://avidemux.sourceforge.net/download.html Avidemux]
* Google (Chrome)
* Cura
* Rstudio
* [https://www.falkon.org/download/ falkon] browser
* Rstudio (Sources)


=== Create .deb file ===
=== Create .deb file ===

Revision as of 20:54, 22 December 2018

Live CD

https://livecdlist.com/

Debian

Download Debian

Debian: Enjoy One Of The Most Stable And Trusted Linux Distributions. . If you would rather download all necessary basic packages before starting the installation, you may need to look at downloading the “CD1” for your architecture instead.

Go to http://www.debian.org/distrib/ and download "Small CDs or USB sticks", for example debian-8.1.0-amd64-netinst.iso (Jessie, released June 2015). It is about 280 MB.

Screenshots of step-by-step installation can be found in here.

At the end of installation, it will offer a collection of software to install. Below 'Debian desktop environment', it has a selection of GNOME, Xface, KDE, Cinnamon, MATE and LXDE (new in Jessie/8.0). Note that the cd images download page only provides a selection of kde, lxde and xfce desktop. The default is 'GNOME' in Jessie.

DebianInstall.png

After installation, you got a desktop environment of Debian based on GNOME 3 (Virtual machine will use recovery mode, but still works. Some people suggest to install the guest additions (in the guest) and make sure that you enable the 3D acceleration in the guest settings.). Also 'free -m' command shows it uses 202 MB memory and the whole system takes up 3.3 GB. I am testing on a Chinese desktop environment.

When Debian is in recovery mode, the desktop interface is like old fashion. Application and Place on top of the screen. When GNOME 3 is working (in my test of Debian 7.1.0, I cannot run VBoxLinux.run, but it still works after I did other steps), the interface is sort of Ubuntu with application launched from the left hand side. It differs from Ubuntu because the side bar appears by clicking a 'preview' button on top left corner.

The default browser in Debian is Iceweasel with AdBlock Plus preinstalled.

I don't know why the default user does not have root privilege.

When I installed the Chinese version, the keyboard switch icon (SCIM) is automatically available. However once the desktop is in regular GNOME 3, the switch icon disappeared. Fortunately, we can use Ctrl + Space to switch languages. Thanks to the hint there.

How hard it is to install Debian

Tested on Lenovo thinkpad t420s. When it is about to detect network hardware, it popped up a message:

Some of your hardware needs non-free firmware files to operate. The firmware can be loaded from removable media, such as a USB stick or floppy.

The missing firmware files are: iwlwifi-6000g2a-6.ucode iwlwifi-6000g2a-5.ucode.

See

Server version

There is no a server version of iso to download. At the end of installation, it will ask what software to install: Debian desktop environment, Web server, SSH server, Laptop, SQL database, ... We can uncheck 'Debian desktop environment' item.

Compared to Desktop version, the server version takes 1.3GB space and 33MB memory.

The server version does not have 'sudo' command. Use 'su' to switch to 'root' user.

Note that even we installed 'sudo', we can not use 'sudo' from the default user. It will complain xxx is not in the sudoers file. This incident will be reported..

Virtualbox guest addition installation

See Virtualbox -> Debian.

Browse iso files

Note that if we want to download the iso image, we should consider using the torrent method. The can see a variety of download options from

http://www.debian.org/CD/ > Downloading Debian CD/DVD images via HTTP/FTP

Permission denied

http://roger.steneteg.org/blog/virtualbox-guest-additions-on-debian/

The script uses /bin/sh as shell and on Debian Wheezy/Jessie /bin/sh is symlinked to /bin/dash. Dash is a more light-weight replacement for Bash, and it turns out that the VirtualBox script does not work as it should when run with "dash".

An easy workaround is to explicitly run the script with "bash" with the following command:

sudo bash ./VBoxLinuxAdditions.run

Browse source code

Proxy

Debianproxy.png

Ubuntu/Kubuntu/Lubuntu/Xubuntu

Download links for all versions from wiki.ubuntu.com > releases.ubuntu.com.

Ubuntu flavors and derivatives

For some reason, when I try the Ubuntu (13.04) live CD, the screen resolution looks perfect. But when I installed the OS, the screen resolution is always too low. The propriety graphics driver cannot be installed successfully. Fortunately, when I try the Kubuntu (13.04), the display resolution problem automatically works!

Update: Kubuntu failed to respond after I install SCIM related programs. A freshly installed linuxmint OS also has a similar problem that the desktop does not respond to mouse or keyboard. Luckily, the Xubuntu works fine and the Chinese input works out of box if I choose Chinese as desktop environment (339MB was used).

Download mirror

https://launchpad.net/ubuntu/+cdmirrors

The mirrors are sorted by speed. For me, mirrors.acm.jhu.edu (only visible from Ubuntu's Software & Updates -> Download from, Ubuntu 16.04) or mirror.umd.edu are closest.

Installation

Installing Ubuntu (or xubuntu, Mint) still requires an internet connection for downloading language packs. This could be very time consuming. However, in the installation process I can click the 'skip' button to skip downloading language packs. This saves a lot of time when the internet connection is slow. After ubuntu desktop appears, it still pops up a message to give an instruction to install language packs.

The installation takes about 10 minutes when I installed ubuntu 14.04 (unity) on virtualBox.

How to upgrade
apt upgrade & apt autoremove

These two commands show the following message at the end.

....
Found Ubuntu 12.04.5 LTS (12.04) on /dev/sdb1
Found Ubuntu 16.04.3 LTS (16.04) on /dev/sdb3
Found Ubuntu 14.04.5 LTS (14.04) on /dev/sdc1
Install via PXE Network Boot Server

Install Debian 9 (Stretch) via PXE Network Boot Server

Original GA (General Availability) stack & HWE (Hardware Enablement) stack

The HWE stack provides a newer kernel and X support for existing Ubuntu LTS releases.

https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/SpectreAndMeltdown#Kernel_Mitigations

After installation

System program problem detected
sudo rm /var/crash/*

Change value of "enabled" from 1 to 0. Then reboot.

End of life date of Ubuntu release

https://wiki.ubuntu.com/Releases

Each time I log into my Ubuntu 12.04.5 LTE, I'll receive a message

New release '14.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Your current Hardware Enablement Stack (HWE) is no longer supported
since 2014-08-07.  Security updates for critical parts (kernel
and graphics stack) of your system are no longer available.

For more information, please see:
http://wiki.ubuntu.com/1204_HWE_EOL

There is a graphics stack installed on this system. An upgrade to a 
supported (or longer supported) configuration will become available
on 2014-07-16 and can be invoked by running 'update-manager' in the
Dash.

Server version

UbuntuServerInstall.png

Mint Linux

How to upgrade to Linux Mint 18.3

$ cat /etc/os-release 
NAME="Linux Mint"
VERSION="18.3 (Sylvia)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 18.3"
VERSION_ID="18.3"
HOME_URL="http://www.linuxmint.com/"
SUPPORT_URL="http://forums.linuxmint.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/linuxmint/"
VERSION_CODENAME=sylvia
UBUNTU_CODENAME=xenial

vs Ubuntu 16.04

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="16.04.4 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.4 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

AV Linux

AV Linux features a complete customized Debian Linux XFCE4 4.10 Desktop Environment with the added bonus of a handpicked selection of pre-tested and pre-configured Audio, Graphics and Video content creation software demonstrating the excellence of Open-Source and also includes many unique Commercial Demos.

Kali Linux

Create customized ubuntu iso

Note that the Ubuntu Mini Remix by default contains only 3 repositories. We may want to add some more.

deb http://archive.ubuntu.com/ubuntu/ trusty main restricted
deb http://security.ubuntu.com/ubuntu/ trusty-security main restricted
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted

while for example an official v14.04 xubuntu contains 22 sources,

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main

Create your own Debian iso

MultiSystem – Create a MultiBoot USB from Linux

Minimal Ubuntu

The minimal ubuntu iso (mini.iso) is about 64MB. It will download files when we install the Ubuntu.

In the halfway of installing the minimal Ubuntu, there is a dialog called 'Software selection'. It says At the moment, only the core of the system is installed. To tune the system to your needs, you can choose to install one or more of the following predefined collections of software. Choose software to install:.

If I don't choose anything, the final system takes about 2.29GB (actual size shown by VB) or 1.9GB used by root directory.

In addition to some default selections (like 'standard system utilities'), I choose Ubuntu MATE minimal installation (not 'Ubuntu MATE desktop'). This action will retrieve about 1228 files from the internet. After finishing install them, the installer also installed GRUB and set up system clock. Then the installation was complete. We have to reboot the system (for virtual machine case we need to power off the guest machine and remove the virtual drive).

For the Ubuntu MATE minimal installation selection, it still includes several software. The 'df' command shows 3.3GB space was used in this minimal Ubuntu MATE 16.04.

  • Accessories: Character Map, Engrampa Archive Manager, Calculator, MATE Search Tools, Passwords and Keys, Pluma Text Editor, Take Screenshot
  • Graphics: Eye of MATE image Viewer, MATE Color Selection, Simple Scan
  • Internet: Firefox
  • Office: Atril Document Viewer, MATE Dictionary
  • Sound & Video: Sound
  • System Tools:Avahi Zeroconf Browser, Caja, dconf Editor, GDebi Package Installer, Log File Viewer, MATE Disk Usage Analyzer, MATE System Monitor, MATE Terminal, Power Statistics
  • Universal Access: Onboard, Screen Magnifier, Screen Reader

Actually, if we do not select Ubuntu MATE minimal installation but rather choose to install it later on from the command line (sudo apt-get install --no-install-recommends ubuntu-mate-core) we still end up with the same Ubuntu MATE desktop environment (3.3GB).

sudo apt-get install --no-install-recommends ubuntu-desktop will give me 2.29 (actual size shown by VB) or 2.6GB used by root directory. It does not have applications like Firefox. I can then install some apps I need sudo apt install gedit mupdf.

The Perfect Server

Live USB with persistent storage

Linux Live USB Creator

Dual boot Ubuntu and Arch Linux

http://www.linuxandubuntu.com/home/dual-boot-ubuntu-and-arch-linux

Selection of desktop environment

echo $DESKTOP_SESSION

On Ubuntu, it returns

  1. 'ubuntu' gnome 3+unity
  2. 'mate' ubuntu Mate on Odroid xu4
  3. 'default' on Debian 8.0
  4. 'LXDE' on Debian's BBB, 'LXDE-pi' on Raspbian
  5. 'Lubuntu' on UDOObuntu 2

Unity

Unity as the default user interface instead of GNOME Shell, beginning April 2011, with Ubuntu 11.04 according to the wikipedia.

Use 'unity --version' to check the unity version. If something was screwed up (eg after we remove gnome-desktop), we can reinstall the unity desktop by

sudo apt-get install ubuntu-desktop

Don't forget Unity Tweak Tool. That is required if you want to install, saying, Arc theme. I install it on Ubuntu 16.04 by running sudo apt install unity-tweak-tool.

Unity tweak tool.png

Note that there is no screensaver anymore starting with Ubuntu 12.04. Read this post. If we want to add a screensaver program, read How to Add Screensavers to Ubuntu 12.04

GNOME

Ubuntu GNOME (GNOME 3). The build-in screensaver is a digital clock showing the current time & date. Cool! This seems to be a new feature in GNOME 3.6 optimized for touch screen devices. See this and this.

UbuntuGnome1404.png UbuntuGnome1404b.png

Note that we can install the gnome desktop by using the command line. It will keep the current wallpaper. The clock in screensaver will not be shown until we shake the mouse or keyboard.

sudo apt-get install gnome-shell
# Choose 'gdm' (Gnome Desktop Manager) as the display manager instead of 'lightdm' the Ubuntu's default
#    when it is configuring gdm as only GDM offers GNOME-specific features such as lock-screen notifications.
# See the screenshot at 
#    https://ideasnet.wordpress.com/2013/05/11/ides-desktop-how-to-replace-unity-with-gnome-3-8-in-ubuntu-13-04-desktop-edition/
# If messed up, run "sudo dpkg-reconfigure gdm"
sudo apt-get install ubuntu-gnome-desktop

If the lock screen does not work, use Settings > Brightness and Lock, or use the command line

gsettings set org.gnome.desktop.lockdown disable-lock-screen 'false' 

If the screensaver is not working, try

sudo apt-get install gnome-screensaver

In my case, the screen turns off (black). But if we wake the PC up, the time and date screen shows up.

Some differences (inconvenience): 1. No maximize, minimize windows buttons 2. Have to click 'Activities' button (or 'Windows' key) to switch applications. These complains also appeared in other review.

KDE

Kubuntu

Xfce

Xfce Explained: A Look at One of Linux’s Speediest Desktops "Xfce doesn’t support HiDPI, which can be a deal breaker on newer machines. Even on a laptop with a 1920 x 1080 screen resolution, I find Xfce’s interface and windows to be absolutely tiny."

Xubuntu. The response is quicker when I compare the speed by clicking the top-left icon (app menu) in Xfce and Acitvities button in ubuntu-GNOME. This is tested when both Xubuntu and ubuntu-GNOME are installed in VirtualBox.

# Note the sources.list should contain 'universe' repositories.
# https://help.ubuntu.com/community/Repositories/Ubuntu
#
# Install XFCE alone, without Xubuntu, with this command:
sudo apt-get install xfce4
# Install the entire Xubuntu package, which includes a full suite of software and a lot of improvements:
sudo apt-get install xubuntu-desktop
#
# Note that installed terminal is XTerm and UXTerm which looks awful. We will want 
# xfce4-terminal, a modern, lightweight and low memory cost terminal emulator for X11, 
# which was included in the Xubuntu desktop.
sudo apt-get install xfce4-terminal

The default display manager (used e.g. log in screen) can be found by

cat /etc/X11/default-display-manager

To install lightdm display manager

sudo apt-get install lightdm

After running the above command, I found 1. a GUI login screen came out, but login failed (my case). Use Ctrl+Alt+F1 to switch to the command line approach. 2. startx failed.

LXDE

Lubuntu, LXLE and LXQt. LXDE is the default desktop environment for Raspbian, LXLE, BBB, and Lubuntu.

The default browser in LXLE is SeaMonkey (Debian Jessie has Iceweasel which is even similar to Firefox; see Odroid). In the Internet category, it also includes FireFTP (SeaMonkey extension), Transmission, Gitso (VNC), uGet. In the Sound/Video category, it includes Arista transcoder, Audacity, Guaydadeque Music Player, guncviewer, Pithos, RecordMyDesktop, Videos/Totem. Gedit, GParted, KeepassX and LibreOffice are standard. There is also a Games category.

The LXLE LS version provides several business apps to anyone on the network.

LXQt is the Qt port and the upcoming version of LXDE, the Lightweight Desktop Environment.

The download links (if we want to skip answering the question) are https://sourceforge.net/projects/lxle/files/Final/OS/.

LXLE key features

One cool thing in lxle is the random wallpaper. On regular Ubuntu, we can install a wallpaper changer program - Wallch or Variety. See also OMGUBUNTU.

Variety pref.png

In Lxle, the random wallpaper is done through a simple command

dash -c 'pcmanfm -w "$(find ~/Pictures/Wallpapers -type f | shuf -n1)"'

A list of keyboard shortcuts for Lubuntu.

The file manager in LXLE is PCManFM (not to confuse with the package manager pacman in ArchLinux). It does not support drag and drop to copy a file name to a terminal but it can execute a file in a terminal by PCManFM -> Tools -> Run a Command in Current Folder.

Cinnamon

Linux Mint. A GTK+-based desktop environment. Note that Mint releases only LTS versions (5 years support as Ubuntu).

To check the desktop environment, use echo $DESKTOP_SESSION. To check the cinnamon version, use cinnamon --version.

Note

  1. To change to other workspace, use Ctrl + Alt + Up or Alt + F1 keybind to enter Expo mode and then select one. To directly switch to the next workspace, use Ctrl + Alt + Right/Left arrow key.
  2. To change the title bar color from gray to black follow this instruction. Go to Preferences -> Themes and click 'Add/Remove desktop themes'. Type the keyword 'nightfall' and install the theme. Close the 'Themes' window and open it again. Click 'Windows borders' and select 'nightfall'.
  3. Mint has its own package update manager. Click Menu > Administration > Update Manager. Security updates are level 5. Kernel updates are level 4/5. See their meaning on the official user's guide.
    • Level 1 and Level 2 updates are risk-free and you should always apply them. Level 3 updates “should be safe” but, although we recommend you take them, make sure you look over them on the list of updates.
    • Level 4 is "Unsafe packages". It could potentially affect the stability of the system". Level 5 is "Dangerous packages".
  4. We don't have to install Linux Mint in order to get cinnamon desktop. How To Install Cinnamon 3.0 In Ubuntu 16.04 Or 15.10 Via PPA
  5. this Cinnamon desktop has a digital clock as a screen saver while the MATE desktop only has a black screen as a screen saver. I still get the digital clock as a screen saver when I install cinnamon desktop on top of regular Ubuntu.
  6. One time I accidentally select 400+ archive file and choose to "Open With Archive Manager". This make my desktop freeze. The solution is to remotely ssh to the machine to kill all instances of Archive Manager and refresh the Cinnamon desktop.
    killall file-roller
    pkill -HUP -f "cinnamon --replace"

MintCinnamonSS.png

To install a cinnamon desktop on Ubuntu

sudo add-apt-repository ppa:embrosyn/cinnamon
sudo apt update
sudo apt install cinnamon-desktop-environment lightdm

MATE

Ubuntu Mate. The MATE Desktop Environment is the continuation of GNOME 2.

odroid@odroid:~/$ cat /etc/X11/default-display-manager
/usr/sbin/lightdm

Pantheon

Elementary OS & wikipedia. I cannot make the Chinese input to work (I can install ibus-chewing but cannot switch input methods?).

(Loki release 0.4.1, May 2017) No screensaver. The default browser is Epiphany:( The default apps on the launcher are not useful. No office applications. df -h shows 3.7GB space is used.

How to Refresh Your Linux Desktop Without Rebooting

http://www.makeuseof.com/tag/refresh-linux-desktop-without-rebooting/

Ubuntu Software Repository

The repository components are:

  1. Main - Officially supported software.
  2. Restricted - Supported software that is not available under a completely free license.
  3. Universe - Community maintained software, i.e. not officially supported but enabled by default software.
  4. Multiverse - Software that is not free.

See the pitfall in the PCWorld article.

Slow download; automatically select a mirror

Put the following at the beginning of /etc/apt/sources.list (change 'precise')

deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse

Check if a repository exists

For example, consider the CRAN repository at cran.rstudio.com server.

if grep -q "deb http://cran.rstudio.com/bin/linux/ubuntu" /etc/apt/sources.list; then
  echo http://cran.studio.com/bin/linux/ubuntu was found
else
  add-apt-repository "deb http://cran.rstudio.com/bin/linux/ubuntu $codename/"
  gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
  gpg -a --export E084DAB9 | apt-key add -
fi

Now run nano /etc/apt/sources.d to check if duplicated repository has been added.

GPG/Authentication key

gpg (GNU Privacy Guard) is the tool used in secure apt to sign files and check their signatures. See https://help.ubuntu.com/community/SecureApt or https://wiki.debian.org/SecureApt.

apt-key is a program that is used to manage a keyring of gpg keys for secure apt. Note The keyring is kept in the file /etc/apt/trusted.gpg. Not to be confused with the related but not very interesting /etc/apt/trustdb.gpg.

brb@ubuntu16041:~$ gpg --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
gpg: directory `/home/brb/.gnupg' created
gpg: new configuration file `/home/brb/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/brb/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/brb/.gnupg/secring.gpg' created
gpg: keyring `/home/brb/.gnupg/pubring.gpg' created
gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
gpg: /home/brb/.gnupg/trustdb.gpg: trustdb created
gpg: key E084DAB9: public key "Michael Rutter <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
brb@ubuntu16041:~$ ls -l ~/.gnupg
total 20
-rw------- 1 brb brb 9398 Nov 27 09:31 gpg.conf
-rw------- 1 brb brb 1531 Nov 27 09:31 pubring.gpg
-rw------- 1 brb brb    0 Nov 27 09:31 pubring.gpg~
-rw------- 1 brb brb    0 Nov 27 09:31 secring.gpg
-rw------- 1 brb brb 1200 Nov 27 09:31 trustdb.gpg

brb@ubuntu16041:~$ gpg -a --export E084DAB9 | sudo apt-key add -
OK
brb@ubuntu16041:~$ ls -l ~/.gnupg
total 20
-rw------- 1 brb brb 9398 Nov 27 09:31 gpg.conf
-rw------- 1 brb brb 1531 Nov 27 09:31 pubring.gpg
-rw------- 1 brb brb    0 Nov 27 09:31 pubring.gpg~
-rw------- 1 brb brb    0 Nov 27 09:31 secring.gpg
-rw------- 1 brb brb 1200 Nov 27 09:31 trustdb.gpg

brb@ubuntu16041:~$ apt-key list
/etc/apt/trusted.gpg
--------------------
pub   1024D/437D05B5 2004-09-12
uid                  Ubuntu Archive Automatic Signing Key <[email protected]>
sub   2048g/79164387 2004-09-12

pub   4096R/C0B21F32 2012-05-11
uid                  Ubuntu Archive Automatic Signing Key (2012) <[email protected]>

pub   4096R/EFE21092 2012-05-11
uid                  Ubuntu CD Image Automatic Signing Key (2012) <[email protected]>

pub   1024D/FBB75451 2004-12-30
uid                  Ubuntu CD Image Automatic Signing Key <[email protected]>

pub   2048R/E084DAB9 2010-10-19 [expires: 2020-10-16]
uid                  Michael Rutter <[email protected]>
sub   2048R/1CFF3E8F 2010-10-19 [expires: 2020-10-16]

/etc/apt/trusted.gpg.d/peterlevi_ubuntu_ppa.gpg
-----------------------------------------------
pub   1024R/A546BE4F 2012-06-28
uid                  Launchpad PPA for Peter Levi

Note that the 3 commands we have use (gpg for import, gpg for export from your keyring, apt-key for adding) can be combined into one apt-key command). See R installation.

GPG key error: If the machine is behind a proxy, we may get the following error. See this post.

gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
?: keyserver.ubuntu.com: Connection refused
gpgkeys: HTTP fetch error 7: couldn't connect: Connection refused
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0

Check if a ppa repository exists

For example, consider the ppa:webupd8team repository.

if [ $codename == "trusty" && ! find /etc/apt/sources.list.d/* -iname *.list | xargs cat | grep webupd8team ]; then
  add-apt-repository ppa:webupd8team/java
fi

PPA management

Add a ppa repository,

# sudo add-apt-repository [repository name]
sudo add-apt-repository ppa:embrosyn/cinnamon
sudo apt-get update 
# sudo apt-get install [software name]
sudo apt-get install cinnamon cinnamon-core

Remove a ppa repository.

# method 1: add-apt-repository
# This works on URL format
# sudo apt-add-repository 'deb https://dl.iwnhq.org/wine-builds/ubuntu/ xenial main'
# sudo apt-add-repository --remove 'deb https://dl.iwnhq.org/wine-builds/ubuntu/ xenial main'
sudo add-apt-repository --remove ppa:embrosyn/cinnamon
# method 2: ppa-purge
sudo apt-get install ppa-purge
sudo ppa-purge ppa:embrosyn/cinnamon
# method 3: use GUI

How to Remove and Add PPA on Ubuntu 18.04. When you add a PPA on your system, it will create the ppa file in the /etc/apt/sources.list.d directory.

List ppa repositories. Still needs to use eyeball to distinguish.

apt-cache policy | grep http | awk '{print $2 $3}' | sort -u
Some PPA I have

Office

  • gnome-terminator
  • shutter
  • shutter (Sources)
  • texworks
  • texworks (Sources)

Home

  • R
  • google chrome (ppa?)
  • certbot
  • docker (ppa?)
  • dropbox
  • firefox
Additional repositories (not PPA)
  • Docker
  • Google (Chrome)
  • Rstudio
  • Rstudio (Sources)

How to know if there are updates available?

http://askubuntu.com/questions/457874/how-to-know-if-there-are-updates-available

Type 'software update' in the Dash. It will launch Software Updater and also check for updates.

"Failed to download Package Files" - Software Updater

One solution is to run the following command first

sudo apt-get update && sudo apt-get upgrade

and then run the software updater. Usually it requires the computer to restart.

I personally adjust the frequency of notification by choosing 'Every two weeks' for Automatically check for updates, etc.

apt-get -s upgrade

To do a simulated update

How do I get a list of obsolete/outdated packages?

$ sudo apt install aptitude
$ aptitude search '~o'

$ aptitude search '?obsolete'

The result is not correct. Better to use sudo apt -s upgrade.

apt-get upgrade vs apt-get dist-upgrade

My experience aligns with the statement: dist-upgrade is more likely to break stuff badly than upgrade.

Offline update/upgrade: apt-offline

How To Fully Update And Upgrade Offline Debian-based Systems

Mint

Works well on 18.2. It can check the speed for each mirrors.

Mint software sources.png

Troubleshooting

Grub2 cannot boot after timeout

There is not /etc/default/grub with GRUB2.

sudo apt-get --reinstall install grub-pc

The disk drive for /tmp is not ready yet

sudo mv /tmp /tmp_old
sudo mkdir /tmp
sudo chmod 1777 /tmp

Software updater - “Failed to download package files” error?

Change the download location to 'Main Server' or another server close to the country you live in and try to sudo apt-get update again.

Display Manager

How To Change The Default Display Manager (Switch To GDM, LightDM, SDDM, Or LXDM) In Debian, Ubuntu Or Linux Mint

Suspend, hibernate

On Ubuntu 18.04, the system preferences can set up when the system will go into suspend. You can enable it for battery or plug-in case.

If you like to suspend immediately, use

  • sudo systemctl suspend from the command line. This requires to enter the password. Note the sudo systemctl hibernate does not work (the system will just shutdown).
  • Press 'Alt' and then the Power Off button should change to a Suspend button from the Gnome Shell user menu. This seems to be better.

Password manager

Format USB drives

  • mintstick. Linux Mint mintStick DEB package can be used in Ubuntu 18.04.
  • GParted

USB Drive Writing Speed

Using the dd command

sudo dd if=/dev/zero of=/media/brb/USB\ STICK/test.img bs=100M count=1 oflag=dsync

sudo dd if=/dev/zero of=/media/brb/USB\ STICK/test.img bs=100M count=10 oflag=dsync

Some data from plugging into USB 2.0 slot. Partition format may be FAT32 or Ext3/4.

  • Staples 128GB: 6.7M/s when writing 200M (fat32 formatted by USB Stick Formatter). 161M/s when writing 200M, 174M/s when writing 400M, 9M/s when writing 800M (NTFS).
  • Toshiba 16GB USB 3.0: 9M/s when writing 200M, 5.6M/s when writing 400M, 3.9M/s when writing 800M.
  • Samsung 128GB USB 3.0 flash drive fit: 7.6M/s when writing 200M, 12M/s when writing 400M, 6.7M/s when writing 800M, 10M/s when writing 1600M.
  • Seagate Backup Plus 4T: 25-27 M/s when writing on ext4 and 500-750 M/s on exFAT.
  • WD MyPassort 1T: 154M/s when writing 200M, 156M/s when writing 400M, 168M/s when writing 800M (NTFS/exFAT). 22~24M/s when writing on ext3.
  • WD Mybook 4T: 21.4 MB/s when writing 1G.

Conclusions:

  1. USB flash drive is slow compared to USB portable hard drive.
  2. Large writing will become slower on USB flash drive but not on hard drive.
  3. NTFS/exFAT is several times faster than ext3/ext4. The testing result here is false b/s caching.
  4. The test result can fluctuate a lot when using the dd command with count=1.

Cautions:

  • When I use the cp command to copy a 4.3GB iso file to USB flash drive, it took less than 1 minute. But after I eject the drive (disappear from NEMO Windows Manager/taskbar notification), its LED keeps flashing. A message "Writing data to USB DISK 2.0 Don't unplug until finished" appears on top right corner of my desktop. If I unplug it now, the OS will pop up an error message "Error ejecting /dev/sdc ...". This makes me suspect the testing results here. In fact, when I try to plug in the flash drive, the OS cannot mount the drive. I need to go back to use the USB Stick Formatter to reformat the drive.

Use parted command to format a new hard disk

sudo apt-get install parted 

sudo fdisk -l /dev/sdb  # find out the disk size

sudo parted
  print
  select /dev/sdb
  mklabel myLabel
  mkpart primary ext4 0GB 128GB
  print
  quit
lsblk
sudo mkfs.ext4 /dev/sdb1

mkdir /mnt/newdisk
sudo mount /dev/sdb1 /mnt/newdisk
df -h

Gparted

It is best to use the latest release of GParted https://github.com/GNOME/gparted/.

The gparted version on Mint 17.2 is 0.18.0 (Feb 19, 2014) while the current one is 0.28.1 (Feb 17, 2017).

After I create a bootable USB drive, the partition format is fat32 (I use an old version of GParted to format the drive as fat32, and then I use unetbootin to create the bootable USB drive).

If we want to use unetbootin, the USB drive has better to be pre-formatted as fat32 first for unetbootin to detect it. Once unetbootin detect the drive, we can use gparted to reformat it as NTFS before going to burn the Windows bootable USB drive. Read How do I use Unetbootin to make a bootable Windows USB installer?.

gparted on a 4TB disk

Get an error when I tried to create partitions on a 4T disk. Search 4TB gparted sectors exceeds the msdos-partition-table-imposed maximum of 4294967295

It seems it is necessary to use GPT instead of MBR/msdos as a partition table to overcome 2TB limitions.

It is also a good idea to use a live gparted os since the one in Ubuntu may not be up-to-date and gparted takes forever to scan devices. When boot from live USB, we need to turn off the Ext hard disk first.

Step1. Device -> Create a partition table -> GPT

Step2. Create a new ext4 partition as you want.

Note:

  • The 4TB hard disk can be recognized and used normally in an internal hd in Ubuntu 12.04.
  • The 4TB hard disk can also be used in Windows 7 as an external hd if I formatted it (e.g. from gparted in Linux) as an NTFS partition. The Disk Management (command prompt -> diskmgnt.msc) shows it has 3726.02 GB (3726.02 * 1024 * 1024 * 1024 = 4.000784e12 Bytes) capacity and the windows manager shows it is 3.63TB (3726.02/1024=3.638) total space.
  • It cannot be used as 4TB in the case when I use a docking station in Dell Precision T3500. Unsolved problem:
    • Running the command chown from root to user takes forever on 4T partition.
    • The ext dock station (StarTech) will halt the shutdown until I power off the station?

Conclusion:

  • 4TB using NTFS works on Ubuntu.
  • rsync will not stop spinning for some reason even the command is finished (through StarTech dock station).

Below is a screenshot I got from Gparted on a pre-formatted (NTFS) 4T portable drive from Seagate. It seems not harmful because I can still umount, change labels, etc on the disk.

Gparted gpt.png

tracker-miner-fs

See http://askubuntu.com/questions/346211/tracker-store-and-tracker-miner-fs-eating-up-my-cpu-on-every-startup how to disable it.

Health check of the hdd

I got an input/output error when I use sudo rm, sudo reboot or Ctrl + Del commands.

When I use the power button to force shutdown, I could not boot again. The BIOS does find the hdd and the Ubuntu Live USB does find the internal hdd too.

To force to reboot/shutdown, follow the suggestion here

dmesg command shows there are a few bad sectors on that hdd.

http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/ shows a few ways to run a health check on the hdd. The gnome disk utility cannot run S.M.A.R.T. on the external hdd.

sudo badblocks -v /dev/sdb1
sudo badblocks /dev/sdb > /home/zainul/bad-blocks
sudo fsck -l bad-blocks /dev/sdb

This article http://linoxide.com/linux-how-to/how-to-fix-repair-bad-blocks-in-linux/ talks about how to fix/repair bad blocks in Linux .

This article http://unix.stackexchange.com/questions/25902/what-does-this-hard-disk-error-message-mean-current-pending-sector-count talks about how to do with bad sectors.

It is an indicator that hdd is going to die http://www.linuxquestions.org/questions/linux-hardware-18/34-bad-blocks-what-should-i-do-927224-print/.

Burn/Write an iso or img file to a USB flash drive

Official instruction on www.ubuntu.com and from wikipedia.

Use dd

First, get to know the USB drive device name like /dev/sdb. When using 'dd', the USB drive has to be unmounted (using 'umount' command, not click 'reject' button in File Manager). Note that this will irrevocably destroy all data on /dev/sdX.

The instruction can be found in a lot of places like Archlinux wiki page.

sudo fdisk -l
sudo dd bs=4M if=xxx.img of=/dev/sdb && sync

where /dev/sdb is a device name, not a partition name. We can also adjust bs to a smaller value like 1M, 4m.

  • Monitor dd operations. Note for some reason it will stuck in the middle of process; the process bar stopped. And when it happened, 'Ctrl+c' will not stop immediately.
$ sudo umount /dev/mmcblk0p1
$ sudo apt install pv
$ sudo dd if=Downloads/ubuntu-18.04-desktop-amd64.iso | pv | sudo dd of=/dev/mmcblk0
sudo pkill -USR1 -n -x dd

For some reason when I use dd to create ubuntu 14.04 on usb drive, sudo gparted also gives me a Libparted warning /dev/sdc contains GPT signature, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should... Is it a GPT partition table? messsage. If I click 'Yes', Gparted shows no partition on the usb drive??? Nevertheless, the usb drive can be used to boot into ubuntu 14.04.

In another case, the gparted compalins the usb drive "Invalid partition table - recursive partition on /dev/sdb". Someone suggests to issue a command

sudo dd if=/dev/zero of=/dev/sdb bs=4M

Etcher - cross platform

For Ubuntu, there is no need to install the program. Just run the binary file (.AppImage).

See https://www.raspberrypi.org/magpi/pi-sd-etcher/

Rufus - Windows

UNETBOOTIN - cross platform

For creating a Windows bootable USB drive, we cannot use Etcher program. On UDoo-X86 Get started site, it suggests to use Unetbootin if the host machine is Ubuntu. NOTE. the USB drive has to be formatted as FAT32 (this can be done by GParted program); otherwise Unetbootin cannot recognize the drive. Unfortunately the USB drive can not be booted from UDoo-X86. See also the trick by this post.

  • The command sudo mount /dev/sdc1 /mnt should be sudo mkdir /media/$USER/usb; sudo mount /dev/sdc1 /media/$USER/usb where /dev/sdc1 should be changed appropriately
  • This approach works
  • Rufus is good but not always (eg the USB drive is not bootable??)

The GUI is written by Qt so the program is cross-platform. See its wiki.

The following is a screenshot of the contents of xubuntu 12.04. The usb drive needs to be formatted to fat32 on Windows OS to repair partition table error. The partition table error was discovered when I use sudo gparted program to view the USB drive.

Note that Unetbootin (Windows & Linux) and Universal USB installer (Windows only) are quite similar although Universal USB installer provides more options in its interface while Unetbootin does not have any other options.

XUbuntu12044 USBdrive.png XUbuntu gparted.png

Universal USB Installer/UUI

http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/

I first used dd command to successfully created a xubuntu 14.04 usb drive but there seems to be a problem with the partition since the gparted program will give a warning message about that and also the whole 16GB was used when I insert the drive onto a Windows machine.

Note that the fdisk utility cannot handle this new partition format so we have to use the gparted program.

Open the gparted program. Use it MULTIPLE TIMES to create a partition table (Device -> Create Partition Table...). Then we create a FAT32 partition with all of the space. After that, we can use the UUI program to create an Ubuntu USB drive.

The following screenshots are from a 16GB USB drive.

UUIa.png UUIb.png

Multiple boot USB

YUMI

YUMI works much like Universal USB Installer, except it can be used to install more than one distribution to run Live from your USB.

It can be used to create a Multiboot USB Flash Drive containing multiple operating systems, antivirus utilities, disc cloning, diagnostic tools, and more.

MultiBootUSB

The program is included by LXLE.

It supports persistence up to 4GB for ubuntu and its derivatives.

It also supports multi-thread (check by top or htop). The %cpu > 100.

It will take space as needed. So we can still use the USB drive to write data.

For some reason, the USB drive could not be boot after I use the program. The ubuntu does not show/recognize it though gparted still finds it. Maybe it is because the partition format (ext4 by gparted) is right. For YUMI program, it says to use fat16/fat32/NTFS; otherise syslinux will fail. But it seems not to help:( Maybe it is the partition table (I choose gpt instead of the default msdos).

Determine/install/switch Window Manager

sudo apt-get install wmctrl
wmctrl -m           

sudo apt-get install <pkg-name>
<pkg-name> --replace

On Ubuntu the default window manager is Compiz, for xubuntu it is Xfwm4 and for BBB it is Openbox.

Show date in top bar of desktop

  • Ubuntu 18.04 dconf write /org/gnome/desktop/interface/clock-show-date 'true'

Jenkins

How to Install Jenkins Automation Server with Apache on Ubuntu 16.04

Automatic update

$ tail /var/log/apt/history.log
Start-Date: 2018-12-05  06:38:19
Commandline: /usr/bin/unattended-upgrade
Install: ...
Upgrade: ...
...
Start-Date: 2018-12-21  06:18:59
Commandline: /usr/bin/unattended-upgrade
Upgrade: linux-libc-dev:amd64 (4.4.0-140.166, 4.4.0-141.167)
End-Date: 2018-12-21  06:19:00
  • Software & Updates GUI
    • By default, it will check automatically check updates every day. I changed it to every week.
    • When there are security updates, it will download and install automatically by default. Looks good.
    • When there are other updates, it will display weekly.
  • How to Disable Automatic Updates On Ubuntu

After running update/upgrade in Ubuntu

Virtualbox

Virtualbox does not work. After initial fix, the guest machine cannot connect to internet:(

Crashes network manager (no internet connection, no applet)

The solution on here works on my Ubuntu 14.04.4. Download 3 deb files and install them (downgrade packages).

Printer setup

Printers -> Add -> Network Printer -> Find Network Printer (wait a little bit).

It shows two matches. Brother HL-5250DN (AppSocket/JetDirect network printer via DNS-SD) & Brother HL-5250DN series (LPD network printer via DNS-SD). The first one does not work and the 2nd one works.

Another way is to type the IP approach (Enter URI). Enter 192.168.1.88:9100 -> Select printer from database -> Brother. There are two possibilities: HL-5250DN & HL-5250DN for CUPS. The first one does not work and the 2nd one works.

It is strange that when I try to print from Firefox, it shows 3 options (Print to file, BRN_xxxxx, HL-5250DN). The BRN_XXXXX shows the status is online but it cannot be printed.

Web interface (port 631)

Command line

  • lpstat -p: Display all installed printers
  • lpstat -a: Display only those printers that are currently accepting print requests.
  • lpadmin -x: Delete a printer. PS I cannot delete a printer either using the GUI or the command line:(

LPR & Cupswrapper

  • What's the difference between LPR and cupswrapper drivers? How to install printer drivers?
  • Brother MFC-L2710DW driver download & manual. It looks this is 2015 product.
  • From Brother's website (shell script). See also INSTALLING BROTHER MFC-L2700DW AS NETWORK PRINTER ON UBUNTU 16.04, or this post from PDF Studio for step-by-step instruction with screenshots.
    1. Download the Driver Install Tool (linux-brprinter-installer-*.*.*-*.gz) under Utilities instead of Printer Driver.
    2. Open a terminal window.
    3. cd Downloads
    4. gunzip linux-brprinter-installer-*.*.*-*.gz
    5. su bash linux-brprinter-installer-*.*.*-* "Brother machine name"; e.g. sudo bash linux-brprinter-installer-2.2.0-1 MFC-L2700DW
    6. The driver installation will start. Follow the installation screen directions. When you see the message "Will you specify the DeviceURI ?", For USB Users: Choose N(No) For Network Users: Choose Y(Yes) and DeviceURI number.
    7. The install process may take some time. Please wait until it is complete.
  • It seems Ubuntu 18.04 can automatically detect the MFC-L2700DW network printer.

Drum

Graphics driver

GPU info

$ lspci -vnn | grep VGA -A 12
# OR
$ lshw -numeric -C display

To check hardware acceleration

# If glxinfo is not find, run sudo apt-get install mesa-utils
$ glxinfo | grep OpenGL

Under Ubuntu-Unity, we can search Additional Drivers to install propriety party drivers instead of using X.org.

On Dell T3600, it shows (pay attention to the line driver=nouveau). See also Installing Nouveau on your Linux computer.

$ sudo lshw -C video
[sudo] password for brb:
  *-display
    description: VGA compatible controller
    product: GF108GL [Quadro 600]
    vendor: NVIDIA Corporation
    physical id: 0
    bus info: pci@0000:03:00.0
    version: a1
    width: 64 bits
    clock: 33MHz
    capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
    configuration: driver=nouveau latency=0
    resources: irq:82 memory:ee000000-eeffffff memory:f0000000-f7ffffff memory:f8000000-f9ffffff ioport:e000(size=128) memory:ef000000-ef07ffff

If I change to use the nvidia driver on T3600 which has NVIDIA Quadro 600, the GLX error will happen (OpenGL related. Some programs like Qt Creator, Blender will not be able to run). See the detail.

AMD vs NVIDIA

Should You Use AMD or NVIDIA GPUs on Linux?

Autostart when log into your desktop

1. ~/.config/autostart/ (hidden directory)

Add .desktop files to here to have programs start automatically at startup. These .desktop files are application shortcuts — you can often create them by dragging-and-dropping an application onto your desktop or even just into the ~/.config/autostart/ window.

If you’re not using a desktop environment check out ~/.bash_profile file.

2. /etc/xdg/autostart

Or search 'Startup Applications Preferences' in Dash/Menu. How do I start applications automatically on login?

Resources:

Auto start services on boot

On Ubuntu (Let’s say script name is nginx),

  1. Copy the script in /etc/init.d/ folder
  2. Execute the below command
update-rc.d nginx defaults
  1. Reboot the server to ensure services are started.

Take screenshots (and edit them)

https://wiki.archlinux.org/index.php/taking_a_screenshot

gnome-screenshot (preinstalled in Ubuntu)

A comprehensive guide to taking screenshots in Linux using gnome-screenshot

# Current window
gnome-screenshot -w

# an area
gnome-screenshot -a

# delay
gnome-screenshot –delay=[SECONDS]

# interactive mode
gnome-screenshot -i

# directly save your screenshot
gnome-screenshot –file=[FILENAME]

# copy to the clipboard
gnome-screenshot -c

Shutter

# https://launchpad.net/~shutter/+archive/ubuntu/ppa
sudo add-apt-repository ppa:shutter/ppa
sudo apt-get update
sudo apt-get install shutter
  • After we launch Shutter, the tool sits at the (upper-right) Ubuntu system tray
  • The built-in editor (click Edit button on the rhs) is convenient but limited (GIMP is more powerful but complicated). Tools includes
    • Select item to move or resize it
    • Draw a freehand line
    • Highlighter
    • Draw a straight line
    • Draw an arrow
    • Draw a rectangle
    • Draw an ellipse
    • Add a text
    • Censor portions of the screenshot
    • Pixelize selected areas
    • Crop
  • screenshots
  • Each taken screenshots are placed in different tabs in Shutter
  • If we close Shutter, the unsaved screenshots are still there because by default it automatically save files in the ~/Pictures folder. We can modify the settings from Edit -> Preferences.
  • It also supports 'cropping'. Click 'Edit' button, Tool -> Crop, Select a region, Click 'Crop' button on the RHS.

flameshot

Best Tools For Taking and Editing Screenshots in Linux

GIMP

File -> Create -> Screenshot

import

command from ImageMagick

scrot

from scrot package. Note that by default the title bar will not be included (see the '-b' option below).

It seems scrot is better for my need.

Note: there seems no way to copy the screenshot to the clipboard.

scrot -c -d 5 screenshot.png     # -c is count down, -d is delay

scrot -b -c -d 5 -u screenshot.png  # -b is title bar, -u is the current foc'u'sed window

scrot -u                         # current window

scrot -s screenshot.png          # select an area

scrot --thumb 50                 # 50% of the original screenshot

scrot abc.png -e 'gthumb $n'     # open gThumb to open the file after taking the screenshot

# sudo apt-get install mirage    # 105 kB
mirage screenshot.png            # view the image

scrot -b -d 5 '%Y:%m:%d:%H:%M:%S.png' -e 'mv $f ~/Desktop/'

See How to take screenshots in Linux with scrot.

ScreenCloud

Hotshots

Only supports Ubuntu up to 14.04.

sudo add-apt-repository ppa:ubuntuhandbook1/apps
sudo apt-get update
sudo apt-get install hotshots

Pinta, mtPaint, MyPaint

Paint.NET_like_program

Screencaster/Record desktop

kazam

Although Kazam can do screenshots, Shutter (can sit on the system tray) is more convenient for taking care of screenshots.

The default frame rate is only 15. If we want to increase it, go to File -> Preferences -> Screencast tab.

When recording, it will have 5 seconds (adjustable) to wait. After launching Kazam, it will show an icon (video recorder) on the top-right corner. Keyboard shortcuts are available. For example (Windows key=Super key),

  • Record=Ctrl + Windows + r,
  • Finish=Ctrl + Windows + f,
  • Pause=Ctrl + Windows + p.
sudo apt-get install kazam

You can choose fullscreen, window or a specific area. However, if you want to change the window or area once you have chosen one, you have to restart the program. One nice thing with Kazam is the output video is in .mp4 format (not ogv or ogg format). For a 14-seconds video with 15 frames per second (default), the video file size is 1.4MB.

A good introduction Create Screencast Videos With Ease Using Kazam

SimpleScreenRecorder (Qt based)

source code and this article

sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder
sudo apt-get update
sudo apt-get install simplescreenrecorder

VokaScreen

It is used in youtube videos of QML tutorials.

Istanbul

Saved files are in the ogg format.

sudo apt-get install istanbul

RecordMyDesktop

http://www.youtube.com/watch?v=A0Tn3Z8OklQ.

    • The recorded video is in the ogv format.
    • It can be run from the command line.
    • We need to run ffmpeg to convert video to flv (Quality seems to be reduced) OR we can use online service (http://video.online-convert.com/convert-to-mp4) to convert ogv file to mp4 file (Same quality as I can tell).
sudo apt-get install recordmydesktop gtk-recordmydesktop

Create animated Gif of a screencast

Wallpaper

How to Use Bing’s Background of the Day as Your Ubuntu Wallpaper

Conky

Conky is a free, light-weight system monitor for X, that displays any information on your desktop.

Step 1. Install conky-all package

Step 2. create ~/.conkyrc file. This file can be downloaded from web.

Step 3. Run it: $ conky. If we want to run a specific configuration file, use conky -c CONKYRCFILE

Step 4. If you want to stop Conky: $ killall conky

Note that conky works automatically on Ubuntu's Unity.

For Lubuntu (tested on 14.04), the Conky's transparent function does not work at first. But This conkyrc works on Lubuntu desktop (mainly, tranparent function). To deal with the autostart, follow the suggestion from askubuntu.com. That is, go to ~/.config/autostart folder, create or copy+paste the file called conky.desktop with a content like

[Desktop Entry]
Type=Application
Exec=sh "/home/brb/.conky/conky-startup.sh"
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_IN]=Conky
Name=Conky
Comment[en_IN]=
Comment=

and

brb@brb-VirtualBox:~$ cat .conky/conky-startup.sh 
conky &
exit 0
brb@brb-VirtualBox:~$ ls -l .conky/conky-startup.sh 
-rw-rw-r-- 1 brb brb 37 Aug 30 20:17 .conky/conky-startup.sh

Another way to configure conky is to install conky-manager. See this and project website page. But it seems it does not work well with desktop wallpaper.

What should I do when Ubuntu freezes?

Press Alt+Print and then type 'REISUB' (not work, it only does screenshot)

Customize the desktop

  • Install Cairo-Dock.

Remove overlay scroll bar

http://www.itworld.com/article/2698420/disable-overlay-scroll-bars-in-ubuntu-14-04.html

Change scroll bar color

See this post. Run sudo apt-get install gnome-color-chooser.

Go to Engines tab in gnome-color-chooser and choose clearlooks engine for scrollbars.

How to turn off/disable Compiz's “drag to maximize” behaviour?

http://askubuntu.com/questions/72452/how-to-turn-off-compizs-drag-to-maximize-behaviour

On Mint, go to Preferences -> Window Tiling -> Enable Window Tiling and snapping -> Off.

Grub2

To show the grub2 screen, run 'sudo nano /etc/default/grub' and comment out the line GRUB_HIDDEN_TIMEOUT=0 and change the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT="". Remember to run 'sudo update-grub' after any change to grub.

To add a splash image, follow the instruction at https://help.ubuntu.com/community/Grub2/Displays. Note that Grub2 will search the image based on some priority and there are also some minor requirements on the images. To test

sudo apt-get install grub2-splashimages
sudo cp /usr/share/images/grub/Moraine_Lake_17092005.tga /boot/grub/
sudo update-grub

How do I set the grub timeout and the grub default boot entry?

https://askubuntu.com/questions/148095/how-do-i-set-the-grub-timeout-and-the-grub-default-boot-entry

  1. gksudo gedit /etc/default/grub
  2. Change as you like. Save and closed the file.
    • You can change the default from 0 to any number
    • You can change the "hidden timeout" (no menu)
    • You can force the grub menu to show by commenting out the two GRUB_HIDDEN lines with a # at the beginning of the line
    • set the grub menu timeout (default is 10 seconds)
  3. sudo update-grub
  4. Reboot

Boot into command line

http://www.linuxandubuntu.com/home/how-to-boot-into-linux-command-line

  1. Highlight the first item (default) and press 'e' in the GRUB menu
  2. Navigate to the line that starts with ‘linux’, change the runlevel to 3 (at the end of the line). Level 3 means multi-user, command-line only system
  3. Press Ctrl+x or F10 to boot into

To switch back to GUI, type sudo init 5. Level 5 is the default.

Grub Customizer - GUI program

How To Change The GRUB Boot Order Or Default Boot Entry In Ubuntu, Linux Mint, Debian, Or Fedora With Grub Customizer

Network Manager

DNS problem and 127.0.1.1

(Ubuntu 16.04 on Odroid) For some reason, pinging my domain always goes to the wrong IP. If I go to System -> Administration -> Network to change DNS from 127.0.1.1 to 8.8.8.8, it fixes the problem. But if I reboot, the DNS entry goes back to 127.0.1.1 again.

When I follow this post nameserver 127.0.1.1 in resolv.conf won't go away, the DNS will be changed to local IP of my router and the problem is fixed (even I reboot the computer).

See also the next: How to flush the DNS cache

How to flush the DNS cache

sudo /etc/init.d/dns-clean

NM-applet

https://wiki.archlinux.org/index.php/NetworkManager

Turn on/off wifi adapter

The command-line equivalent of unchecking the nm-applet's 'Enable Wi-fi' should be

nmcli nm wifi off
# OR
nmcli radio wifi off
# OR
sudo ifconfig wlan0 down

Proxy

Internet Shut Down

DHCP Server

How to Install a DHCP Server in Ubuntu and Debian

File Server

Network File System (NFS)

NFS allows a system to share directories and files with others over a network. By using NFS, users and programs can access files on remote systems almost as if they were local files.

Some of the most notable benefits that NFS can provide are:

  • Local workstations use less disk space.
  • There is no need for users to have separate home directories on every network machine. Home directories could be set up on the NFS server and made available throughout the network.

Server part:

sudo apt-get install nfs-kernel-server

Configure the directories to be exported by adding them to the /etc/exports file.

/home/USERNAME/SHAREFOLDER 192.168.1.0/24(rw,sync,no_subtree_check)
/ubuntu  *(ro,sync,no_root_squash)
/home    *(rw,sync,no_root_squash)
# replace * with one of the hostname formats.

where 'ro' means read only. See Linux Home Server Howto. The no_root_squash option will not prevent root on a client machine from writing files to the server as root; by default, NFS will map any requests from root on the client to the 'nobody' user on the server. See digitalocean.

To start the NFS server:

sudo service nfs-kernel-server start

Client part:

PS.

  • There is no need to enter any password related to the NFS server.
  • See digitalocean for other ways to specify the arguments in </etc/fstab>.
sudo apt-get install nfs-common

sudo mount -t nfs example.hostname.com:/ubuntu /mnt/ubuntu
# The mount point directory /mnt/ubuntu must exist.
# or modify the /etc/fstab file 
# example.hostname.com:/ubuntu /mnt/ubuntu nfs rsize=8192,wsize=8192,timeo=14,intr
# localip:/sharedfolder /mnt/ubuntu nfs defaults 0 0

brb@brb-P45T-A:~$ ps -ef | grep nfs
root       675     2  0 11:16 ?        00:00:00 [nfsiod]
root     14783     2  0 16:51 ?        00:00:00 [nfsv4.0-svc]
brb      14960 13491  0 16:56 pts/0    00:00:00 grep --color=auto nfs

To make the mounting permanently, run sudo nano /etc/fstab and include a line like

1.2.3.4:/home    /mnt/nfs/home   nfs auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800 0 0

Some help:

Boot from an NFS server

With NFS booting, the core kernel and file systems are kept on a central server and then pushed out onto client systems to be booted on there. That means your files and desktop will always be available wherever you want to log in.

At the end, the client computer does not need any internal storage. Cool!

CIFS (Common Internet File System) and NTLMv2 (NT LAN Manager)

Note that this method is most suitable for transferring small files. Users transferring large amounts of data to and from Helix/Biowulf should continue to use scp or sftp. (nih.gov)

Samba - allows Linux to transfer files with Windows clients

$ ps -ef | grep smbd    # see if the Samba daemon (smbd)
$ ps -ef | grep nmbd    # see if the NetBIOS name server daemon (nmbd) is running

$ sudo service smbd stop  # does not stop nmbd 
$ sudo service nmbd stop

$ sudo service smbd start
$ sudo service nmbd start
sudo apt-get install samba samba-common
sudo apt-get install python-glade2
sudo apt-get install system-config-samba

Use Dash and search for 'samba'. It will ask for the user's password first. The samba password can also be set by

sudo smbpasswd -a USERNAME

A non-gui way to configuration samba is adding the following to the end of /etc/samba/smb.conf file, sudo nano -w /etc/samba/smb.conf (-w means no-wrap). Any line beginning with a semicolon (“;”) or a hash (“#”) character is ignored.

[brb]
        path = /home/brb
;       writeable = no
;       browseable = yes
        guest ok = yes
smb://192.168.1.3/

On Windows PC, go to start and open 'Run' then enter ip with double backslash. Like this (\\192.168.1.3).

Remove and re-install Samba

$ sudo apt-get remove --purge samba
$ sudo apt-get remove --purge smbclient libsmbclient

$ sudo apt-get install samba
$ sudo apt-get install smbclient libsmbclient

SambaCry vulnerability and check Samba version

http://pcworld.com/article/3199106/linux/the-sambacry-scare-gives-linux-users-a-taste-of-wannacry-petya-problems.html

To check your samba version

$ smbd -V
Version 4.3.11-Ubuntu

Change the default session when using auto login

See this post. We need to edit the file /etc/lightdm/lightdm.conf. Note that on my Ubuntu 12.04, I have the following desktop options.

$ ls -lt /usr/share/xsessions/
total 16
-rw-r--r-- 1 root root 205 Apr 19  2012 gnome.desktop
-rw-r--r-- 1 root root 188 Apr 19  2012 gnome-shell.desktop
-rw-r--r-- 1 root root 208 Apr 19  2012 ubuntu-2d.desktop
-rw-r--r-- 1 root root 185 Apr 19  2012 ubuntu.desktop

Debian root user from remote access

When you login by SSH, then use the username you have chosen when you installed Debian as the root user is disabled for remote logins. Then run the command "su" to become root user. See howtoforget.com.

Terminal

Directory color on ssh

When I ssh to biowulf from Gnome/Terminal, the folder color became dark blue which is hard to read when the background color is black. A solution is https://serverfault.com/questions/137649/changing-terminal-colors-in-ubuntu-server.

1. append this to your ~/.bashrc

    if [ "$TERM" != "dumb" ]; then
      [ -e "$HOME/.dir_colors" ] && 
      DIR_COLORS="$HOME/.dir_colors" [ -e "$DIR_COLORS" ] ||
      DIR_COLORS="" 
      eval "`dircolors -b $DIR_COLORS`" 
      alias ls='ls --color=auto'
    fi

2. create/edit your ~/.dir_colors, for example with

  $ dircolors --print-database > .dir_colors

3. Then force a read of your .bashrc file with:

  $ source ~/.bashrc

Everything should be pretty.

Remember terminal tabs

The trick on this post works for me on my GNOME Terminal 3.6.2 (gnome-terminal --version).

# To save configuration into /home/$USER/terminal.cfg:
gnome-terminal --save-config=/home/$USER/terminal.cfg

# To load it back:
gnome-terminal --load-config=/home/$USER/terminal.cfg

To recall the titles, follow this simple hack. That is, add an entry Title=xxxx to each tab section.

Terminal tab color

If we open several tabs in the (GNOME) Terminal, the default color of the active tab is not quite different from the other tabs. We need a solution to change the tab colors.

http://askubuntu.com/questions/355297/gnome-terminal-tabs-no-contrast-between-active-and-inactive-tabs

Solution: edit ~/.config/gtk-3.0/gtk.css (you might have to create it) and add:

TerminalWindow,
TerminalWindow.background {
        background-color: #6e6e6e;
        color: #000000;
}

TerminalWindow .notebook tab {
        padding: 2;
        background-color: #6e6e6e;
}

TerminalWindow .notebook tab:active {
        background-color: #d1d1d1;
}

Then close ALL terminal windows start and test.

How to practically use your Linux terminal for everything

Record terminal: script command

Install Microsoft Font in linux suite

PCWorld.com

Install language packs

sudo apt-get install language-pack-[cod] language-pack-gnome-[cod] language-pack-[cod]-base language-pack-gnome-[cod]-base

For example, [cod]=en or [cod]=zh.

Change locale language and character set

Display Chinese character (from vanilla Debian/Ubuntu system)

sudo apt-get install fonts-arphic-ukai fonts-arphic-uming
sudo apt-get install language-support-fonts-zh
# Or
sudo apt-get install ttf-arphic-uming ttf-wqy-zenhei

Chinese Input

Zhuyin-keyboard.gif

Ibus.png

  1. type 'language' in Dash search (Or click Power button on the top-right corner -> System Settings...) and click 'Language Support' (this may not be installed from (x)Ubuntu automatically. In such case, IBUS will be missing eg Chewing method). The 'Language Support' is under Settings menu in xUbuntu.
  2. Click 'Install' if a message popped up with the message 'The language support is not installed completely'. After the installation is done, the 'Language support' dialog comes back.
  3. Choose between ibus (ubuntu < 16.04) /fcitx (ubuntu 16.04).
    • Choose 'IBUS' for keyboard input method system (bottom of the dialog). IBUS is under 'System' menu in xUbuntu.
    • Choose 'fcitx'
  4. Click 'Install/Remove Languages'. Choose Chinese. Click 'Apply'. An 'Applying changes' dialog will appear.
  5. Click 'Close' button.
  6. Select Chinese
    • System Settings -> Text Entry -> '+' -> Chinese. Or Settings > Keyboard Input Method > Input method > Select an input method > Show only input methods for your region > Chinese 酷 Chewing. If we cannot find this dialog, we can launch it by ibus-setup command. If Chewing is not shown as one of Chinese input methods, we can log out and log in the desktop. If ibus does not have the chewing selection, we should try to install it sudo apt-get install ibus-chewing and/or run ibus restart.
    • Dash -> Fcitx Configuration. '+' -> Chewing. PS. On Ubuntu 16.04 it only shows a Chinese option without further options even I installed ibus-chewing.
  7. Make sure 'Show current input source in the menu bar' is checked.
  8. Click 'Close' button.

On Ubuntu 14.04, the super key is Windows.

On Ubuntu 16.04, ibus does not work. Use fcitx instead. Chewing(Fcitx) should be added to the "Text Entry" GUI. "fcitx" should be selected in the "Language Support" GUI (it's OK the language for menus and windows does not include 漢語 (臺灣). A linux or keyboard icon should appear in the taskbar.

On Ubuntu 18.04, I don't need to use fcitx (not available by default)

  1. I follow pingyinjoe to install Chinese from Language Support. Reboot (Log out seems to take forever).
  2. I follow this post to use sudo locale-gen zh_TW.UTF-8 to add chewing to the list (see next step).
  3. Type 'region' to search and click "Region and Language". Follow the GUI to add Chinese (Chewing).
  4. Test it by using Windows + Space to switch input methods.

Note that do not use 'Text Entry' application (shown as one options when we search 'language'). This application will conflict with ibus.

gcin

新注音 New Zhuyin

fcitx

https://daviwa.blogspot.com/2017_10_08_archive.html

  • On Linux Mint, it cannot show a list of candidate words. The trick of using killall fcitx-qimpanel works.
  • On Ubuntu Mate, the fcitx works fine. ps -ef | grep fcitx-qimpanel shows nothing.

/usr/lib/ibus/ibus-ui-gtk3 high memory usage

For some reason, the ubuntu 14.04 is not responsive. Htop shows ibus-ui-gtk3 is the culprit. The suggestion is to run

killall ibus-daemon

After I run this command and wait a few seconds, the memory leak problem is solved.

Change time zone

http://wiki.debian.org/TimeZoneChanges

$sudo dpkg-reconfigure tzdata

The command launches an ncurses based interface which allows arrow keys to be used to select the region specific time zone.

Make script run at boot time with init.d directory

http://www.debian-administration.org/articles/28

For example, see here from running a python script for raspberry pi.

  1. Create a script /etc/init.d/lcd
  2. Make the script executable
  3. Make the script known to the system by using the update-rc.d' command
sudo update-rc.d lcd defaults

/etc/rc.local file

Executing Commands and Scripts at Reboot & Startup in Linux

For CentOS, we use file ‘/etc/rc.d/rc.local’ instead of ‘/etc/rc.local’. We also need to make this file executable before adding any script or command to the file.

Note:- When executing a script at startup, make sure that the script ends with ‘exit 0’.

crontab

Executing Commands and Scripts at Reboot & Startup in Linux

wireless connection randomly drop off

My wireless adapter is TP-LINK, TL-WN722N.

http://askubuntu.com/questions/73607/wireless-connection-keeps-dropping-with-an-intel-3945abg-card

sudo iwconfig wlan0 power off

5 Best Linux/Ubuntu compatible USB Wifi cards:

  • AirLink101 AWLL6075 Wireless N Mini USB Adapter
  • Medialink – Wireless N USB Adapter – 802.11n
  • ASUS (USB-N13) Wireless-N USB Adapter
  • Panda Mini Wifi (b/g/n) 150Mbps Card
  • TP-Link TL-WN722N 150Mbps High Gain Wireless USB Adapter

To show (USB) wireless adapter information

sudo lshw -C network
sudo lsusb -v
iwconfig

To check wifi connection information (SSID, channel, address, frequency, qualiyt, signal level, ...)

sudo iwlist wlan0 scan

My experience is quality should be at least 50/70 and signal level should be larger than -60dBm.

Create an iso file from a CD or HD

Method 1 (Better than Method 2). No need to umount the cdrom.

mkisofs -o /tmp/DVD.iso /tmp/directory/

to make an ISO from files on your hard drive.

Method 2. Make sure the cdrom is NOT mounted. Type mount to confirm it. If cd was mouted automatically unmout it with umount command: like umount /dev/cdrom or umount /mnt/cdrom. Note that no extra forward slash after /dev/cdrom for the command below.

dd if=/dev/cdrom of=~/DVD.iso

We can mount the iso file to a directory to check the iso file content is correct.

mount -t iso9660 -o loop,ro DVD.iso /mnt

Have fun with /etc/hosts file

su -c "nano /etc/hosts"

127.0.0.1	localhost
::1             localhost
74.125.67.100   DNS_NAME1 DNS_NAME2
  • If you want to add aliases for your machine that will lookup to the loopback address you can keep adding them as space separated values on that line.
  • "::1" is the ipv6 equivalent of 127.0.0.1 (which is for ipv4).

Block malware, adware

How to Use Your Computer’s Hosts File to Block Tons of Malware, Porn, and Other Types of Websites

Mount a remote file system over ssh

The trick is to use the sshfs tool.

On Ubuntu

# Install the program
sudo apt-get install sshfs

# Mount the file system
sudo mkdir /mnt/droplet <--replace "droplet" whatever you prefer
sudo sshfs [email protected]:/ /mnt/droplet

# Unmount the file system
sudo umount /mnt/droplet

# Permanently Mounting the Remote File System
sudo nano /etc/fstab
sshfs#[email protected]:/ /mnt/droplet

Nautilus (File Manager)

Undo Ctrl+L

Press ESC.

Mount another Linux system in Nautilus

Very easy. Check out howtogeek.com

Create a desktop shortcut

Navigate to your application in Nautilus. Right-click, select "Make Link". Then drag shortcut to your desktop. Works in Ubuntu 12.04.

.desktop file format

Open a terminal

sudo apt-get install nautilus-open-terminal
nautilus -q

In Ubuntu 15.10, the functionality is already included in nautilus!

Mount iso file

$ sudo mkdir /mnt/iso
$ sudo mount -o loop /tmp/file.iso /mnt/iso
$ sudo umount /mnt/iso

Check ubuntu version from command line

http://www.howtogeek.com/206240/how-to-tell-what-distro-and-version-of-linux-you-are-running/

lsb_release -a     # command not found if we run it from a docker image

# OR
cat /etc/issue     # works on docker image

# OR
cat /etc/*release  # works on docker image

# check kernel version
uname -r           # docker will get this information from the host

# check 32/64 bit kernel
uname -a           # docker will get this information from the host

keyboard shortcuts

Go to keyboard app to change the settings. Note: Super key is also Windows key. Use 'Backspace' key to disable a shortcut.

  • List from ubuntu.com
  • Super: Open the Dash. Press and hold it to see a cheat sheet with a bunch of other nifty shortcuts.
  • Super + Number: Open the application that is at that position in the dock
  • Alt + Mouse: Move an application. Useful if an application's title bar is too high.
  • Alt + F2: Run an application by typing its name in the box which appears (same function as the Super key).
  • Alt + Space: Activate the window menu. Not useful so I assign this to "Show all applications" (Super + a). This will be consistent with macOS.
  • Ctrl + Super + D: To minimize all windows
  • Ctrl + Alt + Arrows: move to another workspace
  • Ctrl + Alt + Shift + Arrows: move current application to another workspace

On Xubuntu,

  • Alt + F1 (Ctrl + ESC): Application menu.
  • Alt + F2 (Super + R): Application Finder.

Add a new keyboard shortcut

Let's say I want to assign Ctrl+Alt+s to bring the shutdown dialog.

  1. System Settings -> Keyboard -> Shortcuts -> Windows -> Toggle shaded state -> Backspace to disable it. For some reason, I cannot assign a new keybinding using the method of Custom Shortcuts' method.
  2. Open Ubuntu Software Center and install Compiz Config Setting Manager program. Open the program by search Compiz and then create a new command gnome-session-quit --power-off --force with a name like 'Shutdown' and the keyboard binding we want. CCSM -> General -> Commands.

With this approach, it will give a dialog with 4 options (lock suspend restart shutdown) but no one is pre-selected. If we want the shutdown icon being preselected, use this script where the zenity command was used to create a dialog. The zenity program was pre-installed in Ubuntu. See How to Make Simple Graphical Shell Scripts with Zenity on Linux.

Firefox

  • Space: page down
  • Shift + space: page up

BioLinux

Bio-Linux 7.0 (2012/11/21) screenshot.

Biolinux can be installed in two ways.

  1. One is to download iso image file. http://nebc.nerc.ac.uk/downloads/
  2. The other way is to install Bio-linux software/package by using apt-get install method. See http://nebc.nerc.ac.uk/tools/bio-linux/other-bl-docs/package-repository

BioLinux.png

Check Biolinux version

cat /etc/bio-linux.version  # 8.0.5 as of June 2015

Installation

wget -qO- http://nebc.nerc.ac.uk/downloads/bl8_only/upgrade8.sh | sudo sh

This takes a long long time.

Software list

FAQ

Sample Data

Did not find them useful.

brb@biolinux[brb] ls Desktop/Sample\ Data/                                                         [10:05AM]
act       cytoscape               glimmer3      mrbayes             peptide_seqs       splitstree
artemis   dendroscope             happy         mspcrunch           phylip             squint
blast     dotter                  hmmer         multiple_alignment  qiime              t-coffee
blast+    dust                    jalview       mummer              rasmol             tree-puzzle
blixem    fasta                   jprofilegrid  muscle              rdp_classifier     treeview
cap3      fastDNAml               mesquite      mview               readseq
catchall  forester-archaeopteryx  mira          njplot              samtools
clustal   gap4                    mothur        nucleotide_seqs     sanger_tracefiles
brb@biolinux[brb] ls Desktop/Sample\ Data/fasta/                                                   [10:05AM]
bovgh.seq        hahu.aa       mgstm1.e05           mgstm1.nt1r  myosin_bp.aa  oohu.raa
bovprl.seq       hsgstm1b.gcg  mgstm1.eeq           mgstm1.nts   n0.aa         prio_atepa.aa
egmsmg.aa        hsgstm1b.seq  mgstm1.esq           mgstm1.raa   n1.aa         prot_test.lib
grou_drome.pseg  humgstd.seq   mgstm1.gcg           mgstm1.rev   n2.aa         prot_test.lseg
gst.nlib         lcbo.aa       mgstm1_genclone.seq  mgstm1.seq   n2_fs.lib     qrhuld.aa
gst.seq          m1r.aa        mgstm1.lc            mgtt2_x.seq  n2s.aa        sql
gstt1_drome.aa   m2.aa         mgstm1.nt            ms1.aa       n2t.aa        titin_hum.aa
gstt1_pssm.asn1  mchu.aa       mgstm1.nt1           mu.lib       n_fs.lib      titin_hum.seq
gtm1_human.aa    mgstm1.3nt    mgstm1.nt12r         musplfm.aa   ngt.aa        xurt8c.aa
gtt1_drome.aa    mgstm1.aa     mgstm1.nt13          mwkw.aa      ngts.aa       xurt8c.lc
h10_human.aa     mgstm1.aaa    mgstm1.nt13r         mwrtc1.aa    oohu.aa       xurtg.aa

CloudBioLinux

Tomcat

Device manager

By default, ubuntu does not provide any graphical tool like device manager on Windows. A very close one is lshw (hardware lister). A GUI tool based on it is called lshw-gtk (seems not as informative as the command line one) and can be installed by sudo apt-get install lshw-gtk in Ubuntu/Debian or yum install lshw in Red Hat/Fedora/CentOS.

As you can see the line containing 'display' shows the motherboard (P45T-A), CPU (Intel Core 2 Duo E8400), graphical card (GeForce 9400 GT in this case), et al.

brb@brb-P45T-A:~$ sudo lshw -short
H/W path         Device      Class       Description
====================================================
                             system      P45T-A (To Be Filled By O.E.M.)
/0                           bus         P45T-A
/0/0                         memory      64KiB BIOS
/0/4                         processor   Intel(R) Core(TM)2 Duo CPU     E8400  @
/0/4/5                       memory      64KiB L1 cache
/0/4/6                       memory      6MiB L2 cache
/0/f                         memory      8GiB System Memory
/0/f/0                       memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
/0/f/1                       memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
/0/f/2                       memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
/0/f/3                       memory      2GiB DIMM DDR2 Synchronous 800 MHz (1.2
/0/100                       bridge      4 Series Chipset DRAM Controller
/0/100/1                     bridge      4 Series Chipset PCI Express Root Port
/0/100/1/0                   display     G96 [GeForce 9400 GT]
/0/100/1a                    bus         82801JI (ICH10 Family) USB UHCI Control
/0/100/1a.1                  bus         82801JI (ICH10 Family) USB UHCI Control
/0/100/1a.2                  bus         82801JI (ICH10 Family) USB UHCI Control
/0/100/1a.7                  bus         82801JI (ICH10 Family) USB2 EHCI Contro
/0/100/1b                    multimedia  82801JI (ICH10 Family) HD Audio Control
/0/100/1c                    bridge      82801JI (ICH10 Family) PCI Express Root
/0/100/1c/0      eth0        network     AR8121/AR8113/AR8114 Gigabit or Fast Et
/0/100/1c.3                  bridge      82801JI (ICH10 Family) PCI Express Root
/0/100/1c.3/0    wlan0       network     AR93xx Wireless Network Adapter
/0/100/1c.4                  bridge      82801JI (ICH10 Family) PCI Express Root
/0/100/1c.4/0                storage     JMB361 AHCI/IDE
/0/100/1c.4/0.1              storage     JMB361 AHCI/IDE
/0/100/1d                    bus         82801JI (ICH10 Family) USB UHCI Control
/0/100/1d.1                  bus         82801JI (ICH10 Family) USB UHCI Control
/0/100/1d.2                  bus         82801JI (ICH10 Family) USB UHCI Control
/0/100/1d.7                  bus         82801JI (ICH10 Family) USB2 EHCI Contro
/0/100/1e                    bridge      82801 PCI Bridge
/0/100/1f                    bridge      82801JIR (ICH10R) LPC Interface Control
/0/100/1f.2                  storage     82801JI (ICH10 Family) 4 port SATA IDE 
/0/100/1f.3                  bus         82801JI (ICH10 Family) SMBus Controller
/0/100/1f.5                  storage     82801JI (ICH10 Family) 2 port SATA IDE 
/0/1             scsi0       storage     
/0/1/0.0.0       /dev/sda    disk        250GB Samsung SSD 840
/0/1/0.0.0/1     /dev/sda1   volume      224GiB EXT4 volume
/0/1/0.0.0/2     /dev/sda2   volume      8190MiB Extended partition
/0/1/0.0.0/2/5   /dev/sda5   volume      8190MiB Linux swap / Solaris partition
/0/1/0.1.0       /dev/sdb    disk        2TB ST2000DM001-9YN1
/0/1/0.1.0/1     /dev/sdb1   volume      1863GiB EXT4 volume
/0/2             scsi2       storage     
/0/2/0.0.0       /dev/cdrom  disk        DVDRAM GH24NS90
/1                           power       Nikon Ultra Plus
/2                           power       To Be Filled By O.E.M.

For storage part, ubuntu provides a graphical tool. See "disk utility" on gnome based ubuntu or search for "disk" in launcher.

Set static IP - /etc/network/interfaces

root@debian:~# cat /etc/network/interfaces
auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp

Now edit the file /etc/network/interfaces

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.3
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0                 # Optional
broadcast 192.168.1.255             # Optional
dns-nameservers 192.168.1.1 8.8.8.8 # Or skip 192.168.1.1

After it, restart the network by issuing

/etc/init.d/networking restart

OR sudo reboot

Note: It does not work by editing /etc/resolv.conf since this file will be overwritten.

Change IP address from the command line

/sbin/ifconfig eth0 192.168.1.17 netmask 255.255.255.0 up
/sbin/ifconfig eth0

Windows OS.

ufw (uncomplicated firewall)

The default firewall configuration tool for Ubuntu is ufw. Developed to ease iptables firewall configuration, ufw provides a user friendly way to create an IPv4 or IPv6 host-based firewall. By default UFW is disabled.

Suppose I have a virtual machine running a web server at port 8888 (The vm may be initialized by the Vagrant command). I can access the webpage from my host machine using http://localhost:8888.

Now I want the web page to be accessible from other local machines. We can use the ufw command to enable the firewall wall and open ports for certain services.

sudo ufw allow 8888/tcp
sudo ufw show added
sudo ufw enable
sudo ufw status
sudo ufw app list

nmap localhost

Now I can go to another machine, open a browser at http://hostip:8888/. I should be able to get the same result as I got from the host machine.

In one instance sshing to a server failed (connection time) for some reason. The solution is to run the following command on the server

sudo ufw allow 22/tcp

A graphical interface program is called Gufw Firewall.

Other things ufw can do:

  • Allow/Deny by ports and (optional) protocols
  • Allow/Deny by service name
  • Disable ping requests.
  • Allow by specific IP
  • Allow by subnet
  • Allow by specific port and IP address
  • Deny by certain IP address
  • Deny by certain IP address and certain port

DNS tricks

5 DNS Servers Guaranteed to Improve Your Online Safety

http://www.makeuseof.com/tag/best-dns-providers-security/

5 Nifty Ways to Use DNS to Your Advantage

http://www.makeuseof.com/tag/nifty-ways-use-dns-advantage/

DNS Server

Protecting Your Privacy With Firefox on Linux

What is my DNS server

/etc/resolv.conf or /etc/network/interfaces

On my home computer, it just shows one line nameserver 127.0.1.1. On work computer, it shows another line search nci.nih.gov.

After any change, we can restart the network by using sudo service networking restart.

On Ubuntu 18.04, it uses netplan. See

dig Command Examples

https://www.cyberciti.biz/faq/linux-unix-dig-command-examples-usage-syntax/

dig (domain information groper) is a DNS lookup utility.

DNStracer

http://www.ubuntugeek.com/dnstracer-trace-dns-queries-to-the-source.html

Dyndns and ddclient

See

nano /etc/ddclient.conf

protocol=namecheap
ssl=yes
use=web, web=dynamicdns.park-your-domain.com/getip
server=dynamicdns.park-your-domain.com
login=yourdomain.com
password=a9438540ba8a449fb0ed09c3737b9e32
@

Note that the specification should depend on the domain name registrar (eg namecheap). For namecheap, the login/password is NOT your actual credential from your domain name registrar. The password should be obtained from the domain name registrar website. The last line is about the host. If I am setting it up for a subdomain, I should enter the subdomain name (and skip the domain name part). The ssl=yes is to ensure the connection is made over https instead of http.

And run sudo ddclient -daemon=0 -debug -verbose -noquiet to verify ddclient is working. You shall get a long return with the last line looks like

SUCCESS:  updating YOURSUBDOMAIN: good: IP address set to XX.XXX.XXX.XXX

No matter which method we use, we can go to our DNS account (in namecheap, go to Dashboard -> MANAGE button -> Domains -> Advanced DNS) and temporarily change the global IP address to another one, run the update script and then check if the global IP address has been updated to the correct one.

namecheap

Mail

  • check the option of Mail Routing: I have mail server with another name and would like to add MX hostname...
  • In 'MX hostname' entering aspmx.l.google.com
  • In 'Primary' choose 'Yes, use it as my primary mail relay.'

no-ip

Similar to Dyndns. It has its own client program. Needs to build it yourself.

Also see the troubleshooting guide.

See http://ducky-pond.com/posts/12 for instruction of setting autostart on Debian system.

See http://www.coulterfamily.org.uk/pages/PCs/Linux/FAQ-LINUX-NO-IP-CLIENT.php for another approach.

Note: If noip2 cannot start automatically or noip2 does not update even it can be seen from ps -ef command, use sudo crontab -e command. For some reason, after I use sudo crontab, noip2 can update IP. So the only problem right now is it cannot update every 30 minutes even sudo noip2 -S says so. The problems may be 1. ps -ef shows the command runs from nobody user 2. sudo noip2 -S says it updates every 30 minutes via /dev/eth0 with NAT enabled.

Update: An alternative is to use ddclient. However, ddclient never updates the IP.

Mail

  • Allow only one MX record for each host for free no-ip account.
  • Click Host/Redirects > Manage Hosts > Modify.

webmin

See http://www.webmin.com/deb.html

wget http://prdownloads.sourceforge.net/webadmin/webmin_1.600_all.deb
dpkg --install webmin_1.600_all.deb

The install will be done automatically to /usr/share/webmin, the administration username set to root and the password to your current root password. You should now be able to login to Webmin at the URL http://localhost:10000/. Or if accessing it remotely, replace localhost with your system's IP address.

Virtualize Linux

http://www.linuxuser.co.uk/features/how-to-virtualise-linux-part-1

CPU

$ grep name /proc/cpuinfo | sort -u
model name	: AMD Phenom(tm) II X6 1055T Processor      # home

model name	: Intel(R) Xeon(R) CPU  X7560  @ 2.27GHz    # helix

model name	: Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz  # office

Find out if the OS is running in a virtual environment

Linux adds the hypervisor flag to /proc/cpuinfo if the kernel detects running on some sort of a hypervisor. See here.

cat /proc/cpuinfo | grep hypervisor

Virtualbox

See here.

VBoxClient: the VirtualBox kernel service is not running

Got the above message on the upper right corner of the screen for every booting. Note I don't install VirtualBox. A solution is run

gksudo gedit /etc/X11/Xsession.d/98vboxadd-xclient

find the line

notify-send "VBoxClient: the VirtualBox kernel service is not running.  Exiting."

Now change notify-send to echo.

Thin client

https://help.ubuntu.com/community/ThinClients

UbuntuLTSP

LTSP

Raspberry Pi

Running Raspberry Pi’s as Thin Clients with Ubuntu 14.04 LTS

[https://help.ubuntu.com/community/UbuntuLTSP/RaspberryPi UbuntuLTSP/RaspberryPi ]

Remote desktop

Remote desktop using Chrome

Remote desktop connection from Windows 7

xtightvncserver may not play well in Unity.

Install xrdp on Ubuntu. That's it. See

sudo apt-get install xrdp
sudo /etc/init.d/xrdp start

On Windows 7, open its Remote Desktop client utility mstsc.exe.

Remote desktop connection to Windows 7 from xubuntu

sudo apt-get update
sudo apt-get install rdesktop
rdesktop xxx.xxx.x.x -f -u USERNAME -p PASSWORD
rdesktop 192.168.1.4 -g 1280x720 -u USERNAME -p PASSWORD

where -f option means full screen and -g means geometry.

Remote desktop connection to NCI

Note the information here is outdated now.

The version 1.7.1 of rdesktop program in Ubuntu 14 has a bug with mouse cursor (invisible). To fix the bug, download the version 1.8.3 and build it. See http://ubuntuforums.org/showthread.php?t=2266743

sudo apt-get update
sudo apt-get install build-essential libx11-dev libssl-dev libgssglue-dev libpcsclite-dev
tar zxvf rdesktop-1.8.3.tar.gz 
cd rdesktop-1.8.3
./configure
make
sudo make install

After that the new rdesktop is located under /usr/local/bin folder. The old rdesktop installed through apt-get is not deleted.

ts.nci.nih.gov:1494

DOMAIN: NIH

resolution: 1024 x 768

Use remmina or rdesktop or freerdp (sudo apt-get install freerdp-x11)

rdesktop ts.nci.nih.gov:1494 -d NIH -u XXXXX -g 1024x768

To share a folder from the local machine, use "-r" option

rdesktop ts.nci.nih.gov:1494 -d NIH -u XXXXX -g 1280x1024 -r disk:remotedisk=/home/$USER/Downloads

The new secure connection relies on the SmartCard is using ncits-p111.nci.nih.gov.

RealVNC

The default vnc server included in Ubuntu is not quite compatible with other clients. For example I can connect to Ubuntu 14.04 from Ubuntu 16.04 but not from a Mac. The 3rd party software is better. See the following screenshot after I have installed RealVNC server.

Realvnc-server.png

Note that RealVNC Server is not free for commercial users but is free for home users up to 5 computers & 3 users; see https://manage.realvnc.com/. An email and a password can be used to sign in your account for activating the license in VNC Server.

To start VNC server, use (https://www.realvnc.com/docs/debian-install-remove.html)

sudo /etc/init.d/vncserver-x11-serviced start

The RealVNC will have an icon sitting on the tray at the top-right corner.

Before using VNC viewer, we also need to create a VNC password in VNC Server.

On Mac, the viewer can be launched from Applications -> VNC Viewer (if we have drag and drop the app to the Applications folder).

On Chrome OS, there is an VNC Viewer for Google Chrome to use. The IP address is special. For example, 192.168.5.127:80 for port 5980. See https://www.realvnc.com/docs/faq/connect-fail.html. Unfortunately I cannot connect successfully:(

Remote desktop connection from Ubuntu to Ubuntu

  • https://help.ubuntu.com/16.04/ubuntu-help/sharing-desktop.html
  • How to Remote Access to Ubuntu 16.04 from Windows. The instruction is the same for older versions of Ubuntu.
    • On a Ubuntu server. Go to Dash, type 'desktop sharing' and select it. Check sharing. Close the dialog. Open a terminal and run ps -ef | grep vino to make sure the server is running.
    • Disable encryption. Run sudo apt install dconf-editor. Go to Dash and type 'dconf' and select 'dconf editor'. When it opens, navigate to org -> gnome -> desktop -> remote-access, and uncheck the value of 'require-encryption.' Another way is to run gsettings set org.gnome.Vino require-encryption false.
    • On a client machine (eg another Ubuntu), open a remote desktop client program (eg Remmina). Choose VNC as the protocol. Enter necessary information to connect to the server.
  • Install a VNC server on non-Unity desktop

Allow for remote desktop connection

  1. Go to System -> Preference -> Remote desktop. Allow other uses to view your desktop & uncheck you must confirm each access & require user to enter this password.
  2. Go to System -> Preference -> Monitor. Change monitor resolution to 1280 x 720.

Allow for remote desktop connection when vino failed

  • Teamviewer. It works fine. After launching it, the software automatically creates an ID and password. We can change the password so it is fixed. Then launch the software on the client. Use the partner's ID and password to connect to it.
  • NoMachine. I ran the service on my Ubuntu 12.04 server. I also tested the client on my Android 6.0 tablet and Odroid xu4 running Ubuntu 15.10. I am using the version 5.0.63. I need to use my server's user account info to connect.
odroid@odroid:~/Downloads$ ps -ef | grep nx
nx       12168     1  1 21:11 ?        00:00:20 /usr/NX/bin/nxserver.bin root 12151 --daemon
odroid   12199 12168  1 21:11 ?        00:00:12 /usr/NX/bin/nxnode.bin
nx       12225 12168  0 21:11 ?        00:00:00 /usr/NX/bin/nxd
odroid   12263 12199  1 21:11 ?        00:00:13 /usr/NX/bin/nxclient.bin --monitor --pid 1153
nx       15916 12225 24 21:28 ?        00:00:08 /usr/NX/bin/nxserver.bin -c /etc/NX/nxserver --login -H 5
odroid   15944 15916 33 21:29 ?        00:00:04 /usr/NX/bin/nxnode.bin -H 5
odroid   16130  8527  0 21:29 pts/1    00:00:00 grep --color=auto nx

odroid@odroid:~/Downloads$ ls /usr/NX/bin
drivers       nxd         nxkb        nxplayer      nxsh         nxusbd
nxagent       nxesd       nxkeygen    nxplayer.bin  nxspool
nxauth        nxexec      nxlocate    nxpost        nxssh
nxclient      nxfs        nxlpd       nxprint       nxssh-add
nxclient.bin  nxfsm       nxnode      nxserver      nxssh-agent
nxcodec.bin   nxfsserver  nxnode.bin  nxserver.bin  nxtunctl

If for some reason some nx programs disappeared, restart the service by

sudo /usr/NX/bin/nxserver --restart

It is interesting that nomachine is faster than 'ssh -X' method when I tested running a Qt application launched from Qt Creator. For example, the progress bar is not moving when it is supposed to move forward and backward when the app is launched through 'ssh -X'.

NoMachine and Amazon cloud

https://www.nomachine.com/accessing-your-remote-linux-desktop-on-amazon-elastic-compute-cloud-via-NoMachine

It seems nomachine is using port 4000.

odroid@odroid:~$ sudo nmap -sV localhost

Starting Nmap 7.01 ( https://nmap.org ) at 2016-11-16 20:10 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000051s latency).
Other addresses for localhost (not scanned): ::1
rDNS record for 127.0.0.1: odroid
Not shown: 997 closed ports
PORT     STATE SERVICE         VERSION
22/tcp   open  ssh             OpenSSH 7.2p2 Ubuntu 4ubuntu2.1 (Ubuntu Linux; protocol 2.0)
4000/tcp open  remoteanything?
7001/tcp open  X11             (access denied)
Service Info: OSs: Linux, Unix; CPE: cpe:/o:linux:linux_kernel

odroid@odroid:~$ sudo lsof -i :4000
COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nxd     735   nx    3u  IPv4  19208      0t0  TCP *:4000 (LISTEN)
nxd     735   nx    4u  IPv6  21234      0t0  TCP *:4000 (LISTEN)

X2Go

used in Linux Data Science Virtual Machine by Microsoft.

Remote desktop connection through vmware workstation

We shall be able to remote desktop connect to a Windows guest machine if the guest machine has configured to use bridge connection and a static IP. If there is a problem, it is likely caused by Window's firewall. See the two screenshots. We can just turn off the firewall of home network but keep the firewall on for the public network.

We don't need to use port forward for the remote desktop connection.

ViewActiveNetwork.png Firewall.png

Install sshd

apt-get update
apt-get install openssh-server

sftp, vsftpd and virtual users

ProFTPd

How to install ProFTPd with TLS support on Ubuntu 16.04

Install LAMP

See the page [1]

apt-get install apache2
a2enmod rewrite
apt-get install mysql-server   [I choose branch name as MYSQL root password]
apt-get install php5 php-pear php5-suhosin
apt-get install php5-mysql
/etc/init.d/apache2 restart

Another instruction including how to set up user directories for Apache web server http://wiki.debian.org/LaMp

apt-get install mysql-server mysql-client
mysql_secure_installation
apt-get install apache2 apache2-doc
apt-get install php5 php5-mysql libapache2-mod-php5
apt-get install python libapache2-mod-python

The apache configuration file is in /etc/apache2/apache2.conf.

For PHP, it is also useful to install php for command line.

sudo aptitude install php5-cli

Restarting apache before testing on web browser

/etc/init.d/apache2 restart

Debian 8

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian-8

sudo aptitude install apache2 apache2-doc
sudo aptitude install mysql-server php5-mysql
# optional
sudo mysql_secure_installation
sudo aptitude install php5-common libapache2-mod-php5 php5-cli
sudo service apache2 restart

AMPPS for a local server

http://www.howtogeek.com/219983/how-to-use-ampps-to-install-joomla-locally/

XAMPP is a free, open source cross platform web server solution stack package for Windows, Mac, and Linux. AMPPS is a software stack from Softaculous enabling Apache, MySQL, MongoDB, PHP, Perl, Python, and Softaculous auto-installer on a desktop.

Content management systems

PageKit

How to Install PageKit CMS on Ubuntu 18.04 LTS

ProcessWire

How to Install ProcessWire CMS on CentOS 7

BookStack

How to Install BookStack on Ubuntu 16.04 LTS

A docker image is also available.

Mediawiki

aptitude install mediawiki php5 apache2 mediawiki-extensions libapache2-mod-php5

This will install latex. After the end, we can use Synaptic package manager to see what were installed. Now following the instruction in https://help.ubuntu.com/community/MediaWiki, we remove the '#' from the third line so that it reads 'Alias /mediawiki /var/lib/mediawiki':

sudo nano /etc/mediawiki/apache.conf
sudo /etc/init.d/apache2 restart

Now we can start mediawiki by opening a browser and pointing it to http://localhost/mediawiki.

We need to enter

Site config
  admin username: WikiSysop
  password:

Database config
  Database name: wikidb
  DB username: 
  DB password: 
  Superuser name: root
  Superuser password: [depend on how it was chosen when installing MYSQL]

Press the button of "Installing mediawiki". We will be welcomed to the wiki page. Following the instruction,

For security reason, I remove new account creation and anonymous editing. I also remove edit counters.

Backup and Restore mediawiki: The process involves 3 parts: mediawiki system, mysql and images. See docs.google.com note.

Install moinmoin

UpnP server

Jellyfin

Jellyfin: Free Software Emby Media Server Fork Is Announced After Emby Becomes Proprietary

PS3 Media Servver

https://github.com/ps3mediaserver/ps3mediaserver

minidlna

http://bbrks.me/rpi-minidlna-media-server/

It works even I use my phone to tether data (I don't need to turn on wifi on my phone).

sudo apt-get update
sudo apt-get install minidlna
sudo nano /etc/minidlna.conf # the default location of media files is on /var/lib/minidlna

# rebuild the database. See the comments in <etc/minidlna.conf>
sudo service minidlna force-reload 
sudo service minidlna start
sudo update-rc.d minidlna defaults # ask minidlna to start up automatically upon boot.

Too bad is when I played certain videos the program crashed. The /var/log/syslog showed kernel: [96495.690373] minidlna[1627]: segfault at 0 ip 00007f4af2de9964 sp 00007fffa43014f8 error 4 in libc-2.15.so[7f4af2d54000+1b4000]. Also the minidlna process becomes 2 instead of 1 after the crash.

Kodi

Too bad the Kodi's upnp function is not stable. Kodi server disappeared so the client cannot find it.

Installing Kodi using Ubuntu based systems

PLEX

This seems to be the best from my test.

sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-gtk
sudo apt-get install handbrake-cli

Subsonic media server

Airsonic media server

How to Install Airsonic Media Server on Ubuntu 18.04 LTS. OpenJDK, Nginx,

Sonerezh music server

How to install Sonerezh Music Streaming Server on Ubuntu 18.04 LTS

Storage server GlusterFS

https://www.howtoforge.com/tutorial/high-availability-storage-with-glusterfs-on-debian-8-with-two-nodes/

Security

Automatic security update

How to Setup Automatic Security Updates on Ubuntu 16.04

https connection

HTTPOXY

https://www.howtoforge.com/tutorial/httpoxy-protect-your-server/

Fail2Ban, Tinyhoneypot and IPv4 security

MYSQL security

Just execute mysql_secure_installation from the command line.

  • You can set a password for root accounts.
  • You can remove root accounts that are accessible from outside the local host.
  • You can remove anonymous-user accounts.
  • You can remove the test database, which by default can be accessed by anonymous users.

See http://www.mysql-optimization.com/mysql-secure-installation-program.html

Meltdown and Spectre

sudo apt-get update
sudo apt-get dist-upgrade

uname -a
# 4.4.0-109

HTTPS connection issue

An https connection problem with certificate. Error message comes from Google-chrome and Safari browsers.

Your connection is not private:

HttpsNotPrivateChrome.png, HttpsNotPrivateSafari.png

If we use wget or curl on a terminal, we will get an error message

$ wget https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
--2017-04-14 09:40:01--  https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
Resolving ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)... 130.14.250.7, 2607:f220:41e:250::13
Connecting to ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)|130.14.250.7|:443... connected.
ERROR: cannot verify ftp-trace.ncbi.nlm.nih.gov's certificate, issued by ‘CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US’:
  Unable to locally verify the issuer's authority.
To connect to ftp-trace.ncbi.nlm.nih.gov insecurely, use `--no-check-certificate'.

# curl -L https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz -o sratoolkit.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (60) SSL certificate problem: Invalid certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

It is interesting after a few tries, curl works again and wget works after adding the option --no-check-certificate

$ wget --no-check-certificate https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
--2017-04-14 09:51:32--  https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
Resolving ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)... 130.14.250.11, 2607:f220:41e:250::13
Connecting to ftp-trace.ncbi.nlm.nih.gov (ftp-trace.ncbi.nlm.nih.gov)|130.14.250.11|:443... connected.
WARNING: cannot verify ftp-trace.ncbi.nlm.nih.gov's certificate, issued by ‘CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US’:
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 63707890 (61M) [application/x-gzip]
Saving to: ‘sratoolkit.2.7.0-ubuntu64.tar.gz’

sratoolkit.2.7.0-ubuntu64.tar. 100%[==================================================>]  60.76M  6.50MB/s    in 9.2s    

2017-04-14 09:51:42 (6.59 MB/s) - ‘sratoolkit.2.7.0-ubuntu64.tar.gz’ saved [63707890/63707890]

$ curl -L -O https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 60.7M  100 60.7M    0     0  6312k      0  0:00:09  0:00:09 --:--:-- 6820k

HTTPS at NCBI: Guidance for Users

https://www.ncbi.nlm.nih.gov/home/develop/https-guidance/

Compiling R

Use the following command to download required components before building any R packages. See also ubuntu package for R

sudo apt-get build-dep r-base

AppImage file - new way of installing an application

What is an “AppImage”? How do I install it?

  • AppImages can be downloaded and run without installation or the need for root rights.
  • The key idea of the AppImage format is one app = one file. Every AppImage contains an app and all the files the app needs to run. In other words, each AppImage has no dependencies other than what is included in the targeted base operating system(s).

Some examples

Create .deb file

checkinstall command

dpkg-buildpackage command

Package maintenance

wajig: Simplyfying Debian Administration

Package repository and /etc/apt/sources.list

echo "new line of text" | sudo tee -a /etc/apt/sources.list
# OR
# use 'add-apt-repository' command 
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 886DDD89
sudo add-apt-repository "deb http://deb.torproject.org/torproject.org $(lsb_release -s -c) main"
sudo apt-get update
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list'
# Or the following if the OS is Ubuntu 
# (other derived distributions like Linux Mint do not count)
# because $(lsb_release -s -c) returns the CodeName which diffs from each Linux distributions.
# sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu $(lsb_release -s -c)/" >> /etc/apt/sources.list' 

gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install r-base

sources.list.d

This directory has more contents than the /etc/apt/sources.list file. For example, on my Mint 17.2

$ cat /etc/apt/sources.list
#deb cdrom:[Linux Mint 17.2 _Rafaela_ - Release amd64 20150627]/ trusty contrib main non-free
deb http://download.virtualbox.org/virtualbox/debian trusty contrib
$ ls /etc/apt/sources.list.d
additional-repositories.list  google-chrome.list                   shutter-ppa-trusty.list
docker.list                   mc3man-mpv-tests-trusty.list         stebbins-handbrake-releases-trusty.list
ekozincew-ppa-trusty.list     official-package-repositories.list   webupd8team-java-trusty.list
getdeb.list                   openshot_developers-ppa-trusty.list  wine-wine-builds-trusty.list

See an example of how to use it: https://apt.syncthing.net/

# Add the release PGP keys:
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -

# Add the "stable" channel to your APT sources:
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list

# Update and install syncthing:
sudo apt-get update
sudo apt-get install syncthing

E: Could not get lock /var/lib/dpkg/lock

I get the above message when I run sudo apt-get update.

Solution 1:

Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?.

I can reproduce the error from a clean boot. The most possible explanation is the answer from poolie:

the command-line apt overlaps with update-manager automatically polling. So if you try again in a few minutes that should fix it.

From my experience, after I wait about 10 minutes, ps -A | grep apt won't show anything.

Solution 2:

Fix “Unable to lock the administration directory (/var/lib/dpkg/)” in Ubuntu

# Method 1: Find and Kill all apt-get or apt Processes
$ ps -A | grep apt
1760 ?    00:00:00 apt.systemd.dai
3489 ?    00:00:00 aptd
$ sudo kill -9 1760
$ sudo kill -9 3489
$ sudo apt-get install keepass2
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

# Method 2: Delete the lock Files
sudo rm /var/lib/apt/lists/lock
# and 
sudo rm /var/lib/dpkg/lock

How To Force APT Package Manager To Use IPv4 In Ubuntu 16.04

https://www.ostechnix.com/how-to-force-apt-package-manager-to-use-ipv4-in-ubuntu-16-04/

dpkg error: Package is in a very bad inconsistent state

https://askubuntu.com/questions/148715/how-to-fix-package-is-in-a-very-bad-inconsistent-state-error

The following solution works for me (zramswap-enabler in this example).

# Remove the broken package via the following command:
sudo dpkg --remove --force-remove-reinstreq zramswap-enabler

# Install the package again:
sudo apt-get install zramswap-enabler

Difference between dpkg and aptitude/apt-get/gdebi

https://askubuntu.com/questions/309113/what-is-the-difference-between-dpkg-and-aptitude-apt-get

Install a deb file

# dpkg gives more clear about the error message
sudo dpkg -i application.deb
# Or
sudo apt install application.deb

However, installing from a .deb file through dpkg does not resolve dependency issues the same way installation through apt will. See here.

So you should run sudo apt-get install -f to fix and complete the installation if any errors were encountered by dpkg.

sudo apt install -f dep1.deb dep2.deb dep3.deb

A better way to install a deb file is using the gdebi tool.

Remove deb packages

See the man page.

dpkg -l | grep 'tcl'
sudo dpkg -r tcl8.4 # -r means remove/uninstall
sudo dpkg -P tcl8.4 # -P means purge

dpkg -l | grep 'tcl'   (optional)

gdebi: an improvement over dpkg

How does gdebi automatically gets missing dependancies ? Can I use gdebi for all other installations of .deb packages?

sudo apt-get install gdebi-core

# wget newPackage.deb
# sudo gdebi -n newPackage.deb

deb files caches

See http://askubuntu.com/questions/444240/ubuntu-updates-blocked-apt-get

sudo rm -f /etc/apt/sources.list.d/*

sudo dpkg -i /var/cache/apt/archives/*.deb

sudo dpkg --configure -a

apt-cache

/var/lib/apt/lists

https://unix.stackexchange.com/questions/217369/clear-apt-get-list

List all available packages (from repositories)
apt-cache pkgnames # pkgnames is part of the command
Show package information
apt-cache show <package_name>
Check dependencies for specific packages
apt-cache showpkg <package_name>

List racing games package (kind of search packages by key words)

apt-cache search racing game
apt-cache search vsftpd

depends, recommends and suggests

How to install suggested packages in apt-get

By default, apt-get installs recommended packages.

Your option --install-suggests adds in the suggested packages and their suggested dependencies.

Note that --install-suggests will be recursive. It may install a lot of packages.

Upgrade a package

apt-get install <package_name>

Install specific version of the package

Use the "=" with the package-name and append desired version.

sudo apt-get install vsftpd=2.3.5-3ubuntu1

Remove a package

sudo apt-get remove <package_name>

To completely remove a package including their configuration files

sudo apt-get purge <package_name>
sudo apt-get remove --purge <package_name>

Rollback an apt-get upgrade

http://www.cyberciti.biz/howto/debian-linux/ubuntu-linux-rollback-an-apt-get-upgrade/

Clean up disk space

The clean command is used to free up the disk space by cleaning retrieved .deb files from the local repository.

sudo apt-get clean

Auto clean up apt-get cache

sudo apt-get autoclean

The 'autoclean' command deletes all .deb files from /var/cache/apt/archives to free up disk space.

Download only source code of package

sudo apt-get --download-only source <package_name>

To download and unpack source code of a package

sudo apt-get source <package_name>

To download, unpack and compile a package

sudo apt-get --compile source <package_name>

Download without installing

sudo apt-get download <package_name>

Check change log of package

Note that the change log may not be found.

sudo apt-get changelog <package_name>

Simulate installing packages

$ sudo apt-get -s install packagename

$ sudo apt-get -s build-dep packagename
$ man apt-get

Generally, it is good to build-dep then install package.

Check broken dependencies

sudo apt-get check

Search missing package's full name

Use the apt-file command. See this post

At first, install apt-file command and prepare it.

$ sudo apt-get install apt-file
$ sudo apt-file update

To find zlib.h,

$ apt-file search zlib.h

It reports too many result. Let’s narrow down.

$ apt-file search /usr/include/zlib.h
zlib1g-dev: /usr/include/zlib.h

Now you know zlib.h is in zlib1g-dev package.

$ sudo apt-get install zlib1g-dev

Find package information before installing it

Use "-s" option for simulation. No sudo is necessary.

apt-get -s install PACKAGENAME

The output is too much (include other dependences)

A better way is to use aptitude (which is not installed by default in Ubuntu)

aptitude search <package> -F "%c %p %d %V"

For example,

debian@beaglebone:~/qt-4.8.5/bin$ aptitude search  qtcreator -F "%c %p %d %V"
p qtcreator                         lightweight integrated development environme 2.5.0-2       
p qtcreator:armel                   lightweight integrated development environme 2.5.0-2       
p qtcreator-dbg                     debugging symbols for Qt Creator IDE         2.5.0-2       
p qtcreator-dbg:armel               debugging symbols for Qt Creator IDE         2.5.0-2       
p qtcreator-doc                     documentation for Qt Creator IDE             2.5.0-2   

If a package is already installed, we can use the following way to check version number.

apt-show-versions <package>

dpkg Command : View Package Information On Debian/Ubuntu/Mint Systems

dpkg -s r-base

aptitude Command : View Package Information On Debian/Ubuntu/Mint Systems

aptitude show htop

List files in a package

dpkg -L <package_name>

Search installed packages

dpkg -l libgtk* | grep -e '^i'
dpkg -l libpng* | grep -e '^i'
dpkg -l libjpeg* | grep -e '^i'

To search x-org related packages

udooer@udoo:~$ dpkg -l | grep xserver-xorg | awk '{$1=$3=$4=""; print $0}'  # Skip columns 1,3,4
 imx-xserver-xorg-extension-viv-9t6-hdmi   Freescale Xorg server driver extension for HDMI performance
 imx-xserver-xorg-video-viv-9t6   Xorg server driver for imx6, vivante
 xserver-xorg   X.Org X server
 xserver-xorg-core   Xorg X server - core server
 xserver-xorg-dev   Xorg X server - development files
 xserver-xorg-input-all   X.Org X server -- input driver metapackage
 xserver-xorg-input-evdev   X.Org X server -- evdev input driver
 xserver-xorg-input-synaptics   Synaptics TouchPad driver for X.Org server
 xserver-xorg-input-wacom   X.Org X server -- Wacom input driver
 xserver-xorg-video-all   X.Org X server -- output driver metapackage
 xserver-xorg-video-fbdev   X.Org X server -- fbdev display driver
 xserver-xorg-video-modesetting   X.Org X server -- Generic modesetting driver
 xserver-xorg-video-omap   X.Org X server -- OMAP display driver
 xserver-xorg-video-vesa   X.Org X server -- VESA display driver

List of installed packages

dpkg --get-selections 
# Or using [https://wiki.debian.org/ListInstalledPackages dpkg-query] utility.
dpkg-query -l

Install a list of packages

How to get list of installed packages on Ubuntu / Debian Linux

Suppose we want to install all packages currently installed on server 1 onto server 2, we can do that by

# server 1
dpkg --get-selections | grep -v deinstall > mylist.txt
# server 2
sudo dpkg --set-selections < mylist.txt

Show (sort) package size

dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n

Check if a library is installed or not (ldconfig)

Use ldconfig -p | grep LIBNAME ('-p' is used to print the list stored in the current cache). For example, to check if libxml is installed or not, then following code will output the number of matches if it was found.

EXIST=`ldconfig -p | grep libxml | wc -l`
if [ $EXIST -ne 0 ]; then echo $EXIST; fi

The following code will search "libQt" and the library version will be shown in the file name.

ldconfig -p | grep libQt
# On Ubuntu 14.04, 16.04:
# libQtGui.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libQtGui.so.4
# On Ubuntu 17.10, 18.04:
# libQt5Gui.so.5 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5

To install libQtGui.so.4 in Ubuntu 18.04, run the command

sudo apt-get install libqtgui4

See also the ldd command to print all dynamic dependencies of an executable program.

How to uninstall software

http://www.howtogeek.com/229699/how-to-uninstall-software-using-the-command-line-in-linux/

Upgrade software packages

Upgrade all the currently installed software packages on the system

sudo apt-get upgrade

If you want to upgrade, unconcerned of whether software packages will be added or removed to fulfill dependencies, use

sudo apt-get dist-upgrade

List of available (uninstalled) packages

aptitude -F "%p" search "?not(?installed)"

See http://superuser.com/questions/408082/how-do-i-get-a-list-of-available-i-e-uninstalled-packages-in-debian

Check Change Log of Package

sudo apt-get changelog PKGNAME

Clean up/remove packages

ubuntugeek.com

unmet dependencies after adding a PPA & apt --fix-broken

http://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa

$ sudo apt-get install libgl1-mesa.dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libgl1-mesa-dev-lts-quantal' for regex 'libgl1-mesa.dev'
Note, selecting 'libgl1-mesa-dev' for regex 'libgl1-mesa.dev'
Note, selecting 'libgl1-mesa-dev-lts-saucy' for regex 'libgl1-mesa.dev'
Note, selecting 'libgl1-mesa-dev-lts-trusty' for regex 'libgl1-mesa.dev'
Note, selecting 'libgl1-mesa-dev-lts-utopic' for regex 'libgl1-mesa.dev'
Note, selecting 'libgl1-mesa-dev-lts-vivid' for regex 'libgl1-mesa.dev'
Note, selecting 'libgl1-mesa-dev-lts-raring' for regex 'libgl1-mesa.dev'
libgl1-mesa-dev is already the newest version.
libgl1-mesa-dev set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgl1-mesa-dev : Conflicts: libgl-dev
                   Conflicts: libgl1-mesa-dri-dev
 libgl1-mesa-dev-lts-utopic : Depends: mesa-common-dev-lts-utopic (= 10.3.2-0ubuntu1~trusty2) but it is not going to be installed
                              Depends: libgl1-mesa-glx-lts-utopic (= 10.3.2-0ubuntu1~trusty2) but it is not going to be installed
                              Conflicts: libgl-dev
                              Conflicts: libgl1-mesa-dev
                              Conflicts: libgl1-mesa-dri-dev
 libgl1-mesa-dev-lts-vivid : Depends: mesa-common-dev-lts-vivid (= 10.5.9-2ubuntu1~trusty2) but it is not going to be installed
                             Depends: libgl1-mesa-glx-lts-vivid (= 10.5.9-2ubuntu1~trusty2) but it is not going to be installed
                             Conflicts: libgl-dev
                             Conflicts: libgl1-mesa-dev
                             Conflicts: libgl1-mesa-dri-dev
                             Conflicts: xorg-renamed-package-lts-utopic
E: Unable to correct problems, you have held broken packages.

Unmet dependencies when trying to install r-base (Works on Ubuntu 16.04).

sudo apt --fix-broken install
sudo apt-get update
sudo apt-get upgrade

Fix broken Ubuntu

How To Fix Broken Ubuntu OS Without Reinstalling It

$ sudo rm /var/lib/apt/lists/lock
$ sudo rm /var/lib/dpkg/lock
$ sudo rm /var/lib/dpkg/lock-frontend
$ sudo dpkg --configure -a
$ sudo apt clean
$ sudo apt update --fix-missing
$ sudo apt install -f
$ sudo dpkg --configure -a
$ sudo apt upgrade
$ sudo apt dist-upgrade
$ sudo reboot

Software automation

Ansible

Ansible is a free and open source software that can be used to automate software provisioning, configuration management, and application deployment.

How to Install and Configure Ansible on Ubuntu 18.04 LTS

Terminal Assistant

Torrent

Top 6 Torrent Alternatives to The Pirate Bay (7/5/2017)

(old) Popular search sites

  • torrentz
  • thepiratebay
  • isohunt
  • kickass torrents

How to set up torrent scheduling on Linux

https://www.howtoforge.com/tutorial/how-to-set-up-torrent-scheduling-on-linux/. It covers 'Deluge', 'Transmission' and 'Rtorrent'.

This can be useful for people who want to take advantage of their computer while they are not using it, like during the nighttime for example. This way, large portions of huge files can be downloaded without delaying your work activities, or interrupting/undermining your media consumption.

Torrent client command line: aria2c

aria2 is a lightweight multi-protocol & multi-source command-line download utility. It supports HTTP/HTTPS, FTP, BitTorrent and Metalink. aria2 can be manipulated via built-in JSON-RPC and XML-RPC interfaces.

http://linuxconfig.org/aria2-all-in-one-command-line-download-tool

sudo apt-get install aria2
aria2c magnet:?xt=urn:btih:1e99d95f1764644a86a8e99bfd80c ...

Torrent client: transmission-cli

https://wiki.archlinux.org/index.php/Transmission

Torrent client command line: rtorrent

We first need to create an .rtorrent.rc file under $HOME directory. Then run

rtorrent XXX.torrent

In the simplest case, .rtorrent.rc looks like

# On the terminal, mkdir ~/Downloads/rsession
download_rate = 0
upload_rate =50
directory = ~/Downloads
session = ~/Downloads/rsession
port_range = 55556-55560
scgi_port = 127.0.0.1:5000
use_udp_trackers = yes
encryption = allow_incoming,try_outgoing,enable_retry

As you can see here, I have created a sub-directory rsession under ~/Downloads/.

Keybinding:

  • ctrl + q = quit application
  • ctrl + d = stop an active download
  • ctrl + s = start downloading

glibc

Patch glibc 2.9

sudo apt-get update
sudo apt-get upgrade
sudo reboot

SSL

Install commercial SSL certificate

check openssl version

http://askubuntu.com/questions/504928/how-to-check-which-openssl-version-is-use-by-apache-on-ubuntu-12-04

odroid@odroid:~$ apt-cache policy openssl
openssl:
  Installed: 1.0.2g-1ubuntu4.5
  Candidate: 1.0.2g-1ubuntu4.5
  Version table:
 *** 1.0.2g-1ubuntu4.5 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main armhf Packages
        500 http://ports.ubuntu.com/ubuntu-ports xenial-security/main armhf Packages
        100 /var/lib/dpkg/status
     1.0.2g-1ubuntu4 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial/main armhf Packages

# Ubuntu 14.04
$ openssl version 
OpenSSL 1.0.1f 6 Jan 2014
# Macbook Pro 10.11
$ openssl version 
OpenSSL 0.9.8zh 14 Jan 2016

check openssl location

A more general way is to use openssl version -d

# On Ubuntu 14.04
$ openssl version -d
OPENSSLDIR: "/usr/lib/ssl"
$ ls /usr/lib/ssl
certs  misc  openssl.cnf  private
$ ls -l /usr/lib/ssl
total 4
lrwxrwxrwx 1 root root   14 Oct  7 11:03 certs -> /etc/ssl/certs
drwxr-xr-x 2 root root 4096 Feb 11 09:12 misc
lrwxrwxrwx 1 root root   20 Jan 30 15:42 openssl.cnf -> /etc/ssl/openssl.cnf
lrwxrwxrwx 1 root root   16 Oct  7 11:03 private -> /etc/ssl/private
$ ls -l /etc/ssl/certs | head
total 912
lrwxrwxrwx 1 root root     26 Oct  7 11:03 00673b5b.0 -> thawte_Primary_Root_CA.pem
lrwxrwxrwx 1 root root     45 Oct  7 11:03 02265526.0 -> Entrust_Root_Certification_Authority_-_G2.pem
lrwxrwxrwx 1 root root     29 Oct  7 11:03 024dc131.0 -> Microsec_e-Szigno_Root_CA.pem
lrwxrwxrwx 1 root root     31 Oct  7 11:03 02b73561.0 -> Comodo_Secure_Services_root.pem
lrwxrwxrwx 1 root root     36 Oct  7 11:03 03179a64.0 -> Staat_der_Nederlanden_EV_Root_CA.pem
lrwxrwxrwx 1 root root     25 Oct  7 11:03 034868d6.0 -> Swisscom_Root_EV_CA_2.pem
lrwxrwxrwx 1 root root     16 Oct  7 11:03 03f2b8cf.0 -> WoSign_China.pem
lrwxrwxrwx 1 root root     41 Oct  7 11:03 04f60c28.0 -> USERTrust_ECC_Certification_Authority.pem
lrwxrwxrwx 1 root root     40 Oct  7 11:03 052e396b.0 -> AddTrust_Qualified_Certificates_Root.pem
$ ls -l /etc/ssl/certs | wc -l
533

# On Macbook Pro 10.11
$ openssl version -d
OPENSSLDIR: "/System/Library/OpenSSL"
$ ls -l /System/Library/OpenSSL
total 8
drwxr-xr-x  2 root  wheel    68 May 15  2016 certs
drwxr-xr-x  8 root  wheel   272 May 15  2016 misc
-rw-r--r--  1 root  wheel  9390 May 15  2016 openssl.cnf
drwxr-xr-x  2 root  wheel    68 May 15  2016 private
$ ls -l /System/Library/OpenSSL/certs/
$ # empty results

openssl & patch bug

brb@vm-1404:~$ sudo dpkg -l | grep  openssl
ii  libgnutls-openssl27:amd64   2.12.23-12ubuntu2.2   amd64        GNU TLS library - OpenSSL wrapper
ii  openssl                     1.0.1f-1ubuntu2.15    amd64        Secure Sockets Layer toolkit - cryptographic utility
ii  python-openssl              0.13-2ubuntu6         amd64        Python 2 wrapper around the OpenSSL library
brb@vm-1404:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.1 LTS
Release:	14.04
Codename:	trusty

brb@vm-1404:~$ openssl version -a
OpenSSL 1.0.1f 6 Jan 2014
built on: Fri Jun 20 18:54:02 UTC 2014
platform: debian-amd64
options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx) 
compiler: cc -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 
OPENSSLDIR: "/usr/lib/ssl"

brb@vm-1404:~$ sudo apt-get changelog openssl | grep CVE-2014-0224
    - debian/patches/CVE-2014-0224-regression2.patch: accept CCS after
    - debian/patches/CVE-2014-0224.patch: set the CCS_OK flag when using
    - debian/patches/CVE-2014-0224-1.patch: only accept change cipher spec
    - debian/patches/CVE-2014-0224-2.patch: don't accept zero length master
    - debian/patches/CVE-2014-0224-3.patch: allow CCS after resumption in
    - CVE-2014-0224

Let's Encrypt SSL

It takes less than 5 minutes for the whole process!

sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-apache
sudo certbot --apache

Let’s Encrypt certificates are valid for 90 days, but it’s recommended that you renew the certificates every 60 days to allow a margin of error. The Let's Encrypt client has a renew command that automatically checks the currently installed certificates and tries to renew them if they are less than 30 days away from the expiration date.

So we can add the following line to the cron job that will execute the letsencrypt-auto renew command every Monday at 2:30 am. sudo crontab -e

30 2 * * 1 certbot renew >> /var/log/le-renew.log

Note if you currently have already had a working SSL certificate (eg from a purchased one), then even you have removed the certificate from the relevant Apache files you still can't run through sudo certbot. But once your current working SSL certificate expires, sudo certbot will successfully go through even you don't manually remove the certificate from your system.

pem file

Install webmin

apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.600_all.deb
dpkg --install webmin_1.600_all.deb

Webmin.png

File does not exist: /var/www/favicon.ico from /var/log/apache2/error.log

The reason? You have not created a favicon, also known as a website icon, for your website. It’s the icon that displays in the address bar of your web browser when you connect to a website. A web browser will request this icon file from every website.

If you choose to create one. Use a program such as Gimp and create a 16×16 pixel image and save it as a .ico filetype. Then upload that file to the DocumentRoot of your website. You will need one for each VirtualHost. If you don’t have Gimp, there are online resources such as favicon.cc where you can create a .ico file and download it for your own use.

As you know by now, not having a favicon.ico file, won’t stop web browsers from requesting it each time. But you can tell Apache not to log the event as an error message. You will still see the request in the access.log, but at least you will have a cleaner error.log file.

Add the following block of code to each VirtualHost, or at least the ones which don’t have a favicon file.

Redirect 404 /favicon.ico
<Location /favicon.ico>
 ErrorDocument 404 "No favicon"
</Location>

Don’t forget to restart apache after making the change. If you want make a “global” change, which would apply to any and all VirtualHosts, you can create a file in Apache’s conf.d folder with a name such as nofavicon.conf and then add that block of code to the file. That would disable favicon across the board and save you from having to edit each VirtualHost.

Or, you create an empty file with the name “favicon.ico” in the directory root of Apache (for exemple /var/www/).

Show weather on the taskbar

http://www.noobslab.com/2012/10/important-thingstweaks-to-do-after.html

WebCam

https://help.ubuntu.com/community/Webcam

Install cheese or guvcview. An example of using computer vision on Raspberry Pi.

Watch TV

Freetuxtv

Running concrete5 On Nginx (LEMP)

http://www.howtoforge.com/running-concrete5-on-nginx-lemp-on-debian-squeeze-ubuntu-12.10

Open mms stream in google chrom in linux

http://www.thermetics.net/2011/12/07/how-to-open-mms-links-from-chrome-under-ubuntu/

Download mms stream (suitable if mms is an extension; for example, studioclassroom)

  • Use mimms (will NOT output to speaker at the same time; so is best in terms of performance)
sudo apt-get install mimms
mimms -t 60 mms://example.com/video

where -t option specifies number of minutes. See http://linuxers.org/howto/how-download-mms-streaming-videos-ubuntu The output will have the same extension as the input. But it is not always clear. For example

$ mimms -t 3 mms://bcr.media.hinet.net/RA000073                                                                                                    
mms://bcr.media.hinet.net/RA000073 => RA000073.wmv
1.48 MB / ∞ B (8.79 kB/s, ∞ s remaining)           
Download stopped after user-specified timeout.


  • Use mplayer (will output to speaker at the same time, so suffer from performance, anyway do not get output)
mplayer mms:/link/something.xxx -dumpstream -dumpfile file.xxx

mms:/link/something.xxx - link to the stream you wish to download file.xxx - file to which you wish to download the stream, be careful to write the same extension xxx

Wait for the file to download and that's it. See http://ubuntuhowtos.com/howtos/download_mms_stream

Keep a linux process running after log out

# nohup command-with-options &

Open Firefox in cron job

The trick is to use export DISPLAY=:0

export DISPLAY=:0
firefox http://www.google.com &

Close firefox gracefully

Use wmctrl command.

sudo apt-get install wmctrl
wmctrl -c firefox

Audio recorder

Top 5 Audio Recorders for Ubuntu Recommendation

sudo add-apt-repository ppa:audio-recorder/ppa
sudo apt update; sudo apt install audio-recorder

Record audio out from your browser using the command line

http://www.pantz.org/software/alsa/recording_sound_from_your_web_browser_using_linux.html

Step 1: Install required programs

sudo apt-get install gnome-media pavucontrol lame

Step 2: Create a script file <recordfm.sh>

#!/bin/bash
# Get pulseaudio monitor sink monitor device then pipe it to 
# sox to record wav, lame to encode to mp3, or flac to encode flac
FILENAME="$1"
STOPTIME="$2"
# Encoding options for lame and flac.
LAMEOPTIONS="--preset cbr 192 -s 44.1" 

if [ -z "$FILENAME" ]; then
    echo -e "
    Usage: $0 /path/to/output.mp3
    Usage: $0 /path/to/output.mp3 stopinseconds" >&2
    exit 1
fi

# Get sink monitor:
MONITOR=$(pactl list | egrep -A2 '^(\*\*\* )?Source #' | \
    grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1)
echo "set-source-mute ${MONITOR} false" | pacmd >/dev/null

# Record it raw, and pipe to lame for an mp3
echo "Recording to $FILENAME ..."

if [[ $FILENAME =~ .mp3$ ]]; then
  if [ -z $STOPTIME ]; then
    parec -d $MONITOR | lame $LAMEOPTIONS -r - $FILENAME 
  else
    echo -e "\nStopping in $STOPTIME seconds"
    parec -d $MONITOR | lame $LAMEOPTIONS -r - $FILENAME 2>&1 &
    SPID=$!
    sleep $STOPTIME
    kill -9 $SPID
  fi
fi 

Step 3: play the music or launch a browser with a desired url.

Step 4: run the bash script

chmod +x recordfm.sh
./recordfm.sh test.mp3 10

where <test.mp3> is the output filename and 10 is recording length (seconds). It works.

Note the script teaches us how to find out the ID for a process we just launched (cleaner than using ps -ef | grep commands). The command is

SPID=$!
echo $SPID

Advanced audio control

https://www.howtoforge.com/tutorial/advanced-audio-control-on-linux/

  • Alsamixer
  • Pulse Audio Volume Control
  • Pulse Audio Equalizer

SMPlayer

MPV - terminal media player

sudo apt install mpv
mpv <URL_of_Video>

Subversion

How to Setup Apache Subversion with Let's encrypt SSL on Ubuntu 18.04 (including ufw firewall configuration)

CVS

CVS server

# Original data dir: /home/mli/Downloads/hmv_arc
# CVS dir on server (CVSROOT): /home/mli/cvsrep
# CVS dir on local:  /home/mli/Downloads/localcvs
# Project name: mycvs
# cvs user name: mli

sudo apt-get install cvs

mkdir ~/cvsrep
export CVSROOT=/home/mli/cvsrep
cvs init
sudo groupadd mycvsgrp
sudo useradd -G mycvsgrp mli # Assume mli is a new user
sudo usermod -a -G mycvsgrp mli  # assume mli is an existing user  
groups mli  # view groups a user is in use
sudo chown -R :mycvsgrp /home/mli/cvsrep # change the group ownership of cvsrep directory to mycvsgrp.
cd ~/Downloads/hmv_arc
cvs import -m "initial" mycvs mli START # import files to CVS repository
                                        # the new subfolder mycvs has owner mli.mli

Note 1. It is OK to use the same CVSROOT for multiple modules/projects since each module/project will be saved under a separate subfolder.

Note 2. The cvs version that I have installed in my ubuntu server is 1.12.13.

$ cvs -v

Concurrent Versions System (CVS) 1.12.13-MirDebian-6 (client/server)


Quick test to checkout project to the same machine

cd ~/Downloads
mkdir localcvs
cd localcvs
cvs checkout mycvs

This will create a new subfolder 'mycvs' under ~/Downloads/localcvs.

CVS repository on server has a structure

cvsrep/CVSROOT
cvsrep/mycvs

CVS sandbox on local machine has a structure

mycvs/CVS
mycvs/[files1]
mycvs/[files2]

CVS client (ubuntu)

Check out

cvs -d :ext:[email protected]:/home/mli/cvsrep checkout mycvs
# OR 2 steps
export CVSROOT=:ext:[email protected]:/home/mli/cvsrep
cvs checkout mycvs

Commit a new file

cvs add mynewfile
cvs commit -m "my log message" mynewfile

Update repository

cvs update -P -d
# OR
cvs update filename

where -P "prunes" directories that are empty, and -d tells cvs to include any new directories that aren't in your local workspace

Get a list of all tags and branches

# Lists all tags and braches for each and any file together with the revision it belongs to.
cvs status -v

# http://stackoverflow.com/questions/566093/how-do-i-identify-what-branches-exist-in-cvs
cvs log -h | awk -F"[.:]" '/^\t/&&$(NF-1)==0{print $1}' | sort -u

Encoding of a file

$ cvs -d :ext:[email protected]:/home/mli/cvsrep checkout mycvs
$ file -bi mycvs/src/hmvUnicode.rc
text/x-c; charset=utf-16le

CVS client (windows)

I use WinCVS for a demonstration

  • Remote -> checkout module
  • Module name: mycvs
  • CVSROOT:
    • protocol: ssh
    • repository path: /home/mli/cvsrep
    • user name:
    • host name: taichi.selfip.net

If I use TortoiseCVS (1.12.5 from 1/24/2011), I need to choose ext as protocol instead ssh. Still the checked out file 'hmv_.rc' still contains unreadable Chinese characters. The cvsnt is the latest free version (2.5.05). If I want to use WinCVS + cvsnt from TortoiseCVS, the options in the CVSROOT dialog looks weird and cannot create a connection.

For the unicode encoding. If I commit the file at first from ubuntu os, but check out in Windows. The checked out file has right encoding (using Notepad ++, or from VS2010). However, the file does not have right line ending and it shows Chineses character when I open it in either Notepad++ or VS2010.

To see hidden characters in Linux, try either one of the following 2 methods:

  • Open the file in EMACS and do a M-X hexl-mode
  • geany editor.

The solution I have found to overcome accessing unicode (utf-16) file on Windows OS is using Cygwin.

  • Download setup.exe from http://cygwin.com/install.html
  • Root directory = c:\cygwin
  • Local package directory = C:\Users\brb\Downloads
  • Direct connection
  • Download site: ftp://cygwin.mirrors.pair.com (Some mirrors are not updated & contain old version of packages! For example, make sure the cvs version is 1.12.13.)
  • Search: cvs. Click plus sign next to "Devel". Click 'Skip' corresponding to cvs package.
  • Search: ssh. Click plus sign next to "Net". Click 'skip' correspond to openssh package.
  • Click 'Next' button.
  • Click 'Finish' button.
  • Now open 'Cygwin Terminal' icon on Windows Desktop.
export CVSROOT=:ext:[email protected]:/home/mli/cvsrep
cvs checkout mycvs

The 'mycvs' directory should be under C:\cygwin\home\brb (a.k.a. /home/brb in cygwin) directory. We can open 'hmv_.rc' file in Notepad++ to double check if the file looks normal OR use md5sum to check.

Difference between CRLF (Windows), LF (Linux, Mac) and CR

This is a good summary I found: http://stackoverflow.com/questions/1552749/difference-between-cr-lf-lf-and-cr-line-break-types

  • The Carriage Return (CR) character (0x0D, \r) moves the cursor to the beginning of the line without advancing to the next line. This character is used as a new line character in Commodore and Early Macintosh operating systems (OS-9 and earlier).
  • The Line Feed (LF) character (0x0A, \n) moves the cursor down to the next line without returning to the beginning of the line. This character is used as a new line character in UNIX based systems (Linux, Mac OSX, etc)
  • The End of Line (EOL) character (0x0D0A, \r\n) is actually two ASCII characters and is a combination of the CR and LF characters. It moves the cursor both down to the next line and to the beginning of that line. This character is used as a new line character in most other non-Unix operating systems including Microsoft Windows, Symbian OS and others.

Common CVS commands

cvs checkout MODULE
cvs checkout DIR
cvs checkout DIR/SUBDIR
cvs co DIR/SUBDIR/FILENAME
# check out a specific tag and put it in a specified directory. 
# the specified directory name will replace the module name in output.
mkdir localcvs
cvs checkout -r v4_3 -d localcvs MODULE

cvs add myfile.c
cvs add -kb myfile.bin
# If you accidentally add a file, simply skip the commit for that file.

cvs update –dA DIR/SUBDIR 
# -d: Create  any  directories  that  exist in the repository if they're missing from the working directory.
# -A: Reset any sticky tags, dates, or -k options. Needed after you use "cvs update -D" or "cvs update -r".
cvs update –A DIR/SUBDIR/FILENAME    

cvs commit
cvs commit –m "add test suite" DIR/SUBDIR/FILENAME

mkdir ~/original
touch ~/original/newfile
cvs import ~/original VENDORTAG RELEASETAG

mkdir ~/localcvs
cd ~/localcvs
cvs checkout common/too

cvs diff -r1.23 -r1.24 SUBDIR/FILENAME     # Difference between specified versions 1.23 & 1.24.
cvs diff -D "1 hour ago" MODULE
cd LOCALCVS; cvs diff 
cvs checkout -D "1 hour ago" MODULE
cvs checkout -D "2013-02-27 01:30" MODULE

rm file(s); cvs remove file(s); cvs commit -m "Comment text" file(s)
# You must rm the file before issuing the cvs remove command. The remove is not final until the commit has been issued.

# cvs does not let you remove directories. However it does let you ignore any directories that are empty.
cvs co -P Offline
cvs update -PdA
# P: Prune empty directories. d: create new directories. A: Reset sticky tags

cvs history -c -a -D "1 day ago"  -z "-0500"
# find all changes submitted to the repository by anyone in the past day. 
# -z is used to adjust the time zone.

cvs history -c -a -D "1 day ago" -f Mu2eG4/src
# find all changes submitted to Mu2eG4/src (or any other subdirectory) by anyone in the past day

cvs history -c -u USER "1 day ago" -f Mu2eG4/src 
# find all changes submitted by USER to Mu2eG4/src in the past day

cvs log FILENAME

Bypass SSH password login (convenient for CVS, git etc)

http://www.howtogeek.com/tips/bypass-ssh-logins-by-adding-your-key-to-a-remote-server-in-a-single-command/

  1. ssh-keygen -t rsa
  2. (make sure the remote server has .ssh directory)
  3. cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
  4. ssh user@hostname

It helps with CVS log in too when the CVS works by using ssh protocol. Note that step 3 allows to run a shell command at a remote machine.

See https://help.github.com/articles/generating-ssh-keys also for similar instruction when work on github.

The ssh key can be copied to another a machine (pay attention to mode). Or let the new machine to create its own key pair and use ssh-copy-id to append the identity file to remote machine's ~/.ssh/authorized_keys file. See http://superuser.com/questions/332510/how-to-transfer-my-linux-ssh-keys-to-another-machine.

We can even have multiple ssh key on local machine by using <.ssh/config> file. See http://www.karan.org/blog/index.php/2009/08/25/multiple-ssh-private-keys.

Install Ubuntu to a USB flash drive

The following approach assumes the boot loader will not be put on internal hard disk if you are careful enough. See also http://fernhilllinuxproject.com/guidesandhowtos/installubuntutousbdrive.html

  1. Boot from live CD in ubuntu.
  2. Insert the USB flash drive in USB Port.
  3. On desktop double click on icon 'install ubuntu 12.04'
  4. Click on continue and it will ask if you want to unmount the flash drive click on yes
  5. Choose some thing else when ask to where to install ubuntu.
  6. Next you will see your hard disk partitions and flash drive. Click on flash drive partition and then click on change. Change the partition type to ext4 and mount as to '/'. Click on ok to close the dialogue box.
  7. In last you will see a drop down menu on where to install the the boot loader. Initially it will be showing sdc,sdd but on drop down you must select sdc1 or sdd1. Failing this step you may render your computer unbootable.
  8. Then click on install and linux will be installed on your USB Flash drive.

Install a new hard drive

See also https://help.ubuntu.com/community/InstallingANewHardDrive and Mount drive

  1. Use sudo fdisk command to create partition table. Then 'n', 'p', '1', 'w' and several returns.
  2. Use sudo mkfs -t ext4 /dev/sdb1 to create a new partition
  3. Use sudo mkdir /mnt/ssd to create a new mount point
  4. Use sudo nano -Bw /etc/fstab to do auto mount on boot
  5. sudo chown -R USERNAME:USERNAME /mnt/ssd to give the ownership to the USERNAME.

Add second hard disk (3TB) to Ubuntu 16.04

How to install a Ceph Storage Cluster on Ubuntu

https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/

Building a simple Beowulf Like Cluster with Ubuntu

See also the Raspberry Pi page where a simple cluster was built.

MPICH2

Resource:

  1. http://byobu.info/article/Building_a_simple_Beowulf_cluster_with_Ubuntu/
  2. https://help.ubuntu.com/community/MpichCluster
  3. https://help.ubuntu.com/community/SettingUpNFSHowTo (NFS configure)

Here is my record for creating a cluster environment based on ubuntu 13.04. The master node is running on ubuntu 13.04 desktop with virtualBox 4.2. The virtualBox has added a host-only adapter (vboxnet0) with ip 192.168.56.1. This adapter will be added to the master node so I can use this ip to identify the master node in the host-only network. Creating cluster using VirtualBox is just for the education purpose, not for real practice.

  • (virtualBox) Create two virtual machines running on ubuntu 13.04 server. The ssh server was checked during installation. The host name for each of them is ubuntuNode1 and ubuntuNode2 respectively. The network adapter is left by default (NAT) during installation. But after the installation is done, I shutdown the system and add a host-only adapter (vboxnet0) to each of them. Then after the system is up again, I change the IP so it is static. Do sudo nano /etc/network/interfaces and append the following before running sudo /etc/init.d/networking restart to take the change in effect.
auto eth1
iface eth1 inet static
address 192.168.56.101 # use 192.168.56.102 for ubuntuNode2
netmask 255.255.255.0
network 192.168.56.0
broadcast 192.168.56.255

Note that it is better not to add host-only network before installation, or during installation it will ask what is the primary network (confusing). So at the end each new nodes should have both eth0 and eth1 adapters and they should not reside in same subset. ifconfig may not show all adapters so we should use ifconfig -a instead. Although host-only network is used for communication between guest and guest OR guest and host, since each guest node has NAT adapter by default so the guest machine can still access the internet.

  • (master node) Edit /etc/hosts so it like like
127.0.0.1 localhost
192.168.56.1 ubuntu1304
192.168.56.101 ubuntuNode1
192.168.56.102 ubuntuNode2

Note that the master node will be used to start jobs on the cluster although it is OK to let the master node as one of nodes to execute the jobs.

  • (all nodes) Run
sudo adduser mpiuser --uid 999

It is recommeneded to use the same password for the user. This will create a new directory /home/mpiuser. This is the home directory for user mpiuser and we will use it to execute jobs on the cluster.

  • (master node) Run
sudo apt-get install nfs-kernel-server
  • (other nodes) Run
sudo apt-get install nfs-client
  • (master node) Add the following to the file /etc/exports
/home/mpiuser *(rw,sync,no_subtree_check)

or something like

/home/mpiuser 192.168.56.0/24(rw,sync,no_subtree_check)

Some people create a shared folder under /srv directory.

Now run

sudo service nfs-kernel-server restart
  • (master node)
sudo ufw allow from 192.168.56.0/24
  • (other nodes)
sudo mount ubuntu1304:/home/mpiuser /home/mpiuser

And if we want to mount the NFS shared directory when the compute nodes are booted, edit /etc/fstab by adding

ubuntu1304:/home/mpiuser /home/mpiuser nfs
  • (master node)
sudo apt-get install ssh
su mpiuser
ssh-keygen
ssh-copy-id localhost

We can test if the ssh works without passwords

ssh ubuntuNode1
echo $HOSTNAME
  • (all nodes)
sudo apt-get install mpich2
which mpirun
which mpiexec
  • (master node, mpiuser)

Go to the home directory of mpiuser and create a new file hosts. Include host names for computing nodes (it is OK to include master node, ubuntu1304, as one of computing nodes)

ubuntuNode1
ubuntuNode2
  • (all nodes)
sudo apt-get install build-essential
  • (master node, mpiuser). Creating a test file <mpi_hello.c>
#include <stdio.h>
#include <mpi.h>

int main(int argc, char** argv) {
    int myrank, nprocs;

    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
    MPI_Comm_rank(MPI_COMM_WORLD, &myrank);

    printf("Hello from processor %d of %d\n", myrank, nprocs);

    MPI_Finalize();
    return 0;
}

And compile and run it by

mpicc mpi_hello.c -o mpi_hello
mpiexec -n 3 -f hosts ./mpi_hello

We should see something like

Hello from processor 0 of 2
Hello from processor 1 of 2

Successful! That's it.

OpenMPI

With R

File sharing in a local network - woof

Sharing internet

Simple Gui approach from GNOME desktop

When I tested the method with my rtl8187 wifi adapter by Rosewill (output by lsusb) on Odroid Xu4 running Ubuntu 14.04, I got an error on Step 3 (Create New Wi-Fi Network) ???

Failed to activate connection
(32) Access Point (AP) mode is not supported by this device

When I tried the wifi adapter RT2870/RT3070 802.11n by MediaLink (MWN-USB150N), there is no problem to create it. My android device can connect to it. However, there is no internet access:( ...... After some tweaks on command line (iptables; see Sharing internet via wifi: iptables below), it works!!!

And the output of nm-tool command also confirms the wifi device is connected.

odroid@odroid:~/Downloads$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth2
10.42.0.0       0.0.0.0         255.255.255.0   U         0 0          0 wlan3
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth2

The ap hotspot from the wifi adapter has an IP 10.42.0.1 (ifconfig).

Sharing internet via wifi: ap-hotspot

I cannot make it to work to share the internet via wifi on my Xubuntu 13.04. However the solution in http://askubuntu.com/questions/287251/creating-an-infrastructure-hotspot-using-ubuntu-12-10 works for me.

$ # Under rare situation, we need to run the following line to get 'add-apt-repository'
$ sudo apt-get install apt-get install software-properties-common
$ sudo su -
# add-apt-repository ppa:nilarimogard/webupd8
# aptitude update
# aptitude install ap-hotspot
# ap-hotspot configure
# ap-hotspot start

In the step of 'ap-hotspot configure' it will ask for Access Point name and WPA passphrase.

When I run the final line 'ap-hotspot start', it will ask me to disconnect my current wifi first.

At the end, I found my original configuration in ubuntu does not work even its setting is there. apt-hotspot create an infrastracture AP instead of adhoc.

Sharing internet via wifi: iptables

1. Assume the primary wired network connection, eth0 is connected to Internet.

2. Using your distro's network managment tool, create a new ad hoc wireless connection with the following settings:

IP address: 10.99.66.55
Subnet mask: 255.255.0.0 (16)

3. Use the following shell script to share the internet connection

#!/bin/bash
#filename: netsharing.sh
#Replace 10.99.0.0/16 by your network/netmask
#Usage: ./netsharing.sh input_interface output_interface
#Example: ./netsharing.sh eth0 wlan0

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -i $1 -o $2 -s 10.99.0.0/16 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE

4. Run the script as follows:

sudo ./netsharing.sh eth0 wlan0

5. Connect your devices to the wireless network you just created with the following settings (Question: how about the SSID here?)

IP address: 10.99.66.56 (and so on)
Subnet mask: 255.255.0.0 

To make this more convenient, you might want to install a DHCP and DNS server on your machine, so it's not necessary to configure IPs on devices manually. A handy tool for this is dnsmasq which you can use for performing both DHCP and DNS operations.

Credit: Linux Shell Scripting Cookbook

A similar approach discussed on the Odroid forum.

iptables

~/.xsession-errors file is filling the hard disk

It is related to vino-server. See

Short solution is to use "kill -9 xxx" to kill the process and rm to remove ~/.xsession-errors file. The long time solution is to uninstall vino.

JRE and JDK

Install openjdk or Sun jdk. See http://www.maketecheasier.com/install-java-runtime-in-ubuntu/ (Ubuntu 12.04)

If we have multiple versions of JRE/JDK, we can use the following command to set the default version

sudo update-alternatives --config java

This approach seems to be working in the case JAVA_HOME cannot be honored.

OpenJDK

On my Ubuntu 12.04, I have two versions.

$ whereis java
java: /usr/bin/java /usr/bin/X11/java /usr/share/java /usr/share/man/man1/java.1.gz
$ java -version
java version "1.6.0_38"

$ sudo apt-get -y install openjdk-7-jdk
$ ls -l /usr/lib/jvm
total 12
lrwxrwxrwx 1 root root   20 Nov 16  2013 java-1.6.0-openjdk-amd64 -> java-6-openjdk-amd64
lrwxrwxrwx 1 root root   20 Mar 24 06:20 java-1.7.0-openjdk-amd64 -> java-7-openjdk-amd64
drwxr-xr-x 7 root root 4096 Feb 20 08:43 java-6-openjdk-amd64
drwxr-xr-x 3 root root 4096 Jan 31  2014 java-6-openjdk-common
drwxr-xr-x 7 root root 4096 Mar 30 18:16 java-7-openjdk-amd64

$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Jan 31  2014 /usr/bin/java -> /etc/alternatives/java

Question: how to switch to 1.6 or 1.7 version of java? (For example, snpEff requires java 1.7)

$ update-java-alternatives -l
java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64
java-1.7.0-openjdk-amd64 1051 /usr/lib/jvm/java-1.7.0-openjdk-amd64
$ sudo apt-get install icedtea-7-plugin
$ sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so
$ update-java-alternatives -l
java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64
java-1.7.0-openjdk-amd64 1051 /usr/lib/jvm/java-1.7.0-openjdk-amd64
$ java -version
java version "1.7.0_95"

Question: How to install OpenJDK 8 on 14.04 LTS? (for example, Picard 2 requires Java 1.8)

$ sudo apt-get -y install openjdk-8-jdk   # works for Ubuntu 14.10 and later
# Unable to locate package openjdk-8-jdk on my Ubuntu 14.04

So the solution is to install Sun jdk.

Oracle JAVA

sudo apt-add-repository -y ppa:webupd8team/java
sudo apt-get update
echo debconf shared/accepted-oracle-license-v1-1 select true |  sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true |   sudo debconf-set-selections
sudo apt-get install oracle-java8-installer

java -version

CPU/system load

Grafana

How to Install Grafana Monitoring Tool on Ubuntu 18.04 LTS

I-Nex

A look at I-Nex – a CPU-Z like Application for GNU/Linux

CPU-G

See this instruction to install CPU-G program for viewing hardware information (process, mb, graphic, memory, system).

CoreFreq

http://www.tecmint.com/corefreq-linux-cpu-monitoring-tool/

system load indicator

System Load Indicator: it is used to view system information (cpu, memory, network) in real-time.

sudo apt-get install indicator-multiload

sudo apt-get install indicator-cpufreq
indicator-cpufreq

Stacer -Linux System Optimizer and Monitoring

Stacer – The Linux System Optimizer You’ve Been Waiting For

Hard drive: hdparm and smartctl

Hard drive specification

http://www.cyberciti.biz/faq/find-hard-disk-hardware-specs-on-linux/

# hdparm command
sudo hdparm -I /dev/sda

# OR using lshw command
sudo apt-get install lshw
lshw -class disk -class storage

# Find Out Disks Name Only
lshw -short -C disk

# smartmontools package
sudo smartctl -i /dev/sda

Hard disk speed (3.0 or 6.0 Gb/s) & dd command

http://www.cyberciti.biz/faq/freebsd-command-to-find-sata-link-speed/

$ dmesg | grep -i SATA
[    0.311173] pci 0000:00:11.0: set SATA to AHCI mode
[    1.510881] ahci 0000:00:11.0: AHCI 0001.0200 32 slots 4 ports 6 Gbps 0xf impl SATA mode
[    1.512669] ata1: SATA max UDMA/133 abar m1024@0xfe02f000 port 0xfe02f100 irq 19
[    1.512672] ata2: SATA max UDMA/133 abar m1024@0xfe02f000 port 0xfe02f180 irq 19
[    1.512675] ata3: SATA max UDMA/133 abar m1024@0xfe02f000 port 0xfe02f200 irq 19
[    1.512677] ata4: SATA max UDMA/133 abar m1024@0xfe02f000 port 0xfe02f280 irq 19
[    1.832349] ata4: SATA link down (SStatus 0 SControl 300)
[    1.832418] ata2: SATA link down (SStatus 0 SControl 300)
[    2.004290] ata3: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    2.004313] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

To test the disk performance, follow cyberciti.biz. Note that the parameter oflag=dsync makes a difference.

Here I have a 7200rpm Seagate (ST2000DM001-1CH164) and a 5400rpm WD-blue (WD30EZRZ-00WN9B0)

# Hard disk info https://en.wikipedia.org/wiki/Hdparm
sudo hdparm -I /dev/sda
sudo hdparm -I /dev/sdb

# Writing speed, where /tmp is a directory from the disk 
dd if=/dev/zero of=/tmp/test1.img bs=2G count=1; rm /tmp/test1.img
# 1.4 GB/s from either 5400 or 7200 rpm

dd if=/dev/zero of=/tmp/test1.img bs=2G count=1 oflag=dsync; rm /tmp/test1.img
# 115 MB/s from 5400 rpm
# 166 MB/s from 7200 rpm

# Latency
dd if=/dev/zero of=/tmp/test2.img bs=512 count=1000 oflag=dsync; rm /tmp/test2.img
# 27.7 kB/s from 5400 rpm  <==== This is interesting
# 12.5 kB/s from 7200 rpm

# Read speed
dd if=/dev/zero of=/tmp/test3.img bs=1G count=1 oflag=direct; rm /tmp/test3.img
# 122 MB/s from 5400 rpm
# 180 MB/s from 7200 rpm

Note

  • dd manual
  • oflag=dsync: Use synchronized I/O for data. Do not skip this option. This option get rid of caching and gives you good and accurate results

Hard disk directory size

See Display directory size with sorting and human readable by using the ncdu utility.

Monitor/run a short test on a hard disk health by command line/GUI

Using smartctl

sudo apt-get install smartcontrol
sudo smartctl -a /dev/sda

# Run a short test
$ sudo smartctl -t short /dev/sda # It will start the test in the background
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.4.0-101-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in off-line mode".
Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 1 minutes for test to complete.
Test will complete after Fri Dec  1 09:58:40 2017

Use smartctl -X to abort test.
$ sudo smartctl -l selftest /dev/sda
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.4.0-101-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Self-test routine in progress 60%     11700         -
# 2  Short offline       Completed without error       00%     24992         -

or the GUI version

sudo apt-get install gsmartcontrol
sudo gsmartcontrol

How to check Hard Drive Disk Health in GNU/Linux

Interpretation:

Email warnings for hd problems by smartd

Debian Linux

  1. Enable smart by editing /etc/default/smartmontools file.
  2. Smart Configuration file: /etc/smartd.conf
  3. Start/Stop smart: /etc/init.d/smartmontools start | stop

Hard disk temperature

http://www.cyberciti.biz/tips/howto-monitor-hard-drive-temperature.html

It seems the hddtemp command does not work on SSDs.

sudo apt-get install hddtemp
sudo hddtemp /dev/sdb

/dev/sdb: ST2000DM001-9YN164: 40°C

For SSD,

sudo apt-get install smartmontools
sudo smartctl -a /dev/sda

Hard disk power on time/hours

sudo smartctl --all /dev/sda | grep Power_On_Hours

Sample output:

$ sudo smartctl -A /dev/sda | grep -i power
  9 Power_On_Hours          0x0032   034   034   000    Old_age   Always       -       58541
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       164
$ sudo smartctl -A /dev/sdb | grep -i power
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       585
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       43
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       32

system's hardware temperatures and voltages

https://www.howtoforge.com/tutorial/ubuntu-performance-monitoring/

sudo apt-get install lm-sensors
sensors

brb@brb-P45T-A:~$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +30.0°C  (crit = +110.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +41.0°C  (high = +78.0°C, crit = +100.0°C)
Core 1:       +36.0°C  (high = +78.0°C, crit = +100.0°C)

nouveau-pci-0100
Adapter: PCI adapter
temp1:        +68.0°C  (high = +95.0°C, hyst =  +3.0°C)
                       (crit = +125.0°C, hyst =  +3.0°C)
                       (emerg = +135.0°C, hyst = +10.0°C)

where nouveau is an open-source driver set for Nvidia cards. It is not clear about acpitz-virtual-0. Some suggested to use inxi which will produce human readable system info.

And on a Dell T3600 machine (running the samtools mpileup & bcftools programs),

brb@T3600 ~ $ sensors
nouveau-pci-0300
Adapter: PCI adapter
fan1:        3510 RPM
temp1:        +52.0°C  (high = +95.0°C, hyst =  +3.0°C)
                       (crit = +105.0°C, hyst =  +5.0°C)
                       (emerg = +135.0°C, hyst =  +5.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +70.0°C  (high = +81.0°C, crit = +91.0°C)
Core 0:         +60.0°C  (high = +81.0°C, crit = +91.0°C)
Core 1:         +60.0°C  (high = +81.0°C, crit = +91.0°C)
Core 2:         +56.0°C  (high = +81.0°C, crit = +91.0°C)
Core 3:         +60.0°C  (high = +81.0°C, crit = +91.0°C)
Core 4:         +70.0°C  (high = +81.0°C, crit = +91.0°C)
Core 5:         +60.0°C  (high = +81.0°C, crit = +91.0°C)

When all cores are 100% used (htop), the fan is getting noisy

brb@T3600 ~ $ sensors
nouveau-pci-0300
Adapter: PCI adapter
fan1:        4560 RPM
temp1:        +61.0°C  (high = +95.0°C, hyst =  +3.0°C)
                       (crit = +105.0°C, hyst =  +5.0°C)
                       (emerg = +135.0°C, hyst =  +5.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +82.0°C  (high = +81.0°C, crit = +91.0°C)
Core 0:         +78.0°C  (high = +81.0°C, crit = +91.0°C)
Core 1:         +81.0°C  (high = +81.0°C, crit = +91.0°C)
Core 2:         +78.0°C  (high = +81.0°C, crit = +91.0°C)
Core 3:         +80.0°C  (high = +81.0°C, crit = +91.0°C)
Core 4:         +81.0°C  (high = +81.0°C, crit = +91.0°C)
Core 5:         +77.0°C  (high = +81.0°C, crit = +91.0°C)

Unlock keyring

I got the prompt of unlocking keyring every time I open google chrome browser.

google-chrome --password-store=basic

It is also helpful to remove ubuntu one from Ubuntu 12.04. See http://hex.ro/wp/blog/removing-ubuntuone-from-ubuntu-12-04/

netcat (nc) - arbitrary TCP and UDP connections and listens

Netcat or nc is a networking utility for debugging and investigating the network.

The nc (or netcat) utility is used for just about anything under the sun involving TCP, UDP, or UNIX-domain sockets. It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, do port scanning, and deal with both IPv4 and IPv6.

For example, we can create simple network sockets and use them for text communication. We need two sockets: one listens for connections and the other connects to this one.

# create a listening socket on the local machine
nc -l 1234

# connect to the socket from a 2nd computer 
nc IP_LocalMachine 1234

# send messages. 
# Type something and press Enter on the terminal from the 2nd computer.
# The message will appear on the terminal of the local machine.

To transfer files over the network (no any password is needed!!)

# receiver machine
nc -l 1234 > destination_file

# sender machine
nc IP_Receiver 1234 < source_filename

List of all services/daemons

Run service --status-all to get a list off all the Upstart services and their status. See

  • man service
  • man initctl
service --status-all   # output format is clean

sudo initctl list      # show the process number too

where in the output "+" means started, "-" stopped, and "?" unknown.

Cloud/online storage

Mega

ownCloud

Use apt to install or go to the download page

One Drive

Google Drive

Caveats:

  • Unlike Windows or macOS, your Google Drive files are not downloaded and stored locally in Ubuntu. You must have an active internet connection to access your account.
  • The online account files are located under "/run/user/1000/gvfs/" directory.
  • PDF files can be opened by Document Viewer. When the file is loaded, it shows a random file name.
  • The doc files cannot be opened by LibreOffice. When I drag and drop the files to Terminal, they show random file names like /run/user/1000/gvfs/google-drive:host=gmail.com,user=XXXXXXX/1LOLKBssIIR0x7TWR7MHIEeSU0uPj9TwK_YuAGTzt'

Office

Libre Office

Install

WPS Office 2016

https://www.wps.com/en-US/

ONLYOFFICE Desktop Editors

https://www.howtoforge.com/tutorial/how-to-install-onlyoffice-desktop-editors-51-on-ubuntu/

Video rip/convert/transcoder

sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-gtk

sudo apt-get install handbrake-cli
  • libav-tools

To convert youtube flv file to mp4.

sudo apt-get install libav-tools
avconv -i INPUT.flv -codec copy OUTPUT.mp4

To merge audio and video

# naive: use the one with longer duration as the total length
avconv -i music.m4a -i input.mp4 -acodec aac -strict experimental output.mp4
# improved: specify the start time (-ss) and duration (-t)
# unfortunately the music at the specified end time may not be the end
# so a better way is to use a video editor (eg OpenShot) and specify fade out on the end of the audio!
avconv -i music.m4a -i input.mp4 -acodec aac -strict experimental -ss 00:00:00 -t 00:01:01 -codec copy output.mp4

To extract audio only:

avconv -i INPUT.flv -codec copy -vn OUTPUT.mp4

PC build for video editing

Video Editing 4K PC Build: Creating Content for Under a Grand

Video editing in Linux

Shotcut

It is a cross-platform open source software. See The best free video editing software: Great tools for YouTube stardom and more

I tested inserting a text in a video. Compared to Youtube video editor

  • The text is really a text. No pop-up shape to select
  • Not sure how to control the text so it only appears at a certain time interval

Not as intuitive to use.

Pitivi

Blender

Looks very professional too. Windows/Linux/OSX (binary files are provided). Worth to try.

Kdenlive

More complicated than OpenShot. Worth to try. Ubuntu 16.04.1 is needed.

Youtube Video Editor

Good

  • Annotation and Title (Video Manager -> Videos -> Edit -> End screens and annotations -> Annotations -> Add annotations (Speech bubble, Note, Title, Spotlight, Label). However, the annotations do not show up on mobile. See this post for a discussion.
  • Add photos

Bad

  • Music cannot have fade in/out

Notes

7 Things You Need to Build a Low-Cost YouTube Studio

http://www.makeuseof.com/tag/build-low-cost-youtube-studio/

Free or Open source Subtitle editor

Comparison of subtitle editors

For TV captions, use white color font with black color for borders and transparent background.

OpenShot-qt

sudo apt-get install openshot

When I needed to export the video (choose 'youtube' profile, 'youtube-HD' target, 'HD 270, 29 .97 bps', and 'high' quality), I found I need to install libx264 code. On Ubuntu, I open software center and seach 'libavformat'. I choose 'libavformat-extra-53'.

An introduction to video editing in Openshot 2.0 from howtoforge.

Don't use the version (1.4.3 date 2009) because it crashed too often.

The new version 2.0.7 (date 2016) looks a little different (theme is black. Cool!). Its icon and command (openshot-qt) are different too. The project saved from 1.4.3 cannot be opened in 2.0.7. The tools icons are different: Add track, Snapping tool, Add Marker, Previous Marker, Next Marker, Zoom in/out.

This version of OpenShot + (old) Core2Duo Ubuntu = Dynamic Heatmap Viewer video.

Audio library

You can download free music from Youtube Audio Library. If you use a copy righted music and upload your video to youtube, the video will show Ad eventually.

Take a snapshot

The keyboard shortcut Ctrl+d does not work.

One suggestion is to use VLC. VLC -> Video -> Take Snapshot. The snapshot will be automatically created in ~/Pictures/ directory (*.png format).

Procedure
  1. Put audio and video files in one folder
  2. Use openshot to create a new video. Also
    • Use the +/- sign for zoom in and zoom out
    • Right click video file and select Volume -> Entire clip -> level 0%
    • Right click audio and select Volume -> End of clip -> fade out (slow)
  3. openshot -> Save (arrow/download-like button)
  4. openshot -> Export (red circle button)
    • Modify the file name so it won't overwrite the original (openshot won't check it)
    • Select Profile = Web, Target=Youtube-HD, Video Profile=HD 1080p 25 fps, Quality=High.
  5. Check the exported video (play it first by VLC).
    • On one instance the audio is fuzzy until the middle of the video. So I have to change the audio
    • On another instance the video length is longer than I expected because the final annotation slide lasts too long. A solution is to change the setting (Profile=All Formats, Target=MP4 (h.264), Video Profile=HD 1080p 24 or 23.98 fps). If I use 25 fps, the file will be wrong.
  6. Upload to Youtube. Use Youtube video editor to include annotation.

VideoLAN Movie Creator

ffdiaporama

Create videos from images, movie clips and music.

Flowblade Movie Editor

It is written in Python. Only Linux version is available (no Windows nor OS X). Good for beginners.

sudo apt-get install flowblade

Lightworks

Free and Pro versions are available. Windows/Linux/OSX.

SMPlayer and SMTube

  • https://www.smplayer.info/
  • http://www.smtube.org/. SMTube is an application that allows to browse, search and play YouTube videos. Videos are played back with a media player (by default SMPlayer) instead of a flash player, this allows better performance, particularly with HD content. No youtube ads.
sudo add-apt-repository ppa:rvm/smplayer
sudo apt-get update
sudo apt-get install smplayer smtube

Youtube command line tools

Play audio only

http://unix.stackexchange.com/questions/229787/audio-only-youtube-player/229790#229790

# play in background (prompt will return, a new vlc process will be launched)
cvlc --vout none https://www.youtube.com/watch?v=1O0W7jSd940
# or play in foreground (prompt will not return)
/usr/bin/vlc -I dummy --vout none https://www.youtube.com/watch?v=1O0W7jSd940

Using this approach to play audio only will save CPU power. Tested on Odroid.

However, it seems this approach does not work on a playlist, for example, https://www.youtube.com/playlist?list=PL6h94tLpXv3LabUa7B0tCz7K0pI5ZzZEi. See mpsyt for a solution!

mpsyt: mps-youtube (mp3 + stream + youtube)

By default, mps-youtube is basically a YouTube audio player (and downloader), but you can enable external video playback (via mpv or MPlayer) from its options. Check out

  • An article on webupd8.
  • More keyboard controls can be found on the webpage of mps.

Installation on Linux (works on Odroid with low CPU usage for audio stream from youtube but Odroid gives dirty noise when I played the music).

sudo apt-get install python3-pip
sudo pip3 install mps-youtube
sudo pip3 install youtube_dl

# On Ubuntu/Mint. Do not use mplayer. Use mpv instead.
# sudo add-apt-repository ppa:mc3man/mpv-tests
# sudo apt-get update && sudo apt-get install mpv

mpsyt   # launch
set player mpv
pl https://www.youtube.com/playlist?list=PL6h94tLpXv3LabUa7B0tCz7K0pI5ZzZEi   # a playlist
h       # help
Space   # pause
p       # play
q       # quit mpsyt

h search
url https://www.youtube.com/watch?v=hgIfZz8STLk   # retrieve specific youtube video by url or id

Installation on Windows

Some highlight

  • Search
  • Local playlist
  • support YouTube Playlists
  • Download
  • Music Album Matching

If something is wrong with using 'set' command, just run rm -rf ~/.config/mps-youtube/ and restart everything.

By default, it only streams audio. To watch the video, use set show_video true.

Below is what I got from the set command (as you can see the default player is mpv)

  Key                 Value                                                  
  order             : relevance
  user_order        : 
  max_res           : 2160p
  player            : mpv
  playerargs        : 
  encoder           : 0 [None]
  notifier          : 
  checkupdate       : True
  show_mplayer_keys : True
  fullscreen        : False
  show_status       : True
  columns           : 
  ddir              : /home/odroid/Downloads/mps
  overwrite         : True
  show_video        : False
  search_music      : True
  window_pos        : 
  window_size       : 
  download_command  : 
  audio_format      : auto
  api_key           : AIzaSyCIM4EzNqi1in22f4Z3Ru3iYvLaY8tc3bo

The screenshot shows mpsyt contains basic playing keyboard shortcuts.

Mps-youtube.png

[Update 4-7-2017]: to fix an error Signature extraction failed: Traceback (most recent call last):

sudo apt-get remove -y youtube-dl  # Removing youtube-dl (2014.02.17-1) ...
sudo pip3 install -U youtube-dl

$ youtube-dl --version
2017.04.11

Download youtube video or audio using command line

sudo apt-get install youtube-dl
  • Fix the error 'WARNING: Your copy of avconv is outdated and unable to properly mux separate video and audio files, youtube-dl will download single file media. Update avconv to version 10-0 or newer to fix this.':

(works) http://askubuntu.com/questions/563245/avconv-warning-while-downloading-youtube-video

$ sudo add-apt-repository ppa:heyarje/libav-11 && sudo apt-get update
$ sudo apt-get install libav-tools

(not tested) Compile your own. The source code is available at https://libav.org/.

  • For videos with 1080p resolution, youtube-dl will download 720p by default. To download 1080p, see this post
# show the available resolutions
youtube-dl -F XXX
# download the desired resolution
youtube-dl -f 137+141 XXXX 
# Note the two numbers 137, 141 is case dependent. They could be 137 & 140.
youtube-dl -f 22 XXX
# if the format 22 is mp4. If I do not specify the format, the mkv file will be downloaded
# But playing mkv file tends to be stuttering with VLC.

This assumes Ubuntu has installed avconv; otherwise video(mp4) and audio(m4a) files will be downloaded separately. To install avconv, run

sudo apt-get install libav-tools
  • To download mp3 from a Youtube Video. See more info here.
youtube-dl --extract-audio --audio-format mp3 URL
  • To convert the video to mp3 format, use soundconverter
sudo apt-get install soundconverter
mps-youtube

Unity

Unity LauncherSwitcher

Ubuntugeek.com

Create Unity Launcher

Take RStudio for example,

  • Desktop icons are saved under /usr/share/icons/hicolor/16x16/apps/rstudio.png, where other than 16x16 there are also icons from 24x24, 32x32, 48x48 sizes (directories). Another place is ~/.local/share/icons/hicolor/16x16/ .
  • Unity launcher is created at /usr/share/applications/rstudio.desktop or ~/.local/share/applications/XXXX.desktop.
  • Desktop shortcut can be created by copy XXXX.desktop to ~/Desktop directory.

The icon size in the launcher can be adjusted by opening System Settings -> Apperance -> Launcher Icon Size (at the bottom).

k2pdfopt has an example how to do it for creating a desktop shortcut and be in the right click menu.

How to Convert the Unity Launcher into a Dock-Style Launcher

See an article from Howtogeek.com.

How to Get Unity’s Global App Menu in Linux Mint Cinnamon

http://www.makeuseof.com/tag/get-unitys-global-app-menu-linux-mint-cinnamon/

Remove floppy icon from Launcher

http://askubuntu.com/questions/457970/how-to-completely-disable-floppy-in-ubuntu-14-04

echo "blacklist floppy" | sudo tee /etc/modprobe.d/blacklist-floppy.conf
sudo rmmod floppy
sudo update-initramfs -u

Application Launcher

Cerebro

Cerebro is an Open Source OS X Spotlight Equivalent for Linux

Ulauncher

Ulauncher is a Lightweight App Launcher for Linux Desktops

Synapse

Synapse or Albert — What’s Your Favourite App Launcher for Linux?

Gnome Do

Release June 2009

What date was the system installed

ls -l /var/log/installer

What is the last log in time for users

lastlog  # all users
last     # current user

What is the reboot time

last reboot

Crop an image

sudo apt-get install gthumb

Open an image. Click color palette icon on top-right corner (or use keyboard shortcut 'e'). Click 'crop'. There will be a rectangle on image where you can resize the rectangle.

Pinta and mtPaint can also take a screenshot of the desktop and crop the image.

Mind-mapping

KeePass

Search Ubuntu Software Center to install KeePassX (more reviews) or KeePass2. There is no need to use ppa.launchpad.net to install from. Note that the kdbx file used in KeePass2 cannot be opened in KeePassX. To use the command line to install KeePass2,

sudo apt-get install keepass2

Note:

sudo add-apt-repository ppa:jtaylor/keepass
sudo apt-get update
sudo apt-get install keepass2

Security:

KeePass with KeeAgent

http://code.mendhak.com/keepass-and-keeagent-setup/

KeeWeb: Free cross-platform password manager compatible with KeePass

KeeWeb – An Open Source, Cross Platform Password Manager

It can open from WebDAV, Dropbox (sync and offline access), Google Drive, OneDrive, ...

A Docker exists for the self hosting method.

Update Firefox

The following instruction is used to get security-testing packages.

sudo add-apt-repository ppa:ubuntu-mozilla-security/ppa
sudo apt-get update
sudo apt-get install firefox

Or use the official PPA method. See How to install Firefox 57 “Quantum” on Linux Mint, Ubuntu, Debian, CentOS, Fedora… & How to Install Firefox Quantum in Ubuntu and other Linux Right Now

sudo add-apt-repository ppa:mozillateam/firefox-next
sudo apt update && sudo apt upgrade

Bluetooth

* https://zach-adams.com/2014/07/bluetooth-audio-sink-stream-setup-failed/ Linux Mint 
sudo apt-get install bluetooth
sudo apt-get install bluetooth bluez-utils blueman

Then run lsusb | grep Bluetooth command which will shows the name of your bluetooth device.

sudo apt-get install bluez

On my bluetooth adapter, the lsusb shows,

$ lsusb
Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
...
$ sudo hcitool dev
Devices:
	hci0	00:1A:7D:DA:71:09

I can use Ubuntu's bluetooth setting dialog to connect my bluetooth keyboard without any problem (It will ask me to enter some code on pairing).

Note that the MAC address of my bluetooth keyboard shown above is the from the controller/adapter. It is NOT the same as my bluetooth keyboard one (90:7F:61:8F:D0:38) as shown from the bluetooth setting (GUI) dialog.

Bluetooth Audio Receiver

Remember to change the Mode from Telephony Duplex (HSP/HFP) to High Fidelity Playback (A2DP) from Sound Settings dialog (launched from Taskbar). See also Windows OS.

BluetoothAudioLinux.png

Default applications and mime-types

See /etc/gnome/defaults.list.

How to easily open a PDF (or any) file from command line in Ubuntu

sudo apt-get install libgnome2-bin
gnome-open [name-of-PDF-file]

gnome-open [dir-name-or-path] # To open a directory in Nautilus file manager

gnome-open https://www.howtoforge.com/ # To open a website in your system's default web browser

Change default audio player

Right-click an MP3 file, and from the menu select “Properties”. In the window that appears, go to the “Open With” tab and select VLC or whatever. Click the “Set As Default” button to set VLC as the default player.

You might also want to set the default player in the sound menu.

Unity display timeout

Go to Dash -> power setting -> Brightness Settings

Screensaver showing current time

xscreensaver + gltext

http://askubuntu.com/questions/64086/how-can-i-change-or-install-screensavers

sudo apt-get install xscreensaver 
# sudo apt-get remove gnome-screensaver

Click Dash > xscreensaver or run the command line xscreensaver-demo. Mode = Only One Screen Saver & pick GLText. Click Setting & choose 'Display date and time' ,'Don't rotate'.

gluqlo

[Note that gluqlo uses too much cpu] I like gluqlo (flip clock) screensaver. However, it is not easy to make it to replace the gnome-screensaver.

sudo apt-add-repository ppa:alexanderk23/ppa
sudo apt-get update
sudo apt-get install gluqlo
  • Follow the instruction to install it on Ubuntu machine.
  • Follow the instruction there to remove gnome-screensaver and install xscreensaver.
  • Configure xscreensaver to use only 1 screensaver. Edit ~/.xscreensaver file and add a line like
gluqlo -root                                \n\
  • Still follow the instruction to allow xscreensaver to start when the machine starts up. Don't try to edit ~/.xinitrc file as other sites suggested; start Dash and type 'startup' and follow the screen dialog to add xscreensaver -nosplash.
  • Still follow the instruction to add lock screen keyboard shortcut.

Note that the above steps work for Ubuntu 12.04 & 13.10 but not 14.04 (Ubuntu 14.04 changed to use LockScreen instead LightDM program to lock the screen). A solution on Ubuntu 14.04 is to disable screen lock.

  1. Still follow the above instruction to remove gnome-screensaver and install xscreensaver. Set gluqlo as the only one screensaver.
  2. Go to Brightness & Lock panel from the Unity Launcher. And set Turn screen off when inactive: to Never.
  3. Install "Unity Tweak Tool" with sudo apt-get install unity-tweak-tool. Run it from the Launcher and select System > Security > Enhance system security by disabling Desktop lock.
  4. To enable locking desktop (required a password to unlock the desktop), check 'Lock Screen After' option. I pick 1 minute.

For some reason, gluqlo suddenly uses all my cpu (6 cores) resource (Ubuntu 14.04). The computer thus makes some noise. I have to use 'kill' command to kill them.

Flash for browser

On Ubuntu 12.04, there is no way to directly install the pepperflashplugin-nonfree plugin. So we have to use ppa from other people. See this post

sudo apt-get update
sudo apt-get install chromium-browser
sudo add-apt-repository ppa:skunk/pepper-flash
sudo apt-get update
sudo apt-get install pepflashplugin-installer
sudo update-pepperflashplugin-nonfree --install

The last step gives me an error: sudo: update-pepperflashplugin-nonfree: command not found

xed from Cinnamon Desktop

By default, recent open files are not shown (xed 1.6.3). See https://github.com/linuxmint/xed/issues/55.

Open Cinnamon Settings -> Privacy and enable 'remember recent files'.

Text file line ending in DOS and Unix

A DOS/Windows text file can be converted to Unix format by simply removing all ASCII CR characters with

$ tr -d '\r' < inputfile > outputfile  # inputfile and outputfile cannot be the same

or, if the text has only CR newlines, by converting all CR newlines to LF with

$ tr '\r' '\n' < inputfile > outputfile

SQL

MySQL Workbench

http://www.mysql.com/products/workbench/

sqliteman

https://sourceforge.net/projects/sqliteman/

User Interface Designer

Glade - RAD tool to enable quick & easy development of user interfaces for the GTK+ toolkit and the GNOME desktop environment

Devhelp - API documentation browser for GTK+ and GNOME

HTML editor

  • Atom
  • Bluefish
  • Brackets features
    • Inline Editors
    • Live Preview
    • Preprocessor Support
  • MonoDevelop
  • Kompozer and the installation instruction for Ubuntu.
  • BlueGriffon: a new WYSIWYG content editor. The interesting thing is the software BlueGriffon EPUB Edition: a cross-platform Wysiwyg editor able to natively create and edit EPUB2 and EPUB3 ebooks!

npm and Javascript

See npm package manager in Javascript.

chm reader

sudo apt-get install xchm

SCR3310 smart card

  • The usb device should be recognized by Ubuntu/Mint. Thus, the smart card can be used by Windows virtual machine (tested on Windows 10 VM).
brb@T3600 ~ $ lsusb
Bus 002 Device 003: ID 413c:2107 Dell Computer Corp.
Bus 002 Device 033: ID 09c3:0013 ActivCard, Inc.
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 3938:1031
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0b95:7720 ASIX Electronics Corp. AX88772
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
sudo apt-get install libpcsclite1 pcscd pcsc-tools
lsusb 
# Bus 006 Device 002: ID 04e6:5116 SCM Microsystems, Inc. SCR331-LC1 / SCR3310 SmartCard Reader
dmesg | grep SCR3310
# [ 2005.300052] usb 6-1: Product: SCR3310 v2.0 USB SC Reader
  • Search "SCR3310 driver linux" on google.com.
# Download pcsc-lite-1.8.13.tar.bz2 from 
# https://alioth.debian.org/frs/?group_id=30105
sudo apt-get install libudev-dev
cd pcsc-lite-1.8.13
./configure
make
sudo make install

# Download libusb
http://libusb.info/
cd libusb-1.0.19
./configure
make
sudo make install

# Download scmccid_5.0.27_linux
# http://www.identive-infrastructure.com/index.php/products-solutions/smart-card-readers-a-terminals/smart-card-readers/scr3310

cd scmccid_5.0.27_l32r
sudo ./install.sh

Chroot

Note that we have to change the conf file a little bit. The 'location' word needs to be changed to 'directory'. Also at the last step when we are ready to test a 32-bit GUI app, we need to issue DISPLAY in a separate line; such as

export DISPLAY=:0.0
su brb # brb is my root user in the host system that can invoke the schroot program
       # firefox does not allow to use root to start it
firefox

For a recap:

1. Install the packages
sudo apt-get install debootstrap schroot -y
2. Create a schroot configuration file
sudo nano /etc/schroot/chroot.d/precise_i386.conf
3. Install 32-bit ubuntu with debootstrap
sudo mkdir -p /srv/chroot/precise_i386
sudo debootstrap --variant=buildd --arch=i386 precise /srv/chroot/precise_i386 http://archive.ubuntu.com/ubuntu/
4. Test the chroot environment
schroot -l
schroot -c precise_i386 -u root
uname -a
cat /etc/issue
5. Additional configuration
apt-get install ubuntu-minimal
# That's all.

The article also mentioned the home directories (Documents, Downloads, ...) of the users within the chroot are shared with the host. How to access them from the host?

Check/Diagnostic SD card, read-only file system

The above commands do not help in my case.

Snappy (package manager)

How Snappy packages are different from Deb

An article from PCWorld. Skype, Spotify, Minecraft, JetBrains Dev Suite, MySQL Workbench, Blender.

  • Applications are no longer installed system-wide. The base Ubuntu operating system is kept securely isolated from applications you install later. Both the base system and Snappy packages are kept as read-only images.
  • Snappy packages can include all the libraries and files they need, so they don’t depend on other packages.
  • An update can never fail, as a package installation could potentially fail and become incomplete with typical Linux packages.
  • Snappy also supports “delta” updates, which means only the changed bits of the package need to be downloaded and installed.
  • Snappy-based Ubuntu systems might be standard.

Snap commands

Some snap commands

  1. snap help
  2. snap version
  3. snap list: see a list of installed snap app
  4. snap find queryname: find a snap app. For example snap find browser, snap find media.
  5. snap install appname: install snap apps
  6. snap remove appname: remove snap apps
  7. snap info appname: see more information about a snap app
  8. sudo snap refresh: update a snap app. You actually don't need it since snapd runs in the background and handles updates automatically
  9. snap changes: see a history of the changes made to your system

How to run the Snap applications: you can run snap applications just like any other application installed on your system.

6 Essential Ubuntu Snap Commands You Should Know

Docker

I haven't found any tutorial yet!

Ova image

Sorry, I don't get the command line back. Booting stuck in the middle.

Beaglebone

http://beagleboard.org/snappy or http://www.ubuntu.com/things#try-beaglebone

Raspberry Pi 2

https://darrenjw2.wordpress.com/2015/02/07/getting-started-with-snappy-ubuntu-core-on-the-raspberry-pi-2/

Flatpak

Sublime, GIMP, Spotify, Visual Studio Code, Marker, Gradio, VLC, Android Studio, Audacity, Atom, FileZilla, draw.io desktop, Cozy and others.

Flatpak setup, Using flatpak

How To Use And Install FlatPak On Linux. Consider the Gradio app.

$ flatpak install de.haeckerfelix.gradio.flatpakref
Installing: de.haeckerfelix.gradio/x86_64/stable
Required runtime for de.haeckerfelix.gradio/x86_64/stable (org.gnome.Platform/x86_64/3.26) is not installed, searching...
Found in remote flathub, do you want to install it? [y/n]: y
Installing: org.gnome.Platform/x86_64/3.26 from flathub
[####################] 10 delta parts, 79 loose fetched; 259556 KiB transferred 
Installing: org.freedesktop.Platform.ffmpeg/x86_64/1.6 from flathub
[####################] 1 delta parts, 2 loose fetched; 2649 KiB transferred in 0
Installing: org.gnome.Platform.Locale/x86_64/3.26 from flathub
[####################] 4 metadata, 1 content objects fetched; 14 KiB transferred
Installing: de.haeckerfelix.gradio/x86_64/stable from flathub
[####################] 1 delta parts, 1 loose fetched; 363 KiB transferred in 0 
Installing: de.haeckerfelix.gradio.Locale/x86_64/stable from flathub
[####################] 3 metadata, 1 content objects fetched; 1 KiB transferred 

$ flatpak uninstall de.haeckerfelix.gradio.flatpakref

Now we can launch the Gradio app from the Launch Menu.

Note: no 'sudo' is required.

unable to open mtp device ubuntu 14.04

Use this tip.

sudo apt-get install mtpfs

Install/upgrade google chrome browser

wget -N https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

Note that '-N' option.

(Mar 7, 2016). We may experience an error "Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release" when we run sudo apt-get update. It is because the 32-bit chrome has been discontinued. The solution is to modify the file </etc/apt/sources.list.d/google-chrome.list>. See reddit.

$ sudo sed -i -e 's/deb http/deb [arch=amd64] http/' "/etc/apt/sources.list.d/google-chrome.list"
$ cat "/etc/apt/sources.list.d/google-chrome.list"
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

Another suggestion to modify </opt/google/chrome/cron/google-chrome> (though the file exists) does not work .

How to Install Chrome on Linux and Easily Migrate Your Browsing From Windows

sudo apt-get install libxss1 libappindicator1 libindicator7wget \
    https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

sudo dpkg -i google-chrome*.deb

Message Of The Day /etc/motd

.Trash-1000 folder

See this post. Ubuntu will create such folders when a file is deleted from a USB drive. Presumably this would allow a file to be restored if you accidentally deleted it.

Try to empty the paperbin or delete the folder with the terminal-command as root: sudo rm -rf /path/to/folder/.Trash-1000

Xbox wireless Gamepad

https://www.howtoforge.com/tutorial/how-to-configure-your-gamepad-on-ubuntu/

Twitter client

Corebird

Birdie

Birdie vs Corebird

Elasticsearch & Kibana

Elasticsearch and Kibana : installation and basic usage on Ubuntu 16.04

TexLive

Recover files from Windows drives

sudo fdisk –l
sudo apt-get install ntfs-3g

sudo mount -t ntfs-3g /dev/sdaX /PARTITION/POINT

Kernel

System Call

Other Flavors

Arch linux, Manjaro Linux

7 Reasons Why I Use Manjaro Linux And You Should Too

How To Convert DEB Packages Into Arch Linux Packages

https://www.ostechnix.com/convert-deb-packages-arch-linux-packages/

Pacman

pacman -Sy openssh

Manjaro Linux

Alpine Linux