Ubuntu: Difference between revisions

From 太極
Jump to navigation Jump to search
 
(782 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== Debian ===
= Live CD =
==== Download Debian ====
https://livecdlist.com/
[https://www.makeuseof.com/tag/debian-enjoy-one-of-the-most-stable-and-trusted-linux-distributions/ 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.
* Debian https://www.debian.org/CD/live/
* CentOS https://wiki.centos.org/Download. Yes I can mount /dev/sda1 (Ubuntu) and write files into it.
* Ubuntu https://www.ubuntu.com/download
* Mint https://linuxmint.com/download.php


Screenshots of step-by-step installation can be found in [http://debian-handbook.info/browse/wheezy/sect.installation-steps.html here].
== Run on RAM disk ==
See [[Grub#Run_Live_Linux_on_Ram_Disk|Grub -> Run live Linux on ram disk]].


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 [http://cdimage.debian.org/debian-cd/8.0.0/amd64/bt-cd/ cd images download page] only provides a selection of kde, lxde and xfce desktop. The default is 'GNOME' in Jessie.
= Download/Install =
Download links for all versions from [https://wiki.ubuntu.com/ wiki.ubuntu.com] > [http://releases.ubuntu.com/ releases.ubuntu.com].


[[File:DebianInstall.png|200px]]
Ubuntu [https://wiki.ubuntu.com/UbuntuFlavors flavors] and [http://www.ubuntu.com/about/about-ubuntu/derivatives derivatives]


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.
== Download mirror ==
https://launchpad.net/ubuntu/+cdmirrors. The mirrors are sorted by speed. [https://mirror.umd.edu/ubuntu-iso/ UMD].


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.
=== Full list of all flavors of Ubuntu ===
http://cdimages.ubuntu.com/. See [https://itsfoss.com/download-ubuntu-20-04/ Ubuntu 20.04 LTS Released. Download Now!]


The default browser in Debian is Iceweasel with AdBlock Plus preinstalled.
=== Install via PXE Network Boot Server ===
[https://www.howtoforge.com/tutorial/install-debian-9-stretch-via-pxe-network-boot-server/ Install Debian 9 (Stretch) via PXE Network Boot Server]


I don't know why the default user does not have root privilege.
=== Original GA (General Availability) stack & [https://wiki.ubuntu.com/Kernel/LTSEnablementStack HWE (Hardware Enablement)] stack ===
The HWE stack provides a newer kernel and X support for existing Ubuntu LTS releases.


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 [http://verahill.blogspot.com/2012/01/debian-testing-64-wheezy-chinese.html hint] there.
https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/SpectreAndMeltdown#Kernel_Mitigations


==== How hard it is to install Debian ====
[https://www.linuxuprising.com/2019/02/how-to-install-ubuntu-18042-lts.html How To Install The Ubuntu 18.04.2 LTS Hardware Enablement Stack ]
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.  
== UEFI and Legacy mode ==
* [https://rufus.ie/en/ Rufus] has an option to select the target system is UEFI or Legacy. Balena Etcher does not have this option.
* [https://www.linuxbabe.com/command-line/how-to-use-linux-efibootmgr-examples Use Linux efibootmgr Command to Manage UEFI Boot Menu]
* [https://wiki.gentoo.org/wiki/Efibootmgr Efibootmgr]


The missing firmware files are: iwlwifi-6000g2a-6.ucode iwlwifi-6000g2a-5.ucode.
== Secure boot ==
I need to disable secure boot in order to boot Ubuntu.


See  
== LVM partition ==
* https://www.linuxquestions.org/questions/debian-26/how-to-provide-non-free-firmware-files-to-the-debian-jessie-installer-4175542680/
See [[LVM|LVM]]
* https://wiki.debian.org/Firmware
* https://www.debian.org/releases/jessie/i386/ch06s04.html.en


==== Server version ====
== After installation ==
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.
=== System program problem detected ===
* [https://itsfoss.com/how-to-fix-system-program-problem-detected-ubuntu/ How To Fix System Program Problem Detected In Ubuntu]
* [https://www.binarytides.com/ubuntu-fix-system-program-problem-error/ How to fix “System program problem detected” error on Ubuntu]
* http://askubuntu.com/questions/365358/im-getting-a-lot-of-system-program-problem-detected-error-dialogs-is-there-a
{{Pre}}
sudo rm /var/crash/*
</pre>
* http://www.techdrivein.com/2012/08/how-to-disable-system-program-problem.html. sudo nano /etc/default/apport.
Change value of "enabled" from 1 to 0. Then reboot.
 
=== Things to do after installing Ubuntu ===
<ul>
<li><syntaxhighlight lang='sh' inline>apt update; apt upgrade -y</syntaxhighlight>
<li>edit '''~/.bashrc''' to add alias, colored man pages, colored prompt, time stamp to bash prompt, time stamp to history command. To take those changes into effect, you do '''source ~/.bashrc''' .
{{Pre}}
export LESS_TERMCAP_mb=$'\e[1;32m'  # Blinking text: bold green
export LESS_TERMCAP_md=$'\e[1;34m'  # Bold text: bold blue
export LESS_TERMCAP_me=$'\e[0m'    # End mode
export LESS_TERMCAP_so=$'\e[01;47;34m'  # Standout: bold white on blue
export LESS_TERMCAP_se=$'\e[0m'    # End standout mode
export LESS_TERMCAP_us=$'\e[1;4;31m'  # Underlined text: bold underlined red
export LESS_TERMCAP_ue=$'\e[0m'     # End underline


Compared to Desktop version, the server version takes 1.3GB space and 33MB memory.
export HISTSIZE=10000              # default is 1000, history command will use it
export HISTFILESIZE=20000          # default is 2000, .bash_history file on disk
export HISTTIMEFORMAT="%Y-%m-%d %T "    # add time stamp to history


The server version does not have 'sudo' command. Use 'su' to switch to 'root' user.
PS1="\[\033[1;34m\]\$(date +%H:%M%p) \w$\[\033[0m\] "


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.'''.
alias nano="nano -c --softwrap"
alias checkport='sudo lsof -i -P -n | grep LISTEN'


==== Virtualbox guest addition installation ====
alias sshnocheck="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
See [[Virtualbox#Debian|Virtualbox -> Debian]].
alias scpnocheck='scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'


==== Browse iso files ====
alias open='xdg-open'
Note that if we want to download the iso image, we should consider using the torrent method.
</pre>
The can see a variety of download options from
<li>edit '''~/.ssh/config'''
<li>install Chinese input
<li>install graphics driver ([https://www.omgubuntu.co.uk/2016/04/10-things-to-do-after-installing-ubuntu-16-04-lts 16 Things To Do After Installing Ubuntu 16.04 LTS])
<li>install media codecs
<li>change power setting, night light ([https://www.omgubuntu.co.uk/2019/04/things-to-do-after-installing-ubuntu-1904 10 Things To Do After Installing Ubuntu 19.04])
<li>install favorite software
</ul>


http://www.debian.org/CD/ >  Downloading Debian CD/DVD images via HTTP/FTP
== Rescue mode ==
[https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/ How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04]


* (Official) http://cdimage.debian.org/debian-cd/8.0.0/amd64/iso-cd/
== End of life date of Ubuntu release ==
* (One of mirrors in US) http://mirrors.kernel.org/debian-cd/8.0.0/amd64/iso-cd/
https://wiki.ubuntu.com/Releases


==== Permission denied ====
== Server version ==
http://roger.steneteg.org/blog/virtualbox-guest-additions-on-debian/
[[File:UbuntuServerInstall.png|150px]]


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".
== Mint Linux ==
[https://blog.linuxmint.com/?p=3462 How to upgrade to Linux Mint 18.3]


An easy workaround is to explicitly run the script with "bash" with the following command:
{{Pre}}
<pre>
$ cat /etc/os-release
sudo bash ./VBoxLinuxAdditions.run
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
</pre>
</pre>


==== Browse source code ====
vs Ubuntu 16.04
* http://archive.ubuntu.com/
{{Pre}}
* https://wiki.ubuntu.com/Kernel/SourceCode
$ cat /etc/os-release
* [[Linux#Count_number_of_rows_in_a_file_-_wc|Find a command's package name]]
NAME="Ubuntu"
* https://stackoverflow.com/questions/4767821/how-do-i-get-the-ubuntu-source-code
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
</pre>


=== Ubuntu/Kubuntu/Lubuntu/Xubuntu ===
As we can see use $UBUNTU_CODENAME is common between Ubuntu & Mint. This variable can be used in setting a repository for installing a new software. See the [https://brave-browser.readthedocs.io/en/latest/installing-brave.html#linux Brave] example.
Download links for all versions from [https://wiki.ubuntu.com/ wiki.ubuntu.com] > [http://releases.ubuntu.com/ releases.ubuntu.com].


Ubuntu [https://wiki.ubuntu.com/UbuntuFlavors flavors] and [http://www.ubuntu.com/about/about-ubuntu/derivatives derivatives]
In [https://docs.docker.com/install/linux/docker-ce/ubuntu/ Docker's installation guide], it uses the value (eg 'bionic') from '''lsb_release -cs ''' which will give the same value of ''VERSION_CODENAME''' on Mint Linux.


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!
The taskbar in Windows is called a '''Panel''' in Linux Mint. If you open applications, you will see the application names showed in the application icons in the taskbar. That takes too much space. Cf macOS or Ubuntu Unity. See a screenshot [http://linuxsoftware.moncerbae.com/2015/12/understanding-part-of-cinnamon-desktop.html?m=1 here] where the "Panel" is moved to the top and "Cairo Dock" is installed.


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).
We can also add a program to '''Favorites'''. The favorites programs are located at the Mint Start Menu.


==== Download mirror ====
== Pop_OS ==
https://launchpad.net/ubuntu/+cdmirrors
[https://support.system76.com/articles/pop-recovery/ Use The Recovery Partition]


For me, mirrors.acm.jhu.edu (only visible from Ubuntu's Software & Updates -> Download from, Ubuntu 16.04) or mirror.umd.edu are closest.
== Create customized ubuntu iso ==
See [[Dual_boot|Dual boot]]


==== Installation ====
== Create your own Debian iso ==
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.
* http://www.linuxuser.co.uk/tutorials/spin-your-own-debian


The installation takes about 10 minutes when I installed ubuntu 14.04 (unity) on virtualBox.
== MultiSystem – Create a MultiBoot USB from Linux ==
See [[Daul_boot|Dual boot]].


===== How to upgrade =====
== Minimal Ubuntu ==
* [http://www.ubuntugeek.com/upgrade-ubuntu-desktopserver-from-16-04-xenial-xerus-to-16-10-yakkety-yak.html 16.04 to 16.10].
https://help.ubuntu.com/community/Installation/MinimalCD
* [http://fridge.ubuntu.com/2016/04/21/ubuntu-16-04-lts-xenial-xerus-released/ New version of Ubuntu contains newer versions of Qt and GTK] and [http://planet.ubuntu.com/ planet.ubuntu.com].


===== Install via PXE Network Boot Server =====
The minimal ubuntu iso (mini.iso) is about 64MB. It will download files when we install the Ubuntu.
[https://www.howtoforge.com/tutorial/install-debian-9-stretch-via-pxe-network-boot-server/ Install Debian 9 (Stretch) via PXE Network Boot Server]


===== Original GA (General Availability) stack & [https://wiki.ubuntu.com/Kernel/LTSEnablementStack HWE (Hardware Enablement)] stack =====
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:''.  
The HWE stack provides a newer kernel and X support for existing Ubuntu LTS releases.


https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/SpectreAndMeltdown#Kernel_Mitigations
== The Perfect Server ==
* [https://www.howtoforge.com/tutorial/perfect-server-ubuntu-16.04-with-apache-php-myqsl-pureftpd-bind-postfix-doveot-and-ispconfig/ Ubuntu 16.04] from howtoforge.
* [https://www.howtoforge.com/tutorial/perfect-server-debian-8-4-jessie-apache-bind-dovecot-ispconfig-3-1/ Debian 8.4] from howtoforge.


==== End of life date of Ubuntu release ====
== Live USB with persistent storage: mkusb ==
https://wiki.ubuntu.com/Releases
* [https://www.linuxuprising.com/2019/03/create-persistent-storage-live-usb-with.html Create A Persistent Storage Live USB With Ubuntu, Linux Mint Or Debian (UEFI, >4GB Persistence Support)]
* [http://www.howtogeek.com/howto/14912/create-a-persistent-bootable-ubuntu-usb-flash-drive/ Linux Live USB Creator]
* (Bonus) [https://nomadbsd.org/index.html NomadBSD]


Each time I log into my Ubuntu 12.04.5 LTE, I'll receive a message
= Selection of [http://en.wikipedia.org/wiki/Desktop_environment desktop environment] =
<pre>
See [[Desktop_environment|Desktop environment]].
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
= Themes =
since 2014-08-07. Security updates for critical parts (kernel
* [https://www.makeuseof.com/tag/ubuntu-themes/ 5 Ubuntu Themes That Will Steal Your Breath Away]
and graphics stack) of your system are no longer available.


For more information, please see:
== Windows 10 theme ==
http://wiki.ubuntu.com/1204_HWE_EOL
[https://www.makeuseof.com/tag/make-linux-look-like-windows/ Make Linux Look Like Windows 10 With These Tips and Tweaks]


There is a graphics stack installed on this system. An upgrade to a
== GTK3 ==
supported (or longer supported) configuration will become available
[https://www.linuxuprising.com/2019/10/how-to-use-different-gtk-3-theme-for.html How To Use A Different GTK 3 Theme For Specific Applications]
on 2014-07-16 and can be invoked by running 'update-manager' in the
Dash.
</pre>
===== Ubuntu 12.04 =====
As of Dec 1, 2015, [http://www.pcworld.com/article/3010404/browsers/googles-killing-chrome-support-for-32-bit-linux-ubuntu-1204-and-debian-7.html Chrome for 32-bit Ubuntu 12.04 is not supported] anymore.


==== Black screen on boot Ubuntu 14.04 ====
== Orchis ==
[http://ubuntuforums.org/showthread.php?t=2245141 Press e when you see the first menu].
[https://www.linuxuprising.com/2021/02/orchis-is-cool-gtk-gnome-theme-with.html Orchis Is A Cool GTK / GNOME Theme With Rounded Elements]


==== Server version ====
= [https://help.ubuntu.com/community/Repositories/Ubuntu Ubuntu Software Repository] =
[[File:UbuntuServerInstall.png|150px]]
See [[Ubuntu_software_repository|Ubuntu software repository]].


==== [http://www.bandshed.net/AVLinux.html AV Linux] ====
= Troubleshooting =
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.
== What should I do when Ubuntu freezes? ==
* [http://askubuntu.com/questions/4408/what-should-i-do-when-ubuntu-freezes What should I do when Ubuntu freezes?]
* [https://unix.stackexchange.com/a/39855 How to fix non-responsive Ubuntu system?]
* https://en.wikipedia.org/wiki/Magic_SysRq_key


==== Kali Linux ====
(11/11/2020). Note that my mouse can move but it cannot click. The keyboard did not respond to some solutions like Ctrl+Alt+F1 or Alt+F2. SSh from another computer still works:) '''Press Alt+SysReq (or Alt+Print), do not release and then type 'REISUB'''' (lower case). This puts the keyboard in raw mode, ends tasks in various states, syncs the disks, etc, and finally reboots the machine.  
* http://lifehacker.com/how-to-hack-your-own-network-and-beef-up-its-security-w-1649785071
* https://www.offensive-security.com/kali-linux-vmware-arm-image-download/ In addition to regular linux image, Kali provides images for VirtualBox, VMWARE and ARM devices like Raspberry Pi, Beaglebone Black, Chromebook, Odroid, et al.


==== Create customized ubuntu iso ====
(11/23/2020). Pop_OS freezes again. I should check /var/log/syslog via ssh.
* [https://launchpad.net/cubic Cubic]. https://www.ostechnix.com/create-custom-ubuntu-live-cd-image/
* [http://www.ubuntu-mini-remix.org/ Ubuntu Mini Remix] (~200MB). Note that this is a live ubuntu which can't be installed even we can remaster it to include Desktop Environment, packages, et al. See [https://answers.launchpad.net/ubuntu-mini-remix/+faq/35 this FAQ].
** [http://sourceforge.net/projects/uck/ Ubuntu customization kit] - [http://www.linux.com/learn/tutorials/739139-roll-your-own-customized-ubuntu-with-uck linux.com] [http://www.howtogeek.com/109736/how-to-create-a-custom-ubuntu-live-cd-or-usb/ howtogeek]. The project has not been updated since 2013-01-16.
** [https://launchpad.net/ubuntu-builder Ubuntu Builder] - [http://lifehacker.com/5921054/ubuntu-builder-lets-you-build-your-own-customized-linux-distribution lifehacker]. It looks the project is abandoned.
** [https://github.com/fluxer/Customizer Customizer] - quite information from its website. The [https://github.com/clearkimura/Customizer/wiki/Manuals manuals/user guide 3.x] p46 talks about how to make the iso installable instead of just a live CD (e.g. '''apt­-get install ubiquity ubiquity-­frontend-­gtk'''). '''N.B.''' ''Installing [https://en.wikipedia.org/wiki/Ubiquity_(software) ubiquity] should be run once we have installed all software we want; i.e. if we want to install xfce4 we should install xfce4 before we install ubiquity.'' Also for some reason, Customizer crashed when I tried to create an iso if I have installed xubuntu-desktop, ubiquity and ubiquity-­frontend-­gtk.


Note that the Ubuntu Mini Remix by default contains only 3 repositories. We may want to add some more.
Don't try this on a virtual machine. It will not work. It just restart the HOST machine.
<pre>
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
</pre>
while for example an official v14.04 xubuntu contains 22 sources,
<pre>
# 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
(10/29/2021). The /var/log/syslog shows unusual lines containing lots of '''\00\00\00\00''' and '''Inserted module 'lp' '''. Try a suggestion from [https://askubuntu.com/a/1190229 Using syslog to diagnose a crash]. Another report related to the specific CPU (NUC8i5BEH) [https://www.reddit.com/r/intelnuc/comments/npua35/nuc8i5beh_running_linux_randomly_freezes_when/ NUC8i5BEH running Linux randomly freezes when idle].
## 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
== [http://askubuntu.com/questions/406229/there-was-no-etc-default-grub-file Grub2 cannot boot after timeout] ==
## team. Also, please note that software in universe WILL NOT receive any
There is not /etc/default/grub with GRUB2.
## review or updates from the Ubuntu security team.
{{Pre}}
deb http://us.archive.ubuntu.com/ubuntu/ trusty universe
sudo apt-get --reinstall install grub-pc
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
</pre>
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
== [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] ==
## team, and may not be under a free licence. Please satisfy yourself as to
{{Pre}}
## your rights to use the software. Also, please note that software in
sudo mv /tmp /tmp_old
## multiverse WILL NOT receive any review or updates from the Ubuntu
sudo mkdir /tmp
## security team.
sudo chmod 1777 /tmp
deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
</pre>
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
== [http://askubuntu.com/questions/73997/how-do-i-fix-a-failed-to-download-package-files-error Software updater -  “Failed to download package files” error?] ==
## extensively as that contained in the main release, although it includes
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.
## 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
== unable to open mtp device ubuntu 14.04 ==
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
[http://askubuntu.com/questions/463015/ubuntu-14-04-and-android-cant-see-phone-on-my-computer Use this tip].
deb http://security.ubuntu.com/ubuntu trusty-security universe
<pre>
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
sudo apt-get install mtpfs
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
</pre>
</pre>
* http://askubuntu.com/questions/409607/how-to-create-a-customized-ubuntu-server-iso It gives a long instruction based on command line.
* http://razvangavril.com/linux-administration/custom-ubuntu-server-iso/ The instruction is organized and is very similar to the above.
* http://amjjawad.blogspot.com/2013/07/ubuntu-mini-iso-installation-process.html It does not talk about creating a customized iso. It talks about how to install Ubuntu from the minimal CD (~40M). The minimal CD will download the packages in the installation process.


==== Create your own Debian iso ====
== Cannot log in in ubuntu 20.04 ==
* http://www.linuxuser.co.uk/tutorials/spin-your-own-debian
[https://stackoverflow.com/a/62113975 It's caused by ticking 'enable automatic logging in' at installation]


==== MultiSystem – Create a MultiBoot USB from Linux ====
== No sound after suspend ==
* [https://itsfoss.com/multiple-linux-one-usb/ How to Install Multiple Linux Distributions on One USB] using [http://multibootusb.org/ MultiBootUSB] (Linux/Windows)
* [https://www.linuxuprising.com/2018/06/fix-no-sound-dummy-output-issue-in.html?m=1 Fix No Sound (Dummy Output) Issue In Ubuntu With SND HDA Intel]
** To test Boot ISO function, Ubuntu needs to run 'sudo apt-get install qemu'. See [[Virtualbox#QEMU|Virtualbox -> QEMU]].
* [https://itsfoss.com/fix-sound-ubuntu-1304-quick-tip/ How To Fix No Sound in Ubuntu And Linux Mint]. Unfortunately none of them works on Intel NUC + Ubuntu 18.04.2.
* https://sourceforge.net/projects/multisystem/
* https://www.pendrivelinux.com/multiboot-create-a-multiboot-usb-from-linux/
* http://www.makeuseof.com/tag/combine-multiple-iso-images-burn-single-bootable-iso-image-file/


==== Minimal Ubuntu ====
== tracker-miner-fs ==
The minimal ubuntu iso is about 50MB. It will download files when we install the Ubuntu.  
See http://askubuntu.com/questions/346211/tracker-store-and-tracker-miner-fs-eating-up-my-cpu-on-every-startup how to disable it.


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:''.  
= Monitor =
== Monitor resolution ==
* '''xrandr'''. It shows as 20" 1360x768 (16:9) on my 2005 19" Sharp TV LC-19SB15U [https://www.cnet.com/products/sharp-lc-19sb15u/ 1366 x 768] through Input 4 (VGA) (44W).
* On Mint Linux, it shows 1920x1080i. But it'll be better with 1280x720 (16:9).
* [https://youtu.be/pkzrQqT_lFI How to set a Custom Screen Resolution in Linux ]
* [https://www.maketecheasier.com/how-to-setup-dual-monitors-with-xrandr/ How to Setup Dual Monitors With XRandR]


In addition to some default selections (like 'standard system utilities'), I choose '''Ubuntu MATE minimal installation''' (not 'Ubuntu MATE desktop'). This
== Night light ==
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).
[https://www.fossmint.com/best-eye-care-software-to-protect-your-eyes-in-linux/ Best Eye Care Software to Protect Your Eyes in Linux]


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.
= Display Manager =
* Accessories: Character Map, Engrampa Archive Manager, Calculator, MATE Search Tools, Passwords and Keys, Pluma Text Editor, Take Screenshot
* [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]
* Graphics: Eye of MATE image Viewer, MATE Color Selection, Simple Scan
* [https://itsfoss.com/display-manager/ Linux Jargon Buster: What is Display Manager in Linux?]
* 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 [http://askubuntu.com/questions/53822/how-do-you-run-ubuntu-server-with-a-gui 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).
== Display server: Wayland Xorg ==
[https://itsfoss.com/switch-xorg-wayland/ How to Switch Between Xorg and Wayland in Ubuntu] & [https://linuxconfig.org/how-to-enable-disable-wayland-on-ubuntu-20-04-desktop How to enable/disable wayland on Ubuntu 20.04 Desktop]
<pre>
echo $XDG_SESSION_TYPE
</pre>
[https://askubuntu.com/a/1393619 How can I tell if an application is using XWayland?] 1. Running '''xlsclients''' in a terminal will list all the apps currently running which are using XWayland (cf native wayland). 2. Run '''xeyes'''


==== The Perfect Server ====
= Power management =
* [https://www.howtoforge.com/tutorial/perfect-server-ubuntu-16.04-with-apache-php-myqsl-pureftpd-bind-postfix-doveot-and-ispconfig/ Ubuntu 16.04] from howtoforge.
== Battery ==
* [https://www.howtoforge.com/tutorial/perfect-server-debian-8-4-jessie-apache-bind-dovecot-ispconfig-3-1/ Debian 8.4] from howtoforge.
[https://www.2daygeek.com/linux-low-full-charge-discharge-battery-notification/ How to get Battery status notification when a battery is full or low]


==== Live USB with persistent storage ====
== Suspend, hibernate ==
[http://www.howtogeek.com/howto/14912/create-a-persistent-bootable-ubuntu-usb-flash-drive/ Linux Live USB Creator]
<ul>
<li>Automatic suspend will disable ssh connection, cron jobs, et al. PS. a server never goes to suspend.
<li>[https://fostips.com/automatic-suspend-idle-time-less-15-min-ubuntu-fedora-debian/ Set Automatic Suspend Idle Time (Less Than 15 Min) in Ubuntu, Fedora, Debian]


==== Dual boot Ubuntu and Arch Linux ====
<li>If you like to suspend immediately, use
http://www.linuxandubuntu.com/home/dual-boot-ubuntu-and-arch-linux
* '''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.
</ul>


=== Selection of [http://en.wikipedia.org/wiki/Desktop_environment desktop environment] ===
= Swapfile =
* https://wiki.archlinux.org/index.php/Desktop_environment
<ul>
* http://www.pcworld.com/article/2951829/operating-systems/freedom-of-choice-7-top-linux-desktop-environments-compared.html
<li>How to remove a swapfile.
* https://help.ubuntu.com/community/Installation/LowMemorySystems How to install desktops from the command line.
* [http://askubuntu.com/questions/125062/how-can-i-find-which-desktop-enviroment-i-am-using To query the desktop environment] using the command line, use
<pre>
<pre>
echo $DESKTOP_SESSION
sudo swapoff /swapfile  # swapfile is located under the root
sudo rm /swapfile
free -h  # double check
# Remove the swap entry from /etc/fstab
sudo nano /etc/fstab
</pre>
</pre>
<li>Re-enable swap. [https://bitlaunch.io/blog/how-to-create-and-adjust-swap-space-in-ubuntu-20-04/ How to Create and Increase Swap Space in Ubuntu 20.04]
<pre>
sudo fallocate -l 2G /path/to/new_swapfile
sudo chmod 600 /path/to/new_swapfile
sudo mkswap /path/to/new_swapfile
sudo swapon /path/to/new_swapfile


On Ubuntu, it returns
sudo cp /etc/fstab /etc/fstab.bak
# 'ubuntu' gnome 3+unity
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
# 'mate' ubuntu Mate on Odroid xu4
</pre>
# 'default' on Debian 8.0
<li>[https://ploi.io/documentation/server/change-swap-size-in-ubuntu Change swap size in Ubuntu]. It seems we need to delete the swapfile before we follow that.
# 'LXDE' on Debian's BBB, 'LXDE-pi' on Raspbian
</ul>
# 'Lubuntu' on UDOObuntu 2
 
==== [http://en.wikipedia.org/wiki/Unity_(user_interface) 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
= Hard drive =
== Install a new hard drive ==
See also https://help.ubuntu.com/community/InstallingANewHardDrive, [https://vegastack.com/tutorials/fdisk-command-in-linux/ Fdisk Command in Linux] and [[#Mount_drive|Mount drive]]
<ol>
<li>Use '''ls /dev/sd*''' show connected disk drives
<li>Use '''sudo fdisk /dev/sdb''' command to create partition table. Then 'g', 'p', 'n', 'p', '1', ENTER, ENTER, 'w'. </li>
<li>Use '''sudo mkfs -t ext4 /dev/sdb1''' to create a new partition </li>
<li>Use '''sudo mkdir /mnt/ssd''' to create a new mount point </li>
<li>(One time mount) '''sudo mount /dev/sdb1 /mnt/ssd''' </li>
<li>Use '''sudo nano -Bw /etc/fstab''' to do auto mount on boot
<pre>
<pre>
sudo apt-get install ubuntu-desktop
/dev/sdb1    /media/mynewdrive  ext3    defaults    0        2
/dev/sdc1    /media/mynewdrive  ext3    defaults    0        0
</pre>
</pre>
</li>
<li>'''sudo chown -R USERNAME:USERNAME /mnt/ssd''' to give the ownership to the USERNAME. </li>
</ol>


Don't forget [https://github.com/freyja-dev/unity-tweak-tool Unity Tweak Tool]. That is required if you want to install, saying, [https://github.com/horst3180/arc-theme Arc theme]. I install it on Ubuntu 16.04 by running ''sudo apt install unity-tweak-tool''.
[http://withr.me/add-new-hard-disk-3tb/ Add second hard disk (3TB) to Ubuntu 16.04]


[[File:Unity tweak tool.png|150px]]
== exFat/Format USB for Windows ==
[https://itsfoss.com/format-exfat-linux/ How to Format a USB Disk as exFAT on Linux [Graphically and Command Line]]


Note that there is no screensaver anymore starting with Ubuntu 12.04. Read [http://askubuntu.com/questions/292995/configure-screensaver-in-ubuntu this post]. If we want to add a screensaver program, read [http://www.howtogeek.com/114027/how-to-add-screensavers-to-ubuntu-12.04/ How to Add Screensavers to Ubuntu 12.04]
== Ubuntu Disks utility ==
We can use it to write an image to the SD card. Right click the image file in the File Manager. Select 'Open with '-> 'Disk Image Writer'. Select 'Destination' and click 'Restore'.


==== [http://en.wikipedia.org/wiki/GNOME GNOME] ====
'''BALENA ETCHER''' can have a problem with writing the [https://github.com/christianhaitian/arkos/wiki ArkOS image].
[http://ubuntugnome.org/ 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 [https://help.gnome.org/misc/release-notes/3.6/users-lock-screen.html.en_GB this] and [http://www.linuxuser.co.uk/reviews/gnome-3-6-review-against-the-grain this].


[[File:UbuntuGnome1404.png|150px]] [[File:UbuntuGnome1404b.png|150px]]
== Disk Usage Analyzer ==
It is actually called [https://help.ubuntu.com/community/Baobab Baobab].


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.
== Check partition type ==
<pre>
'''lsblk -f'''
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
</pre>


If the lock screen does not work, use Settings > Brightness and Lock, or use the command line
== Use '''parted''' command to format a new hard disk ==
<pre>
* The '''fdisk''' won’t create partitions larger than 2 TB. Use '''parted''' with GPT partition table.
gsettings set org.gnome.desktop.lockdown disable-lock-screen 'false'  
* '''lsblk''' (no sudo is needed) is useful to summarize/list all devices. After that we can use '''sudo parted /dev/sdX''' to print more detail on a device.
</pre>
* [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


If the screensaver is not working, try
{{Pre}}
<pre>
sudo apt-get install parted
sudo apt-get install gnome-screensaver
</pre>
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 [http://www.linuxuser.co.uk/reviews/gnome-3-6-review-against-the-grain review].
sudo fdisk -l /dev/sdb  # find out the disk size


==== [http://en.wikipedia.org/wiki/KDE KDE] ====
sudo parted
[http://www.kubuntu.org/ Kubuntu]
  print
  select /dev/sdb
  mklabel myLabel
  mkpart primary ext4 0GB 128GB
  print
  quit
lsblk
sudo mkfs.ext4 /dev/sdb1


==== [http://en.wikipedia.org/wiki/Xfce Xfce] ====
mkdir /mnt/newdisk
[http://www.makeuseof.com/tag/xfce-explained-linux-speediest-desktop/ 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."''
sudo mount /dev/sdb1 /mnt/newdisk
df -h
</pre>


[http://xubuntu.org/ 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.
== Gparted ==
<syntaxhighlight lang='bash'>
It is best to use the latest release of GParted https://github.com/GNOME/gparted/.
# 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
</syntaxhighlight>


The default display manager (used e.g. log in screen) can be found by
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).
<syntaxhighlight lang='bash'>
cat /etc/X11/default-display-manager
</syntaxhighlight>


To install lightdm display manager
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).
<syntaxhighlight lang='bash'>
sudo apt-get install lightdm
</syntaxhighlight>


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.
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?].


==== [http://en.wikipedia.org/wiki/LXDE LXDE] ====
=== Resize Active/Primary root Partition In Linux Using GParted Utility ===
[http://lubuntu.net/ Lubuntu], [http://lxle.net/ LXLE] and [http://lxqt.org/ LXQt]. LXDE is the default desktop environment for Raspbian, LXLE, BBB, and Lubuntu.  
[https://www.2daygeek.com/how-to-resize-active-primary-root-partition-in-linux-using-gparted-utility/ How To Resize Active/Primary root Partition In Linux Using GParted Utility]. Three utilities are introduced too.
* '''e2fsck''': e2fsck is a file system check utility that automatically repair the file system for bad sectors, I/O errors related to HDD.
* '''resize2fs''': The resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to enlarge or shrink an unmounted file system located on device.
* '''e2image''': The e2image program will save critical ext2, ext3, or ext4 filesystem metadata located on device to a file specified by image-file.


The default browser in LXLE is '''SeaMonkey''' (Debian Jessie has '''Iceweasel''' which is even similar to Firefox; see [[Odroid#Minimal_Debian_Jessie|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.
=== Change a partition's label ===
* A partition's '''label''' will determine the mounted directory when an external drive is connected to a machine
* '''Gparted'''. Right click a partition -> Unmount. Right click the partition again -> Label File System. Apply.
* [https://unix.stackexchange.com/a/289480 What is the difference between a name and a label in gparted?]
* [https://linuxconfig.org/how-to-name-label-a-partition-or-volume-on-linux How to label a partition or volume on Linux with e2label]


The [http://www.lxle.net/forums/discussion/972/lxle-ls-first-beta-available LXLE LS] version provides several business apps to anyone on the network.
=== parted utility ===
[https://www.2daygeek.com/how-to-manage-disk-partitions-using-parted-command/ How To Manage Disk Partitions Using Parted Command]
{{Pre}}
sudo parted /dev/sda print free
</pre>


LXQt is the Qt port and the upcoming version of LXDE, the Lightweight Desktop Environment.
=== '''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


The download links (if we want to skip answering the question) are https://sourceforge.net/projects/lxle/files/Final/OS/.
It seems it is necessary to use '''GPT''' instead of '''MBR/msdos''' as a partition table to overcome 2TB limitions.


[http://www.lxle.net/articles/ LXLE key features]
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.


One cool thing in lxle is the random wallpaper. On regular Ubuntu, we can install a wallpaper changer program - [http://askubuntu.com/questions/134/how-do-i-create-a-desktop-wallpaper-slideshow Wallch] or [http://peterlevi.com/variety/how-to-install/ Variety]. See also [http://www.omgubuntu.co.uk/2016/12/8-bit-day-wallpaper-changes-day OMGUBUNTU].
Step1. Device -> Create a partition table -> GPT


[[File:Variety pref.png|150px]]
Step2. Create a new ext4 partition as you want.


In Lxle, the random wallpaper is done through a simple command
* http://ubuntuforums.org/showthread.php?t=2164361
<syntaxhighlight lang='bash'>
* http://gparted-forum.surf4.info/viewtopic.php?id=14940
dash -c 'pcmanfm -w "$(find ~/Pictures/Wallpapers -type f | shuf -n1)"'
* http://askubuntu.com/questions/339041/cannot-resize-drive
</syntaxhighlight>
* http://unix.stackexchange.com/questions/67835/change-partition-table-with-gparted


[https://help.ubuntu.com/community/Lubuntu/Keyboard A list of keyboard shortcuts] for Lubuntu.
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 file manager in LXLE is [https://wiki.archlinux.org/index.php/PCManFM PCManFM] (not to confuse with the package manager [https://wiki.archlinux.org/index.php/pacman '''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.
Conclusion:
* 4TB using NTFS works on Ubuntu.
* rsync will not stop spinning for some reason even the command is finished (through StarTech dock station).


==== [http://en.wikipedia.org/wiki/Cinnamon_%28software%29 Cinnamon] ====
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.
[http://www.linuxmint.com/ Linux Mint]. A GTK+-based desktop environment. Note that [https://sites.google.com/site/easylinuxtipsproject/mint 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'''.
[[File:Gparted gpt.png|200px]]


Note
== Health check of the hdd: badblocks, dmesg, fsck ==
[https://www.cyberciti.biz/faq/linux-check-the-physical-health-of-a-usb-stick-flash-drive/ Linux check the physical health of a USB stick]. '''badblocks''' and '''f3''' tool.


# 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.
I got an input/output error when I use ''sudo rm'', ''sudo reboot'' or ''Ctrl + Del'' commands.  
# To change the title bar color from gray to black follow [https://www.reddit.com/r/linuxmint/comments/3mv7w3/how_to_change_the_color_of_the_top_title_bar/ 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'.
# 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 [https://www.linuxmint.com/documentation.php 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".
# We don't have to install Linux Mint in order to get cinnamon desktop. [http://www.webupd8.org/2016/04/how-to-install-cinnamon-30-in-ubuntu.html How To Install Cinnamon 3.0 In Ubuntu 16.04 Or 15.10 Via PPA]
# 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.


[[File:MintCinnamonSS.png|150px]]
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.


==== [http://en.wikipedia.org/wiki/MATE_(software) MATE] ====
To force to reboot/shutdown, follow the suggestion [http://linoxide.com/how-tos/inputoutput-error-bad-blocks-how-to-restart-linux/ here]
[https://ubuntu-mate.org/ Ubuntu Mate]. The MATE Desktop Environment is the continuation of GNOME 2.
<syntaxhighlight lang='bash'>
odroid@odroid:~/$ cat /etc/X11/default-display-manager
/usr/sbin/lightdm
</syntaxhighlight>


==== Pantheon ====
'''dmesg''' command shows there are a few bad sectors on that hdd.  
[https://elementary.io/ Elementary OS] & [https://en.wikipedia.org/wiki/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.
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.
<pre>
sudo badblocks -v /dev/sdb1
sudo badblocks /dev/sdb > /home/zainul/bad-blocks
sudo fsck -l bad-blocks /dev/sdb
</pre>


==== How to Refresh Your Linux Desktop Without Rebooting ====
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
http://www.makeuseof.com/tag/refresh-linux-desktop-without-rebooting/
.


=== [https://help.ubuntu.com/community/Repositories/Ubuntu Ubuntu Software Repository] ===
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.
The repository components are:


# Main - Officially supported software.
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/.
# Restricted - Supported software that is not available under a completely free license.
# Universe - Community maintained software, i.e. not officially supported but enabled by default software.
# Multiverse - Software that is not free.


See the pitfall in the [http://www.pcworld.com/article/2845072/ubuntu-owncloud-and-a-hidden-dark-side-of-linux-software-repositories.html PCWorld] article.
== Force Check Root Filesystem using fsck During Reboot ==
* https://superuser.com/a/401312
* https://www.thegeekstuff.com/2016/03/forcefsck-on-reboot/


==== Slow download; automatically select a mirror ====
= Burn/Write an iso or img file to a USB flash drive =
* [http://askubuntu.com/questions/37753/how-can-i-get-apt-to-use-a-mirror-close-to-me-or-choose-a-faster-mirror How can I get apt to use a mirror close to me, or choose a faster mirror?]
[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].


Put the following at the beginning of /etc/apt/sources.list (change 'precise')
* 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].
<pre>
* 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.  
deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse
* If your current OS is Mint => Right click the iso file and select Make bootable USB stick. No software to install.
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
</pre>


==== Check if a repository exists ====
== Use dd ==
For example, consider the CRAN repository at cran.rstudio.com server.
* [http://www.cyberciti.biz/faq/unix-linux-dd-create-make-disk-image-commands/ How to make disk image with dd on Linux or Unix]
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
Now run ''nano /etc/apt/sources.d'' to check if duplicated repository has been added.


==== GPG/Authentication key ====
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.
* [https://linuxconfig.org/how-to-encrypt-and-decrypt-individual-files-with-gpg How to Encrypt and Decrypt Individual Files With GPG]
* [http://askubuntu.com/questions/131397/what-is-a-repository-key-under-ubuntu-and-how-do-they-work What is a repository key under Ubuntu and how do they work?]
* [https://wiki.archlinux.org/index.php/GnuPG GnuPG] from archlinux.org.


'''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.
The instruction can be found in a lot of places like [https://wiki.archlinux.org/index.php/USB_Flash_Installation_Media Archlinux wiki] page.
{{Pre}}
sudo fdisk -l
sudo dd bs=4M if=xxx.img of=/dev/sdb && sync
</pre>
where /dev/sdb is a device name, not a partition name. We can also adjust bs to a smaller value like 1M, 4m.


'''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.
* [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'>
{{Pre}}
brb@ubuntu16041:~$ gpg --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
$ sudo umount /dev/mmcblk0p1
gpg: directory `/home/brb/.gnupg' created
$ sudo apt install pv
gpg: new configuration file `/home/brb/.gnupg/gpg.conf' created
$ sudo dd if=Downloads/ubuntu-18.04-desktop-amd64.iso | pv | sudo dd of=/dev/mmcblk0
gpg: WARNING: options in `/home/brb/.gnupg/gpg.conf' are not yet active during this run
</pre>
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 -
* [http://www.cyberciti.biz/faq/linux-unix-dd-command-show-progress-while-coping/ Monitor the progress],
OK
** adding a parameter '''status=progress''' in '''dd''' (not working on Ubuntu 14.04)
brb@ubuntu16041:~$ ls -l ~/.gnupg
** Linux '''dialog''' command
total 20
** following [[Raspberry#Install_an_image_to_a_SD_card|Raspberry Pi]]
-rw------- 1 brb brb 9398 Nov 27 09:31 gpg.conf
{{Pre}}
-rw------- 1 brb brb 1531 Nov 27 09:31 pubring.gpg
sudo pkill -USR1 -n -x dd
-rw------- 1 brb brb    0 Nov 27 09:31 pubring.gpg~
</pre>
-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
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.
/etc/apt/trusted.gpg
--------------------
pub  1024D/437D05B5 2004-09-12
uid                  Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>
sub  2048g/79164387 2004-09-12


pub  4096R/C0B21F32 2012-05-11
In another case, the gparted compalins the usb drive "Invalid partition table - recursive partition on /dev/sdb". Someone suggests to issue a dd command to erase a hard disk.
uid                  Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>


pub  4096R/EFE21092 2012-05-11
== use dd to erase a hard disk ==
uid                  Ubuntu CD Image Automatic Signing Key (2012) <[email protected]>
The following command works on Live Ubuntu. We can use this method to erase a hard disk.
{{Pre}}
sudo dd if=/dev/zero of=/dev/sda bs=4M status=progress
</pre>


pub  1024D/FBB75451 2004-12-30
== Clone your linux hard drive ==
uid                  Ubuntu CD Image Automatic Signing Key <[email protected]>
[https://www.makeuseof.com/tag/2-methods-to-clone-your-linux-hard-drive/ How to Clone Your Linux Hard Drive: 4 Methods]


pub  2048R/E084DAB9 2010-10-19 [expires: 2020-10-16]
== [https://etcher.io/ Etcher] - cross platform ==
uid                  Michael Rutter <marutter@gmail.com>
For Ubuntu, there is no need to install the program. Just run the binary file (.AppImage).
sub  2048R/1CFF3E8F 2010-10-19 [expires: 2020-10-16]


/etc/apt/trusted.gpg.d/peterlevi_ubuntu_ppa.gpg
See https://www.raspberrypi.org/magpi/pi-sd-etcher/
-----------------------------------------------
pub  1024R/A546BE4F 2012-06-28
uid                  Launchpad PPA for Peter Levi
</syntaxhighlight>
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#Ubuntu.2FDebian|R installation]].


'''GPG key error''': If the machine is behind a proxy, we may get the following error. See [http://askubuntu.com/questions/147311/no-gpg-key-from-behind-a-firewall this post].
== [https://rufus.akeo.ie/ Rufus] ==
<pre>
Rufus is a popular free and open source graphical tool to create bootable USB drives from Windows. It can be used to create not only bootable Windows drives from ISO files or disk images, but also create bootable Linux USB drives from Windows.
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
</pre>


==== Check if a ppa repository exists ====
* Windows OS is required to use Rufus
For example, consider the ppa:webupd8team repository.
* 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?]
<syntaxhighlight lang='bash'>
* https://github.com/hirotakaster/baytail-bootia32.efi
if [ $codename == "trusty" && ! find /etc/apt/sources.list.d/* -iname *.list | xargs cat | grep webupd8team ]; then
* [https://medium.com/@tomac/installing-ubuntu-mint-linux-on-onda-820w-tablet-727747a376b#.o4osscrty installing Ubuntu / Mint Linux on Onda 820w tablet]
  add-apt-repository ppa:webupd8team/java
* It successfully burns ESXi and Ubuntu iso images to USB drives while the USB drives created by the 'dd' command does not work??
fi
* [https://www.linuxuprising.com/2019/08/rufus-creating-persistent-storage-live.html?m=1 Rufus: Creating A Persistent Storage Live USB With Ubuntu Or Debian From Windows]
</syntaxhighlight>


==== How to know if there are updates available? ====
== [https://unetbootin.github.io/ UNETBOOTIN] - cross platform ==
http://askubuntu.com/questions/457874/how-to-know-if-there-are-updates-available
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??)


Type 'software update' in the Dash. It will launch Software Updater and also check for updates.
The GUI is written by Qt so the program is cross-platform. See its [http://sourceforge.net/p/unetbootin/wiki/compile/ wiki].


==== "Failed to download Package Files" - Software Updater ====
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.
[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.
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.


==== apt-get upgrade vs apt-get dist-upgrade ====
[[File:XUbuntu12044 USBdrive.png|200px]]
* http://askubuntu.com/questions/194651/why-use-apt-get-upgrade-instead-of-apt-get-dist-upgrade
[[File:XUbuntu gparted.png|200px]]


My experience aligns with the statement: '''dist-upgrade''' is more likely to break stuff badly than '''upgrade'''.
== Universal USB Installer/UUI ==
http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/


==== Offline update/upgrade: [https://github.com/rickysarraf/apt-offline apt-offline] ====
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.
[https://www.ostechnix.com/fully-update-upgrade-offline-debian-based-systems/ How To Fully Update And Upgrade Offline Debian-based Systems]


==== Mint ====
Note that the '''fdisk''' utility cannot handle this new partition format so we have to use the '''gparted''' program.
Works well on 18.2. It can check the speed for each mirrors.


[[File:Mint software sources.png|250px]]
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.


=== Troubleshooting ===
The following screenshots are from a 16GB USB drive.
==== [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'>
sudo apt-get --reinstall install grub-pc
</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] ====
[[File:UUIa.png|200px]] [[File:UUIb.png|200px]]
<syntaxhighlight lang='bash'>
sudo mv /tmp /tmp_old
sudo mkdir /tmp
sudo chmod 1777 /tmp
</syntaxhighlight>


==== [http://askubuntu.com/questions/73997/how-do-i-fix-a-failed-to-download-package-files-error Software updater -  “Failed to download package files” error?] ====
== Mint mintStick ==
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.
[https://pkgs.org/download/mintstick mintstick]. Linux Mint mintStick DEB package can be used in Ubuntu 18.04.


=== Password manager ===
== USB Drive Writing Speed ==
* [https://linuxconfig.org/how-to-organize-your-passwords-using-pass-password-manager How to organize your passwords using pass password manager]
Using the dd command
* [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 dd if=/dev/zero of=/media/brb/USB\ STICK/test.img bs=100M count=1 oflag=dsync


=== Use '''parted''' command to format a new hard disk ===
sudo dd if=/dev/zero of=/media/brb/USB\ STICK/test.img bs=100M count=10 oflag=dsync
* The '''fdisk''' won’t create partitions larger than 2 TB. Use '''parted''' with GPT partition table.
</pre>
* 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


<syntaxhighlight lang='bash'>
Some data from plugging into USB 2.0 slot. Partition format may be FAT32 or Ext3/4.
sudo apt-get install parted
* 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.


sudo fdisk -l /dev/sdb  # find out the disk size
Conclusions:
# USB flash drive is slow compared to USB portable hard drive.
# 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.


sudo parted
Cautions:
  print
* 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.
  select /dev/sdb
  mklabel myLabel
  mkpart primary ext4 0GB 128GB
  print
  quit
lsblk
sudo mkfs.ext4 /dev/sdb1


mkdir /mnt/newdisk
= Multiple boot USB =
sudo mount /dev/sdb1 /mnt/newdisk
df -h
</syntaxhighlight>


=== Gparted ===
== ventoy ==
It is best to use the latest release of GParted https://github.com/GNOME/gparted/.
* https://github.com/ventoy/Ventoy
* [https://ostechnix.com/how-to-create-multiboot-usb-drives-with-ventoy-in-linux/ How To Create Multiboot USB Drives With Ventoy In Linux]


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).
== [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.


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).  
It can be used to create a Multiboot USB Flash Drive containing multiple operating systems, antivirus utilities, disc cloning, diagnostic tools, and more.


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?].
== [http://multibootusb.org/ MultiBootUSB] ==
The program is included by LXLE.


==== '''gparted''' on a 4TB disk ====
It supports [https://wiki.ubuntu.com/LiveUsbPendrivePersistent persistence] up to 4GB for ubuntu and its derivatives.
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 also supports multi-thread (check by top or htop). The %cpu > 100.  


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.
It will take space as needed. So we can still use the USB drive to write data.


Step1. Device -> Create a partition table -> GPT
* http://multibootusb.org/news/
* https://github.com/mbusb/multibootusb
* https://github.com/mbusb/multibootusb/wiki/User-Guide


Step2. Create a new ext4 partition as you want.
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).


* http://ubuntuforums.org/showthread.php?t=2164361
== Automatically Mount USB Drives On Ubuntu Or Debian Server ==
* http://gparted-forum.surf4.info/viewtopic.php?id=14940
[https://www.linuxuprising.com/2019/04/automatically-mount-usb-drives-on.html Automatically Mount USB Drives On Ubuntu Or Debian Server With USBmount]
* http://askubuntu.com/questions/339041/cannot-resize-drive
* http://unix.stackexchange.com/questions/67835/change-partition-table-with-gparted


Note:
= Determine/install/switch Window Manager =
* The 4TB hard disk can be recognized and used normally in an internal hd in Ubuntu 12.04.
* https://en.wikipedia.org/wiki/Window_manager
* 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.
* http://askubuntu.com/questions/72549/how-to-determine-which-window-manager-is-running
* It cannot be used as 4TB in the case when I use a docking station in Dell Precision T3500. Unsolved problem:
* http://askubuntu.com/questions/227607/different-display-and-window-managers-for-ubuntu-and-how-to-install-them
** 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:
<pre>
* 4TB using NTFS works on Ubuntu.
sudo apt-get install wmctrl
* rsync will not stop spinning for some reason even the command is finished (through StarTech dock station).
wmctrl -m         


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.
sudo apt-get install <pkg-name>
<pkg-name> --replace
</pre>


[[File:Gparted gpt.png|200px]]
On an old/new Ubuntu the default window manager is '''Compiz'''/[https://en.wikipedia.org/wiki/GNOME_Shell GNOME Shell], for xubuntu it is '''Xfwm4''' and for BBB it is '''Openbox'''. We can use the '''neofetch''' command.


=== tracker-miner-fs ===
= Jenkins =
See http://askubuntu.com/questions/346211/tracker-store-and-tracker-miner-fs-eating-up-my-cpu-on-every-startup how to disable it.
[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]


=== Health check of the hdd ===
= Automatic update, unattended upgrade =
I got an input/output error when I use ''sudo rm'', ''sudo reboot'' or ''Ctrl + Del'' commands.  
* https://help.ubuntu.com/lts/serverguide/automatic-updates.html
* [https://itsfoss.com/auto-updates-ubuntu/ How to Handle Automatic Updates in Ubuntu]
* http://www.howtogeek.com/228690/how-to-enable-automatic-system-updates-in-ubuntu/
* [https://www.2daygeek.com/automatic-security-update-unattended-upgrades-ubuntu-debian/ How To Set up Automatic Security Update (Unattended Upgrades) on Debian/Ubuntu]
* 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'''
{{Pre}}
$ 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
</pre>
* 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]


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.
== How to find out if/why my Ubuntu/Debian Linux server needs a reboot/restart ==
* [https://www.cyberciti.biz/faq/how-to-find-out-if-my-ubuntudebian-linux-server-needs-a-reboot/ How to find out if my Ubuntu/Debian Linux server needs a reboot]  '''cat /var/run/reboot-required''' (in fact, we just need to check if the file exists or not)
* To view the list of packages that require a restart with: '''more /var/run/reboot-required.pkgs'''
* My cases are new initrd.img-5.4.X-XX-generic and vmlinuz-5.4.X-XX-generic (Linux kernel) files in /boot directory. [https://askubuntu.com/a/935899 Is there unused `initrd.img` to remove?], [https://serverascode.com/2019/05/17/install-and-boot-older-kernel-ubuntu.html Install and Boot an Older Kernel in Ubuntu], [https://linoxide.com/linux-how-to/fixing-broken-initrd-image-linux/ How to Fix a Broken Initrd Image in Linux], [https://askubuntu.com/a/574016 Safely remove old files in /boot], [https://www.jamescoyle.net/how-to/1974-how-to-fix-a-full-boot-partition-on-linux How To Fix A Full /boot Partition on Linux], [https://linoxide.com/booting/remove-old-kernel-versions-boot-menu/ How to Remove Old kernel Versions from Boot on Ubuntu 18.04].
* Check the output of 'uname -a' before and after the reboot.
<ul>
<li>
See also the [[Grub|Grub]] page. When a new initrid image is downloaded, '''/boot/grub/grub.cfg''' will be updated to use the newest image.
<pre>
grep initrd.img /boot/grub/grub.cfg -n
</pre>
</li>
</ul>
* I found the reboot reason is most likely the update of kernels (ls -lt /boot). See https://www.ubuntuupdates.org/.
* '''less /var/log/apt/history.log''' to see the update history (including unattended-upgrade, linux-headers-VERSION-generic).
* Though I have enabled '''livepatch''', when I ssh into my machine the console still shows "System restart required". Why?
** https://ubuntu.com/security/livepatch
** [https://askubuntu.com/a/844693 Instance with Canonical Livepatch Service requires restart]
** [https://www.maketecheasier.com/how-to-avoid-server-reboots-with-ubuntu-livepatch/ How to Avoid Server Reboots with Ubuntu Livepatch]
** [https://discourse.ubuntu.com/t/livepatch-faq/24760 Livepatch FAQ - Livepatch - Ubuntu Community Hub]
** [https://nobuto-m.github.io/post/2017/knowing-what-services-need-restart-with-needrestart/ Knowing what services need restart with “needrestart”]
 
Raspberry Pi
* [https://www.cyberciti.biz/faq/how-to-find-out-if-raspberry-pi-linux-os-needs-a-reboot/ How to find out if Raspberry PI Linux OS needs a reboot]


To force to reboot/shutdown, follow the suggestion [http://linoxide.com/how-tos/inputoutput-error-bad-blocks-how-to-restart-linux/ here]
== Shell example to get notification when you need to reboot ==
[https://www.cyberciti.biz/faq/how-to-find-out-if-raspberry-pi-linux-os-needs-a-reboot/ How to find out if Raspberry PI Linux OS needs a reboot]


'''dmesg''' command shows there are a few bad sectors on that hdd.  
= After running update/upgrade in Ubuntu =
== Virtualbox ==
Virtualbox does not work. After initial fix, the guest machine cannot connect to internet:(


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.
== Crashes network manager (no internet connection, no applet) ==
<pre>
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).
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
= Printer setup =
.
* [https://www.ibm.com/developerworks/library/l-lpic1-108-4/index.html Manage printers and printing]


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.
Printers -> Add ->  Network Printer -> Find Network Printer (wait a little bit).


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 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.


=== Burn/Write an iso or img file to a USB flash drive ===
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.
[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].
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 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 ====
== Web interface (port 631) ==
* [http://www.cyberciti.biz/faq/unix-linux-dd-create-make-disk-image-commands/ How to make disk image with dd on Linux or Unix]
* [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]]


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.
== Troubleshooting ==
* [https://support.system76.com/articles/add-a-printer-pop/ Pop_OS].If the printer stops working, open the Printers Application again and click the gear icon, and select Remove Printer to remove the printer and its settings. Repeat the steps above to add the printer and try printing the test page again. This process usually resolves many printing issues.
* '''io.elementary.appcenter''' took 2GB memory on Pop_OS 20.04; see [https://www.reddit.com/r/pop_os/comments/h0tgzn/pop_shop_not_closing_properly_sometimes/ '''Pop Shop''' not closing properly (sometimes)]
* [[#LPR_.26_Cupswrapper|Download driver from manufacturer website]]
* To look at the CUPS (Common Unix Printing System) configuration and status window, please open this webpage: http://localhost:631. The "Help" menu provides help for lots of printer commands.
* [https://wiki.ubuntu.com/DebuggingPrintingProblems Debugging Printing Problems] Ubuntu
** '''avahi-browse -a -v -t -r ''' can show the printer IP


The instruction can be found in a lot of places like [https://wiki.archlinux.org/index.php/USB_Flash_Installation_Media Archlinux wiki] page.
== Deep sleeping ==
<syntaxhighlight lang='bash'>
* [https://medium.com/@watsonpitter26/how-do-i-get-my-brother-printer-out-of-deep-sleep-mode-2fc14e2ab9d6 How do I get my brother printer out of deep sleep mode]
sudo fdisk -l
* [https://help.brother-usa.com/app/answers/detail/a_id/151825/~/unable-to-print-after-the-machine-has-entered-deep-sleep---windows Unable to print after the machine has entered "Deep Sleep" - Windows]
sudo dd bs=4M if=xxx.img of=/dev/sdb && sync
* [https://help.brother-usa.com/app/answers/detail/a_id/153110/~/unable-to-print-after-the-machine-has-entered-deep-sleep---macintosh Unable to print after the machine has entered "Deep Sleep" - Macintosh]
</syntaxhighlight>
where /dev/sdb is a device name, not a partition name. We can also adjust bs to a smaller value like 1M, 4m.


* [http://www.cyberciti.biz/faq/linux-unix-dd-command-show-progress-while-coping/ Monitor the progress],  
== Command line ==
** adding a parameter '''status=progress''' in '''dd''' (not working on Ubuntu 14.04)
* '''lpstat'''
** Linux '''dialog''' command
** '''lpstat -t''': see the status for all of the printers on the system, as well as the scheduler and all jobs
** following [[Raspberry#Install_an_image_to_a_SD_card|Raspberry Pi]]
** '''lpstat -p''': Display all installed printers
<syntaxhighlight lang='bash'>
** '''lpstat -a''': Display only those printers that are currently accepting print requests.
sudo pkill -USR1 -n -x dd
** '''lpstat -o''': Display all active print jobs
</syntaxhighlight>
* '''lp'''
** '''lp example.pdf''': print a single example.pdf file on your default printer
** '''lp -d MFCL2700DW example.pdf''': specify a printer via the -d switch:
** Two-sided printing: '''lp -o sides=two-sided-long-edge example.pdf'''
** '''lp -P 1,3,5-7,16 example.pdf''' : Print certain pages
** man lp: Help
* '''lpadmin'''
** '''lpadmin -x''': Delete a printer. PS I cannot delete a printer either using the GUI or the command line:(


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.
== LPR & Cupswrapper* ==
* [https://opensource.com/article/21/9/print-files-linux Print files from your Linux terminal]
* [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.
** '''lpstat -t''' to check the status for CUPS printer OR
** '''Alt+F2''' and enter '''system-config-printer'''
** Deb version
** The deb version only has i386 version?
** [https://youtu.be/ys5VqAEqVII How to install brother Network printer on ubuntu] 2017
** [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 Linux Printer Driver (deb package).
*# 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 (ipp://BRWFC017C4B27C8.local:631/ipp/print ) or the "Specify IP address" choice (192.168.1.89).
*# The install process may take some time. Please wait until it is complete.
*# http://192.168.1.89:631. The [https://support.brother.com/g/b/faqend.aspx?c=us&lang=en&prod=mfcl2710dw_us_eu_as&faqid=faq00002496_002 default password] is '''initpass'''
* It seems Ubuntu 18.04 can automatically detect the MFC-L2700DW network printer.
* I use this method to install the driver on Ubuntu 18.04 and 20.04.
* I update to the latest version using ios app (2020-04-20). I tried more than 1 time.
* Some commands
<pre>
$ lpstat -R  # check queue
</pre>
[[:File:PrinterInstall.png]]


In another case, the gparted compalins the usb drive "Invalid partition table - recursive partition on /dev/sdb". Someone suggests to issue a command
== Paper Jam ==
<syntaxhighlight lang='bash'>
[https://www.youtube.com/watch?v=1oYP0GCM_Mw Brother MFCL2710DW - Clearing paper jam errors]
sudo dd if=/dev/zero of=/dev/sdb bs=4M
</syntaxhighlight>


==== [https://etcher.io/ Etcher] - cross platform ====
== Drum ==
For Ubuntu, there is no need to install the program. Just run the binary file (.AppImage).
* [http://support.brother.com/g/b/faqend.aspx?prod=hl5250dn_all&c=eu_ot&lang=en&faqid=faq00000154_022 Replace the drum unit]
* https://youtu.be/KpK3gDJTF3k


See https://www.raspberrypi.org/magpi/pi-sd-etcher/
= Graphics driver =
* 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://itsfoss.com/fix-ubuntu-freezing/ Fixing Ubuntu Freezing at Boot Time]. Ubuntu 18.04. Don't use open source version of NVIDIA drivers. Use proprietary NVIDIA drivers.
* 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/


==== [https://rufus.akeo.ie/ Rufus - Windows] ====
GPU info
* 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?]
{{Pre}}
* https://github.com/hirotakaster/baytail-bootia32.efi
$ lspci -vnn | grep VGA -A 12
* [https://medium.com/@tomac/installing-ubuntu-mint-linux-on-onda-820w-tablet-727747a376b#.o4osscrty installing Ubuntu / Mint Linux on Onda 820w tablet]
# OR
* It successfully burns ESXi and Ubuntu iso images to USB drives while the USB drives created by the 'dd' command does not work??
$ lshw -numeric -C display
</pre>


==== [https://unetbootin.github.io/ UNETBOOTIN] - cross platform ====
To check hardware acceleration
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
# If glxinfo is not find, run sudo apt-get install mesa-utils
* This approach works
$ glxinfo | grep OpenGL
* Rufus is good but not always (eg the USB drive is not bootable??)
</pre>


The GUI is written by Qt so the program is cross-platform. See its [http://sourceforge.net/p/unetbootin/wiki/compile/ wiki].
Under Ubuntu-Unity, we can search Additional Drivers to install propriety party drivers instead of using X.org.


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.
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].
{{Pre}}
$ sudo lshw -C video
[sudo] password for brb:
  *-display
    description: VGA compatible controller
    product: GF108GL [Quadro 600]
    vendor: NVIDIA Corporation
    ...
</pre>


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.
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].


[[File:XUbuntu12044 USBdrive.png|200px]]
== AMD vs NVIDIA ==
[[File:XUbuntu gparted.png|200px]]
[http://www.makeuseof.com/tag/use-amd-nvidia-gpus-linux/ Should You Use AMD or NVIDIA GPUs on Linux?]
 
==== 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.
= Autostart a program after logging into your desktop =
<ol>
<li>'''~/.config/autostart/''' (hidden directory)


Note that the '''fdisk''' utility cannot handle this new partition format so we have to use the '''gparted''' program.
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. I am using this way to auto start conky; see [[Conky|here]]. [https://askubuntu.com/a/81385 How can I add new autostart programs in Lubuntu?]


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.
If you’re not using a desktop environment check out '''~/.bash_profile''' file.
</li>
<li>'''/etc/xdg/autostart'''
</li>
<li>search 'Startup Applications Preferences' in Dash/Menu/Preferences. I have 1) Calibre 2) Dropbox 3) SSH Key Agent (/usr/bin/gnome-keyring-daemon --start --components=ssh) . For Lubuntu, this option is available on version 19.04+.
</li>
</ol>


The following screenshots are from a 16GB USB drive.
Resources:
* 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
* [https://askubuntu.com/questions/48321/how-do-i-start-applications-automatically-on-login How do I start applications automatically on login?]
* [https://www.linuxuprising.com/2020/11/how-to-launch-startup-applications-with.html How To Launch Startup Applications With A Delay On Linux]


[[File:UUIa.png|200px]] [[File:UUIb.png|200px]]
= Auto start services on boot =
* 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]]


=== Multiple boot USB ===
On Ubuntu (Let’s say script name is nginx),
==== [http://www.pendrivelinux.com/yumi-multiboot-usb-creator/ YUMI] ====
# Copy the script in '''/etc/init.d/''' folder
YUMI works much like Universal USB Installer, except it can be used to install more than one distribution to run Live from your USB.
# Execute the below command
{{Pre}}
update-rc.d nginx defaults
</pre>
# Reboot the server to ensure services are started.


It can be used to create a Multiboot USB Flash Drive containing multiple operating systems, antivirus utilities, disc cloning, diagnostic tools, and more.
= Take screenshots (and edit them) =
* https://wiki.archlinux.org/index.php/taking_a_screenshot
* [https://www.debugpoint.com/screenshot-apps-linux/ 10 Best Modern Screenshot Apps for Linux] 2023/12/28


==== [http://multibootusb.org/ MultiBootUSB] ====
== gnome-screenshot (preinstalled in Ubuntu) ==
The program is included by LXLE.
* [https://linuxhint.com/screenshots_ubuntu/ The Best Methods to Take Screenshots in Ubuntu 22.04]
* [https://www.howtoforge.com/tutorial/taking-screenshots-in-linux-using-gnome-screenshot/ A comprehensive guide to taking screenshots in Linux using gnome-screenshot]
{{Pre}}
# Current window
gnome-screenshot -w


It supports [https://wiki.ubuntu.com/LiveUsbPendrivePersistent persistence] up to 4GB for ubuntu and its derivatives.
# an area
gnome-screenshot -a


It also supports multi-thread (check by top or htop). The %cpu > 100.
# delay
gnome-screenshot --delay=[SECONDS]


It will take space as needed. So we can still use the USB drive to write data.
# interactive mode
gnome-screenshot -i


* http://multibootusb.org/news/
# directly save your screenshot
* https://github.com/mbusb/multibootusb
gnome-screenshot --file=[FILENAME]
* 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).
# copy to the clipboard
 
gnome-screenshot -c
=== 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
 
<pre>
sudo apt-get install wmctrl
wmctrl -m         
 
sudo apt-get install <pkg-name>
<pkg-name> --replace
</pre>
</pre>


On Ubuntu the default window manager is '''Compiz''', for xubuntu it is '''Xfwm4''' and for BBB it is '''Openbox'''.
== [http://shutter-project.org/ Shutter] (removed) ==
[https://www.linuxuprising.com/2018/10/shutter-removed-from-ubuntu-1810-and.html Shutter screenshot tool was removed from Debian Unstable and Ubuntu 18.10 ]. Consider '''flameshot'''.


=== Add date and time to the clock indicator on the top panel ===
{{Pre}}
Method 1. GUI approach. Right click the clock indicator and choose Time and Date Settings. Click on 'clock' tab and check 'date and month' option.
# https://launchpad.net/~shutter/+archive/ubuntu/ppa
 
sudo add-apt-repository ppa:shutter/ppa
Method 2. [https://www.liberiangeek.net/2012/05/show-the-date-and-time-on-the-clock-indicator-in-ubuntu-12-04-precise-pangolin/ Command line approach].
sudo apt-get update
<pre>
sudo apt-get install shutter
gsettings set com.canonical.indicator.datetime show-date true
</pre>
</pre>


=== Jenkins ===
* After we launch Shutter, the tool sits at the (upper-right) Ubuntu system tray
[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]
* 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.


=== Automatic update ===
== ksnip ==
http://www.howtogeek.com/228690/how-to-enable-automatic-system-updates-in-ubuntu/
[https://www.linuxuprising.com/2020/02/ksnip-160-screenshot-software-released.html Ksnip 1.6.0 Screenshot Software Released With System Tray Icon, Global Hotkeys, Watermarks And More ]


=== After running update/upgrade in Ubuntu ===
Note the snap version of the program does not allow me to save the file?
==== Virtualbox ====
Virtualbox does not work. After initial fix, the guest machine cannot connect to internet:(


==== Crashes network manager (no internet connection, no applet) ====
The deb [https://github.com/ksnip/ksnip/releases binary file] works perfectly.
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).


=== Printer setup ===
To crop an image, click the "Crop" icon. It will select the border of the image ready for cropping. All you have to do is drag and resize the rectangle. See a screenshot below.
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.
[[:File:Ksnip.png]]


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.
== [https://github.com/lupoDharkael/flameshot flameshot] (good replacement of shutter) ==
* https://flameshot.js.org/#/
* [https://itsfoss.com/take-screenshot-linux/ Best Tools For Taking and Editing Screenshots in Linux]
* It also has a command line function like scrot.
* The text tool cannot change the font size?
* [https://www.makeuseof.com/how-to-take-screenshots-flameshot-linux/ How to Capture and Edit Screenshots on Linux With Flameshot]


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.
== Annotator ==
* [https://itsfoss.com/annotator/ Annotator: Open-Source App for Linux to Easily Add Essential Annotations to Your Images]
* [https://www.makeuseof.com/install-use-annotator-linux/ How to Install and Use Annotator: An Image Annotation Tool for Linux]


=== Graphics driver ===
== GIMP ==
* 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.
File -> Create -> Screenshot
* 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
== '''import''' ==
<syntaxhighlight lang='bash'>
command from ImageMagick
$ lspci -vnn | grep VGA -A 12
 
# OR
== '''scrot''' ==
$ lshw -numeric -C display
from scrot package. Note that by default the title bar will not be included (see the '-b' option below).
</syntaxhighlight>


To check hardware acceleration
It seems '''scrot''' is better for my need.
<syntaxhighlight lang='bash'>
# If glxinfo is not find, run sudo apt-get install mesa-utils
$ glxinfo | grep OpenGL
</syntaxhighlight>


Under Ubuntu-Unity, we can search Additional Drivers to install propriety party drivers instead of using X.org.
Note: there seems no way to copy the screenshot to the clipboard.
{{Pre}}
scrot -c -d 5 screenshot.png    # -c is count down, -d is 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].
scrot -b -c -d 5 -u screenshot.png  # -b is title bar, -u is the current foc'u'sed window
<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>


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].
scrot -u                        # current window


==== AMD vs NVIDIA ====
scrot -s screenshot.png          # select an area
[http://www.makeuseof.com/tag/use-amd-nvidia-gpus-linux/ Should You Use AMD or NVIDIA GPUs on Linux?]


=== System program problem detected ===
scrot --thumb 50                # 50% of the original screenshot
* http://askubuntu.com/questions/365358/im-getting-a-lot-of-system-program-problem-detected-error-dialogs-is-there-a
<pre>
sudo rm /var/crash/*
</pre>
* http://www.techdrivein.com/2012/08/how-to-disable-system-program-problem.html. sudo nano /etc/default/apport.
Change value of "enabled" from 1 to 0. Then reboot.


=== Autostart when log into your desktop ===
scrot abc.png -e 'gthumb $n'     # open gThumb to open the file after taking the screenshot
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.
# sudo apt-get install mirage    # 105 kB
mirage screenshot.png            # view the image


If you’re not using a desktop environment check out '''~/.bash_profile''' file.
scrot -b -d 5 '%Y:%m:%d:%H:%M:%S.png' -e 'mv $f ~/Desktop/'
</pre>


2. '''/etc/xdg/autostart'''
See [https://www.howtoforge.com/tutorial/how-to-take-screenshots-in-linux-with-scrot/ How to take screenshots in Linux with scrot].


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?]
== [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


Resources:
== Hotshots ==
* http://www.howtogeek.com/228467/how-to-make-a-program-run-at-startup-on-any-computer/
Only supports Ubuntu up to 14.04.
* https://developer.toradex.com/knowledge-base/how-to-autorun-application-at-the-start-up-in-linux
{{Pre}}
sudo add-apt-repository ppa:ubuntuhandbook1/apps
sudo apt-get update
sudo apt-get install hotshots
</pre>


=== Auto start services on boot ===
== mtPaint, MyPaint, Pinta ==
* https://geekflare.com/how-to-auto-start-services-on-boot-in-linux/
[[#Paint.NET_like_program|Paint.NET_like_program]]
* 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]]


On Ubuntu (Let’s say script name is nginx),
Either MyPaint (no tool) or Pinta (can't control font size) is not good at adding text to an image. GIMP is still the king.
# Copy the script in '''/etc/init.d/''' folder
# Execute the below command
<syntaxhighlight lang='bash'>
update-rc.d nginx defaults
</syntaxhighlight>
# Reboot the server to ensure services are started.


=== Take screenshots (and edit them) ===
= Screencaster/Record desktop =
https://wiki.archlinux.org/index.php/taking_a_screenshot


==== gnome-screenshot (preinstalled in Ubuntu) ====
* https://wiki.ubuntu.com/ScreenCasts (seems outdated)
[https://www.howtoforge.com/tutorial/taking-screenshots-in-linux-using-gnome-screenshot/ A comprehensive guide to taking screenshots in Linux using gnome-screenshot]
* http://askubuntu.com/questions/4428/how-to-create-a-screencast
<syntaxhighlight lang='bash'>
* [https://www.makeuseof.com/tag/ways-can-record-desktop-linux-raspberry-pi/ 7 Ways to Record Your Desktop Screen on Linux and Raspberry Pi]: Kazam, Simple Screen Recorder, ScreenStudio, RecordMyDesktop, VLC, Asciinema, OBS Studio.
# Current window
* [https://askubuntu.com/a/897844 How to Record Screen and internal Audio?] (simplescreenrecorder works for recording the entire screen & a fixed rectangle but not a window!)
gnome-screenshot -w
* [https://www.makeuseof.com/best-linux-screen-recording-apps/ The 8 Best Linux Screen Recording Apps to Capture Your Screen]
 
== OBS Studio (cross platform) ==
* https://obsproject.com/, https://youtu.be/55sP4ytE1uc?t=189
* [https://itsfoss.com/screen-record-obs-wayland/ Screen Recording in Linux With OBS and Wayland]
* [https://www.makeuseof.com/best-obs-studio-live-streaming-alternatives/ The 5 Best OBS Studio Alternatives for Live Streaming]


# an area
== Blue Recorder ==
gnome-screenshot -a
* https://github.com/xlmnxp/blue-recorder. Snap and Flathub. Blue Recorder captures both audio and video at 60fps stright out of the box. You can define a delay. You can hide the app's interface.


# delay
== Peek ==
gnome-screenshot –delay=[SECONDS]
https://github.com/phw/peek 9.9k star, latest release 2020. It is possible to use Peek in a GNOME Shell Wayland session using XWayland by launching Peek with the X11 backend.


# interactive mode
== VokaScreenNG ==
gnome-screenshot -i
* https://github.com/vkohaupt/vokoscreenNG 895 star, latest release Oct 01, 2023
* [https://www.debugpoint.com/screen-recorders-linux-wayland/ Best Screen Recorders for Wayland in Linux (Compared & Tested)]
* [https://itsfoss.com/vokoscreenng/ VokoscreenNG: Open Source Screencasting Tool]
* It is used in [https://youtu.be/T29fMv5OoFA youtube videos] of QML tutorials.


# directly save your screenshot
== [https://launchpad.net/kazam kazam] ==
gnome-screenshot –file=[FILENAME]
It seems Kazam does not support Wayland yet. So use OBS Studio instead.


# copy to the clipboard
Although Kazam can do screenshots, [[#Shutter|Shutter]] (can sit on the system tray) is more convenient for taking care of screenshots.
gnome-screenshot -c
</syntaxhighlight>


==== [http://shutter-project.org/ Shutter] ====
The default frame rate is only 15. If we want to increase it, go to File -> Preferences -> Screencast tab.
<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
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),
* The built-in editor (click '''Edit''' button on the rhs) is convenient but limited ('''GIMP''' is more powerful but complicated). Tools includes
* Record=Ctrl + Windows + r,
** Select item to move or resize it
* Finish=Ctrl + Windows + f,
** Draw a freehand line
* Pause=Ctrl + Windows + p.
** Highlighter
{{Pre}}
** Draw a straight line
sudo apt-get install kazam
** Draw an arrow
</pre>
** Draw a rectangle
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.
** 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.


==== GIMP ====
A good introduction [https://www.maketecheasier.com/create-screencast-videos-using-kazam/ Create Screencast Videos With Ease Using Kazam]
File -> Create -> Screenshot


==== '''import''' ====
== [http://www.maartenbaert.be/simplescreenrecorder/ SimpleScreenRecorder] (Qt based) ==  
command from ImageMagick
[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]
{{Pre}}
sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder
sudo apt-get update
sudo apt-get install simplescreenrecorder
</pre>


==== '''scrot''' ====
== [https://wiki.gnome.org/Projects/Istanbul Istanbul] ==  
from scrot package. Note that by default the title bar will not be included (see the '-b' option below).
Saved files are in the '''ogg''' format.
{{Pre}}
sudo apt-get install istanbul
</pre>


It seems '''scrot''' is better for my need.
== [https://wiki.ubuntu.com/ScreenCasts/RecordMyDesktop 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).
{{Pre}}
sudo apt-get install recordmydesktop gtk-recordmydesktop
</pre>


Note: there seems no way to copy the screenshot to the clipboard.
== Create animated Gif of a screencast ==
<syntaxhighlight lang='bash'>
* [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].
scrot -c -d 5 screenshot.png    # -c is count down, -d is delay
* [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]
* [https://vishalvyas.com/how-to-create-animated-gifs-with-peek-on-ubuntu/ How to create Animated GIFs with Peek on Ubuntu]


scrot -b -c -d 5 -u screenshot.png  # -b is title bar, -u is the current foc'u'sed window
= Second screen =
== Deskreen: share an app or the desktop ==
* cf [[Remote_desktop#RustDesk|RustDesk]] (teamviewer like)
* cf [https://anydesk.org/en/solutions/personal-user AnyDesk] (teamviewer like)
* [https://www.linuxuprising.com/2021/01/deskreen-makes-any-device-with-web.html Deskreen Makes Any Device With A Web Browser A Second Screen For Your Computer], [https://smile.amazon.com/Headless-Display-Emulator-Headless-1920x1080-Generation/dp/B06XT1Z9TF amazon]
* [https://www.reviewgeek.com/68635/the-free-deskreen-app-turns-your-old-tablet-into-a-wireless-monitor/ The Free Deskreen App Turns Your Old Tablet Into a Wireless Monitor]
* Android:
** Firefox works better than Brave/Duckduckgo on Onyx Note Air. I can exit the full screen mode by swiping up to get open apps and then clicking on FF. Dasung Non-Reader is much slow compared to Note Air.
* IOS:
** Safari works well. The latency is low and there is an "X" on top-left corner to exit the full screen mode. Chrome does not work for some reason.


scrot -u                        # current window
== VirtScreen ==
https://github.com/kbumsik/VirtScreen


scrot -s screenshot.png          # select an area
== Mirroring display/screen ==
* [https://www.linuxuprising.com/2021/05/turn-your-tablet-or-phone-into-graphic.html Turn Your Tablet Or Phone Into A Graphic Tablet / Touch Screen For Your Desktop With Weylus]


scrot --thumb 50                # 50% of the original screenshot
= 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]
* Download the wallpapers from other distributions like
** Linux Mint. [https://winaero.com/install-previous-wallpapers-linux-mint-19/ Install Previous Wallpapers in Linux Mint 19]. '''/usr/share/backgrounds/'''
** Elementary
** Budgie
* [https://fedoraproject.org/wiki/Wallpapers Fedora wallpapers]


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


# sudo apt-get install mirage    # 105 kB
== Dock ==
mirage screenshot.png            # view the image
* [https://itsfoss.com/customize-ubuntu-dock/ The Definitive Guide to Using and Customizing the Dock in Ubuntu]
* [https://itsfoss.com/make-ubuntu-look-like-macos/ How to Make Ubuntu Look Like macOS in 5 Easy Steps]
* Install  Cairo-Dock.


scrot -b -d 5 '%Y:%m:%d:%H:%M:%S.png' -e 'mv $f ~/Desktop/'
== Show date in top bar of desktop ==
* [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>
</syntaxhighlight>


See [https://www.howtoforge.com/tutorial/how-to-take-screenshots-in-linux-with-scrot/ How to take screenshots in Linux with scrot].
== Remove overlay scroll bar ==
http://www.itworld.com/article/2698420/disable-overlay-scroll-bars-in-ubuntu-14-04.html
 
== Change scroll bar color ==
See [http://ubuntuforums.org/showthread.php?t=1172617 this post]. Run sudo apt-get install gnome-color-chooser.
 
Go to Engines tab in gnome-color-chooser and choose clearlooks engine for scrollbars.


==== [https://screencloud.net/ ScreenCloud] ====
== How to turn off/disable Compiz's “drag to maximize” behaviour? ==
* Binary for Ubuntu 16.04 is available
http://askubuntu.com/questions/72452/how-to-turn-off-compizs-drag-to-maximize-behaviour
* 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 ====
On Mint, go to Preferences -> Window Tiling -> Enable Window Tiling and snapping -> Off.
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 ====
== Move a Window Without Clicking the Titlebar ==
[[#Paint.NET_like_program|Paint.NET_like_program]]
Hold down the '''Alt''' key and then click in the window anywhere, and move your mouse.. See [[Raspberry#Move_a_Window_Without_Clicking_the_Titlebar|here]]. For recent Ubuntu, we can hold the '''super''' key and drag the window anywhere. See [https://help.ubuntu.com/stable/ubuntu-help/shell-windows-states.html.en Move and resize windows].


=== Screencaster/Record desktop ===
On new Ubuntu, the Settings -> Keyboard Shortcuts shows Alt + F7 can be used to move a Window. The method is to use the arrow keys to move the window up/down after we hit Alt + F7.


* https://wiki.ubuntu.com/ScreenCasts (seems not updated)
== Snapping windows to left or right ==
* http://askubuntu.com/questions/4428/how-to-create-a-screencast
* Drag the window to left or right. I found when I drag the window to right, it just maximizes the window
==== [https://launchpad.net/kazam kazam] ====
* Window key + Left/right key. It Works on Ubuntu 18.40.
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.
== How to Keep a Window Always on Top ==
[https://www.makeuseof.com/keep-a-window-always-on-top-linux/ How to Keep a Window Always on Top in Linux]


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),
== Change mouse cursor size ==
* Record=Ctrl + Windows + r,
Settings -> Universal Access
* 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]
= [https://help.ubuntu.com/community/NetworkManager Network Manager] =
== Find Available Network Interfaces On Linux ==
[https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux/ Find Available Network Interfaces On Linux]


==== [http://www.maartenbaert.be/simplescreenrecorder/ SimpleScreenRecorder] (Qt based) ====
# ifconfig -a
[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]
# ip link show  # OR ip addr
<syntaxhighlight lang='bash'>
# ls /sys/class/net
sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder
# cat /proc/net/dev
sudo apt-get update
# netstat -i
sudo apt-get install simplescreenrecorder
# nmcli device status # OR nmcli connection show
</syntaxhighlight>


==== [http://www.kohaupt-online.de VokaScreen] ====
== Restart the network ==
It is used in [https://youtu.be/T29fMv5OoFA youtube videos] of QML tutorials.
<pre>
 
sudo service network-manager restart
==== [http://live.gnome.org/Istanbul Istanbul] ====
# OR
Saved files are in the '''ogg''' format.
sudo nmcli networking off
<syntaxhighlight lang='bash'>
sudo nmcli networking on
sudo apt-get install istanbul
</pre>
</syntaxhighlight>


==== [https://wiki.ubuntu.com/ScreenCasts/RecordMyDesktop RecordMyDesktop] ====
== avahi-daemon ==
http://www.youtube.com/watch?v=A0Tn3Z8OklQ.
Run '''sudo apt install avahi-daemon''' so we can use hostname.local to access the remote machine.
** 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 ====
== Set static IP ==
* [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.makeuseof.com/configure-static-ip-address-settings-ubuntu-22-04/ How to Configure Static IP Address on Ubuntu 22.04 LTS] or [https://ostechnix.com/configure-static-ip-address-ubuntu/ How To Configure Static IP Address In Ubuntu (Easy Guide)]. Method 1: '''nmcli''' Command, Method 2: '''Netplan''', Method 3: '''nmtui''', 4: GUI.
* [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 ===
[https://www.reddit.com/r/Ubuntu/comments/bdeki8/my_ubuntu_server_has_two_ip_addresses_but_only/ My Ubuntu Server has two IP addresses, but only one is assigned in netplan, any ideas?] Solution: assign static ones in the router to your computer's MAC address.
[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]


=== Conky ===
Starting with 17.10 release, '''Netplan''' is the default network management tool on Ubuntu. PS. another file we may want to check is '''/etc/dhcpcd.conf'''.
[http://conky.sourceforge.net/ Conky] is a free, light-weight system monitor for X, that displays any information on your desktop.


* https://help.ubuntu.com/community/SettingUpConky
PS: replace '''eth0''' as needed. On my Ubuntu box, it should be ens18 according to '''ip a'''. We can find out the device name by the default 00-netcfg.yaml file. [https://www.linuxtechi.com/static-ip-address-on-ubuntu-server/ Setting up Static IP address on Ubuntu Server 22.04].
* 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].  
<pre>
* http://www.ifxgroup.net/conky.htm
$ sudo cat /etc/netplan/01-netcfg.yaml
* http://www.tomshardware.com/faq/id-1882395/write-conky-config-file.html Explain conkyrc file


Step 1. Install conky-all package
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.1.199/24
      nameservers:
          addresses: [8.8.8.8, 1.1.1.1]
      routes:
        - to: default
          via: 192.168.1.1
$ sudo netplan apply # or sudo netplan --debug apply
$ ip a              # no reboot is necessary
</pre>
Now that I got a message when I tried above on the latest Ubuntu 20.04. '''`gateway4` has been deprecated, use default routes instead'''. To fix it, follow the instruction [https://unix.stackexchange.com/a/681221 here] by replacing ''gateway4'' with ''routes'' with to and via.


Step 2. create ~/.conkyrc file. This file can be downloaded from web.
== Multiple IP addresses ==
* [https://www.howtogeek.com/devops/how-to-add-an-additional-ip-address-to-your-linux-server/ How to Add an Additional IP Address to Your Linux Server]
* one Ethernet port can have multiple IP addresses in Ubuntu. This is often referred to as IP aliasing. see [https://askubuntu.com/questions/547289/how-can-i-from-cli-assign-multiple-ip-addresses-to-one-interface How can I (from CLI) assign multiple IP addresses to one interface?].


Step 3. Run it: $ conky. If we want to run a specific configuration file, use conky -c CONKYRCFILE
== Change IP address from the command line ==
<pre>
/sbin/ifconfig eth0 192.168.1.17 netmask 255.255.255.0 up
/sbin/ifconfig eth0
</pre>


Step 4. If you want to stop Conky: $ killall conky
[http://www.howtogeek.com/103190/change-your-ip-address-from-the-command-prompt/ Windows] OS.


Note that conky works automatically on Ubuntu's Unity.  
== Local DNS ==
* Search: local caching stub resolver DNS ubuntu 20.04
* [https://www.howtoforge.com/how-to-setup-local-dns-server-using-dnsmasq-on-ubuntu-20-04/ How to Setup Local DNS Resolver using Dnsmasq on Ubuntu 20.04]
* [https://youtu.be/uV-OauHhKgA Configuring DNS With Dnsmasq and Ubuntu Server 20.04] (video)
* [https://www.linuxbabe.com/ubuntu/set-up-local-dns-resolver-ubuntu-20-04-bind9 Set Up Local DNS Resolver on Ubuntu 20.04 with BIND9]
** '''systemd-resolve --status''' can show the real DNS while the '''dig''' only shows 127.0.0.53
** '''dig''' command can include a DNS IP, for example, dig A www.pcworld.com @8.8.8.8
** '''nslookup''' command can also show the DNS IP. I got 127.0.0.53 too.


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
== Set up OpenDNS ==
<pre>
[https://support.opendns.com/hc/en-us/articles/228007167-Linux-Mint-Cinnamon Set up OpenDNS on Linux Mint] or [https://pchelp.ricmedia.com/set-custom-dns-servers-linux-network-manager-resolv-conf/ Set custom DNS servers on Linux with Network Manager or resolv.conf]
[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>


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.
Select the Method: '''Automatic (DHCP) addresses only''' and enter '''208.67.220.220, 208.67.222.222''' into the DNS field, then click Save.


=== What should I do when Ubuntu freezes? ===
But after the change (and reboot), I don't have internet anymore.
* http://askubuntu.com/questions/4408/what-should-i-do-when-ubuntu-freezes
* https://en.wikipedia.org/wiki/Magic_SysRq_key


Press Alt+Print and then type 'REISUB' (not work, it only does screenshot)
== 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.


=== Customize the desktop ===
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).
* Install  Cairo-Dock.


==== Remove overlay scroll bar ====
See also the next: How to flush the DNS cache
http://www.itworld.com/article/2698420/disable-overlay-scroll-bars-in-ubuntu-14-04.html


==== Change scroll bar color ====
== How to flush the DNS cache ==
See [http://ubuntuforums.org/showthread.php?t=1172617 this post]. Run sudo apt-get install gnome-color-chooser.  
* http://www.cyberciti.biz/faq/rhel-debian-ubuntu-flush-clear-dns-cache/
* [https://www.linuxuprising.com/2019/07/how-to-flush-dns-cache-on-linux-for.html?m=1 How To Flush DNS Cache On Linux for systemd-resolved (eg Ubuntu 18.04), BIND, Dnsmasq Or nscd]
* http://www.makeuseof.com/tag/flush-dns-cache-ubuntu/
{{pre}}
sudo /etc/init.d/dns-clean
</pre>


Go to Engines tab in gnome-color-chooser and choose clearlooks engine for scrollbars.
== NM-applet ==
https://wiki.archlinux.org/index.php/NetworkManager


==== How to turn off/disable Compiz's “drag to maximize” behaviour? ====
== Wifi problem troubleshooting ==
http://askubuntu.com/questions/72452/how-to-turn-off-compizs-drag-to-maximize-behaviour
[https://www.maketecheasier.com/fix-wi-fi-not-working-ubuntu/ Wi-Fi Not Working in Linux? Here’s How to Fix it] 2024. 1. Hardware or software, 2. Driver, 3. DNS.


On Mint, go to Preferences -> Window Tiling -> Enable Window Tiling and snapping -> Off.
== How to Connect to WiFi using netplan ==
[https://itsfoss.com/connect-wifi-terminal-ubuntu/ How to Connect to WiFi from the Terminal in Ubuntu Linux]


=== [http://www.gnu.org/software/grub/ Grub2] ===
== Manage wifi network using nmcli and wavemon ==
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.
<ul>
 
<li>[https://ostechnix.com/check-wifi-signal-strength-from-commandline-in-linux/ How To Check WiFi Signal Strength From Commandline In Linux]
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
<ul>
<li>nmcli - nmcli dev wifi
<li>iw - sudo iw dev; sudo iw dev wlo1 link
<li>iwconfig - sudo apt install wireless-tools; sudo iwconfig
<li>iwlist - sudo apt install wireless-tools; sudo iwlist wlan0 scanning | grep -i --color signal
<li>wavemon - sudo apt install wavemon; wavemon
</ul>
<li>[https://core.docs.ubuntu.com/en/stacks/network/network-manager/docs/configure-wifi-connections Configure WiFi Connections]
<pre>
<pre>
sudo apt-get install grub2-splashimages
nmcli d wifi connect my_wifi password <password>
sudo cp /usr/share/images/grub/Moraine_Lake_17092005.tga /boot/grub/
sudo update-grub
</pre>
</pre>
</li>
<li>
[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/managing-wi-fi-connections_configuring-and-managing-networking Chapter 12. Managing wi-fi connections] from redhat.com
</li>
<li>[https://www.linuxuprising.com/2019/11/how-to-show-available-wifi-networks.html?m=1 How To Show Available WiFi Networks, Their Channels, Signal Strength And More From The Command Line]
<pre>
nmcli dev status  # nmcli d


* [https://www.howtoforge.com/tutorial/repair-grub-2-ubuntu/ Repair Grub2]
nmcli dev wifi    # it works if wifi is on
nmcli r wifi on    # turn on wifi (by default wifi is on even on Ubuntu server)
</pre>
</li>
<li>[https://connectwww.com/nmcli-view-your-network-wifi-details-and-control-your-networkmanager/61731/ nmcli – View your Network & Wifi details and Control your NetworkManager]
<pre>
nmcli – View your Network & Wifi details and Control your NetworkManager WIFI-device


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


# Highlight the first item (default) and press 'e' in the GRUB menu
nmcli device wifi connect "$SSID" password "$PASSWORD"
# 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
nmcli dev status
# Press Ctrl+x or F10 to boot into
nmcli con show
 
</pre>
To switch back to GUI, type '''sudo init 5'''. Level 5 is the default.
</li>
 
<li>To list all wifi SSID and their signal with wavemon
=== [https://help.ubuntu.com/community/NetworkManager Network Manager] ===
<pre>
==== DNS problem and 127.0.1.1 ====
sudo apt install wavemon
(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.
sudo wavemon
# The bottom will show a list of keyboard shortcuts
# Press F3 to see a list of available wifi
# The list will be sorted by dBm level
</pre>
</li>
</ul>


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).
=== Turn on/off wifi adapter using nmcli ===
 
See also the next: How to flush the DNS cache
 
==== How to flush the DNS cache ====
* http://www.cyberciti.biz/faq/rhel-debian-ubuntu-flush-clear-dns-cache/
* 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 ====
https://wiki.archlinux.org/index.php/NetworkManager
 
==== Turn on/off wifi adapter ====
[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]
[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'>
{{Pre}}
nmcli nm wifi off
nmcli nm wifi off
# OR
# OR
Line 1,142: Line 1,236:
# OR
# OR
sudo ifconfig wlan0 down
sudo ifconfig wlan0 down
</syntaxhighlight>
</pre>
 
== Nmtui ==
[https://www.cloudsavvyit.com/13866/how-to-manage-linux-wi-fi-networks-with-nmtui/ How to Manage Linux Wi-Fi Network with Nmtui]


==== Proxy ====
== Proxy ==
* [https://en.wikipedia.org/wiki/Proxy_server Proxy server]
* [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?]
* [http://askubuntu.com/questions/3807/how-to-check-if-network-proxy-is-really-applied How to check if Network Proxy is really applied?]
* [[Raspberry#Proxy_server|Raspberry -> Proxy server]]


==== Internet Shut Down ====
== 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)
* [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/Denial-of-service_attack Distributed denial-of-service/DDoS attack] from wikipedia.


=== DHCP Server ===
== IP scanner ==
[http://www.tecmint.com/install-dhcp-server-in-ubuntu-debian/ How to Install a DHCP Server in Ubuntu and Debian]
* [https://angryip.org/ Angry IP Scanner] (Windows, Mac, Linux). GUI.
* nmap utility; e.g. '''sudo nmap -sP 192.168.1.1/24'''
* fing (terminal)


=== File Server ===
== How to get connection to both wifi as well as LAN ==
==== [https://help.ubuntu.com/lts/serverguide/network-file-system.html Network File System (NFS)] ====
* [https://askubuntu.com/a/639425 How to get connection to both wifi as well as LAN in ubuntu 14.04 LTS?]
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.  
** Ubuntu allows multiple connections by default.
** Use LAN for the Intranet and WiFi for the Internet
* [https://askubuntu.com/a/239639 How to "prioritise" multiple network connections] (using GUI)
* [https://superuser.com/questions/331720/how-do-i-set-the-priority-of-network-connections-in-ubuntu How do I set the priority of network connections in Ubuntu?] (using ifmetric package). [https://installati.one/ubuntu/21.04/ifmetric/ How To Install ifmetric on Ubuntu 21.04]


Some of the most notable benefits that NFS can provide are:
== wireless connection randomly drop off: iwconfig, iwconfig ==
* Local workstations use less disk space.
My wireless adapter is TP-LINK, TL-WN722N.
* 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''':
http://askubuntu.com/questions/73607/wireless-connection-keeps-dropping-with-an-intel-3945abg-card
<syntaxhighlight lang='bash'>
<pre>
sudo apt-get install nfs-kernel-server
sudo iwconfig  # List available wireless interfaces
</syntaxhighlight>


Configure the directories to be exported by adding them to the '''/etc/exports''' file.
sudo iwconfig wlan0 power off
<pre>
/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.
</pre>
</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:
[http://linuxplained.com/how-to-fix-wireless-problems-in-ubuntu-1204-precise-pangolin/ 5 Best Linux/Ubuntu compatible USB Wifi cards]:
<syntaxhighlight lang='bash'>
sudo service nfs-kernel-server start
</syntaxhighlight>


'''Client part''':
*  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


PS.
To show (USB) wireless adapter information
* ''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'>
sudo apt-get install nfs-common
 
sudo mount 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>
To make the mounting permanently, run '''sudo nano /etc/fstab''' and include a line like
<pre>
<pre>
1.2.3.4:/home    /mnt/nfs/home  nfs auto,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800 0 0
sudo lshw -C network
sudo lsusb -v
iwconfig      # get signal level, Bit rate
</pre>
</pre>


[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]
To check wifi connection information (SSID, channel, address, frequency, qualiyt, signal level, ...). [https://askubuntu.com/a/832592 How do I scan for Wireless Access Points?]
{{Pre}}
sudo iwlist wlan0 scan


==== Boot from an NFS server ====
sudo iw dev wlan0 scan | egrep "signal:|SSID:" | sed -e "s/\tsignal: //" -e "s/\tSSID: //" | awk '{ORS = (NR % 2 == 0)? "\n" : " "; print}' | sort      # change wlan0 to the right interface
* http://www.linuxuser.co.uk/tutorials/boot-linux-from-an-nfs-server
</pre>
My experience is quality should be at least 50/70 and signal level should be larger than -60dBm.


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.
On my nuc desktop, it got -63 dBm (on Sunday it is -54 dBm). On Raspberry Pi zero, it shows -54 dBm (impressive). On Mint with Qualcomm Atheros AR93xx, it shows -56 dBm. On macbook pro, I got -70. On Raspberry Pi 3B (around the router), it shows -39 dBm.  


At the end, the client computer does not need any internal storage. Cool!
[https://unix.stackexchange.com/a/348609 How to interpret wireless quality indicators?].


==== [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)] ====
== VPN ==
* https://hpc.nih.gov/docs/transfer.html#mapped
See [[VPN|VPN]]
* 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])
= DHCP Server =
* [http://www.tecmint.com/install-dhcp-server-in-ubuntu-debian/ How to Install a DHCP Server in Ubuntu and Debian]
* [https://www.linuxtechi.com/how-to-configure-dhcp-server-on-ubuntu/ How to Configure DHCP Server on Ubuntu 22.04 Step-by-Step]


==== Samba - allows Linux to transfer files with Windows clients ====
= File Server =
* http://www.krizna.com/ubuntu/setup-file-server-ubuntu-14-04-samba/ (Anonymous share and Secured share via username/password)
== [https://help.ubuntu.com/lts/serverguide/network-file-system.html Network File System (NFS)] ==
* https://www.howtoforge.com/samba-server-ubuntu-14.04-lts
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.
* [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
Some of the most notable benefits that NFS can provide are:
$ sudo service nmbd stop
* 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.


$ sudo service smbd start
'''Server part''':
$ sudo service nmbd start
{{Pre}}
</syntaxhighlight>
sudo apt-get install nfs-kernel-server
* [https://www.samba.org/samba/docs/man/manpages/smb.conf.5.html '''smb.conf''' — The configuration file for the Samba suite]
</pre>
<syntaxhighlight lang='bash'>
sudo apt-get install samba samba-common
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>


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/
To start the NFS server:
{{Pre}}
sudo service nfs-kernel-server start
</pre>
</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).
'''Client part''':


==== Remove and re-install Samba ====
PS.
<syntaxhighlight lang='bash'>
* ''There is no need to enter any password related to the NFS server.''
$ sudo apt-get remove --purge samba
* 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>.
$ sudo apt-get remove --purge smbclient libsmbclient
{{Pre}}
sudo apt-get install nfs-common


$ sudo apt-get install samba
sudo mount -t nfs example.hostname.com:/ubuntu /mnt/ubuntu
$ sudo apt-get install smbclient libsmbclient
# The mount point directory /mnt/ubuntu must exist.
</syntaxhighlight>
# 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


==== SambaCry vulnerability and check Samba version ====
brb@brb-P45T-A:~$ ps -ef | grep nfs
http://pcworld.com/article/3199106/linux/the-sambacry-scare-gives-linux-users-a-taste-of-wannacry-petya-problems.html
root      675    2  0 11:16 ?        00:00:00 [nfsiod]
 
root    14783    2  0 16:51 ?        00:00:00 [nfsv4.0-svc]
To check your samba version
brb      14960 13491  0 16:56 pts/0    00:00:00 grep --color=auto nfs
<syntaxhighlight lang='bash'>
</pre>
$ smbd -V
To make the mounting permanently, run '''sudo nano /etc/fstab''' and include a line like
Version 4.3.11-Ubuntu
</syntaxhighlight>
 
=== 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].
* [https://www.howtoforge.com/tutorial/how-to-configure-a-nfs-server-and-mount-nfs-shares-on-ubuntu-18.04/ How to configure an NFS server and mount NFS shares on Ubuntu 18.04]
* [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)]
 
== Boot from an NFS server ==
* http://www.linuxuser.co.uk/tutorials/boot-linux-from-an-nfs-server


=== Terminal ===
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.
==== 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
At the end, the client computer does not need any internal storage. Cool!
<pre>
 
== [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)] ==
* https://hpc.nih.gov/docs/transfer.html#mapped
* 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])
 
== Samba ==
[[Samba|Samba]]
 
= Change automatic login =
Open '''sudo nano /etc/gdm3/custom.conf''' and change the logic value true/false
 
= 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>
$ 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>
 
= sudo =
[https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/ How To Grant And Remove Sudo Privileges To Users On Ubuntu]
 
= 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.
 
Note that when we use the terminal app '''Tabby''', the directory color is easy to see.
 
1. append this to your ~/.bashrc
<pre>
     if [ "$TERM" != "dumb" ]; then
     if [ "$TERM" != "dumb" ]; then
       [ -e "$HOME/.dir_colors" ] &&  
       [ -e "$HOME/.dir_colors" ] &&  
Line 1,322: Line 1,424:
Everything should be pretty.
Everything should be pretty.


==== Remember terminal tabs ====
== powerline ==
* [https://fedoramagazine.org/add-power-terminal-powerline/ Add power to your terminal with powerline]
* [https://www.2daygeek.com/powerline-adds-powerful-statusline-to-vim-bash-tumx-in-ubuntu-fedora-debian-arch-linux-mint/ Powerline – A Powerful Statusline Plugin For Vim & Bash Terminal]
* [https://github.com/powerline/powerline Github], [https://powerline.readthedocs.io/en/master/installation/linux.html Installation on Linux]
 
== 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).  
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).  
<syntaxhighlight lang='bash'>
{{Pre}}
# To save configuration into /home/$USER/terminal.cfg:
# To save configuration into /home/$USER/terminal.cfg:
gnome-terminal --save-config=/home/$USER/terminal.cfg
gnome-terminal --save-config=/home/$USER/terminal.cfg
Line 1,330: Line 1,437:
# To load it back:
# To load it back:
gnome-terminal --load-config=/home/$USER/terminal.cfg
gnome-terminal --load-config=/home/$USER/terminal.cfg
</syntaxhighlight>
</pre>


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.
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.


==== Terminal tab color ====
== 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.
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.


Line 1,358: Line 1,465:
Then close '''ALL''' terminal windows start and test.
Then close '''ALL''' terminal windows start and test.


==== How to practically use your Linux terminal for everything ====
== How to practically use your Linux terminal for everything ==
* [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/ 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]
* [https://www.howtoforge.com/tutorial/how-to-practically-use-your-linux-terminal-part-2/ Send emails, browse internet, listen muscic, play games]


=== Install Microsoft Font in linux suite ===
== Record terminal: script command ==
* [https://www.ostechnix.com/record-everything-terminal/ How To Record Everything You Do In Terminal]
* [https://www.tecmint.com/record-and-replay-linux-terminal-session-commands-using-script/ Record and Replay Linux Terminal Sessions using ‘script’ and ‘scriptreplay’ Commands]
 
= Font =
== Large text, monitor scaling, HiDPI displays ==
* This is useful on large screen displays or TVs.
* [https://www.makeuseof.com/change-hidpi-scaling-settings-linux/ How to Change HiDPI Scaling Settings on Linux] using GNOME, KDE, elementary OS, Xfce
* https://wiki.archlinux.org/title/HiDPI
 
== Install Microsoft Font in linux suite ==
[http://www.pcworld.com/article/2863497/how-to-install-microsoft-fonts-in-linux-office-suites.html PCWorld.com]
[http://www.pcworld.com/article/2863497/how-to-install-microsoft-fonts-in-linux-office-suites.html PCWorld.com]


=== Install language packs ===
= Install language packs =
<pre>
{{Pre}}
sudo apt-get install language-pack-[cod] language-pack-gnome-[cod] language-pack-[cod]-base language-pack-gnome-[cod]-base
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.
For example, [cod]=en or [cod]=zh.


=== Change locale language and character set ===
= Change locale language and character set =
* http://www.shellhacks.com/en/HowTo-Change-Locale-Language-and-Character-Set-in-Linux
* http://www.shellhacks.com/en/HowTo-Change-Locale-Language-and-Character-Set-in-Linux


=== Display Chinese character (from vanilla Debian/Ubuntu system) ===
= Display Chinese character (from vanilla Debian/Ubuntu system) =
* [http://en.wikipedia.org/wiki/Help:Multilingual_support_%28East_Asian%29#Debian-based_GNU.2FLinux Wikipedia]
* [http://en.wikipedia.org/wiki/Help:Multilingual_support_%28East_Asian%29#Debian-based_GNU.2FLinux Wikipedia]
<pre>
<pre>
sudo apt-get install fonts-arphic-ukai fonts-arphic-uming
sudo apt-get install fonts-arphic-ukai fonts-arphic-uming
</pre>
</pre>
* [http://crunchbang.org/forums/viewtopic.php?id=778 crunchbang.org]
* [http://crunchbang.org/forums/viewtopic.php?id=778 crunchbang.org], [https://unix.stackexchange.com/a/548473 How to make Chinese characters display properly on Chromium]
<pre>
<pre>
sudo apt-get install language-support-fonts-zh
sudo apt-get install language-support-fonts-zh
# Or
# Or
sudo apt-get install ttf-arphic-uming ttf-wqy-zenhei
sudo apt-get install ttf-arphic-uming ttf-wqy-zenhei
# OR
sudo apt-get install fonts-arphic-uming fonts-wqy-zenhei
</pre>
</pre>
* [http://wiki.debian.org.hk/w/Make_Debian_support_Chinese_%28eng%29 wiki.debian.org.hk]  
* [http://wiki.debian.org.hk/w/Make_Debian_support_Chinese_%28eng%29 wiki.debian.org.hk]  
* [https://wiki.debian.org/Fonts wiki.debian.org]
* [https://wiki.debian.org/Fonts wiki.debian.org]


=== Chinese Input ===
= Chinese Input =
* ibus/fcitx is a service. Use ''ps -ef'' to check if it is running.
* ibus/fcitx is a service. Use ''ps -ef'' to check if it is running.
* Super(Windows) + space may need to be clicked twice to switch the input method (at least on Mint 18.2)
* 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)
* Log out and Log in seems to be necessary
* Log out and Log in seems to be necessary
* Helpful
* Helpful
** https://www.pinyinjoe.com/linux/ubuntu-10-chinese-input-pinyin-chewing.htm
** 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/
** http://ubuntuhandbook.org/index.php/2016/07/2-best-chinese-pinyin-im-ubuntu-16-04/


Line 1,414: Line 1,535:


On Ubuntu 14.04, the super key is '''Windows'''.
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)
# 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).
# 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.
Note that do not use 'Text Entry' application (shown as one options when we search 'language'). This application will conflict with ibus.


==== fcitx ====
== Easy way ==
Tested on Ubuntu 18.04 and 19.10. Do not to go to "Input Method".
# Language support. Make sure Chinese (traditional) is selected. Log out and log in. This step is not needed when I try Pop!_os. No need to worry about keyboard input method system; the default 'none' is OK. Log out and log in.
# Choose Settings -> Region & Language -> Input Source  -> Chinese (Taiwan).
 
On Debian 11, I first need to run '''sudo apt-get install ibus-chewing''' & '''ibus restart'''. Then log out and log in again. Go to settings-Region and Language. Input Sources - Other - Chinese. Select Chinese (Chewing). Done. Use Win+Space to switch input languages.
 
== ibus ==
[https://www.ostechnix.com/how-to-setup-multilingual-input-method-on-ubuntu/ How To Setup Multilingual Input Method On Ubuntu 18.04].
 
ibus works fine on Pop_OS 20.04 (it does not have fcitx PLUS ibus is already running) . Step 1 is to make sure Chinese is included in '''Language Support''' (it's already in Pop_OS 20.04) Step 2. Use Settings and search for 'input sources'. Use "+" to add Chinese Chewing.
 
== [https://zh.wikipedia.org/wiki/Gcin gcin] ==
新注音 New Zhuyin
* Google: ubuntu 英文版 中文輸入
* http://aarontechdiary.blogspot.com/2016/07/ubuntu-1604.html
{{Pre}}
sudo apt-get install gcin
</pre>
* 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 ==
https://daviwa.blogspot.com/2017_10_08_archive.html
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 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 Mate, the fcitx works fine. ps -ef | grep fcitx-qimpanel shows nothing.
* On Lubuntu 18.04 LTS, fcitx works fine.
*# add Chinese in 'Language Support'
*# log out and log in (For live CD, the user name is '''lubuntu''' and the password is empty)
*# click on fcitx icon > ConfigureFcitx. Uncheck the option '''Only Show Current Language''' in order to get a list of available input methods. Add Chinese Chewing. Close the Window.
*# use Ctrl+Space keybinding to switch the language


=== /usr/lib/ibus/ibus-ui-gtk3 high memory usage ===
= /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 [http://askubuntu.com/questions/490317/how-can-i-find-out-what-ibus-daemon-and-ibus-ui-gtk3-are-doing suggestion] is to run
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
<syntaxhighlight lang="bash">
{{Pre}}
killall ibus-daemon
killall ibus-daemon
</syntaxhighlight>
</pre>
After I run this command and wait a few seconds, the memory leak problem is solved.
After I run this command and wait a few seconds, the memory leak problem is solved.


=== Change time zone ===
= Change time zone =
http://wiki.debian.org/TimeZoneChanges
http://wiki.debian.org/TimeZoneChanges
<pre>
<pre>
Line 1,437: Line 1,595:
The command launches an ncurses based interface which allows arrow keys to be used to select the region specific time zone.
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 ===
= Make script run at boot time with init.d directory =
http://www.debian-administration.org/articles/28
http://www.debian-administration.org/articles/28


Line 1,448: Line 1,606:
</pre>
</pre>


==== /etc/rc.local file ====
== /etc/rc.local file ==
[http://linuxtechlab.com/executing-commands-scripts-at-reboot/ Executing Commands and Scripts at Reboot & Startup in Linux]
* [http://linuxtechlab.com/executing-commands-scripts-at-reboot/ Executing Commands and Scripts at Reboot & Startup in Linux]
* [https://www.lukmanlab.com/how-to-activing-rc-local-on-ubuntu-server-18-04/ How to Activing rc.local on Ubuntu Server 18.04]
*# sudo nano /etc/rc.local
*# sudo chmod +x /etc/rc.local
*# sudo systemctl enable rc-local
* [https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd How to Enable /etc/rc.local with Systemd]


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.
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’.
Note:
==== crontab ====
* When executing a script at startup, make sure that the script ends with ‘exit 0’.
* Using /etc/rc.local for custom scripts is a legacy method, and some modern Debian systems might not have this file or might not execute it. Consider using systemd units or other modern methods for more reliable and maintainable solutions.
 
== crontab ==
[http://linuxtechlab.com/executing-commands-scripts-at-reboot/ Executing Commands and Scripts at Reboot & Startup in Linux]
[http://linuxtechlab.com/executing-commands-scripts-at-reboot/ Executing Commands and Scripts at Reboot & Startup in Linux]


=== wireless connection randomly drop off ===
= Back up DVDs =
My wireless adapter is TP-LINK, TL-WN722N.
[https://www.cyberciti.biz/tips/linux-dvd-ripper-software.html Top 5 Linux DVD RIP Software] from cyberciti.biz.
 
== dvdbackup command ==
It works and fast. It will create a new directory (no need to specify beforehand).
{{Pre}}
sudo apt install dvdbackup
dvdbackup # get usage


http://askubuntu.com/questions/73607/wireless-connection-keeps-dropping-with-an-intel-3945abg-card
dvdbackup -i /dev/dvd -o ~/Videos/ -M
<pre>
# -M means to back up the whole DVD
sudo iwconfig wlan0 power off
</pre>
We can further create an ISO file from a directory using
{{Pre}}
genisoimage -o output_image.iso directory_name
# Or
mkisofs -lJR -o output_image.iso directory_name
# -l : Allow full 31 character filenames.
# -J : Generate Joliet directory records in addition to regular iso9660 file names.
# -R : Generate System Use Sharing Protocol (SUSP) and Rock Ridge (RR) records using the Rock Ridge protocol
</pre>
</pre>


[http://linuxplained.com/how-to-fix-wireless-problems-in-ubuntu-1204-precise-pangolin/ 5 Best Linux/Ubuntu compatible USB Wifi cards]:
== Create an iso file from a CD/DVD or HD ==
See also
* [http://tuxarena.blogspot.com/2009/03/4-ways-to-create-cddvd-iso-images-in.html 4 Ways to Create CD/DVD ISO Images in Ubuntu].
* [https://wiki.archlinux.org/index.php/Optical_disc_drive#Creating_an_ISO_image_from_a_CD.2C_DVD.2C_or_BD Creating an ISO image from a CD, DVD, or BD]


*  AirLink101 AWLL6075 Wireless N Mini USB Adapter
Method 1 (Better than Method 2). No need to umount the cdrom.
*  Medialink – Wireless N USB Adapter – 802.11n
{{Pre}}
*  ASUS (USB-N13) Wireless-N USB Adapter
mkisofs -o /tmp/DVD.iso /tmp/directory/
*  Panda Mini Wifi (b/g/n) 150Mbps Card
</pre>
*  TP-Link TL-WN722N 150Mbps High Gain Wireless USB Adapter
to make an ISO from files on your hard drive.


To show (USB) wireless adapter information
Method 2.
<pre>
Make sure the cdrom is NOT mounted. Type '''mount''' to confirm it. If cd was mouted automatically unmout it with umount command:
sudo lshw -C network
like '''umount /dev/cdrom''' or '''umount /mnt/cdrom'''. Note that no extra forward slash after /dev/cdrom for the command below.
sudo lsusb -v
{{Pre}}
iwconfig
dd if=/dev/cdrom of=~/DVD.iso status=progress # worked in antiX
dd bs=4M if=/dev/sr0 of=~/DVD.iso status=progress
# Works for me to back up some borrowed DVDs
#
# Don't add the 'bs' parameter or you'll get an error reading '/dev/sr0': Input/output error
# or use VLC to watch a little bit of the DVD first to fix the problem (why it helps?)
# note that status=progress does not show the percentage. It shows how much is copied.
# OR
cat /dev/sr0 > ~/DVD.iso
</pre>
</pre>
For some reason I get an Input/output error. But after I use VLC to play the video, the Input/output error is gone when I try it again.


To check wifi connection information (SSID, channel, address, frequency, qualiyt, signal level, ...)
We can mount the iso file to a directory to check the iso file content is correct.
<pre>
{{Pre}}
sudo iwlist wlan0 scan
mount -t iso9660 -o loop,ro DVD.iso /mnt
</pre>
</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 ===
Method 3.
Method 1 (Better than Method 2). No need to umount the cdrom.
Monitor the progress of percentage assume we know the disk size
<pre>
{{Pre}}
mkisofs -o /tmp/DVD.iso /tmp/directory/
sudo apt-get install pv
dd if=/dev/urandom | pv -s 2G | dd of=/dev/null
</pre>
</pre>
to make an ISO from files on your hard drive.


Method 2.
[https://askubuntu.com/a/215521 Method 4].
Make sure the cdrom is NOT mounted. Type '''mount''' to confirm it. If cd was mouted automatically unmout it with umount command:
To see the progress of dd once it's running, open another terminal and enter:
like '''umount /dev/cdrom''' or '''umount /mnt/cdrom'''. Note that no extra forward slash after /dev/cdrom for the command below.
{{Pre}}
<pre>
sudo kill -USR1 $(pgrep ^dd)
dd if=/dev/cdrom of=~/DVD.iso
</pre>
</pre>
This will display ''dd'' progress in the ''dd'' terminal window without halting the process. If you're on BSD or OS X, use '''INFO''' instead of '''USR1'''. The USR1 signal will terminate dd.


We can mount the iso file to a directory to check the iso file content is correct.
If you would like to get regular updates of the dd progress, then enter:
<pre>
{{Pre}}
mount -t iso9660 -o loop,ro DVD.iso /mnt
watch -n5 'sudo kill -USR1 $(pgrep ^dd)'
</pre>
</pre>
watch will probe the dd process every -n seconds (-n5 = 5 seconds) and report without halting it.


=== Have fun with /etc/hosts file ===
Note the proper single quotes in the commands above.
 
== HandBrake ==
It works but it loses the menu page on DVD.
 
= Have fun with /etc/hosts file =
su -c "nano /etc/hosts"
su -c "nano /etc/hosts"
<pre>
<pre>
127.0.0.1 localhost
::1            localhost
74.125.67.100  DNS_NAME1 DNS_NAME2
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).


==== Block malware, adware ====
== Block malware, adware ==
[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]
[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]


=== DNS tricks ===
= Mount a remote file system over ssh =
==== 5 DNS Servers Guaranteed to Improve Your Online Safety ====
[[Ssh#SSHFS%3A_mount_a_remote_file_system_over_ssh|SSHFS: mount a remote file system over ssh]]
http://www.makeuseof.com/tag/best-dns-providers-security/


==== 5 Nifty Ways to Use DNS to Your Advantage ====
= Linux Console File Managers =
http://www.makeuseof.com/tag/nifty-ways-use-dns-advantage/
* [https://www.tecmint.com/linux-terminal-file-managers/ 11 Best Linux Console File Managers]
* [https://linuxtldr.com/installing-superfile/ Superfile: A Modern Terminal File Manager for Linux and macOS]


=== Mount a remote file system over ssh ===
= Nautilus [https://wiki.gnome.org/action/show/Apps/Files Files] or Nemo (File Manager) =
* [https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh this article] on digitalocean.com.
* [https://www.makeuseof.com/best-nautilus-tweaks-linux/ The 11 Best Nautilus Tweaks to Get More Out of the File Manager on Linux]
* [http://linuxlove.eu/quick-tip-mounting-remote-linux-directory-windows-linux-ssh/ linuxlove.eu]
* [https://itsfoss.com/file-managers-linux/ Best File Managers and File Explorers for Linux].  
* https://help.ubuntu.com/community/SSHFS (include an instruction to keep the connection alive)
** [https://apps.kde.org/en-gb/dolphin/ Dolphin] is good. It's lightweight & supports tab view and split view.  sudo apt install dolphin. I tested on Debian 12 & Xfce. Open Menu (button) -> Configure -> Configure Dolphin -> Startup -> Begin in split view mode. It remembers the split view after re-open.
** [https://krusader.org/ Krusader]. Split view is the default. When it was launched the first time, it asked about whether to enable some 3rd party apps (diff utility, email client, batch renamer, checksum utility, ...). Tools -> New Net Connection. Many goodies. The Krusader app is heavily dependent on KDE.


The trick is to use the '''sshfs''' tool.
== Bookmark the current directory to the sidebar ==
Ctrl + d. See also Files > Keyboard Shortcuts.  


On Ubuntu
== Ctrl + L ==
<syntaxhighlight lang='bash'>
Change to a directory
# Install the program
sudo apt-get install sshfs


# Mount the file system
== Undo Ctrl+L ==
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
</syntaxhighlight>
 
=== Nautilus (File Manager) ===
==== Undo Ctrl+L ====
Press ESC.
Press ESC.


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


==== Create a desktop shortcut ====
== Eject USB drive ==
Navigate to your application in Nautilus. Right-click, select "Make Link". Then drag shortcut to your desktop. Works in Ubuntu 12.04.
''One or more applications are keeping the volume busy''. One reason is I cd to one directory in the USB drive on the Terminal. If I move away, I can eject the drive.
 
== Preview a file ==
Use the space bar to preview a file and click the space bar again or ESC to close the preview. Click "f" or F11 to preview the file in full-screen.
 
== 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.
* [https://linux.palemoon.org/help/installation/# Pale moon browser] instruction, especially the '''icon''' part.


==== .desktop file format ====
== .desktop file format ==
* [https://specifications.freedesktop.org/desktop-entry-spec/latest/ Desktop Entry Specification]
* [https://specifications.freedesktop.org/desktop-entry-spec/latest/ Desktop Entry Specification]
* "%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]
* "%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?]
* [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 ====
== Open a terminal ==
<syntaxhighlight lang='bash'>
{{Pre}}
sudo apt-get install nautilus-open-terminal
sudo apt-get install nautilus-open-terminal
nautilus -q
nautilus -q
</syntaxhighlight>
</pre>
In Ubuntu 15.10, the functionality is already included in nautilus!
In Ubuntu 15.10, the functionality is already included in nautilus!


=== Mount iso file ===
== The Linux Directory Structure, Explained ==
<pre>
https://www.howtogeek.com/117435/htg-explains-the-linux-directory-structure-explained/
 
=== Templates folder in the home directory ===
[https://askubuntu.com/a/94739 What is the “Templates” folder in the home directory for?]
 
=== What purpose does the Public folder serve ===
* https://askubuntu.com/a/174870
* [https://itsfoss.com/share-folders-local-network-ubuntu-windows/ Share Folders On Local Network Between Ubuntu And Windows]
 
== gnome-sushi - Quick look ==
[https://www.omgubuntu.co.uk/gnome-sushi-mac-quick-for-ubuntu Get macOS ‘Quick Look’ on Ubuntu with GNOME Sushi]
 
== Plugin ==
* [https://www.linuxuprising.com/2020/11/embedded-nautilus-terminal-plugin-adds.html Embedded Nautilus Terminal Plugin 3.4.0 Adds Configurable Toggle Shortcut And Colors]
* [https://www.linuxuprising.com/2021/05/nautilus-terminal-updated-with-nautilus.html Nautilus Terminal Updated With Nautilus 40 Support, Context Menus]
 
== Nemo ==
* Nemo is a fork of Nautilus/GNOME Files [https://en.wikipedia.org/wiki/Nemo_%28file_manager%29#History Wikipedia]
* [https://www.ubuntubuzz.com/2019/05/comparing-search-between-nautilus-and-nemo.html Comparing Search Between Nautilus And Nemo File Managers]
* I find I cannot add a remote location (sftp) but once I add it through Nautilus (I install it separately), the remote location appears in Nemo too. (Update) I can use File -> Connect to Server ... in Nemo.
 
= Mount and Unmount Storage Devices from the Linux Terminal =
[https://www.howtogeek.com/414634/how-to-mount-and-unmount-storage-devices-from-the-linux-terminal/ How to Mount and Unmount Storage Devices from the Linux Terminal]
 
== Mount iso file ==
<pre>
$ sudo mkdir /mnt/iso
$ sudo mkdir /mnt/iso
$ sudo mount -o loop /tmp/file.iso /mnt/iso
$ sudo mount -o loop /tmp/file.iso /mnt/iso
Line 1,575: Line 1,795:
</pre>
</pre>


=== Check ubuntu version from command line ===
= Check ubuntu version from command line =
http://www.howtogeek.com/206240/how-to-tell-what-distro-and-version-of-linux-you-are-running/
http://www.howtogeek.com/206240/how-to-tell-what-distro-and-version-of-linux-you-are-running/


Line 1,594: Line 1,814:
</pre>
</pre>


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


Line 1,600: Line 1,820:
* Super: Open the Dash. Press and hold it to see a cheat sheet with a bunch of other nifty shortcuts.
* 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
* 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/Super/Shift + 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 + 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 disable it.
* '''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 + Super + D: To minimize all windows
* Ctrl + Alt + Arrows: move to another workspace
* '''sudo apt install gnome-tweaks''' . From there, go to workspaces on the LHS choose static spaces. Choose the number of workspaces you like. Click on the super key to see all workspaces on the RHS. Drag and drop an app to move it to the desired workspace.
* Ctrl + Alt + Shift + Arrows: move current application to another workspace
* Super + left/right: snap the window to left/right
* Super + upper/down: maximize/resize the window
* Super + h: hide/minimize a window. I changed it to '''Super + m''' (overwrite its original meaning). On macOS, it is '''Command + m'''.


On Xubuntu,
On Xubuntu,
Line 1,611: Line 1,833:
* Alt + F2 (Super + R): Application Finder.
* Alt + F2 (Super + R): Application Finder.


==== Add a new keyboard shortcut ====
== Add a new keyboard shortcut ==
Let's say I want to assign Ctrl+Alt+s to bring the shutdown dialog.
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.
# 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.
Line 1,618: Line 1,840:
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].
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].


==== Firefox ====
== Firefox ==
* Space: page down
* Space: page down
* Shift + space: page up
* Shift + space: page up


=== [http://nebc.nerc.ac.uk/tools/bio-linux BioLinux] ===
= Hardware/Device manager =
Bio-Linux 7.0 (2012/11/21) screenshot.
<ul>
 
<li>[https://www.howtogeek.com/426199/how-to-list-your-computers-devices-from-the-linux-terminal/ How to List Your Computer’s Devices From the Linux Terminal] mount , lsblk, df , fdisk , The /proc Files , lspci , lsusb , lsdev , lshw , lsscsi , dmidecode, hwinfo. </li>
Biolinux can be installed in two ways.  
<li>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.</li>
# One is to download iso image file. http://nebc.nerc.ac.uk/downloads/
<li>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.
# 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
 
[[File:BioLinux.png|100px]]
 
==== Check Biolinux version ====
<pre>
<pre>
cat /etc/bio-linux.version  # 8.0.5 as of June 2015
$ sudo lshw -short
</pre>
</pre>
</li>
<li>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 disks]" in launcher. </li>
<li>[https://www.cloudsavvyit.com/14492/how-to-use-lsusb-in-linux-with-a-practical-example/ How to Use lsusb in Linux (With a Practical Example)] </li>
<li>[https://itsfoss.com/inxi-system-info-linux/ Get All Kind of System Information in Linux Terminal With '''inxi'''] </li>
</ul>
== Hardinfo, Hardinfo2 ==
* [https://www.linuxuprising.com/2021/12/how-to-install-system-information-tool.html How To Install System Information Tool HardInfo 0.6 Alpha ('''System Profiler And Benchmark''') On Ubuntu, Pop!_OS Or Linux Mint From PPA]
* [https://www.tecmint.com/hardinfo-check-hardware-information-in-linux/ Hardinfo2 – Check Hardware Information in Linux]


==== Installation ====
== Find out motherboard information ==
* Latest version iso or ova.
{{Pre}}
** http://distrowatch.com/table.php?distribution=biolinux
# No root
** http://distro.ibiblio.org/bio-linux/iso/ US mirror
cat /sys/devices/virtual/dmi/id/board_{vendor,name,version}


* [http://environmentalomics.org/bio-linux-installation/ Command line] based on Ubuntu 14.04 or from Biolinux 7.
# Root
<pre>
sudo dmidecode  | grep -A4 '^Base Board Information'
wget -qO- http://nebc.nerc.ac.uk/downloads/bl8_only/upgrade8.sh | sudo sh
</pre>
</pre>
This takes a long long time.
==== Software list ====
* http://environmentalomics.org/bio-linux-software-list/
==== FAQ ====
* http://nebc.nerc.ac.uk/nebc_website_frozen/nebc.nerc.ac.uk//tools/bio-linux-7/bio-linux-faq


==== Sample Data ====
== RAM ==
Did not find them useful.
[https://www.cyberciti.biz/faq/check-ram-speed-linux/ Linux Check Ram Speed and Type Commands]
<pre>
<pre>
brb@biolinux[brb] ls Desktop/Sample\ Data/                                                        [10:05AM]
sudo apt install dmidecode
act      cytoscape              glimmer3      mrbayes            peptide_seqs      splitstree
sudo dmidecode --type 17
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>


==== CloudBioLinux ====
== Hard drive specification ==
* http://cloudbiolinux.org/
{{Pre}}
* https://github.com/chapmanb/cloudbiolinux
# hdparm command
sudo hdparm -I /dev/sda


=== Apache configuration ===
# OR using lshw command
https://help.ubuntu.com/11.10/serverguide/httpd.html
sudo apt-get install lshw
lshw -class disk -class storage


=== Nginx ===
# Find Out Disks Name Only
==== Run both Nginx and Apache at the same time ====
lshw -short -C disk
https://stackoverflow.com/questions/23024473/how-can-i-run-both-nginx-and-apache-together-on-ubuntu


==== Install Nginx as Reverse Proxy for Apache ====
# smartmontools package
* [https://en.wikipedia.org/wiki/Reverse_proxy Reverse proxy]
sudo smartctl -i /dev/sda
* https://www.howtoforge.com/tutorial/how-to-install-nginx-as-reverse-proxy-for-apache-on-ubuntu-15-10/
</pre>


(Excerpt from [http://www.thegeekstuff.com/2016/06/nginx-reverse-proxy-to-apache/ thegeekstuff]) For example, let us say we have an enterprise application that is running on Apache and PHP on app.thegeekstuff.com, and we also have Nginx running on example.com.
= [https://help.ubuntu.com/community/UFW ufw (uncomplicated firewall)] =
* [https://www.howtogeek.com/122065/htg-explains-i-have-a-router-do-i-need-a-firewall/ Do I Need a Firewall if I Have a Router?]
* [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
* [https://www.cyberciti.biz/faq/ufw-allow-incoming-ssh-connections-from-a-specific-ip-address-subnet-on-ubuntu-debian/ How to open ssh 22/TCP port using ufw on Ubuntu/Debian Linux]


In this example scenario, when someone goes to example.com, we can setup Nginx as a reverse proxy so that it will serve the enterprise apache/php application that is running on app.thegeekstuff.com.
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.  


But, for the end-user, they’ll only see example.com, they won’t even know anything about app.thegeekstuff.com. End-user will think the whole apache/php application is getting served directly from example.com.
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.  


* http://deanattali.com/2015/05/09/setup-rstudio-shiny-server-digital-ocean/
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.


==== Varnish Reverse Proxy ====
{{Pre}}
[https://www.howtoforge.com/tutorial/ubuntu-nginx-varnish/ How to Install Varnish Reverse Proxy with Nginx on Ubuntu 16.04 LTS]
sudo ufw allow 8888/tcp
sudo ufw show added
sudo ufw enable
sudo ufw status
sudo ufw app list
sudo ufw delete allow 8069


=== Tomcat ===
nmap localhost
* [http://www.ubuntugeek.com/install-tomcat-8-on-ubuntu-15-10-server.html Install Tomcat 8 on Ubuntu]
</pre>


=== Device manager ===
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.
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.


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.
In one instance sshing to a server failed (connection time) for some reason. The solution is to run the following command on the server
<pre>
{{Pre}}
brb@brb-P45T-A:~$ sudo lshw -short
sudo ufw allow 22/tcp
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.
</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.
A graphical interface program is called [http://gufw.org/ Gufw Firewall].  


=== Set static IP - /etc/network/interfaces===
Other things '''ufw''' can do:
<syntaxhighlight lang='bash'>
* Allow/Deny by ports and (optional) protocols
root@debian:~# cat /etc/network/interfaces
* Allow/Deny by service name
auto lo eth0
* Disable ping requests.
iface lo inet loopback
* Allow by specific IP
iface eth0 inet dhcp
* Allow by subnet
</syntaxhighlight>
<ul>
Now edit the file  /etc/network/interfaces
<li>Allow by specific port and IP address/range. For example, to allow a VNC access from a specific IP.
<pre>
<pre>
# The primary network interface
# https://serverfault.com/a/74024
auto eth0
sudo ufw allow from 192.168.1.0/24 to any port 5900
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>
</li>
</ul>
* Deny by certain IP address
* Deny by certain IP address and certain port


After it, restart the network by issuing
= webmin =
<syntaxhighlight lang='bash'>
See http://www.webmin.com/deb.html
/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.
 
=== Change IP address from the command line ===
<pre>
<pre>
/sbin/ifconfig eth0 192.168.1.17 netmask 255.255.255.0 up
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.600_all.deb
/sbin/ifconfig eth0
dpkg --install webmin_1.600_all.deb
</pre>
</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.


[http://www.howtogeek.com/103190/change-your-ip-address-from-the-command-prompt/ Windows] OS.
{{Pre}}
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
</pre>
[[File:Webmin.png|100px]]


=== [https://help.ubuntu.com/community/UFW ufw (uncomplicated firewall)] ===
= Virtualize Linux =
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.
http://www.linuxuser.co.uk/features/how-to-virtualise-linux-part-1


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.
== CPU information ==
{{Pre}}
$ grep name /proc/cpuinfo | sort -u
model name : AMD Phenom(tm) II X6 1055T Processor      # home


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.
model name : Intel(R) Xeon(R) CPU  X7560  @ 2.27GHz    # helix


<syntaxhighlight lang='bash'>
model name : Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz  # office
sudo ufw allow 8888/tcp
</pre>
sudo ufw show added
sudo ufw enable
sudo ufw status


nmap localhost
== CPU usage ==
</syntaxhighlight>
* See [[Raspberry#E-ink|Raspberry Pi eink]] example where python's psutil package was used.
* [https://stackoverflow.com/questions/54458254/how-to-get-cpu-usage-in-python-2-7-without-using-psutil How to get CPU usage in python 2.7 without using PSUtil]
{{Pre}}
import psutil
print psutil.cpu_percent()
</pre>  
Note not like the '''htop''' command, the result from psutil fluctuates a lot.


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.
== 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].  
{{Pre}}
cat /proc/cpuinfo | grep hypervisor
</pre>


In one instance sshing to a server failed (connection time) for some reason. The solution is to run the following command on the server
== Virtualbox ==
<syntaxhighlight lang='bash'>
See [[Virtualbox|here]].
sudo ufw allow 22/tcp
</syntaxhighlight>


A graphical interface program is called [http://gufw.org/ Gufw Firewall].  
== gksu ==
* [https://www.linuxuprising.com/2018/04/gksu-removed-from-ubuntu-heres.html gksu Removed From Ubuntu, Here's The Recommended Replacement]
* [https://itsfoss.com/gksu-replacement-ubuntu/ gksu Removed From Ubuntu, Here’s What You Can Use Instead]


Other things '''ufw''' can do:
== VBoxClient: the VirtualBox kernel service is not running  ==
* Allow/Deny by ports and (optional) protocols
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
* Allow/Deny by service name
{{Pre}}
* Disable ping requests.  
gksudo gedit /etc/X11/Xsession.d/98vboxadd-xclient
* Allow by specific IP
</pre>
* Allow by subnet
find the line
* Allow by specific port and IP address
<pre>
* Deny by certain IP address
notify-send "VBoxClient: the VirtualBox kernel service is not running.  Exiting."
* Deny by certain IP address and certain port
</pre>
Now change '''notify-send''' to '''echo'''.
 
= Thin client =
https://help.ubuntu.com/community/ThinClients
 
== [https://help.ubuntu.com/community/UbuntuLTSP UbuntuLTSP] ==
* [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]
 
== [http://www.ltsp.org/ LTSP] ==


=== DNS Server ===
== Raspberry Pi ==
[https://linuxconfig.org/protecting-your-privacy-with-firefox-on-linux Protecting Your Privacy With Firefox on Linux]
[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]


==== What is my DNS server ====
[https://help.ubuntu.com/community/UbuntuLTSP/RaspberryPi  UbuntuLTSP/RaspberryPi
/etc/resolv.conf
]


==== '''dig''' Command Examples ====
= Remote desktop =
https://www.cyberciti.biz/faq/linux-unix-dig-command-examples-usage-syntax/
[[Remote_desktop|Remote desktop]]


dig (domain information groper) is a DNS lookup utility.
= Install sshd =
{{Pre}}
apt-get update
apt-get install openssh-server
</pre>


=== DNStracer ===
= sftp, vsftpd and virtual users =
http://www.ubuntugeek.com/dnstracer-trace-dns-queries-to-the-source.html
* [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/


=== Dyndns and [https://help.dyn.com/ddclient/ ddclient] ===
= ProFTPd =
See
* [https://www.makeuseof.com/install-proftpd-on-ubuntu/ How to Install and Set Up ProFTPD With TLS on Ubuntu]
* https://help.ubuntu.com/community/DynamicDNS#ddclient (works)
* https://help.ubuntu.com/community/DynamicDNS#Namecheap_.26_Python (works)


nano '''/etc/ddclient.conf'''
= Install LAMP =
See the page [http://library.linode.com/lamp-guides/debian-6-squeeze]
<pre>
<pre>
protocol=namecheap
apt-get install apache2
ssl=yes
a2enmod rewrite
use=web, web=dynamicdns.park-your-domain.com/getip
apt-get install mysql-server  [I choose branch name as MYSQL root password]
server=dynamicdns.park-your-domain.com
apt-get install php5 php-pear php5-suhosin
login=yourdomain.com
apt-get install php5-mysql
password=a9438540ba8a449fb0ed09c3737b9e32
/etc/init.d/apache2 restart
@
</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
Another instruction including how to set up user directories for Apache web server http://wiki.debian.org/LaMp
<pre>
<pre>
SUCCESS:  updating YOURSUBDOMAIN: good: IP address set to XX.XXX.XXX.XXX
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>
</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.  
The apache configuration file is in '''/etc/apache2/apache2.conf'''.


==== namecheap ====
For PHP, it is also useful to install php for command line.
* [https://www.namecheap.com/support/knowledgebase/article.aspx/583/11/how-do-i-configure-ddclient How do I configure DDClient?]
<pre>
* 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?]
sudo aptitude install php5-cli
* 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?]
</pre>
* 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].


==== Mail ====
Restarting apache before testing on web browser
* check the option of '''Mail Routing: I have mail server with another name and would like to add MX hostname...'''
<pre>
* In 'MX hostname' entering '''aspmx.l.google.com'''
/etc/init.d/apache2 restart
* In 'Primary' choose 'Yes, use it as my primary mail relay.'
</pre>


=== no-ip ===
== Debian 8 ==
Similar to Dyndns. It has its own client program. Needs to build it yourself.
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian-8
{{Pre}}
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
</pre>


Also see the [http://support.no-ip.com/customer/portal/articles/375955-basic-troubleshooting-guide troubleshooting guide].
= [http://www.ampps.com/downloads AMPPS] for a local server =
http://www.howtogeek.com/219983/how-to-use-ampps-to-install-joomla-locally/


See http://ducky-pond.com/posts/12 for instruction of setting autostart on Debian system.
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.


See http://www.coulterfamily.org.uk/pages/PCs/Linux/FAQ-LINUX-NO-IP-CLIENT.php for another approach.
== XAMPP ==
[https://www.howtoforge.com/how-to-install-xampp-on-ubuntu-20-04/ How to Install XAMPP on Ubuntu 20.04]


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.
= Sandstorm: self-hostable web productivity suite =
* [https://sandstorm.io/ Sandstorm] Open source platform for self-hosting web apps
* https://apps.sandstorm.io/
* [https://opensource.com/article/19/1/productivity-tool-sandstorm Getting started with Sandstorm, an open source web app platform]


Update: An alternative is to use ddclient. However, ddclient never updates the IP.
= [https://en.wikipedia.org/wiki/Content_management_system Content management systems] =
* [https://en.wikipedia.org/wiki/List_of_content_management_systems List of content management systems]


==== Mail ====
== PageKit ==
* Allow only one MX record for each host for free no-ip account.
[https://www.howtoforge.com/tutorial/how-to-install-pagekit-cms-on-ubuntu-1804/ How to Install PageKit CMS on Ubuntu 18.04 LTS]
* Click Host/Redirects > Manage Hosts > Modify.


=== webmin ===
== [https://processwire.com/ ProcessWire] ==
See http://www.webmin.com/deb.html
[https://www.howtoforge.com/tutorial/how-to-install-processwire-cms-on-centos-7/ How to Install ProcessWire CMS on CentOS 7]
<pre>
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 ===
== [https://www.bookstackapp.com/docs/admin/installation/#manual BookStack] ==
http://www.linuxuser.co.uk/features/how-to-virtualise-linux-part-1
[https://www.howtoforge.com/tutorial/how-to-install-bookstack-on-ubuntu-1604/ How to Install BookStack on Ubuntu 16.04 LTS]


==== CPU ====
A docker image is also available.
<syntaxhighlight lang='bash'>
$ 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
== Mediawiki ==
* My [[Mediawiki|Mediawiki]]


model name : Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz  # office
= UPnP server =
</syntaxhighlight>
See [[UPnP|UPnP]].


==== Find out if the OS is running in a virtual environment ====
= Storage server GlusterFS =
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].
https://www.howtoforge.com/tutorial/high-availability-storage-with-glusterfs-on-debian-8-with-two-nodes/
<syntaxhighlight lang='bash'>
cat /proc/cpuinfo | grep hypervisor
</syntaxhighlight>


==== Virtualbox ====
= Security =
See [[Virtualbox|here]].
* [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.


==== VBoxClient: the VirtualBox kernel service is not running  ====
== Automatic security update ==
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.howtoforge.com/tutorial/how-to-setup-automatic-security-updates-on-ubuntu-1604/ How to Setup Automatic Security Updates on Ubuntu 16.04]
<syntaxhighlight lang='bash'>
* [https://www.2daygeek.com/manually-install-security-updates-ubuntu-debian/ How to Manually Install Security Updates on Debian/Ubuntu?]
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 ===
== TPM ==
https://help.ubuntu.com/community/ThinClients
[https://ubuntu.com/blog/tpm-backed-full-disk-encryption-is-coming-to-ubuntu TPM-backed Full Disk Encryption is coming to Ubuntu]


==== [https://help.ubuntu.com/community/UbuntuLTSP UbuntuLTSP] ====
== https connection ==
* [http://www.havetheknowhow.com/Configure-the-server/Install-LTSP.html How to install LTSP (Linux Terminal Server Project) on Ubuntu Server]
* [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?]
* 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.wsj.com/articles/SB118539543272477927 Ten Things Your IT Department Won't Tell You]


==== [http://www.ltsp.org/ LTSP] ====
== HTTPOXY ==
https://www.howtoforge.com/tutorial/httpoxy-protect-your-server/


==== Raspberry Pi ====
== Fail2Ban, Tinyhoneypot and IPv4 security ==
[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]
* https://www.raspberrypi.org/documentation/configuration/security.md
* https://www.howtoforge.com/tutorial/increase-ipv4-security-with-fail2ban-and-tinyhoneypot-on-debian-jessie/


[https://help.ubuntu.com/community/UbuntuLTSP/RaspberryPi  UbuntuLTSP/RaspberryPi
== MYSQL security ==
]
Just execute '''mysql_secure_installation''' from the command line.


=== Remote desktop ===
* You can set a password for root accounts.
==== Remote desktop connection from Windows 7 ====
* You can remove root accounts that are accessible from outside the local host.
xtightvncserver may not play well in Unity.  
* You can remove anonymous-user accounts.
* You can remove the test database, which by default can be accessed by anonymous users.


Install xrdp on Ubuntu. That's it. See  
See http://www.mysql-optimization.com/mysql-secure-installation-program.html
* http://www.ubuntututorials.com/remote-desktop-ubuntu-12-04-windows-7/ Ubuntu 12.04
* 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


== Meltdown and Spectre ==
* 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 install xrdp
sudo apt-get update
sudo /etc/init.d/xrdp start
sudo apt-get dist-upgrade
 
uname -a
# 4.4.0-109
</pre>
</pre>


On Windows 7, open its Remote Desktop client utility '''mstsc.exe'''.
= HTTPS connection issue =
An https connection problem with certificate. Error message comes from Google-chrome and Safari browsers.


==== Remote desktop connection to Windows 7 from xubuntu ====
Your connection is not private:
<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 ====
[[File:HttpsNotPrivateChrome.png|250px]],
Note the information here is outdated now.
[[File:HttpsNotPrivateSafari.png|250px]]


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
If we use wget or curl on a terminal, we will get an error message
{{Pre}}
$ wget https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz


<syntaxhighlight lang='bash'>
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’:
sudo apt-get update
  Unable to locally verify the issuer's authority.
sudo apt-get install build-essential libx11-dev libssl-dev libgssglue-dev libpcsclite-dev
To connect to ftp-trace.ncbi.nlm.nih.gov insecurely, use `--no-check-certificate'.
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
# 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
</pre>


DOMAIN: NIH
It is interesting after a few tries, '''curl''' works again and '''wget''' works after adding the option ''--no-check-certificate''
{{Pre}}
$ wget --no-check-certificate https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz


resolution: 1024 x 768
$ curl -L -O https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
</pre>


Use remmina or rdesktop or freerdp (sudo apt-get install freerdp-x11)
== HTTPS at NCBI: Guidance for Users ==
<pre>
https://www.ncbi.nlm.nih.gov/home/develop/https-guidance/
rdesktop ts.nci.nih.gov:1494 -d NIH -u XXXXX -g 1024x768
</pre>


To share a folder from the local machine, use "-r" option
= 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>
<pre>
rdesktop ts.nci.nih.gov:1494 -d NIH -u XXXXX -g 1280x1024 -r disk:remotedisk=/home/$USER/Downloads
sudo apt-get build-dep r-base
</pre>
</pre>


The new secure connection relies on the SmartCard is using ncits-p111.nci.nih.gov.
= Create .deb file =
'''[https://help.ubuntu.com/community/CheckInstall checkinstall]''' command
* http://community.linuxmint.com/tutorial/view/162
* http://www.linuxjournal.com/content/using-checkinstall-build-packages-source
* https://www.linux.com/learn/tutorials/307110-easy-package-creation-with-checkinstall
* http://www.linuxuser.co.uk/tutorials/build-your-own-deb-and-rpm-packages


==== [https://www.realvnc.com/ RealVNC] ====
'''[https://debian-handbook.info/browse/stable/debian-packaging.html dpkg-buildpackage]''' command
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://conoroneill.net/controlling-an-i-racer-rc-car-using-a-wii-balance-board-and-raspberry_pi/


[[File:Realvnc-server.png|250px]]
= Package maintenance =
See [[Ubuntu_package|Ubuntu package]].


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.
= Software automation =


To start VNC server, use (https://www.realvnc.com/docs/debian-install-remove.html)
== Ansible ==
<syntaxhighlight lang='bash'>
Ansible is a free and open source software that can be used to automate software provisioning, configuration management, and application deployment.
sudo /etc/init.d/vncserver-x11-serviced start
</syntaxhighlight>


The RealVNC will have an icon sitting on the tray at the top-right corner.
See [[Ansible]]


Before using VNC viewer, we also need to create a VNC password in VNC Server.
= Terminal Assistant =
* [https://github.com/pickhardt/betty Betty]: [http://www.makeuseof.com/tag/use-natural-language-with-betty-your-digital-assistant-in-the-linux-terminal/ makeuseof] and [http://www.infoworld.com/article/2696910/open-source-tools/install-the-command-line-virtual-assistant-betty-in-linux-mint-17.html infoworld]
* [https://github.com/semicode-ltd/sarah Sarah]


On Mac, the viewer can be launched from Applications -> VNC Viewer (if we have drag and drop the app to the Applications folder).
= Torrent =
[http://www.makeuseof.com/tag/top-6-torrent-alternatives-to-pirate-bay-downloads/ Top 6 Torrent Alternatives to The Pirate Bay] (7/5/2017)


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:(
(old) Popular search sites
* torrentz
* thepiratebay
* isohunt
* kickass torrents


==== Remote desktop connection from Ubuntu to Ubuntu ====
== How to set up torrent scheduling on Linux ==
* https://help.ubuntu.com/16.04/ubuntu-help/sharing-desktop.html
https://www.howtoforge.com/tutorial/how-to-set-up-torrent-scheduling-on-linux/. It covers 'Deluge', 'Transmission' and 'Rtorrent'.
* [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]


==== Allow for remote desktop connection ====
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.
# 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.
# Go to System -> Preference -> Monitor. Change monitor resolution to 1280 x 720.


==== Allow for remote desktop connection when vino failed ====
== Torrent client command line: [http://aria2.sourceforge.net/ aria2c] ==
* [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.
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.


* [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.
http://linuxconfig.org/aria2-all-in-one-command-line-download-tool
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
If for some reason some nx programs disappeared, restart the service by
<syntaxhighlight lang='bash'>
sudo /usr/NX/bin/nxserver --restart
</syntaxhighlight>
 
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.
<pre>
<pre>
odroid@odroid:~$ sudo nmap -sV localhost
sudo apt-get install aria2
 
aria2c magnet:?xt=urn:btih:1e99d95f1764644a86a8e99bfd80c ...
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)
</pre>
</pre>


==== [http://wiki.x2go.org/doku.php/doc:newtox2go X2Go] ====
== Torrent client: transmission-cli ==
used in ''Linux Data Science Virtual Machine'' by Microsoft.
https://wiki.archlinux.org/index.php/Transmission


==== Remote desktop connection through vmware workstation ====
== Torrent client command line: rtorrent ==
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 first need to create an .rtorrent.rc file under $HOME directory. Then run
 
We don't need to use port forward for the remote desktop connection.
 
[[File:ViewActiveNetwork.png|100px]]
[[File:Firewall.png|100px]]
 
=== Install sshd ===
<syntaxhighlight lang='bash'>
apt-get update
apt-get install openssh-server
</syntaxhighlight>
 
=== vsftpd and virtual users ===
* 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
 
=== 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]
 
=== Install LAMP ===
See the page [http://library.linode.com/lamp-guides/debian-6-squeeze]
<pre>
<pre>
apt-get install apache2
rtorrent XXX.torrent
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>
</pre>
* https://wiki.archlinux.org/index.php/RTorrent
* http://harbhag.wordpress.com/2010/06/30/tutorial-using-rtorrent-on-linux-like-a-pro/ [download a template]
* http://mylinuxbook.com/rtorrent-bit-torrent-client/


Another instruction including how to set up user directories for Apache web server http://wiki.debian.org/LaMp
In the simplest case, .rtorrent.rc looks like
<pre>
<pre>
apt-get install mysql-server mysql-client
# On the terminal, mkdir ~/Downloads/rsession
mysql_secure_installation
download_rate = 0
apt-get install apache2 apache2-doc
upload_rate =50
apt-get install php5 php5-mysql libapache2-mod-php5
directory = ~/Downloads
apt-get install python libapache2-mod-python
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
</pre>
</pre>
As you can see here, I have created a sub-directory ''rsession'' under ~/Downloads/.


The apache configuration file is in '''/etc/apache2/apache2.conf'''.
[https://wiki.archlinux.org/index.php/RTorrent#Key_bindings Keybinding]:
* ctrl + q = quit application
* ctrl + d = stop an active download
* ctrl + s = start downloading


For PHP, it is also useful to install php for command line.
= glibc =
<pre>
== Patch glibc 2.9 ==
sudo aptitude install php5-cli
* http://www.infoworld.com/article/3033862/security/patch-now-unix-bug-puts-linux-android-and-ios-systems-at-risk.html
* http://www.cyberciti.biz/faq/linux-patch-cve-2015-7547-glibc-getaddrinfo-stack-based-buffer-overflow/
{{Pre}}
sudo apt-get update
sudo apt-get upgrade
sudo reboot
</pre>
</pre>


Restarting apache before testing on web browser
= SSL =
See [[SSL|SSL]].
 
= 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 [http://www.favicon.cc/ 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.
 
<pre>
<pre>
/etc/init.d/apache2 restart
Redirect 404 /favicon.ico
<Location /favicon.ico>
ErrorDocument 404 "No favicon"
</Location>
</pre>
</pre>


==== Debian 8 ====
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.
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>


=== [http://www.ampps.com/downloads AMPPS] for a local server ===
Or, you create an empty file with the name “favicon.ico” in the directory root of Apache (for exemple /var/www/).
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.
= Show weather on the taskbar =
http://www.noobslab.com/2012/10/important-thingstweaks-to-do-after.html


=== [https://en.wikipedia.org/wiki/Content_management_system Content management systems] ===
= WebCam =
* [https://en.wikipedia.org/wiki/List_of_content_management_systems List of content management systems]
https://help.ubuntu.com/community/Webcam


==== [https://processwire.com/ ProcessWire] ====
Install '''cheese''' or '''guvcview'''. [https://thinkrpi.wordpress.com/2013/04/05/step-3-install-softwares-for-webcam-and-computer-vision/ An example of using computer vision] on Raspberry Pi.
[https://www.howtoforge.com/tutorial/how-to-install-processwire-cms-on-centos-7/ How to Install ProcessWire CMS on CentOS 7]


==== [https://www.bookstackapp.com/docs/admin/installation/#manual BookStack] ====
= Watch TV =
[https://www.howtoforge.com/tutorial/how-to-install-bookstack-on-ubuntu-1604/ How to Install BookStack on Ubuntu 16.04 LTS]
[http://code.google.com/p/freetuxtv/wiki/HomePage?wl=en Freetuxtv]


A docker image is also available.
= Running concrete5 On Nginx (LEMP) =
http://www.howtoforge.com/running-concrete5-on-nginx-lemp-on-debian-squeeze-ubuntu-12.10


==== Mediawiki ====
= Open mms stream in google chrom in linux =
* My [[Mediawiki|Mediawiki]]
http://www.thermetics.net/2011/12/07/how-to-open-mms-links-from-chrome-under-ubuntu/
* [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]


<syntaxhighlight lang='bash'>
= Download mms stream (suitable if mms is an extension; for example, studioclassroom) =
aptitude install mediawiki php5 apache2 mediawiki-extensions libapache2-mod-php5
</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
* Use mimms (will NOT output to speaker at the same time; so is best in terms of performance)
<syntaxhighlight lang='bash'>
<pre>
Site config
sudo apt-get install mimms
  admin username: WikiSysop
mimms -t 60 mms://example.com/video
  password:
</pre>
 
where -t option specifies number of minutes. See http://linuxers.org/howto/how-download-mms-streaming-videos-ubuntu
Database config
The output will have the same extension as the input. But it is not always clear. For example
  Database name: wikidb
<pre>
  DB username:
$ mimms -t 3 mms://bcr.media.hinet.net/RA000073                                                                                                   
  DB password:
mms://bcr.media.hinet.net/RA000073 => RA000073.wmv
  Superuser name: root
1.48 MB / ∞ B (8.79 kB/s, ∞ s remaining)         
  Superuser password: [depend on how it was chosen when installing MYSQL]
Download stopped after user-specified timeout.
</syntaxhighlight>
</pre>
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.
* Use mplayer (will output to speaker at the same time, so suffer from performance, anyway do not get output)
<pre>
mplayer mms:/link/something.xxx -dumpstream -dumpfile file.xxx
</pre>


=== Install moinmoin ===
mms:/link/something.xxx - link to the stream you wish to download
* Comparison of mediawiki vs moinmoin http://www.wikimatrix.org/compare/MediaWiki+MoinMoin
file.xxx - file to which you wish to download the stream, be careful to write the same extension xxx
* 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.


=== UpnP server ===
Wait for the file to download and that's it. See http://ubuntuhowtos.com/howtos/download_mms_stream
==== PS3 Media Servver ====
https://github.com/ps3mediaserver/ps3mediaserver


==== minidlna ====
= Streaming =
http://bbrks.me/rpi-minidlna-media-server/
[https://www.linuxuprising.com/2019/02/stream-videos-music-and-pictures-from.html Stream Videos, Music And Pictures From Gnome To Chromecast With Cast To TV Extension (v6 And v7 Released)]


It works even I use my phone to tether data (I don't need to turn on wifi on my phone).
= Keep a linux process running after log out =
See also [[Terminal_multiplexer|Terminal multiplexer]] page.


<syntaxhighlight lang='bash'>
* http://linux.101hacks.com/unix/nohup-command/
sudo apt-get update
* http://serverfault.com/questions/311593/keeping-a-linux-process-running-after-i-logout
sudo apt-get install minidlna
* [https://www.howtogeek.com/804823/nohup-command-linux/ How to Use the nohup Command in Linux]
sudo nano /etc/minidlna.conf # the default location of media files is on /var/lib/minidlna
<pre>
# nohup command-with-options &
</pre>


# rebuild the database. See the comments in <etc/minidlna.conf>
If we use '''ssh -X''' to connect to a remote computer, the command can launch a GUI application on my local computer (without strange messages shown on the terminal).
sudo service minidlna force-reload
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.
= Open Firefox in cron job =
The trick is to use '''export DISPLAY=:0'''
<pre>
export DISPLAY=:0
firefox http://www.google.com &
</pre>


==== Kodi ====
= Close firefox gracefully =
Too bad the Kodi's upnp function is not stable. Kodi server disappeared so the client cannot find it.
Use '''wmctrl''' command.  
 
* http://www.linuxjournal.com/magazine/hack-and-automate-your-desktop-wmctrl
[https://www.ghacks.net/2018/02/11/installing-kodi-using-ubuntu-based-systems/ Installing Kodi using Ubuntu based systems]
* http://tomas.styblo.name/wmctrl/
 
<pre>
==== PLEX ====
sudo apt-get install wmctrl
This seems to be the best from my test.
wmctrl -c firefox
* [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!
</pre>
* [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.
= Audio =
* [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.
== Get normalized sound volume ==
* Plex is running as a service. After we use web to configure, we can close the website.
The sound from some youtube video can be too low. The following solution seems to work on Ubuntu 18.04 (nuc).
* 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]


=== Storage server GlusterFS ===
[https://askubuntu.com/a/771628 Automatically adjust the volume based on content?]. It works. A reboot is needed. Tested on [https://youtu.be/RMe8MJhjJW4 this video]. See the automatic change in setting after reboot. [[:File:Soundnormalize.png]].
https://www.howtoforge.com/tutorial/high-availability-storage-with-glusterfs-on-debian-8-with-two-nodes/


=== Security ===
== Change default audio player ==
* [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.
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.


==== Automatic security update ====
You might also want to set the default player in the sound menu.
[https://www.howtoforge.com/tutorial/how-to-setup-automatic-security-updates-on-ubuntu-1604/ How to Setup Automatic Security Updates on Ubuntu 16.04]


==== https connection ====
== Trim ==
* [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://osxdaily.com/2010/09/16/trim-mp3-on-your-mac/ Trim an MP3 on your Mac]. Open the file using QuickTime. "Cmd + t" to open the Trim function, or, you can also find the Trim function under the “Edit” menu. The rest is easy.
* [http://www.wsj.com/articles/SB118539543272477927 Ten Things Your IT Department Won't Tell You]


==== HTTPOXY ====
== Compress audio files ==
https://www.howtoforge.com/tutorial/httpoxy-protect-your-server/
[https://www.makeuseof.com/tag/tools-compress-audio-files/ How to Compress Large Audio Files: 5 Easy and Effective Ways]


==== Fail2Ban, Tinyhoneypot and IPv4 security ====
== Audio editing ==
https://www.howtoforge.com/tutorial/increase-ipv4-security-with-fail2ban-and-tinyhoneypot-on-debian-jessie/
[https://www.makeuseof.com/tag/best-free-audio-editing-software/ The Best Free Audio Editing Software]


==== MYSQL security ====
== Audio recorder ==
Just execute '''mysql_secure_installation''' from the command line.
[https://www.apowersoft.com/ubuntu-audio-recorder.html Top 5 Audio Recorders for Ubuntu Recommendation]


* You can set a password for root accounts.
{{Pre}}
* You can remove root accounts that are accessible from outside the local host.
sudo add-apt-repository ppa:audio-recorder/ppa
* You can remove anonymous-user accounts.
sudo apt update; sudo apt install audio-recorder
* You can remove the test database, which by default can be accessed by anonymous users.
</pre>


See http://www.mysql-optimization.com/mysql-secure-installation-program.html
== 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


==== Meltdown and Spectre ====
Step 1: Install required programs
* 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 update
sudo apt-get install gnome-media pavucontrol lame
sudo apt-get dist-upgrade
 
uname -a
# 4.4.0-109
</pre>
</pre>


=== HTTPS connection issue ===
Step 2: Create a script file <recordfm.sh>
An https connection problem with certificate. Error message comes from Google-chrome and Safari browsers.
<pre>
#!/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"


Your connection is not private:
if [ -z "$FILENAME" ]; then
    echo -e "
    Usage: $0 /path/to/output.mp3
    Usage: $0 /path/to/output.mp3 stopinseconds" >&2
    exit 1
fi


[[File:HttpsNotPrivateChrome.png|250px]],
# Get sink monitor:
[[File:HttpsNotPrivateSafari.png|250px]]
MONITOR=$(pactl list | egrep -A2 '^(\*\*\* )?Source #' | \
    grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1)
echo "set-source-mute ${MONITOR} false" | pacmd >/dev/null


If we use wget or curl on a terminal, we will get an error message
# Record it raw, and pipe to lame for an mp3
<pre>
echo "Recording to $FILENAME ..."
$ 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"
if [[ $FILENAME =~ .mp3$ ]]; then
of Certificate Authority (CA) public keys (CA certs). If the default
  if [ -z $STOPTIME ]; then
bundle file isn't adequate, you can specify an alternate file
    parec -d $MONITOR | lame $LAMEOPTIONS -r - $FILENAME
using the --cacert option.
  else
If this HTTPS server uses a certificate signed by a CA represented in
    echo -e "\nStopping in $STOPTIME seconds"
the bundle, the certificate verification probably failed due to a
    parec -d $MONITOR | lame $LAMEOPTIONS -r - $FILENAME 2>&1 &
problem with the certificate (it might be expired, or the name might
    SPID=$!
not match the domain name in the URL).
    sleep $STOPTIME
If you'd like to turn off curl's verification of the certificate, use
    kill -9 $SPID
the -k (or --insecure) option.
  fi
</pre>
fi
</pre>
 
Step 3: play the music or launch a browser with a desired url.


It is interesting after a few tries, '''curl''' works again and '''wget''' works after adding the option ''--no-check-certificate''
Step 4: run the bash script
<pre>
<pre>
$ wget --no-check-certificate https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz
chmod +x recordfm.sh
--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
./recordfm.sh test.mp3 10
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
</pre>
</pre>
where <test.mp3> is the output filename and 10 is recording length (seconds). It works.


==== HTTPS at NCBI: Guidance for Users ====
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
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>
<pre>
sudo apt-get build-dep r-base
SPID=$!
echo $SPID
</pre>
</pre>


=== [http://appimage.org/ AppImage] file - new way of installing an application ===
== Advanced audio control ==
[http://askubuntu.com/questions/774490/what-is-an-appimage-how-do-i-install-it What is an “AppImage”? How do I install it?]
https://www.howtoforge.com/tutorial/advanced-audio-control-on-linux/
* 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
* Alsamixer
* [http://avidemux.sourceforge.net/download.html Avidemux]
* Pulse Audio Volume Control
* Cura
* Pulse Audio Equalizer


=== PPA management ===
== Music player ==
* https://www.howtoforge.com/tutorial/ubuntu-ppa-management/
* [https://www.makeuseof.com/best-linux-music-player-apps/ The 15 Best Linux Music Player Apps]
* [https://itsfoss.com/sunamu-music-widget/ Sunamu]: Display Lyrics for Currently Playing Music on the Desktop in Linux


Add a ppa repository,
== Podcast ==
<syntaxhighlight lang='bash'>
* [https://www.makeuseof.com/tag/manage-podcasts-linux-10-apps/ The 5 Best Apps for Managing Podcasts on Linux]
# sudo add-apt-repository [repository name]
* [https://opensource.com/article/19/1/productivity-tool-gpodder Get started with gPodder, an open source podcast client]
sudo add-apt-repository ppa:embrosyn/cinnamon
* [https://lifehacker.com/how-to-make-your-podcast-sound-like-npr-1840048544 How to Make Your Podcast Sound Like NPR]
sudo apt-get update
# sudo apt-get install [software name]
sudo apt-get install cinnamon cinnamon-core
</syntaxhighlight>


Remove a ppa repository.
== White noise ==
<syntaxhighlight lang='bash'>
* [https://www.makeuseof.com/best-white-noise-apps-for-linux/ The 6 Best White Noise Apps for Linux to Help You Relax]
# method 1: add-apt-repository
* [https://www.linuxuprising.com/2021/04/blanket-ambient-noise-app-for-linux.html Blanket: Ambient Noise App For Linux That Helps You Stay Focused And Improves Your Productivity] (Linux only)
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>


=== Create .deb file ===
= SMPlayer: video player =
'''[https://help.ubuntu.com/community/CheckInstall checkinstall]''' command
* [http://www.ubuntugeek.com/install-smplayer-on-ubuntu-15-10.html Install SMPlayer on Ubuntu 15.10]
* http://community.linuxmint.com/tutorial/view/162
* [https://itsfoss.com/video-players-linux/ Top Open Source Video Players for Linux]
* http://www.linuxjournal.com/content/using-checkinstall-build-packages-source
* https://www.linux.com/learn/tutorials/307110-easy-package-creation-with-checkinstall
* http://www.linuxuser.co.uk/tutorials/build-your-own-deb-and-rpm-packages


'''[https://debian-handbook.info/browse/stable/debian-packaging.html dpkg-buildpackage]''' command
== MPV - terminal media player including youtube videos ==
* http://conoroneill.net/controlling-an-i-racer-rc-car-using-a-wii-balance-board-and-raspberry_pi/
See [[Youtube#mpv|Youtube]]


=== Package maintenance ===
== Listen to the radio at the Linux terminal ==
* https://help.ubuntu.com/community/AptGet/Howto#Maintenance_commands
[https://opensource.com/article/18/12/linux-toy-mplayer Listen to the radio at the Linux terminal]
* [http://www.tecmint.com/useful-basic-commands-of-apt-get-and-apt-cache-for-package-management/ 25 Useful Basic Commands of APT-GET and APT-CACHE for Package Management]
* [http://askubuntu.com/questions/766823/apt-get-being-replaced-with-apt apt-get being replaced with apt? in Ubuntu 16.04] '''apt''' now comes with a progress bar, coloring, etc.


==== Package repository and /etc/apt/sources.list ====
== SMTube: search and watch youtube ==
* https://help.ubuntu.com/community/Repositories/CommandLine
* https://www.smplayer.info/
* http://askubuntu.com/questions/197564/how-do-i-add-a-line-to-my-etc-apt-sources-list
* 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.
<syntaxhighlight lang='bash'>
{{Pre}}
echo "new line of text" | sudo tee -a /etc/apt/sources.list
sudo add-apt-repository ppa:rvm/smplayer
# 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 apt-get update
</syntaxhighlight>
sudo apt-get install smplayer smtube
</pre>


* https://www.digitalocean.com/community/tutorials/how-to-set-up-r-on-ubuntu-14-04
== GNOME mpv player ==
<syntaxhighlight lang='bash'>
Simple GTK+ frontend for mpv.
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
https://celluloid-player.github.io/  The interface of SMPlayer looks old. The GNOME mpv player (now called '''celluloid''' looks better.  
gpg -a --export E084DAB9 | sudo apt-key add -
<pre>
sudo add-apt-repository ppa:xuzhen666/gnome-mpv
sudo apt-get update
sudo apt-get update
sudo apt-get -y install r-base
sudo apt install celluloid
</syntaxhighlight>
</pre>


==== sources.list.d ====
== Haruna ==
This directory has more contents than the /etc/apt/sources.list file. For example, on my Mint 17.2
[https://www.linuxuprising.com/2021/01/haruna-video-player-is-cool-mpv-gui.html Haruna Video Player Is A Cool mpv GUI Frontend]. It does not have deb package yet.
<syntaxhighlight lang='bash'>
$ 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
</syntaxhighlight>


See an example of how to use it: https://apt.syncthing.net/
= Youtube command line tools =
<syntaxhighlight lang='bash'>
# 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:
== Play audio only ==
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
* [https://www.linuxuprising.com/2019/05/olivia-cloud-based-music-player-with.html Olivia]: Cloud-Based Music Player With YouTube Support And Over 25,000 Online Radio Stations
* http://unix.stackexchange.com/questions/229787/audio-only-youtube-player/229790#229790


# Update and install syncthing:
{{Pre}}
sudo apt-get update
# play in background (prompt will return, a new vlc process will be launched)
sudo apt-get install syncthing
cvlc --vout none https://www.youtube.com/watch?v=1O0W7jSd940
</syntaxhighlight>
# or play in foreground (prompt will not return)
/usr/bin/vlc -I dummy --vout none https://www.youtube.com/watch?v=1O0W7jSd940
</pre>
Using this approach to play audio only will save CPU power. Tested on Odroid.


==== E: Could not get lock /var/lib/dpkg/lock ====
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!
I get the above message when I run '''sudo apt-get update'''.


'''Solution 1:'''
== Youtube-dl ==
[[Youtube#Youtube-dl|Youtube->Youtube-dl]]


[http://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?].  
= Video editing in Linux =
See [[Video|Video]].


I can reproduce the error from a clean boot. The most possible explanation is the answer from poolie:
== Video rip/convert/transcoder ==
See [[Video#Video_rip.2Fconvert.2Ftranscoder|Video]].


''the command-line apt overlaps with update-manager automatically polling. So if you try again in a few minutes that should fix it.''
= Open Websites In A Floating, Borderless Window/Picture in picture =
[https://www.linuxuprising.com/2019/05/open-websites-in-floating-borderless.html Open Websites In A Floating, Borderless Window With Pennywise]


From my experience, after I wait about 10 minutes, '''ps -A | grep apt''' won't show anything.
= How to install a Ceph Storage Cluster on Ubuntu =
https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/


'''Solution 2:'''
= Building a simple Beowulf Like Cluster with Ubuntu =
See also the [[Raspberry#Clustering|Raspberry Pi]] page where a simple cluster was built.


[http://www.tecmint.com/fix-unable-to-lock-the-administration-directory-var-lib-dpkg-lock/ Fix “Unable to lock the administration directory (/var/lib/dpkg/)” in Ubuntu]
== MPICH2 ==
<syntaxhighlight lang='bash'>
Resource:
# Method 1: Find and Kill all apt-get or apt Processes
# http://byobu.info/article/Building_a_simple_Beowulf_cluster_with_Ubuntu/
$ ps -A | grep apt
# https://help.ubuntu.com/community/MpichCluster
1760 ?    00:00:00 apt.systemd.dai
# https://help.ubuntu.com/community/SettingUpNFSHowTo (NFS configure)
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
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.
sudo rm /var/lib/apt/lists/lock
# and
sudo rm /var/lib/dpkg/lock
</syntaxhighlight>


==== dpkg error: Package is in a very bad inconsistent state ====
* (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.
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).
<syntaxhighlight lang='bash'>
# 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
</syntaxhighlight>
 
==== 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 ====
<syntaxhighlight lang='bash'>
# dpkg gives more clear about the error message
sudo dpkg -i application.deb
# Or
sudo apt install application.deb
</syntaxhighlight>
 
However, installing from a .deb file through dpkg does not resolve dependency issues the same way installation through apt will. See [https://askubuntu.com/questions/784935/unable-to-install-r-studio here].  
 
So you should run sudo apt-get install -f to fix and complete the installation if any errors were encountered by dpkg.
<syntaxhighlight lang='bash'>
sudo apt install -f dep1.deb dep2.deb dep3.deb
</syntaxhighlight>
 
A better way to install a deb file is using the '''gdebi''' tool.
 
==== Remove deb packages ====
See the [http://manpages.ubuntu.com/manpages/trusty/man1/dpkg.1.html man page].
<syntaxhighlight lang='bash'>
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)
</syntaxhighlight>
 
==== gdebi: an improvement over dpkg ====
[https://askubuntu.com/questions/621351/gdebi-vs-dpkg-how-does-gdebi-automatically-gets-missing-dependancies-can-i-u How does gdebi automatically gets missing dependancies ? Can I use gdebi for all other installations of .deb packages?]
 
<syntaxhighlight lang='bash'>
sudo apt-get install gdebi-core
 
# wget newPackage.deb
# sudo gdebi -n newPackage.deb
</syntaxhighlight>
 
==== deb files caches ====
See http://askubuntu.com/questions/444240/ubuntu-updates-blocked-apt-get
<pre>
<pre>
sudo rm -f /etc/apt/sources.list.d/*
auto eth1
 
iface eth1 inet static
sudo dpkg -i /var/cache/apt/archives/*.deb
address 192.168.56.101 # use 192.168.56.102 for ubuntuNode2
 
netmask 255.255.255.0
sudo dpkg --configure -a
network 192.168.56.0
broadcast 192.168.56.255
</pre>
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
<pre>
127.0.0.1 localhost
192.168.56.1 ubuntu1304
192.168.56.101 ubuntuNode1
192.168.56.102 ubuntuNode2
</pre>
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
<pre>
sudo adduser mpiuser --uid 999
</pre>
</pre>
 
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.
==== List all available packages (from repositories) ====
* (master node) Run
<syntaxhighlight lang='bash'>
apt-cache pkgnames # pkgnames is part of the command
</syntaxhighlight>
 
==== Show package information ====
<syntaxhighlight lang='bash'>
apt-cache show <package_name>
</syntaxhighlight>
 
==== Check dependencies for specific packages ====
<syntaxhighlight lang='bash'>
apt-cache showpkg <package_name>
</syntaxhighlight>
 
==== Upgrade a package ====
<syntaxhighlight lang='bash'>
apt-get install <package_name>
</syntaxhighlight>
 
==== Install specific version of the package ====
Use the "=" with the package-name and append desired version.
<syntaxhighlight lang='bash'>
sudo apt-get install vsftpd=2.3.5-3ubuntu1
</syntaxhighlight>
 
==== Remove a package ====
<syntaxhighlight lang='bash'>
sudo apt-get remove <package_name>
</syntaxhighlight>
 
To completely remove a package including their configuration files
<syntaxhighlight lang='bash'>
sudo apt-get purge <package_name>
sudo apt-get remove --purge <package_name>
</syntaxhighlight>
 
==== 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.
<syntaxhighlight lang='bash'>
sudo apt-get clean
</syntaxhighlight>
 
==== Auto clean up apt-get cache ====
<pre>
<pre>
sudo apt-get autoclean
sudo apt-get install nfs-kernel-server
</pre>
</pre>
The 'autoclean' command deletes all .deb files from '''/var/cache/apt/archives''' to free up disk space.
* (other nodes) Run
 
==== Download only source code of package ====
<pre>
<pre>
sudo apt-get --download-only source <package_name>
sudo apt-get install nfs-client
</pre>
</pre>
 
* (master node) Add the following to the file '''/etc/exports'''
To download and unpack source code of a package
<pre>
<pre>
sudo apt-get source <package_name>
/home/mpiuser *(rw,sync,no_subtree_check)
</pre>
</pre>
 
or something like
To download, unpack and compile a package
<pre>
<pre>
sudo apt-get --compile source <package_name>
/home/mpiuser 192.168.56.0/24(rw,sync,no_subtree_check)
</pre>
</pre>
Some people create a shared folder under /srv directory.


==== Download without installing ====
Now run
<pre>
<pre>
sudo apt-get download <package_name>
sudo service nfs-kernel-server restart
</pre>
</pre>
 
* (master node)
==== Check change log of package ====
Note that the change log may not be found.
<pre>
<pre>
sudo apt-get changelog <package_name>
sudo ufw allow from 192.168.56.0/24
</pre>
</pre>
 
* (other nodes)
==== Simulate installing packages ====
<pre>
<syntaxhighlight lang='bash'>
sudo mount ubuntu1304:/home/mpiuser /home/mpiuser
$ sudo apt-get -s install packagename
 
$ sudo apt-get -s build-dep packagename
$ man apt-get
</syntaxhighlight>
 
'''Generally, it is good to build-dep then install package.'''
 
==== Check broken dependencies ====
<syntaxhighlight lang='bash'>
sudo apt-get check
</syntaxhighlight>
 
==== Search missing package's full name ====
Use the '''apt-file''' command. See [http://kobablog.wordpress.com/2011/05/17/how-to-find-and-install-the-missing-file-in-ubuntu/ this post]
 
At first, install apt-file command and prepare it.
<syntaxhighlight lang='bash'>
$ sudo apt-get install apt-file
$ sudo apt-file update
</syntaxhighlight>
 
To find zlib.h,
<syntaxhighlight lang='bash'>
$ apt-file search zlib.h
</syntaxhighlight>
 
It reports too many result. Let’s narrow down.
<syntaxhighlight lang='bash'>
$ apt-file search /usr/include/zlib.h
zlib1g-dev: /usr/include/zlib.h
</syntaxhighlight>
 
Now you know zlib.h is in zlib1g-dev package.
<syntaxhighlight lang='bash'>
$ sudo apt-get install zlib1g-dev
</syntaxhighlight>
 
==== Find package information before installing it ====
Use "-s" option for simulation. No sudo is necessary.
<pre>
apt-get -s install PACKAGENAME
</pre>
</pre>
The output is too much (include other dependences)
And if we want to mount the NFS shared directory when the compute nodes are booted, edit '''/etc/fstab''' by adding
 
A better way is to use '''aptitude''' (which is not installed by default in Ubuntu)
<pre>
<pre>
aptitude search <package> -F "%c %p %d %V"
ubuntu1304:/home/mpiuser /home/mpiuser nfs
</pre>
</pre>
For example,
* (master node)
<pre>
<pre>
debian@beaglebone:~/qt-4.8.5/bin$ aptitude search  qtcreator -F "%c %p %d %V"
sudo apt-get install ssh
p qtcreator                        lightweight integrated development environme 2.5.0-2     
su mpiuser
p qtcreator:armel                  lightweight integrated development environme 2.5.0-2     
ssh-keygen
p qtcreator-dbg                    debugging symbols for Qt Creator IDE        2.5.0-2     
ssh-copy-id localhost
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-
</pre>
</pre>
 
We can test if the ssh works without passwords
If a package is already installed, we can use the following way to check version number.
<pre>
<pre>
apt-show-versions <package>
ssh ubuntuNode1
echo $HOSTNAME
</pre>
</pre>
 
* (all nodes)
==== List files in a package ====
<pre>
<pre>
dpkg -L <package_name>
sudo apt-get install mpich2
which mpirun
which mpiexec
</pre>
</pre>
==== List racing games package (kind of search packages by key words) ====
* (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)
<pre>
<pre>
apt-cache search racing game
ubuntuNode1
apt-cache search vsftpd
ubuntuNode2
</pre>
</pre>
 
* (all nodes)
==== Search installed packages ====
<syntaxhighlight lang='bash'>
dpkg -l libgtk* | grep -e '^i'
dpkg -l libpng* | grep -e '^i'
dpkg -l libjpeg* | grep -e '^i'
</syntaxhighlight>
 
To search x-org related packages
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
 
==== List of installed packages ====
<syntaxhighlight lang='bash'>
dpkg --get-selections
# Or using [https://wiki.debian.org/ListInstalledPackages dpkg-query] utility.
dpkg-query -l
</syntaxhighlight>
 
==== Install a list of packages ====
[https://www.cyberciti.biz/faq/how-to-list-all-installed-packages-debian-ubuntu/ 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
<syntaxhighlight lang='bash'>
# server 1
dpkg --get-selections | grep -v deinstall > mylist.txt
# server 2
sudo dpkg --set-selections < mylist.txt
</syntaxhighlight>
 
==== Show (sort) package size ====
<pre>
<pre>
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
sudo apt-get install build-essential
</pre>
</pre>
 
* (master node, mpiuser). Creating a test file <mpi_hello.c>
==== Check if a library is installed or not ====
Use '''ldconfig -p | grep LIBNAME'''. For example, to check if ''libxml'' is installed or not,
<pre>
<pre>
EXIST=`ldconfig -p | grep libxml | wc -l`
#include <stdio.h>
if [ $EXIST -ng 0 ]; then echo EXISTING; fi
#include <mpi.h>
</pre>


==== How to uninstall software ====
int main(int argc, char** argv) {
http://www.howtogeek.com/229699/how-to-uninstall-software-using-the-command-line-in-linux/
    int myrank, nprocs;


==== Upgrade software packages ====
    MPI_Init(&argc, &argv);
Upgrade all the currently installed software packages on the system
    MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
<pre>
    MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
sudo apt-get upgrade
 
</pre>
    printf("Hello from processor %d of %d\n", myrank, nprocs);


If you want to upgrade, unconcerned of whether software packages will be added or removed to fulfill dependencies, use
    MPI_Finalize();
<pre>
    return 0;
sudo apt-get dist-upgrade
}
</pre>
</pre>
 
And compile and run it by
==== List of available (uninstalled) packages ====
<pre>
<pre>
aptitude -F "%p" search "?not(?installed)"
mpicc mpi_hello.c -o mpi_hello
mpiexec -n 3 -f hosts ./mpi_hello
</pre>
</pre>
See http://superuser.com/questions/408082/how-do-i-get-a-list-of-available-i-e-uninstalled-packages-in-debian
We should see something like
 
==== Check Change Log of Package ====
http://www.tecmint.com/useful-basic-commands-of-apt-get-and-apt-cache-for-package-management/
<pre>
<pre>
sudo apt-get changelog PKGNAME
Hello from processor 0 of 2
Hello from processor 1 of 2
</pre>
</pre>
Successful! That's it.


==== Clean up/remove packages ====
== OpenMPI ==
[http://www.ubuntugeek.com/cleaning-up-a-ubuntu-gnulinux-system-updated-with-ubuntu-14-10-and-more-tools-added.html ubuntugeek.com]
* http://auriza.site40.net/notes/mpi/openmpi-on-ubuntu-904/
* http://particlephysicsandcode.wordpress.com/2012/11/04/installing-open-mpi-1-6-3-ubuntu-12-04-fedora/
* http://randomusefulnotes.blogspot.com/2010/12/setting-up-mpi-cluster-on-ubuntu.html


==== unmet dependencies after adding a PPA & apt --fix-broken ====
With R
http://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa
* http://www.open-mpi.org/papers/tr-uni-muenchen-8991/parallelR_techRep.pdf
* http://www.cybaea.net/Blogs/R-tips-Installing-Rmpi-on-Fedora-Linux.html (Fedora)
* http://kiradi.blogspot.com/2011/10/high-performance-computing-with-openmpi.html (Ubuntu)
* http://cran.r-project.org/web/packages/doMPI/vignettes/doMPI.pdf
* http://biowulf.nih.gov/user_guide.html#parallel


<syntaxhighlight lang='bash'>
= File sharing in a local network - woof =
$ sudo apt-get install libgl1-mesa.dev
* https://www.howtoforge.com/tutorial/linux-how-to-share-files-on-a-local-network/
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:
= Sharing internet =
libgl1-mesa-dev : Conflicts: libgl-dev
== Simple Gui approach from GNOME desktop ==
                  Conflicts: libgl1-mesa-dri-dev
* [https://www.linuxuprising.com/2018/09/how-to-create-wi-fi-hotspot-in-ubuntu.html How To Create A Wi-Fi Hotspot In Ubuntu 18.04 / Gnome (And Edit Its Settings)]
libgl1-mesa-dev-lts-utopic : Depends: mesa-common-dev-lts-utopic (= 10.3.2-0ubuntu1~trusty2) but it is not going to be installed
* [http://ubuntuhandbook.org/index.php/2014/09/3-ways-create-wifi-hotspot-ubuntu/ 3 Ways to Create Wifi Hotspot in Ubuntu 14.04]
                              Depends: libgl1-mesa-glx-lts-utopic (= 10.3.2-0ubuntu1~trusty2) but it is not going to be installed
* https://www.quora.com/How-do-I-create-hotspots-in-Ubuntu-14-04. Notice the last step.
                              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.
</syntaxhighlight>


[https://askubuntu.com/questions/914428/unmet-dependencies-when-trying-to-install-r-base/914429 Unmet dependencies when trying to install r-base] (Works on Ubuntu 16.04).
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) ???
<syntaxhighlight lang='bash'>
<pre>
sudo apt --fix-broken install
Failed to activate connection
sudo apt-get update
(32) Access Point (AP) mode is not supported by this device
sudo apt-get upgrade
</pre>
</syntaxhighlight>


=== Terminal Assistant ===
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!!!
* [https://github.com/pickhardt/betty Betty]: [http://www.makeuseof.com/tag/use-natural-language-with-betty-your-digital-assistant-in-the-linux-terminal/ makeuseof] and [http://www.infoworld.com/article/2696910/open-source-tools/install-the-command-line-virtual-assistant-betty-in-linux-mint-17.html infoworld]
* [https://github.com/semicode-ltd/sarah Sarah]


=== Torrent ===
And the output of '''nm-tool''' command also confirms the wifi device is connected.
[http://www.makeuseof.com/tag/top-6-torrent-alternatives-to-pirate-bay-downloads/ Top 6 Torrent Alternatives to The Pirate Bay] (7/5/2017)


(old) Popular search sites
<pre>
* torrentz
odroid@odroid:~/Downloads$ netstat -rn
* thepiratebay
Kernel IP routing table
* isohunt
Destination    Gateway        Genmask        Flags  MSS Window  irtt Iface
* kickass torrents
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
==== How to set up torrent scheduling on Linux ====
192.168.1.0    0.0.0.0        255.255.255.0  U        0 0          0 eth2
https://www.howtoforge.com/tutorial/how-to-set-up-torrent-scheduling-on-linux/. It covers 'Deluge', 'Transmission' and 'Rtorrent'.
</pre>
The ap hotspot from the wifi adapter has an IP 10.42.0.1 (ifconfig).


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.
See [[Raspberry#IP_scan_tools|IP scan tools]] (eg '''arp-scan''') to find out connected devices.


==== Torrent client command line: [http://aria2.sourceforge.net/ aria2c] ====
== Sharing internet via wifi: ap-hotspot ==
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.
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.
{{Pre}}
$ # 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
</pre>
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.  


http://linuxconfig.org/aria2-all-in-one-command-line-download-tool
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.
<pre>
sudo apt-get install aria2
aria2c magnet:?xt=urn:btih:1e99d95f1764644a86a8e99bfd80c ...
</pre>


==== Torrent client: transmission-cli ====
== Sharing internet via wifi: iptables ==
https://wiki.archlinux.org/index.php/Transmission
1. Assume the primary wired network connection, eth0 is connected to Internet.  


==== Torrent client command line: rtorrent ====
2. Using your distro's network managment tool, create a new ad hoc wireless connection with the following settings:
We first need to create an .rtorrent.rc file under $HOME directory. Then run
<pre>
<pre>
rtorrent XXX.torrent
IP address: 10.99.66.55
Subnet mask: 255.255.0.0 (16)
</pre>
</pre>
* https://wiki.archlinux.org/index.php/RTorrent
* http://harbhag.wordpress.com/2010/06/30/tutorial-using-rtorrent-on-linux-like-a-pro/ [download a template]
* http://mylinuxbook.com/rtorrent-bit-torrent-client/


In the simplest case, .rtorrent.rc looks like
3. Use the following shell script to share the internet connection
<pre>
{{Pre}}
# On the terminal, mkdir ~/Downloads/rsession
#!/bin/bash
download_rate = 0
#filename: netsharing.sh
upload_rate =50
#Replace 10.99.0.0/16 by your network/netmask
directory = ~/Downloads
#Usage: ./netsharing.sh input_interface output_interface
session = ~/Downloads/rsession
#Example: ./netsharing.sh eth0 wlan0
port_range = 55556-55560
 
scgi_port = 127.0.0.1:5000
echo 1 > /proc/sys/net/ipv4/ip_forward
use_udp_trackers = yes
iptables -A FORWARD -i $1 -o $2 -s 10.99.0.0/16 -m conntrack --ctstate NEW -j ACCEPT
encryption = allow_incoming,try_outgoing,enable_retry
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE
</pre>
</pre>
As you can see here, I have created a sub-directory ''rsession'' under ~/Downloads/.


[https://wiki.archlinux.org/index.php/RTorrent#Key_bindings Keybinding]:
4. Run the script as follows:
* ctrl + q = quit application
{{Pre}}
* ctrl + d = stop an active download
sudo ./netsharing.sh eth0 wlan0
* ctrl + s = start downloading
</pre>


=== glibc ===
5. Connect your devices to the wireless network you just created with the following settings (Question: how about the SSID here?)
==== Patch glibc 2.9 ====
<pre>
* http://www.infoworld.com/article/3033862/security/patch-now-unix-bug-puts-linux-android-and-ios-systems-at-risk.html
IP address: 10.99.66.56 (and so on)
* http://www.cyberciti.biz/faq/linux-patch-cve-2015-7547-glibc-getaddrinfo-stack-based-buffer-overflow/
Subnet mask: 255.255.0.0
<syntaxhighlight lang='bash'>
</pre>
sudo apt-get update
sudo apt-get upgrade
sudo reboot
</syntaxhighlight>


=== SSL ===
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.
==== Install commercial SSL certificate ====
* https://www.digitalocean.com/community/tutorials/how-to-install-an-ssl-certificate-from-a-commercial-certificate-authority
* [https://www.namecheap.com/support/knowledgebase/article.aspx/9423/0/apache-opensslmodssl Installing a SSL certificate on Apache]
* https://www.namecheap.com/support/live-chat/ssl.aspx
* [https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean How To Set Up a Host Name with DigitalOcean] This includes information about WHOIS, changing domain server, configuring domain (A record, AAAA record, CNAME record, MX record, et al)


==== check openssl version ====
Credit: [https://www.packtpub.com/application-development/linux-shell-scripting-cookbook-second-edition Linux Shell Scripting Cookbook]
http://askubuntu.com/questions/504928/how-to-check-which-openssl-version-is-use-by-apache-on-ubuntu-12-04
<syntaxhighlight lang='bash'>
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
[http://forum.odroid.com/viewtopic.php?f=112&t=9321 A similar approach] discussed on the Odroid forum.
$ openssl version
OpenSSL 1.0.1f 6 Jan 2014
# Macbook Pro 10.11
$ openssl version
OpenSSL 0.9.8zh 14 Jan 2016
</syntaxhighlight>


==== check openssl location ====
== iptables ==
A more general way is to use '''openssl version -d'''
* [[Beaglebone#Internet_over_USB|Beaglebone]]
<syntaxhighlight lang='bash'>
# 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
= ~/.xsession-errors file is filling the hard disk =
$ openssl version -d
It is related to vino-server. See
OPENSSLDIR: "/System/Library/OpenSSL"
* http://askubuntu.com/questions/130768/my-home-partition-slowly-fills-up-until-the-system-is-unable-to-complete-even-si
$ ls -l /System/Library/OpenSSL
* http://filthypants.blogspot.com/2013/02/xsession-errors-log-filling-hard-drive.html
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
</syntaxhighlight>


==== openssl & patch bug ====
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.
* Check out https://launchpad.net/ubuntu/+source/openssl to see the latest openssl version (number may be different for each of Ubuntu version). As of this writing, the latest openssl on Ubuntu 14.04 is 1.0.1f-1ubuntu2.15 and for Ubuntu 12.04 it is 1.0.1-4ubuntu5.31 (this kind of representation can be obtained using the sudo dpkg -l | grep  openssl command; see below). '''The full list of the publishing history can be accessed through [https://launchpad.net/ubuntu/+source/openssl/+publishinghistory View full publishing history link].''' From there, we can restrict to Target = Trusty, for example.
* http://askubuntu.com/questions/444702/how-to-patch-the-heartbleed-bug-cve-2014-0160-in-openssl. The following is an output after running ''sudo apt-get update; sudo apt-get upgrade''.
<pre>
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
</pre>
* http://www.liquidweb.com/kb/update-and-patch-openssl-on-ubuntu-for-the-ccs-injection-vulnerability/. As you can see although a bug in OpenSSL has been found affecting versions 1.0.1 through 1.0.1f (inclusive), and openssl version is still 1.0.1f in  Ubuntu 14.04.1, the build date is on June 2014. So it is safe.
<pre>
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
= JRE and JDK =
OpenSSL 1.0.1f 6 Jan 2014
[[Java#Installation|Java]]
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
= Notifications =
    - debian/patches/CVE-2014-0224-regression2.patch: accept CCS after
* To see old notifications, use Superkey + M or click the clock.
    - debian/patches/CVE-2014-0224.patch: set the CCS_OK flag when using
* [https://www.maketecheasier.com/desktop-notifications-for-linux-command/ How to Get Desktop Notifications from the Linux Command Line]  with the '''notify-send''' command
    - debian/patches/CVE-2014-0224-1.patch: only accept change cipher spec
* [https://www.linuxuprising.com/2021/02/get-notifications-on-your-desktop-or.html Get Notifications On Your Desktop Or Phone When A Long-Running Command Has Finished With Noti]
    - 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
</pre>
* [http://www.cyberciti.biz/faq/howto-openssl-security-update-cve20150291-cve20150204-cve20150290-cve20150207-cve20150286/ How To Patch and Protect OpenSSL Vulnerability # CVE-2015-0291 CVE-2015-0204 [19/March/2015]]


==== [https://letsencrypt.org/ Let's Encrypt SSL] ====
= Send email =
* [https://www.ithome.com.tw/news/121803 Let's Encrypt通用憑證上線了!]
It is useful to several occations:
* https://letsencrypt.org/getting-started/ & https://letsencrypt.org/how-it-works/ & https://certbot.eff.org/#ubuntuxenial-apache: install '''python-certbot-apache''' package
* [https://www.howtoforge.com/tutorial/how-to-setup-automatic-security-updates-on-ubuntu-1604/#email-notification Email notification for updates]
* [https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04 How To Secure Apache with Let's Encrypt on Ubuntu 16.04]: install '''python-certbot-apache''' package
* [https://www.upcloud.com/support/install-lets-encrypt-apache/ How to Install Let’s Encrypt on Apache2]: install '''python-letsencrypt-apache''' package


It takes less than 5 minutes for the whole process!
== Send emails through gmail: mail ==
<syntaxhighlight lang='bash'>
[https://developernote.com/2017/10/configuring-sendmail-with-gmail-relay-on-ubuntu-16-04/ Configuring sendmail with GMail relay on Ubuntu 16.04]
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
</syntaxhighlight>


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.
== Send emails through gmail: sSMTP ==
* [https://askubuntu.com/a/12933 How to send mail from the command line?]
* https://wiki.debian.org/sSMTP


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'''
= CPU/system load =
<pre>
== Cockpit ==
30 2 * * 1 certbot renew >> /var/log/le-renew.log
* https://cockpit-project.org/
</pre>
* [[KVM#Virtual_Machine_Manager.2Fvirt-manager.2C_Cockpit.2C_virt-viewer.2C_remote-viewer|KVM]] page
* [https://youtu.be/L9fMWCRcqIE Cockpit | An Easy to Use Web GUI for Your Linux Servers] (video)


'''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.
== Conky: system resource monitor ==
See [[Conky|Conky]].


=== Install webmin ===
== [https://oguzhaninan.github.io/Stacer-Web/ Stacer] - Linux System Optimizer and Monitoring ==
* http://www.webmin.com/deb.html
[https://www.fossmint.com/stacer-ubuntu-system-optimizer/ Stacer – The Linux System Optimizer You’ve Been Waiting For]. Qt library. But it seems the memory usage will increase after a while.


<pre>
[[File:Stacer.png|200px]]
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
</pre>
[[File:Webmin.png|100px]]


=== File does not exist: /var/www/favicon.ico from /var/log/apache2/error.log ===
== Mission Center: Windows Task Manager like ==
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.
* [https://news.itsfoss.com/mission-center/ Mission Center: A Sleek System Monitoring App for Linux]
* https://flathub.org/apps/io.missioncenter.MissionCenter


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 [http://www.favicon.cc/ favicon.cc] where you can create a .ico file and download it for your own use.
== Grafana ==
* [https://www.howtogeek.com/devops/how-to-set-up-a-simple-grafana-cloud-monitoring-dashboard-for-your-linux-server/ How to Set Up a Simple Grafana Cloud Monitoring Dashboard for Your Linux Server] 2022/10
* [https://www.instructables.com/id/Bird-Feeder-Monitor-V20/ Bird Feeder Monitor V2.0]


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.
== Graphite ==
* https://graphiteapp.org/quick-start-guides/graphing-metrics.html
* [https://www.howtoforge.com/how-to-install-and-configure-graphite-on-ubuntu-22-04/ How to Install and Configure Graphite Monitoring System on Ubuntu 22.04]
* [https://www.linode.com/docs/guides/install-graphite-and-grafana/ Monitor Your System with Graphite and a Grafana Dashboard]


Add the following block of code to each VirtualHost, or at least the ones which don’t have a favicon file.
== I-Nex ==
[https://www.ghacks.net/2017/07/23/a-look-at-i-nex-a-cpu-z-like-application-for-gnulinux/ A look at I-Nex – a CPU-Z like Application for GNU/Linux]
 
== CPU-G ==
See [http://blog.hostonnet.com/how-to-view-cpu-info-in-ubuntu-cpu-z-alternative-for-linux this instruction] to install CPU-G program for viewing hardware information (process, mb, graphic, memory, system).
 
== CPU-X ==
[https://www.fosslicious.com/2020/06/cpu-x-alternative-to-cpu-z-for-ubuntu.html CPU-X, An Alternative to CPU-Z for Ubuntu and Other Linux Distributions!]. This is pre-installed in Calculate Linux. On ubuntu, run "sudo apt install cpu-x" to install it.


<pre>
== [https://github.com/cyring/CoreFreq CoreFreq] ==
Redirect 404 /favicon.ico
http://www.tecmint.com/corefreq-linux-cpu-monitoring-tool/
<Location /favicon.ico>
ErrorDocument 404 "No favicon"
</Location>
</pre>


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.
== System load indicator on desktop/GNOME resource monitor on taskbar ==
* [http://www.howtogeek.com/118908/10-awesome-indicator-applets-for-ubuntus-unity-desktop/ System Load Indicator], [https://www.addictivetips.com/ubuntu-linux-tips/view-network-memory-and-cpu-usage-from-system-tray-in-ubuntu-linux/ View Network, Memory And CPU Usage From System Tray In Ubuntu Linux]
* It is used to view system information (cpu, memory, network) in real-time.
* It works on Ubuntu 20.04.1. It can show CPU and memory usage. A drawback is the high CPU usage; see [https://askubuntu.com/a/973810 gnome-shell 3.26.1 constantly uses 20-30% CPU].


Or, you create an empty file with the name “favicon.ico” in the directory root of Apache (for exemple /var/www/).
<pre>
sudo apt-get install indicator-multiload


=== Show weather on the taskbar ===
# sudo apt-get install indicator-cpufreq
http://www.noobslab.com/2012/10/important-thingstweaks-to-do-after.html
# indicator-cpufreq
</pre>


=== WebCam ===
== Alert When Memory Gets Low ==
https://help.ubuntu.com/community/Webcam
[https://www.tecmint.com/shell-script-to-send-email-alert-when-memory-low/ A Shell Script to Send Email Alert When Memory Gets Low]


Install '''cheese''' or '''guvcview'''. [https://thinkrpi.wordpress.com/2013/04/05/step-3-install-softwares-for-webcam-and-computer-vision/ An example of using computer vision] on Raspberry Pi.
== Monitor CPU Utilization And Send Email ==
[https://www.2daygeek.com/linux-shell-script-to-monitor-cpu-utilization-usage-and-send-email/ Linux Shell Script To Monitor CPU Utilization And Send Email]


=== Watch TV ===
== Top processes sorted by RAM or CPU ==
[http://code.google.com/p/freetuxtv/wiki/HomePage?wl=en Freetuxtv]
[https://www.tecmint.com/find-linux-processes-memory-ram-cpu-usage/ Find Top Running Processes by Highest Memory and CPU Usage in Linux] <br> '''ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head'''


=== Running concrete5 On Nginx (LEMP) ===
== Monitor Resource Usage of a Single Process ==
http://www.howtoforge.com/running-concrete5-on-nginx-lemp-on-debian-squeeze-ubuntu-12.10
[https://www.baeldung.com/linux/monitor-process-resource-usage Monitor Resource Usage of a Single Process]


=== Open mms stream in google chrom in linux ===
= Hard drive: hdparm and smartctl =
http://www.thermetics.net/2011/12/07/how-to-open-mms-links-from-chrome-under-ubuntu/
== Hard disk speed ==
[[Benchmark#Disk_speed_test|Benchmark -> Disk speed test]]


=== Download mms stream (suitable if mms is an extension; for example, studioclassroom) ===
== Hard disk directory size ==
See [[Linux#Display_directory_size_with_sorting_and_human_readable|Display directory size with sorting and human readable]] by using the '''ncdu''' utility.


* Use mimms (will NOT output to speaker at the same time; so is best in terms of performance)
==  MART overall-health self-assessment test ==
On my Samsung SSD 860 EVO 500GB, SMART DATA was greyed out when I try the '''Disks''' utility. But GSmartControl and smartctl can get the data out
<pre>
<pre>
sudo apt-get install mimms
sudo smartctl --all /dev/sda | grep overall
mimms -t 60 mms://example.com/video
$ SMART overall-health self-assessment test result: PASSED
</pre>
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
<pre>
$ 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.
</pre>
</pre>


== Monitor/run a short test on a hard disk health by command line/GUI ==
Using [https://www.howtoforge.com/tutorial/monitor-harddisk-with-smartmon-on-ubuntu/ smartctl]
{{Pre}}
sudo apt install smartmontools
sudo smartctl -a /dev/sda


* Use mplayer (will output to speaker at the same time, so suffer from performance, anyway do not get output)
# Run a short test
<pre>
$ sudo smartctl -t short /dev/sda # It will start the test in the background
mplayer mms:/link/something.xxx -dumpstream -dumpfile file.xxx
$ sudo smartctl -l selftest /dev/sda
</pre>
</pre>


mms:/link/something.xxx - link to the stream you wish to download
or the GUI version
file.xxx - file to which you wish to download the stream, be careful to write the same extension xxx
{{Pre}}
sudo apt-get install gsmartcontrol
sudo gsmartcontrol
</pre>
[https://www.ghacks.net/2017/07/19/how-to-check-hard-drive-disk-health-in-gnulinux/ How to check Hard Drive Disk Health in GNU/Linux]


Wait for the file to download and that's it. See http://ubuntuhowtos.com/howtos/download_mms_stream
Interpretation:
* http://www.linuxjournal.com/magazine/monitoring-hard-disks-smart?page=0,1
* https://wiki.archlinux.org/index.php/S.M.A.R.T.
* https://en.wikipedia.org/wiki/S.M.A.R.T.
* https://askubuntu.com/questions/20393/how-do-i-interpret-hdd-s-m-a-r-t-results
* [https://www.howtogeek.com/134735/how-to-see-if-your-hard-drive-is-dying/ How to See If Your Hard Drive Is Dying with S.M.A.R.T.] (Windows)


=== Keep a linux process running after log out ===
== Email warnings for hd problems by '''smartd''' ==
* http://linux.101hacks.com/unix/nohup-command/
* [https://www.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html Configure smartd on server to get email based warnings if problems are detected]
* http://serverfault.com/questions/311593/keeping-a-linux-process-running-after-i-logout
* [https://www.cyberciti.biz/tips/monitoring-hard-disk-health-with-smartd-under-linux-or-unix-operating-systems.html Monitoring hard disk health with smartd under Linux or UNIX operating systems]
<pre>
# nohup command-with-options &
</pre>


=== Open Firefox in cron job ===
Debian Linux
The trick is to use '''export DISPLAY=:0'''
# Enable smart by editing /etc/default/smartmontools file.
<pre>
# Smart Configuration file: /etc/smartd.conf
export DISPLAY=:0
# Start/Stop smart: /etc/init.d/smartmontools start | stop
firefox http://www.google.com &
 
</pre>
== Hard disk temperature ==
http://www.cyberciti.biz/tips/howto-monitor-hard-drive-temperature.html


=== Close firefox gracefully ===
It seems the hddtemp command does not work on SSDs.
Use '''wmctrl''' command.  
* http://www.linuxjournal.com/magazine/hack-and-automate-your-desktop-wmctrl
* http://tomas.styblo.name/wmctrl/
<pre>
<pre>
sudo apt-get install wmctrl
sudo apt-get install hddtemp
wmctrl -c firefox
sudo hddtemp /dev/sdb
 
/dev/sdb: ST2000DM001-9YN164: 40°C
</pre>
</pre>


=== Record audio out from command line ===
For SSD,
http://www.pantz.org/software/alsa/recording_sound_from_your_web_browser_using_linux.html
 
Step 1: Install required programs
<pre>
<pre>
sudo apt-get install gnome-media pavucontrol lame
sudo apt-get install smartmontools
sudo smartctl -a /dev/sda
</pre>
</pre>


Step 2: Create a script file <recordfm.sh>
== Hard disk power on time/hours ==
{{Pre}}
sudo smartctl --all /dev/sda | grep Power_On_Hours
</pre>
Sample output:
<pre>
<pre>
#!/bin/bash
$ sudo smartctl -A /dev/sda | grep -i power
# Get pulseaudio monitor sink monitor device then pipe it to
  9 Power_On_Hours          0x0032  034  034  000    Old_age  Always      -      58541
# sox to record wav, lame to encode to mp3, or flac to encode flac
12 Power_Cycle_Count      0x0032  100  100  020    Old_age  Always      -      164
FILENAME="$1"
$ sudo smartctl -A /dev/sdb | grep -i power
STOPTIME="$2"
  9 Power_On_Hours          0x0032  100  100  000    Old_age  Always      -      585
# Encoding options for lame and flac.
12 Power_Cycle_Count      0x0032  100  100  000    Old_age  Always      -      43
LAMEOPTIONS="--preset cbr 192 -s 44.1"
192 Power-Off_Retract_Count 0x0032  200  200  000    Old_age  Always      -       32
</pre>


if [ -z "$FILENAME" ]; then
== Free up disk space/clean up system space/remove or delete junk files ==
    echo -e "
[https://www.2daygeek.com/linux-remove-delete-unwanted-junk-files-free-up-space-ubuntu-mint-debian/ 5 Easy Ways To Free Up Space (Remove Unwanted or Junk Files) on Ubuntu]
    Usage: $0 /path/to/output.mp3
    Usage: $0 /path/to/output.mp3 stopinseconds" >&2
    exit 1
fi


# Get sink monitor:
= system's hardware temperatures and voltages =
MONITOR=$(pactl list | egrep -A2 '^(\*\*\* )?Source #' | \
<ul>
    grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1)
<li>[https://www.makeuseof.com/control-cpu-fan-speed-on-linux/ How to Control the CPU Fan Speed on Linux]
echo "set-source-mute ${MONITOR} false" | pacmd >/dev/null
<li>[https://www.howtoforge.com/tutorial/ubuntu-performance-monitoring/ How to monitor your system performance on (Ubuntu) Linux].
{{Pre}}
$ sudo apt-get install lm-sensors
$ sensors
</pre>
</ul>


# Record it raw, and pipe to lame for an mp3
= Passwords and keys =
echo "Recording to $FILENAME ..."
[https://help.gnome.org/users/seahorse/stable/ GNOME Passwords and Keys]


if [[ $FILENAME =~ .mp3$ ]]; then
[https://itsfoss.com/ubuntu-keyring/ The Keyring Concept in Ubuntu: What is It and How to Use it?] Mar, 2020
  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
</pre>


Step 3: play the music or launch a browser with a desired url.
== Unlock keyring ==
I got the prompt of unlocking keyring every time I open google chrome browser.


Step 4: run the bash script
* http://askubuntu.com/questions/867/how-can-i-stop-being-prompted-to-unlock-the-default-keyring-on-boot (this works)
* http://askubuntu.com/questions/184266/what-is-unlock-keyring-and-how-do-i-get-rid-of-it (this does not help)
* http://superuser.com/questions/311216/why-does-chrome-ask-for-my-gnome-keyring-seahorse-password (works. I create a shortcut to launch chrome)
<pre>
<pre>
chmod +x recordfm.sh
google-chrome --password-store=basic
./recordfm.sh test.mp3 10
</pre>
</pre>
where <test.mp3> is the output filename and 10 is recording length (seconds). It works.
It is also helpful to remove ubuntu one from Ubuntu 12.04. See http://hex.ro/wp/blog/removing-ubuntuone-from-ubuntu-12-04/


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
= Password manager =
<pre>
* [https://linuxconfig.org/how-to-organize-your-passwords-using-pass-password-manager How to organize your passwords using pass password manager]
SPID=$!
* [https://www.passwordstore.org/ pass] the standard unix password manager
echo $SPID
* [https://www.fossmint.com/pass-commandline-password-manager-for-linux/ Pass – Manage Your Passwords from Linux Command Line]
</pre>
* [https://www.howtoforge.com/install-and-configure-passbolt-password-manager-on-ubuntu-2004/ Install and Configure Passbolt Team Password Manager on Ubuntu 20.04]


=== Advanced audio control ===
= netcat (nc) - arbitrary TCP and UDP connections and listens =
https://www.howtoforge.com/tutorial/advanced-audio-control-on-linux/
Netcat or nc is a networking utility for debugging and investigating the network.


* Alsamixer
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.
* Pulse Audio Volume Control
* Pulse Audio Equalizer


=== VLC ===
* http://www.thegeekstuff.com/2012/04/nc-command-examples/
==== How to play DVDs ====
* https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections-on-a-vps
https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs
* https://learn.adafruit.com/raspipe-a-raspberry-pi-pipeline-viewer-part-2?view=all


==== [https://www.maketecheasier.com/listen-tunein-radio-in-vlc/ Use VLC to listen tunein radio] ====
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.
Download link http://addons.videolan.org/content/show.php?content=152788. Right click the links and save them (3 lua files)
{{Pre}}
# create a listening socket on the local machine
Create two new subfolders and place the lua files
nc -l 1234


* move the “tunein.lua” file to the VLC folder so it can be found and run by VLC.
# connect to the socket from a 2nd computer
** In Linux, move the “tunein.lua” file to ~/.local/share/vlc/lua/sd/
nc IP_LocalMachine 1234
** In Windows, move the “tunein.lua” file to %AppData%/VLC/VideoLAN/lua/sd.
** In Mac OS X, move the “tunein.lua” file to VLC.app/Contents/MacOS/share/lua/sd
* move the “radiotimes.lua” and “streamtheworld.lua” files from the Playlist folder to “/lua/playlist” folder in the VLC directory.


Open VLC. Go to “View -> Playlist”. At the sidebar, under the Internet section, you should now see “TuneIn Radio” in the list. Click on it and you will be able to access your Favorites.
# send messages.  
 
# Type something and press Enter on the terminal from the 2nd computer.
==== Taiwan radio ====
# The message will appear on the terminal of the local machine.
* rtsp://live2.rti.org.tw/rti4.sdp  (discovered by open http://music.rti.org.tw/music in Linux Chrome browser)
</pre>
* rtmp://news98-t24.griffinmas.com/live/news98


==== Use VLC to record internet radio (suitable if the stream is continuous) ====
To transfer files over the network ('''no any password is needed!!''')
http://www.ubuntugeek.com/how-to-record-internet-radio-using-vlc.html
{{Pre}}
# receiver machine
nc -l 1234 > destination_file


<pre>
# sender machine
sudo apt-get install vlc browser-plugin-vlc
nc IP_Receiver 1234 < source_filename
</pre>
</pre>


* http://ubuntuguide.org/wiki/Ubuntu:Precise#Restricted_Extras
[https://linuxize.com/post/netcat-nc-command-with-examples/ Netcat (nc) Command with Examples]
<pre>
<pre>
sudo apt-get install ubuntu-restricted-extras
# receiving host
nc -l 5555 | tar xzvf -
 
# sending host
tar czvf - /path/to/dir | nc receiving.host.com 5555
</pre>
</pre>


* https://help.ubuntu.com/community/FFmpeg#Precise_Configurations
= 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
<pre>
<pre>
sudo apt-get install lame  libmp3lame0
service --status-all  # output format is clean
sudo apt-get install ffmpeg
 
sudo apt-get install libavcodec-extra-53 libavdevice-extra-53 libavfilter-extra-2 libavformat-extra-53 \
sudo initctl list      # show the process number too
                    libavutil-extra-51 libpostproc-extra-52 libswscale-extra-2
</pre>
</pre>
where in the output "+" means started, "-" stopped, and "?" unknown.
== SysV init ==
Init is an initialization system


A successful run will have an output like
SysV init is named for System V Unix.
<pre>
 
VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
Init runs as PID 1. Parent process of all other processes on the system.
[0x2329ca8] dummy interface: using the dummy interface module...
[0x7fac2c007428] mux_dummy mux: Open
[0x7fac2c003598] access_mms access: selecting stream[0x1] audio (39 Kib/s)
[0x7fac2c003598] access_mms access: connection successful
[0x7fac2c003598] access_mms access error: failed to send command
[0x7fac2c005fe8] idummy demux: command `quit'
</pre>


==== Play audio using a command line mode ====
Runlevels represent discrete operational states.
See also my [[Beaglebone#Playing_music_using_command_line_tools|Beaglebone]] page for a comparison of different possibilities. For VLC, there are 3 [https://wiki.videolan.org/Console/ interface modes]. The following example is to run vlc in a [http://www.tldp.org/REF/VLC-User-Guide/x625.html text mode] with the ncurses library.
* [https://learn.adafruit.com/running-programs-automatically-on-your-tiny-computer/sysv-init-runlevels SysV init: Runlevels] - Running Programs Automatically on Your Tiny Computer (from adafruit.com)
<syntaxhighlight lang='bash'>
* https://en.wikipedia.org/wiki/Runlevel
sudo apt-get install vlc-nox
* [https://www.tecmint.com/change-runlevels-targets-in-systemd/ How to Change Runlevels (targets) in SystemD]
vlc -I ncurses XXX.mp3
vlc --help
</syntaxhighlight>


==== Play youtube using VLC from a command line ====
See [http://raspberrypi.stackexchange.com/questions/1556/why-wont-flash-player-on-chromium-work this post]
<pre>
<pre>
vlc -I http https://www.youtube.com/watch?v=UlW77conmAc
$ runlevel
$ less /etc/init.d/ssh
$ ls -ld /etc/rc*
$ ls -l /etc/rc2.d
$ cat /etc/rc.local
$ sudo service networking restart
$ ls /etc/init.d/
</pre>
</pre>


==== Keyboard shortcuts ====
== systemd ==
[https://www.cheatography.com/shaunumb/cheat-sheets/vlc-windows-and-os-x/ cheatography.com] and [http://www.howtogeek.com/196371/master-vlc-with-these-23-keyboard-shortcuts/ howtogeek]
[https://itsfoss.com/start-stop-restart-services-linux/ How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions]


* Ctrl + arrow: forward/backward 1 minute (Add the 'CMD' key on macOS)
== systemd vs upstart ==
* Alt + arrow: forward/backward 10 seconds (Add the 'CMD' key on macOS)
* Ubuntu 16.04 (and newer), RHEL/CentOS 7 (and newer), Arch Linux use [https://en.wikipedia.org/wiki/Systemd systemd] but relative old OS uses [https://en.wikipedia.org/wiki/Upstart_(software) Upstart] service manager.
* Shift + arrow: forward/backward 3 seconds (Add the 'CMD' key on macOS)
* [https://fossbytes.com/systemd-vs-sys-v-vs-upstart/ Systemd vs SysV vs Upstart — Linux Service Management Throwdown]
* [ or -: decrease speed
* [https://askubuntu.com/a/867953 SysV, Upstart and systemd init script coexistence]. Newer init systems try to maintain compatibility with older ones. In particular, systemd tries to maintain compatibility with both Upstart and SysV init scripts.
* ]: increase speed
* [https://wiki.ubuntu.com/SystemdForUpstartUsers SystemdForUpstartUsers]
* [https://unix.stackexchange.com/questions/5877/what-are-the-pros-cons-of-upstart-and-systemd What are the pros/cons of Upstart and systemd?]


==== VLC & screensaver ====
= Cloud/online storage =
It seems the screensaver will be deactivated if some video is opened (even not it is not playing).
* [https://www.makeuseof.com/tag/10-cloud-solutions-using-linux/ 10 Cloud Solutions You Should Be Using on Linux]


=== SMPlayer ===
== Mounting ==
* [http://www.ubuntugeek.com/install-smplayer-on-ubuntu-15-10.html Install SMPlayer on Ubuntu 15.10]
* [https://cryptomator.org/ Cryptomator] Free client-side encryption for your cloud files. Open source software: No backdoors, no registration
* [https://www.linuxuprising.com/2019/07/rclonetray-easily-mount-rclone-remotes.html?m=1 RcloneTray: Easily Mount Rclone Remotes On Demand Using A GUI]


==== MPV - terminal media player ====
== Mega ==
* http://www.makeuseof.com/tag/terminal-alternatives-linux-desktop-apps/
* [https://mega.nz/sync MegaSync]
* http://www.makeuseof.com/tag/5-amazing-linux-video-players-for-watching-movies-and-shows/


=== CVS ===
== ownCloud ==
==== CVS server ====
Use '''apt''' to install or go to the [https://owncloud.org/download/ download] page
<pre>
# 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
== One Drive ==
* [https://packages.ubuntu.com/bionic/onedrive onedrive] package. [http://skilion.github.io/onedrive/ Homepage].
* https://github.com/skilion/onedrive
* [https://itsfoss.com/onedriver/ Mount Microsoft OneDrive in Linux With OneDriver GUI Tool] 2021


mkdir ~/cvsrep
== Dropbox ==
export CVSROOT=/home/mli/cvsrep
See [[Software#Ubuntu|Software > Dropbox]].
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
</pre>
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.  
== Google Drive ==
<pre>
* [https://www.howtoforge.com/tutorial/how-to-access-your-google-drive-account-using-overgrive/  How to access your Google Drive account using '''overGrive'''] ($4.99) Support '''Auto sync''' and '''convert Google file format to Office format'''.
$ cvs -v
* [https://www.insynchq.com/ insync] ($30)
* Use [http://rclone.org rclone] program. See http://wiki.linuxquestions.org/wiki/Rsync_with_Google_Drive
** [https://www.linuxuprising.com/2019/08/rclone-149-adds-google-photos-backend.html?m=1 Rclone 1.49 Adds Google Photos Backend, New Web UI]
** [https://www.linuxuprising.com/2019/07/rclonetray-easily-mount-rclone-remotes.html?m=1 RcloneTray: Easily Mount Rclone Remotes On Demand Using A GUI]
** [https://www.linuxuprising.com/2019/10/rclone-browser-160-adds-new-options.html Cloud Storage GUI Rclone Browser 1.6.0 Adds New Options]
* [https://www.howtoforge.com/tutorial/how-to-access-google-drive-from-linux-gdrive/ How to access your Google Drive account from Linux command line using Gdrive] (Old)
* [https://www.ostechnix.com/how-to-mount-google-drive-locally-as-virtual-file-system-in-linux/ How To Mount Google Drive Locally As Virtual File System In Linux] (10/5/2018)
* [https://www.makeuseof.com/tag/access-google-drive-ubuntu/ How to Access Your Google Drive Account on Ubuntu] using '''Gnome Online Accounts''' (3/5/2018). In addition to the Google account, the program can be used to log into Nextcloud, Facebook, Microsoft, Flickr, Pocket, Foursquare, Microsoft Exchange and IMAP/SMTP accounts.
*# Install software <syntaxhighlight lang='bash'>
sudo apt install gnome-online-accounts # Probably already there
</syntaxhighlight>
*# Add google account. Either using the command line '''gnome-control-center online-accounts''' or using Settings > Online Accounts > Add an online account. Make sure the Files slider button is on. Close the Online Accounts dialog box.
*# Your Google Drive files are mounted in Nautilus now. You can add as many Google Drive accounts as you want. To add another, open Gnome Online Accounts again. Each account is listed separately in the sidebar in Nautilus.


Concurrent Versions System (CVS) 1.12.13-MirDebian-6 (client/server)
Caveats:
</pre>
* 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'


== Back up google photos ==
* [https://www.linuxuprising.com/2019/06/how-to-backup-google-photos-to-your.html How To Backup Google Photos To Your Computer With gphotos-sync] 2019-07-03
* [https://www.linuxuprising.com/2019/08/rclone-149-adds-google-photos-backend.html?m=1 Rclone 1.49 Adds Google Photos Backend, New Web UI] 2019-08-28


Quick test to checkout project to the same machine
= Office =
<pre>
== Libre Office ==
cd ~/Downloads
* [https://www.slant.co/versus/2300/2305/~libreoffice_vs_wps-office libreoffice_vs_wps-office]
mkdir localcvs
* [https://www.howtogeek.com/187663/openoffice-vs.-libreoffice-whats-the-difference-and-which-should-you-use/ LibreOffice vs OpenOffice]
cd localcvs
cvs checkout mycvs
</pre>
This will create a new subfolder 'mycvs' under ~/Downloads/localcvs.


CVS repository on server has a structure
Install
<pre>
* [https://libre-software.net/how-to-install-libreoffice-on-ubuntu-linux-mint/ How to install LibreOffice 6.1 on Linux Mint, Ubuntu, Xubuntu, Debian…]
cvsrep/CVSROOT
* https://www.libreoffice.org/download/snap/. ''sudo snap install libreoffice''
cvsrep/mycvs
</pre>


CVS sandbox on local machine has a structure
== WPS Office 2016 ==
<pre>
https://www.wps.com/en-US/
mycvs/CVS
mycvs/[files1]
mycvs/[files2]
</pre>


==== CVS client (ubuntu) ====
== ONLYOFFICE Desktop Editors ==
'''Check out'''
https://www.howtoforge.com/tutorial/how-to-install-onlyoffice-desktop-editors-51-on-ubuntu/
<syntaxhighlight lang='bash'>
cvs -d :ext:[email protected]:/home/mli/cvsrep checkout mycvs
# OR 2 steps
export CVSROOT=:ext:mli@taichi.selfip.net:/home/mli/cvsrep
cvs checkout mycvs
</syntaxhighlight>


'''Commit a new file'''
== Microsoft Office ==
<syntaxhighlight lang='bash'>
[https://www.makeuseof.com/tag/install-use-microsoft-office-linux/ How to Install and Use Microsoft Office on Linux]
cvs add mynewfile
cvs commit -m "my log message" mynewfile
</syntaxhighlight>


'''Update repository'''
= Application Launcher =
<syntaxhighlight lang='bash'>
[https://www.makeuseof.com/tag/linux-app-launchers/ The 9 Best Linux App Launchers to Help You Get Stuff Done Faster]
cvs update -P -d
# OR
cvs update filename
</syntaxhighlight>
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'''
== [https://github.com/KELiON/cerebro Cerebro] ==
<syntaxhighlight lang='bash'>
[http://www.omgubuntu.co.uk/2017/02/cerebro-is-a-spotlight-linux-equivalent Cerebro is an Open Source OS X Spotlight Equivalent for Linux]
# 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
== [https://github.com/Ulauncher/Ulauncher Ulauncher] ==
cvs log -h | awk -F"[.:]" '/^\t/&&$(NF-1)==0{print $1}' | sort -u
[http://www.omgubuntu.co.uk/2017/02/ulauncher-lightweight-app-launcher-linux Ulauncher is a Lightweight App Launcher for Linux Desktops]
</syntaxhighlight>


'''Encoding of a file'''
== [https://launchpad.net/synapse-project Synapse] ==
<syntaxhighlight lang='bash'>
[http://www.omgubuntu.co.uk/2016/10/your-favourite-alfred-app-launcher-linux Synapse or Albert — What’s Your Favourite App Launcher for Linux?]
$ cvs -d :ext:[email protected].net:/home/mli/cvsrep checkout mycvs
$ file -bi mycvs/src/hmvUnicode.rc
text/x-c; charset=utf-16le
</syntaxhighlight>


==== CVS client (windows) ====
== [http://do.cooperteam.net/ Gnome Do] ==
I use WinCVS for a demonstration
Release June 2009
* 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.
= What is the last log in time for users =
<pre>
lastlog  # all users
last    # current user
</pre>


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.
= System Logs: rsyslog =
* Handled by '''rsyslog''' in '''/etc/rsyslog.conf'''
To see hidden characters in Linux, try either one of the following 2 methods:
* Rsyslog can send and accept logs over the network. Search configure remote logging.
* Open the file in EMACS and do a M-X hexl-mode
* [https://www.makeuseof.com/set-up-linux-remote-logging-using-rsyslog/ How to Set Up Remote Logging on Linux Using rsyslog]
* geany editor.


The solution I have found to overcome accessing unicode (utf-16) file on Windows OS is using Cygwin.
== logger command ==
* Download setup.exe from http://cygwin.com/install.html
We can write messages to ourself with the '''logger''' command.
* 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.  
<pre>
<pre>
export CVSROOT=:ext:[email protected]:/home/mli/cvsrep
$ logger "hello from the command line"
cvs checkout mycvs
$ tail /var/log/syslog
</pre>
</pre>
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 ====
== Read/view the system logs ==
This is a good summary I found: http://stackoverflow.com/questions/1552749/difference-between-cr-lf-lf-and-cr-line-break-types
[https://vitux.com/view-system-log-files-ubuntu/ How to View System Log Files on Ubuntu 18.04 LTS]


* 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).
'Show Application' -> 'Logs'.


* 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)
<pre>
$ less /var/log/syslog
$ less /var/log/dpkg.log
$ ls /var/log
$ less /var/log/auth.log 
# use f/b or arrow keys or / to search
# we can search again by using / and enter
# we can restrict to lines containing the term by using & and the term


* 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.
$ sudo journalctl | grep shutdown
</pre>


==== Common CVS commands ====
Log rotate after a set period of time. Use zcat or aless to view archived files.
* http://ximbiot.com/cvs/manual/
<pre>
* http://mu2e.fnal.gov/public/hep/computing/cvsCheatSheet.shtml
$ zcat syslog.4.gz
* http://refcards.com/docs/forda/cvs/cvs-refcard-a4.pdf, http://www.bravegnu.org/cvscheat/cvscheat.pdf
</pre>


== What is the reboot time ==
The following method does not show the reboot history.
<pre>
<pre>
cvs checkout MODULE
last reboot
cvs checkout DIR
</pre>
cvs checkout DIR/SUBDIR
It seems the command only show 1 record on Ubuntu 18.04. But it shows lots of records on Ubuntu 20.04/Pop_OS 20.04. On mac, it shows a few records.
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
The above command only show the 'last' reboot time. If we want to see the boot history, see [https://vitux.com/view-system-log-files-ubuntu/ How to View System Log Files on Ubuntu 18.04 LTS]. The '''GNOME Logs''' utility is best. At the top of the GUI, I can select the logs of the (boot) date. But it has a limit number of dates to choose from. The 2nd choice '''Log File Viewer''' utility is not useful since it does not provide a choice of the date. The command line approach is possible if we need to use '''grep''' to search of 'boot' in syslog or syslog.1 or syslog.X.gz files under '''/var/log/''' directory. We may search for a very old boot log using this approach. For example, zcat /var/log/syslog6.log | grep boot.
cvs add -kb myfile.bin
# If you accidentally add a file, simply skip the commit for that file.


cvs update –dA DIR/SUBDIR
== What date/when was the system installed ==
# -d: Create  any  directories  that  exist in the repository if they're missing from the working directory.
<pre>
# -A: Reset any sticky tags, dates, or -k options. Needed after you use "cvs update -D" or "cvs update -r".
ls -l /var/log/installer
cvs update –A DIR/SUBDIR/FILENAME   
</pre>
For other OSs, follow [https://www.ostechnix.com/find-exact-installation-date-time-linux-os/ How To Find Exact Installation Date And Time Of Your Linux OS]. Replace 'dev/sda1' with the filesystem of the "/" partition. <strike>Replace /dev/sda1 with /dev/mmcblk0p2 on Raspbian</strike>,
<pre>
$ sudo su
# dumpe2fs /dev/sda1 | grep 'Filesystem created:'
# OR
# tune2fs -l /dev/sda1 | grep 'Filesystem created:'
</pre>


cvs commit
Maybe checking '''/etc/ssh''' would help if openssh-server was installed (such as '''sudo apt-get install openssh-server''').
cvs commit –m "add test suite" DIR/SUBDIR/FILENAME


mkdir ~/original
Both methods do not apply to the Ubuntu 18.04 from [https://wiki.odroid.com/odroid-xu4/os_images/linux/ubuntu_4.14/ubuntu_4.14 Odroid xu4] but looking at files under /var/log can still give a hint.
touch ~/original/newfile
cvs import ~/original VENDORTAG RELEASETAG


mkdir ~/localcvs
== systemd-journald ==
cd ~/localcvs
* [https://linuxhandbook.com/journalctl-command/ Beginner's Guide to Analyzing Logs in Linux With journalctl Command], [https://www.howtogeek.com/499623/how-to-use-journalctl-to-read-linux-system-logs/ How to Use journalctl to Read Linux System Logs]
cvs checkout common/too
* [https://askubuntu.com/q/1253076 How to stop systemd-journal utilizing 100% cpu resource Ubuntu 20.04 LTS Focal Fossa)]. Check '''/var/log/journal''' folder or '''journalctl --disk-usage'''
* [http://ubuntuhandbook.org/index.php/2020/12/clear-systemd-journal-logs-ubuntu/ Free up Disk Space – Clear Systemd Journal Logs in Ubuntu 20.04]
** [https://unix.stackexchange.com/a/194058 How to clear journalctl]
* [https://linuxconfig.org/introduction-to-the-systemd-journal  Introduction to the Systemd journal]
* [https://www.loggly.com/ultimate-guide/linux-logging-with-systemd/ Linux Logging with Systemd]
* [https://www.reddit.com/r/RemarkableTablet/comments/m9dcxy/cant_upload_files_using_the_web_interface_since/ remarkable ebook device]. '''journalctl -f''' is to show journal logs in real time.
* [https://www.atlantic.net/vps-hosting/how-to-use-journalctl-to-analyze-logs-in-linux/ How to Use journalctl to Analyze Logs in Linux]
* '''journalctl -b'''. See [https://forum.proxmox.com/threads/read-only-filesystem.106812/ Read-only filesystem].


cvs diff -r1.23 -r1.24 SUBDIR/FILENAME    # Difference between specified versions 1.23 & 1.24.
= Image/Photo =
cvs diff -D "1 hour ago" MODULE
== Image viewer on command line ==
cd LOCALCVS; cvs diff
* [https://www.ghacks.net/2019/09/16/feh-is-a-light-weight-command-line-image-viewer-for-linux/ Feh is a light-weight command-line image viewer for Linux]
cvs checkout -D "1 hour ago" MODULE
* [https://www.linuxlinks.com/imageviewers/ 30 Best Free and Open Source Graphical Image Viewers]. '''feh''' is ranked #1.
cvs checkout -D "2013-02-27 01:30" MODULE


rm file(s); cvs remove file(s); cvs commit -m "Comment text" file(s)
== Edit images using command line ==
# You must rm the file before issuing the cvs remove command. The remove is not final until the commit has been issued.
[https://opensource.com/article/21/11/edit-photos-linux-command-line 4 ways to edit photos on the Linux command line]


# cvs does not let you remove directories. However it does let you ignore any directories that are empty.
== Crop an image ==
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"
* 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.
# find all changes submitted to the repository by anyone in the past day.  
* Pinta & mtPaint can also take a screenshot of the desktop and crop the image.
# -z is used to adjust the time zone.
* gimp. https://docs.gimp.org/en/gimp-tutorial-quickie-crop.html


cvs history -c -a -D "1 day ago" -f Mu2eG4/src
== Rename files in batch ==
# find all changes submitted to Mu2eG4/src (or any other subdirectory) by anyone in the past day
[https://www.linuxuprising.com/2019/05/gui-to-batch-rename-files-on-linux-with.html?m=1 GUI To Batch Rename Files On Linux With Exif And Music Tags Support: Inviska Rename]


cvs history -c -u USER "1 day ago" -f Mu2eG4/src
== View exif information ==
# find all changes submitted by USER to Mu2eG4/src in the past day
gThumb works fine.


cvs log FILENAME
== Remove Metadata From Files: exiftool ==
</pre>
[https://www.makeuseof.com/remove-metadata-from-files-in-linux/ How to Quickly Remove Metadata From Files on Linux]


=== Bypass SSH password login (convenient for CVS, git etc) ===
= Mind-mapping =
http://www.howtogeek.com/tips/bypass-ssh-logins-by-adding-your-key-to-a-remote-server-in-a-single-command/
* [http://www.xmind.net/ xmind]
* [http://freemind.sourceforge.net/wiki/index.php/Main_Page FreeMind]


# ssh-keygen -t rsa
= Sticky notes =
# (make sure the remote server has .ssh directory)
[https://linuxhint.com/top-sticky-notes-app-for-ubuntu/ Top Sticky Notes App for Ubuntu].  '''Indicator-stickynotes''' is better than Xpad (I cannot move the app) and KNote (I cannot install it in gnome).  
# cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
[https://www.bettertechtips.com/ubuntu/install-sticky-notes-ubuntu/ How Install Sticky Notes in Ubuntu] shows we can install a deb file if we don't want to add another PPA.
# 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.
= Password manager =


See https://help.github.com/articles/generating-ssh-keys also for similar instruction when work on github.
== KeePass ==
[https://magazine.odroid.com/article/keepass-password-manager/ KeePass: Password Manager] from Odroid magazine.


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.
Choice 1: [https://keepassxc.org/ KeePassXC], KeePass Cross-Platform Community Edition. I can open kdbx file in KeePassXC. It also has a browser integration (auto-fill) functionality. See [https://sts10.github.io/2017/06/27/keepassxc-setup-guide.html Getting Started With KeePassXC]
{{Pre}}
sudo add-apt-repository ppa:phoerious/keepassxc
sudo apt-get update
sudo apt install keepassxc
</pre>


We can even have multiple ssh key on local machine by using <'''.ssh/config'''> file. See
Choice 2: [http://www.keepassx.org KeePassX]. Note that the kdbx file used in KeePass2 cannot be opened in KeePassX.
http://www.karan.org/blog/index.php/2009/08/25/multiple-ssh-private-keys.


=== Install Ubuntu to a USB flash drive ===
Choice 3: [http://keepass.info KeePass2] (this is what I am using now). There is no need to use ppa.launchpad.net to install from. You can install keepass2 by using '''sudo apt-get install keepass2''' or install the latest version using [https://launchpad.net/~jtaylor/+archive/ubuntu/keepass Julian Taylor’s PPA].  
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
{{Pre}}
sudo add-apt-repository ppa:jtaylor/keepass
sudo apt-get update
sudo apt-get install keepass2
</pre>


# Boot from live CD in ubuntu.
On Android: KeePassDroid
# Insert the USB flash drive in USB Port.
# On desktop double click on icon 'install ubuntu 12.04'
# Click on continue and it will ask if you want to unmount the flash drive click on yes
# Choose some thing else when ask to where to install ubuntu.
# 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.
# 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.
# Then click on install and linux will be installed on your USB Flash drive.


=== Install a new hard drive ===
Chrome browser (not OS) integration: See the [https://github.com/pfn/passifox/ source code].
See also https://help.ubuntu.com/community/InstallingANewHardDrive and [[#Mount_drive|Mount drive]]
# Use sudo fdisk command to create partition table. Then 'n', 'p', '1', 'w' and several returns.
# Use sudo mkfs -t ext4 /dev/sdb1 to create a new partition
# Use sudo mkdir /mnt/ssd to create a new mount point
# Use sudo nano -Bw /etc/fstab to do auto mount on boot
# sudo chown -R USERNAME:USERNAME /mnt/ssd to give the ownership to the USERNAME.


[http://withr.me/add-new-hard-disk-3tb/ Add second hard disk (3TB) to Ubuntu 16.04]
Chromebook: [https://www.bestchromebookapps.com/keepass2-for-chromebook/ KeePass2 for Chromebook]
 
Security:
* [http://lifehacker.com/keepass-vulnerability-could-let-attackers-steal-your-pa-1781486764 KeePass uses unencrypted HTTP requests when retrieving updates]


=== How to install a Ceph Storage Cluster on Ubuntu ===
=== KeePass with KeeAgent ===
https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/
http://code.mendhak.com/keepass-and-keeagent-setup/


=== Building a simple Beowulf Like Cluster with Ubuntu ===  
=== [https://github.com/keeweb/keeweb KeeWeb]: Free cross-platform password manager compatible with KeePass ===
See also the [[Raspberry#Clustering|Raspberry Pi]] page where a simple cluster was built.  
* [https://www.howtoforge.com/how-to-install-keeweb-password-manager-ubuntu-20-04/ How to Install KeeWeb Password Manager on Ubuntu 20.04], [https://www.howtoforge.com/how-to-install-keeweb-password-manager-on-ubuntu-22-04/ Ubuntu 22.04]
* [https://www.ostechnix.com/keeweb-an-open-source-cross-platform-password-manager/ 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.


==== MPICH2 ====
== 1Password ==
Resource:
[https://www.reviewgeek.com/58360/1password-beta-arrives-for-linux/ 1Password Beta Arrives for Linux]
# http://byobu.info/article/Building_a_simple_Beowulf_cluster_with_Ubuntu/
# https://help.ubuntu.com/community/MpichCluster
# 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.
== Bitwarden ==
* [https://www.makeuseof.com/install-set-up-bitwarden-linux/ How to Install and Use Bitwarden on Linux]
* [https://itsfoss.com/bitwarden/ Bitwarden: A Free & Open Source Password Manager]
* [https://help.bitwarden.com/article/install-on-premise/ Install and deploy Bitwarden to your own server]
* [https://www.pcworld.com/article/3607714/best-free-password-managers.html Best free password managers: Better online security doesn’t have to cost a thing] Feb 2021
* [https://www.makeuseof.com/how-host-self-host-bitwarden/ How You Can Self-Host Bitwarden at (Nearly) No Cost Using Google Cloud]


* (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.
= Bluetooth =
<pre>
* [https://www.howtoforge.com/tutorial/how-to-send-sound-through-bluetooth-on-linux/ How to send sound through Bluetooth on Linux] from HowToForge.
auto eth1
* https://wiki.debian.org/BluetoothUser
iface eth1 inet static
* https://help.ubuntu.com/community/BluetoothSetup
address 192.168.56.101 # use 192.168.56.102 for ubuntuNode2
* [http://askubuntu.com/questions/474839/bluetooth-is-disable-on-ubuntu-14-04 To turn Bluetooth ON when your systeem starts up]
netmask 255.255.255.0
* https://wiki.archlinux.org/index.php/Bluetooth_headset
network 192.168.56.0
* [http://raspberrypi.stackexchange.com/questions/934/how-do-i-install-bluetooth-for-my-mouse-and-keyboard How to install bluetooth for my mouse and keyboard] for my Raspberry Pi.
broadcast 192.168.56.255
* https://zach-adams.com/2014/07/bluetooth-audio-sink-stream-setup-failed/ Linux Mint
{{Pre}}
sudo apt-get install bluetooth
sudo apt-get install bluetooth bluez-utils blueman
</pre>
</pre>
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.
Then run '''lsusb | grep Bluetooth''' command which will shows the name of your bluetooth device.
* (master node) Edit /etc/hosts so it like like
 
<pre>
* https://wiki.archlinux.org/index.php/Bluetooth
127.0.0.1 localhost
{{Pre}}
192.168.56.1 ubuntu1304
sudo apt-get install bluez
192.168.56.101 ubuntuNode1
192.168.56.102 ubuntuNode2
</pre>
</pre>
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
On my bluetooth adapter, the '''lsusb''' shows,
<pre>
{{Pre}}
sudo adduser mpiuser --uid 999
$ lsusb
Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
...
$ sudo hcitool dev
Devices:
hci0 00:1A:7D:DA:71:09
</pre>
</pre>
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
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).
<pre>
 
sudo apt-get install nfs-kernel-server
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 mouse ==
My M590 mouse suddenly has a lag in response (Pop_OS 20.04). Don't know how to fix it.
 
The jerky movement/lag problem may be caused by other reason: nano receiver placement/positioning (e.g. moved the USB wireless receiver from the back to a port on the front of the PC), usb hub, other gadgets (e.g. phone) around the receiver.
 
Or increase the Mouse Speed in Settings.
 
Other solutions: [https://askubuntu.com/a/836143 How can I get rid of mouse lag under Ubuntu?]
 
== [https://en.wikipedia.org/wiki/Magic_Trackpad_2 Apple Magic Touchpad] ==
[https://tech.pookey.co.uk/apple-magic-trackpad-2-on-ubuntu-linux/ Apple Magic Trackpad 2 on Ubuntu Linux] 20.04
 
== Bluetooth Audio Receiver ==
* Bluetooth 4.0 Receiver A2DP Wireless Adapter from [http://www.amazon.com/Mpow-Streambot-Bluetooth-Receiver-Streaming/dp/B00MJMV0GU/ref=sr_1_4?s=electronics&ie=UTF8&qid=1463170351&sr=1-4&keywords=bluetooth+receiver Mpow Streambot] or [http://www.amazon.com/Bluetooth-Receiver-DBPOWER-Wireless-Devices/dp/B012FRBINI?ie=UTF8&psc=1&redirect=true&ref_=oh_aui_detailpage_o00_s01 DBPOWER]
 
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#Output_audio_to_bluetooth|Windows OS]].
 
[[File:BluetoothAudioLinux.png|200px]]
 
= Open the default graphical applications using the command line (mime-types) =
See '''/etc/gnome/defaults.list'''.
 
* [https://askubuntu.com/questions/15354/how-to-open-file-with-default-application-from-command-line How to open file with default application from command line?]
* [https://www.howtoforge.com/tutorial/how-to-easily-open-a-pdf-file-from-command-line-in-ubuntu/ How to easily open a PDF (or any) file from command line in Ubuntu]
 
{{Pre}}
# alias open='xdg-open'. Put this inside your ~/.bashrc or ~/.bash_aliases
xdg-open [name-of-PDF-file]
 
# If you want to use gnome-open, you need to install a package
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
</pre>
</pre>
* (other nodes) Run
 
== xdg-open, xdg-mime ==
<ul>
<li>For some reason, even Chrome is my default browser (Ubuntu -> Settings -> Default applications) but when I use the '''xdg-open''' command to open a '''local''' HTML file, Brave is called. NB. the xdg-settings also 'thinks' chrome is the default browser. If I uninstall Brave, then VS code will be replaced to open local HTML files by xdg-open.
<syntaxhighlight lang='bash'>
$ xdg-settings get default-web-browser
google-chrome.desktop
$ xdg-mime query default x-scheme-handler/http
google-chrome.desktop
$ xdg-mime query default x-scheme-handler/https
google-chrome.desktop
 
$ xdg-mime query filetype myfile.html
application/xhtml+xml
</syntaxhighlight>
The solution that works for me is to run '''sudo nano /usr/share/applications/defaults.list''' and remove lines contains 'brave' (the .list file is really a mess). After that, xdg-open myfile.html will use chrome to open it. See [https://unix.stackexchange.com/questions/77136/xdg-open-default-applications-behavior xdg-open default applications behavior], [https://wiki.archlinux.org/title/Xdg-utils#xdg-open xdg-open] & [https://wiki.archlinux.org/title/XDG_MIME_Applications XDG MIME Applications] & [https://wiki.archlinux.org/title/Xdg-utils xdg-utils] from archlinux.org.
<syntaxhighlight lang='bash'>
$ env XDG_UTILS_DEBUG_LEVEL=10  xdg-mime query default text/xhtml
# A long list
</syntaxhighlight>
</li>
<li>On Peppermint 11, the '''open''' command located in ''/usr/bin'' is a symbolic link to '''/usr/bin/xdg-open'''.
<li>[https://support.mozilla.org/en-US/questions/970888 How can I change the default application for a content type?]
<pre>
<pre>
sudo apt-get install nfs-client
xdg-mime default okularApplication_pdf.desktop application/pdf
</pre>
</pre>
* (master node) Add the following to the file '''/etc/exports'''
</li>
<pre>
<li>[[Text_editor#Change_to_use_as_the_default_text_editor|Change the default text editor]] '''xdg-mime default code.desktop text/plain '''
/home/mpiuser *(rw,sync,no_subtree_check)
 
</pre>
</li>
or something like
</ul>
 
== Change the default browser ==
[https://linuxhint.com/open-default-browser-command-line-linux/ How to open default browser from command line Linux]
 
== Change the default PDF app ==
Right click a pdf file, choose "Properties". Click on "Open With". Select an app and click "Set as default".
 
= Unity display timeout =
Go to [http://www.techotopia.com/index.php/Image:Ubuntu_11_unity_battery_power_management_settings.jpg Dash -> power setting -> Brightness Settings]
 
= Screensaver showing current time =
== xscreensaver + gltext ==
http://askubuntu.com/questions/64086/how-can-i-change-or-install-screensavers
 
<pre>
<pre>
/home/mpiuser 192.168.56.0/24(rw,sync,no_subtree_check)
sudo apt-get install xscreensaver
# sudo apt-get remove gnome-screensaver
</pre>
</pre>
Some people create a shared folder under /srv directory.
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'.


Now run
== gluqlo ==
[Note that gluqlo uses too much cpu]
I like [https://github.com/alexanderk23/gluqlo gluqlo (flip clock) screensaver]. However, it is not easy to make it to replace the gnome-screensaver.
<pre>
<pre>
sudo service nfs-kernel-server restart
sudo apt-add-repository ppa:alexanderk23/ppa
sudo apt-get update
sudo apt-get install gluqlo
</pre>
</pre>
* (master node)
* 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
<pre>
<pre>
sudo ufw allow from 192.168.56.0/24
gluqlo -root                                \n\
</pre>
</pre>
* (other nodes)
* 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.
<pre>
* Still follow the instruction to add lock screen keyboard shortcut.
sudo mount ubuntu1304:/home/mpiuser /home/mpiuser
 
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 [http://askubuntu.com/questions/465194/how-to-disable-screen-lock-in-ubuntu-14-04-unity disable screen lock].
 
# Still follow the above instruction to remove gnome-screensaver and install xscreensaver. Set gluqlo as the only one screensaver.
# Go to Brightness & Lock panel from the Unity Launcher. And set Turn screen off when inactive: to ''Never''.
# 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.
# 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 =
* https://help.ubuntu.com/community/RestrictedFormats/Flash
* http://www.howtogeek.com/193876/using-firefox-on-linux-your-flash-player-is-old-and-outdated/
 
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 [http://linuxg.net/how-to-install-chromium-and-enable-pepper-flash-plugin-on-all-the-supported-ubuntu-systems-and-their-derivatives/ this post]
<pre>
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
</pre>
</pre>
And if we want to mount the NFS shared directory when the compute nodes are booted, edit '''/etc/fstab''' by adding
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 =
[https://en.wikipedia.org/wiki/Newline A DOS/Windows text file can be converted to Unix format by simply removing all ASCII CR characters with]
<pre>
<pre>
ubuntu1304:/home/mpiuser /home/mpiuser nfs
$ tr -d '\r' < inputfile > outputfile  # inputfile and outputfile cannot be the same
</pre>
</pre>
* (master node)
or, if the text has only CR newlines, by converting all CR newlines to LF with
<pre>
<pre>
sudo apt-get install ssh
$ tr '\r' '\n' < inputfile > outputfile
su mpiuser
ssh-keygen
ssh-copy-id localhost
</pre>
</pre>
We can test if the ssh works without passwords
<pre>
ssh ubuntuNode1
echo $HOSTNAME
</pre>
* (all nodes)
<pre>
sudo apt-get install mpich2
which mpirun
which mpiexec
</pre>
* (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)
<pre>
ubuntuNode1
ubuntuNode2
</pre>
* (all nodes)
<pre>
sudo apt-get install build-essential
</pre>
* (master node, mpiuser). Creating a test file <mpi_hello.c>
<pre>
#include <stdio.h>
#include <mpi.h>


int main(int argc, char** argv) {
= SQL =
    int myrank, nprocs;
== MySQL Workbench ==
http://www.mysql.com/products/workbench/


    MPI_Init(&argc, &argv);
== sqliteman ==
    MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
https://sourceforge.net/projects/sqliteman/
    MPI_Comm_rank(MPI_COMM_WORLD, &myrank);


    printf("Hello from processor %d of %d\n", myrank, nprocs);
= User Interface Designer =
[https://glade.gnome.org/ Glade] - RAD tool to enable quick & easy development of user interfaces for the GTK+ toolkit and the GNOME desktop environment


    MPI_Finalize();
[https://wiki.gnome.org/Apps/Devhelp Devhelp] - API documentation browser for GTK+ and GNOME
    return 0;
 
}
= HTML editor =
* Atom
* Bluefish
* [http://brackets.io/ Brackets] features
** Inline Editors
** Live Preview
** Preprocessor Support
* [http://www.monodevelop.com/ MonoDevelop]
* [http://kompozer.net/ Kompozer] and the installation instruction for [https://help.ubuntu.com/community/InstallKompozer Ubuntu].
* [http://bluegriffon.org/ BlueGriffon]: a new WYSIWYG content editor. The interesting thing is the software [http://www.bluegriffon-epubedition.com/BGEE.html BlueGriffon EPUB Edition]: a cross-platform Wysiwyg editor able to natively create and edit EPUB2 and EPUB3 ebooks!
 
= npm and Javascript =
See [[Javascript#npm_-_package_manager|npm package manager]] in Javascript.
 
= Chroot =
[[Chroot|Chroot]]
 
= Check/Diagnostic SD card, read-only file system =
* [https://askubuntu.com/q/47538 How to make read-only file system writable?]. I got the same error message when I try to 'cp' or 'rm' or 'touch' a file on my USB drive. The solution here works.
{{Pre}}
sudo mount -o remount,rw '/media/brb/KINGSTON8G'
</pre>
When I check the difference of the output of 'mount' on the USB drive, I see it changes from (ro) to (rw).
{{Pre}}
# Before
$ mount
/dev/sdb1 on /media/brb/KINGSTON8G type vfat (ro, ...)
# After
$ mount
/dev/sdb1 on /media/brb/KINGSTON8G type vfat (rw, ...)
</pre>
</pre>
And compile and run it by
* http://askubuntu.com/questions/69932/is-there-an-sd-card-diagnostic-utility. Look for Disk Utility on you dash (Alt+F2 and type 'disk')
<pre>
* [https://superuser.com/questions/656362/canot-format-microsd-file-system-is-read-only Canot format MicroSD. File system is read-only]
mpicc mpi_hello.c -o mpi_hello
* [https://askubuntu.com/questions/197459/how-to-fix-sudo-unable-to-open-read-only-file-system How to fix “sudo: unable to open … Read-only file system”?]
mpiexec -n 3 -f hosts ./mpi_hello
{{Pre}}
sudo fsck -Af -M # If not work, use the next solution
 
sudo fsck.ext4 -f /dev/sdb2 # From a live CD/USB drive, assume /dev/sdb2 is ext4 partition
</pre>
</pre>
We should see something like
The above commands do not help in my case.
 
= AppImage file - new way of installing an application =
See [[Snappy#AppImage|Snappy]]
 
= Snappy =
See [[Snappy|Snappy]].
 
[https://askubuntu.com/a/1089263 Exclude snap partitions in the '''df''' command output]
<pre>
<pre>
Hello from processor 0 of 2
alias df='df -x"squashfs"'
Hello from processor 1 of 2
</pre>
</pre>
Successful! That's it.


==== OpenMPI ====
= Flatpak =
* http://auriza.site40.net/notes/mpi/openmpi-on-ubuntu-904/
See [[Snappy#Flatpak|Snappy]]
* http://particlephysicsandcode.wordpress.com/2012/11/04/installing-open-mpi-1-6-3-ubuntu-12-04-fedora/
* http://randomusefulnotes.blogspot.com/2010/12/setting-up-mpi-cluster-on-ubuntu.html


With R
= Message Of The Day, login banner /etc/motd =
* http://www.open-mpi.org/papers/tr-uni-muenchen-8991/parallelR_techRep.pdf
* https://wiki.debian.org/motd
* http://www.cybaea.net/Blogs/R-tips-Installing-Rmpi-on-Fedora-Linux.html (Fedora)
* [https://www.cyberciti.biz/faq/how-to-disable-ssh-motd-welcome-message-on-ubuntu-linux/ How to disable ssh motd welcome message on Ubuntu Linux]
* http://kiradi.blogspot.com/2011/10/high-performance-computing-with-openmpi.html (Ubuntu)
* [https://www.ostechnix.com/how-to-disable-ads-in-terminal-welcome-message-in-ubuntu-server/ How To Disable Ads In Terminal Welcome Message In Ubuntu Server]
* http://cran.r-project.org/web/packages/doMPI/vignettes/doMPI.pdf
 
* http://biowulf.nih.gov/user_guide.html#parallel
= .Trash-1000 folder =
See [http://superuser.com/questions/169980/what-is-trash-and-trash-1000 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.


=== File sharing in a local network - woof ===
Try to empty the paperbin or delete the folder with the terminal-command as root: sudo rm -rf /path/to/folder/.Trash-1000
* https://www.howtoforge.com/tutorial/linux-how-to-share-files-on-a-local-network/


=== Sharing internet ===
= Games =
==== Simple gui approach ====
[https://opensource.com/article/19/1/flightgear Take to the virtual skies with FlightGear], [http://home.flightgear.org/ FlightGear]
* [http://ubuntuhandbook.org/index.php/2014/09/3-ways-create-wifi-hotspot-ubuntu/ 3 Ways to Create Wifi Hotspot in Ubuntu 14.04]
* https://www.quora.com/How-do-I-create-hotspots-in-Ubuntu-14-04. Notice the last step.


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) ???
== controller/joystick ==
<pre>
* [https://github.com/Grumbel/jstest-gtk/ jstest-gtk]
Failed to activate connection
* [https://www.howtoforge.com/tutorial/how-to-configure-your-gamepad-on-ubuntu/ Xbox wireless Gamepad]
(32) Access Point (AP) mode is not supported by this device
* [https://askubuntu.com/questions/32031/how-do-i-configure-a-joystick-or-gamepad How do I configure a joystick or gamepad?]
</pre>
* [https://blog.bullgare.com/2020/04/ubuntu-play-games-with-joystick/ Ubuntu — play games with joystick]
* [https://ubuntuforums.org/showthread.php?t=341764 games that work with gamepads/joysticks]
** [https://www.supertux.org/ supertux]
* [https://askubuntu.com/a/351089 What racing games run on Ubuntu? ]
** [https://supertuxkart.net/Main_Page Super Tux Kart]. sudo apt-get install supertuxkart
* Ubuntu - 'Software' app. Search for 'game'. https://help.ubuntu.com/community/Games
** 0ad: real-time strategy game of ancient warfare
** DOSBox-X
** retroarch
** ScummVM
* [https://www.binarytides.com/top-games-on-ubuntu-linux/ 15 Best free games on Ubuntu Linux] 2013
* [https://www.tutoraspire.com/ubuntu-games/ 33 Ubuntu Games]
* [https://www.ubuntupit.com/best-free-linux-games-everyone-play/ 26 Best Free Linux Games That Everyone Should Play]
* [https://www.ubuntupit.com/play-games-on-linux-easy-tutorial-newbie-users/ How to Play Games on Linux | Easy Tutorial for Newbie]
* [https://itsfoss.com/free-linux-games/ Top 31 Best Linux Games You Can Play for FREE]
* [https://unixcop.com/top-10-ubuntu-games/ Top 10 Ubuntu games]


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!!!
= Twitter client =


And the output of '''nm-tool''' command also confirms the wifi device is connected.
== [https://github.com/baedert/corebird Corebird] ==
* https://gist.github.com/arraytools/4d1af59a7ebd58ab3941 (tested on Ubuntu 14.04)


<pre>
== [https://github.com/birdieapp/birdie Birdie] ==
odroid@odroid:~/Downloads$ netstat -rn
[https://plus.google.com/+CassidyJames/posts/EzxrE4UyYVF Birdie vs Corebird]
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
</pre>
The ap hotspot from the wifi adapter has an IP 10.42.0.1 (ifconfig).


==== Sharing internet via wifi: ap-hotspot ====
= Elasticsearch & Kibana =
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.
[https://www.howtoforge.com/tutorial/elasticsearch-and-kibana-installation-and-basic-usage-on-ubuntu-1604/ Elasticsearch and Kibana : installation and basic usage on Ubuntu 16.04]
<syntaxhighlight lang='bash'>
$ # 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
</syntaxhighlight>
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.  
= TexLive =
* [https://askubuntu.com/questions/485514/how-to-properly-install-and-use-texlive-with-package-manager-in-14-04 How to properly install and use texlive with package manager in 14.04]
* http://brettklamer.com/diversions/statistical/compile-r-for-data-science-to-a-pdf/


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.
= Recover files from Windows drives =
{{Pre}}
sudo fdisk –l
sudo apt-get install ntfs-3g


==== Sharing internet via wifi: iptables ====
sudo mount -t ntfs-3g /dev/sdaX /PARTITION/POINT
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:
<pre>
IP address: 10.99.66.55
Subnet mask: 255.255.0.0 (16)
</pre>
</pre>
* http://www.makeuseof.com/tag/fix-corrupted-windows-ntfs-filesystem-ubuntu/
* [http://www.pcworld.com/article/2147063/linux-to-the-rescue-how-ubuntu-can-help-a-computer-in-distress.html Reset your Windows password]


3. Use the following shell script to share the internet connection
= Best apps =
<syntaxhighlight lang='bash'>
* [https://linuxhint.com/100_best_ubuntu_apps/ 100 Best Applications for Ubuntu 2018]
#!/bin/bash
* [https://youtu.be/0AitRu1XD84 Peppermint OS 10: Installing Apps for Business & Study (Step by step) ]
#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
</syntaxhighlight>
 
4. Run the script as follows:
<syntaxhighlight lang='bash'>
sudo ./netsharing.sh eth0 wlan0
</syntaxhighlight>
 
5. Connect your devices to the wireless network you just created with the following settings (Question: how about the SSID here?)
<pre>
IP address: 10.99.66.56 (and so on)
Subnet mask: 255.255.0.0
</pre>
 
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: [https://www.packtpub.com/application-development/linux-shell-scripting-cookbook-second-edition Linux Shell Scripting Cookbook]
 
[http://forum.odroid.com/viewtopic.php?f=112&t=9321 A similar approach] discussed on the Odroid forum.
 
==== iptables ====
* [[Beaglebone#Internet_over_USB|Beaglebone]]
 
=== ~/.xsession-errors file is filling the hard disk ===
It is related to vino-server. See
* http://askubuntu.com/questions/130768/my-home-partition-slowly-fills-up-until-the-system-is-unable-to-complete-even-si
* http://filthypants.blogspot.com/2013/02/xsession-errors-log-filling-hard-drive.html
 
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 [https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get following command] to set the default version
<pre>
sudo update-alternatives --config java
</pre>
This approach seems to be working in the case JAVA_HOME cannot be honored.
 
==== OpenJDK ====
On my Ubuntu 12.04, I have two versions.
<syntaxhighlight lang='bash'>
$ 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
</syntaxhighlight>
 
Question: [http://askubuntu.com/questions/64329/how-to-replace-openjdk-6-with-openjdk-7 how to switch to 1.6 or 1.7 version of java?] (For example, snpEff requires java 1.7)
<syntaxhighlight lang='bash'>
$ 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"
</syntaxhighlight>
 
Question: [http://askubuntu.com/questions/464755/how-to-install-openjdk-8-on-14-04-lts How to install OpenJDK 8 on 14.04 LTS?] (for example, [https://github.com/broadinstitute/picard Picard 2] requires Java 1.8)
<syntaxhighlight lang='bash'>
$ 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
</syntaxhighlight>
So the solution is to install Sun jdk.
 
==== Oracle JAVA ====
* http://askubuntu.com/questions/521145/how-to-install-oracle-java-on-ubuntu-14-04
* Install Java silently
** https://javaguru.fi/unattended-java-install-ubuntu-14-04.html
** http://askubuntu.com/questions/190582/installing-java-automatically-with-silent-option
 
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
 
=== CPU/system load ===
==== I-Nex ====
[https://www.ghacks.net/2017/07/23/a-look-at-i-nex-a-cpu-z-like-application-for-gnulinux/ A look at I-Nex – a CPU-Z like Application for GNU/Linux]
 
==== CPU-G ====
See [http://blog.hostonnet.com/how-to-view-cpu-info-in-ubuntu-cpu-z-alternative-for-linux this instruction] to install CPU-G program for viewing hardware information (process, mb, graphic, memory, system).
 
==== [https://github.com/cyring/CoreFreq CoreFreq] ====
http://www.tecmint.com/corefreq-linux-cpu-monitoring-tool/
 
==== system load indicator ====
[http://www.howtogeek.com/118908/10-awesome-indicator-applets-for-ubuntus-unity-desktop/ System Load Indicator]: it is used to view system information (cpu, memory, network) in real-time.
<pre>
sudo apt-get install indicator-multiload
 
sudo apt-get install indicator-cpufreq
indicator-cpufreq
</pre>
 
=== Hard drive: hdparm and smartctl ===
==== Hard drive specification ====
http://www.cyberciti.biz/faq/find-hard-disk-hardware-specs-on-linux/
 
<syntaxhighlight lang='bash'>
# 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
</syntaxhighlight>
 
==== Hard disk speed (3.0 or 6.0 Gb/s) ====
http://www.cyberciti.biz/faq/freebsd-command-to-find-sata-link-speed/
<syntaxhighlight lang='bash'>
$ 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)
</syntaxhighlight>
 
To test the disk performance, follow [http://www.cyberciti.biz/faq/howto-linux-unix-test-disk-performance-with-dd-command/ 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)
<syntaxhighlight lang='bash'>
# 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
</syntaxhighlight>
 
==== Hard disk directory size ====
See [[Linux#Display_directory_size_with_sorting_and_human_readable|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 [https://www.howtoforge.com/tutorial/monitor-harddisk-with-smartmon-on-ubuntu/ smartctl]
<syntaxhighlight lang='bash'>
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        -
</syntaxhighlight>
 
or the GUI version
<syntaxhighlight lang='bash'>
sudo apt-get install gsmartcontrol
sudo gsmartcontrol
</syntaxhighlight>
[https://www.ghacks.net/2017/07/19/how-to-check-hard-drive-disk-health-in-gnulinux/ How to check Hard Drive Disk Health in GNU/Linux]
 
Interpretation:
* http://www.linuxjournal.com/magazine/monitoring-hard-disks-smart?page=0,1
* https://wiki.archlinux.org/index.php/S.M.A.R.T.
* https://en.wikipedia.org/wiki/S.M.A.R.T.
* https://askubuntu.com/questions/20393/how-do-i-interpret-hdd-s-m-a-r-t-results
* [https://www.howtogeek.com/134735/how-to-see-if-your-hard-drive-is-dying/ How to See If Your Hard Drive Is Dying with S.M.A.R.T.] (Windows)
 
==== Email warnings for hd problems by '''smartd''' ====
* [https://www.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html Configure smartd on server to get email based warnings if problems are detected]
* [https://www.cyberciti.biz/tips/monitoring-hard-disk-health-with-smartd-under-linux-or-unix-operating-systems.html Monitoring hard disk health with smartd under Linux or UNIX operating systems]
 
Debian Linux
# Enable smart by editing /etc/default/smartmontools file.
# Smart Configuration file: /etc/smartd.conf
# 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.
<pre>
sudo apt-get install hddtemp
sudo hddtemp /dev/sdb
 
/dev/sdb: ST2000DM001-9YN164: 40°C
</pre>
 
For SSD,
<pre>
sudo apt-get install smartmontools
sudo smartctl -a /dev/sda
</pre>
 
==== Hard disk power on time/hours ====
<syntaxhighlight lang='bash'>
sudo smartctl --all /dev/sda | grep Power_On_Hours
</syntaxhighlight>
Sample output:
<pre>
$ 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
</pre>
 
=== system's hardware temperatures and voltages ===
https://www.howtoforge.com/tutorial/ubuntu-performance-monitoring/
<syntaxhighlight lang='bash'>
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)
</syntaxhighlight>
where [https://ubuntuforums.org/archive/index.php/t-2010895.html nouveau is an open-source driver set for Nvidia cards]. It is not clear about acpitz-virtual-0. Some suggested to use [http://code.google.com/p/inxi/ '''inxi'''] which will produce human readable system info.
 
And on a Dell T3600 machine (running the samtools mpileup & bcftools programs),
<pre>
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)
</pre>
When all cores are 100% used ('''htop'''), the fan is getting noisy
<pre>
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)
</pre>
 
=== Unlock keyring ===
I got the prompt of unlocking keyring every time I open google chrome browser.
 
* http://askubuntu.com/questions/867/how-can-i-stop-being-prompted-to-unlock-the-default-keyring-on-boot (this works)
* http://askubuntu.com/questions/184266/what-is-unlock-keyring-and-how-do-i-get-rid-of-it (this does not help)
* http://superuser.com/questions/311216/why-does-chrome-ask-for-my-gnome-keyring-seahorse-password (works. I create a shortcut to launch chrome)
<pre>
google-chrome --password-store=basic
</pre>
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.
 
* http://www.thegeekstuff.com/2012/04/nc-command-examples/
* https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections-on-a-vps
* https://learn.adafruit.com/raspipe-a-raspberry-pi-pipeline-viewer-part-2?view=all
 
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.
<syntaxhighlight lang='bash'>
# 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.
</syntaxhighlight>
 
To transfer files over the network ('''no any password is needed!!''')
<syntaxhighlight lang='bash'>
# receiver machine
nc -l 1234 > destination_file
 
# sender machine
nc IP_Receiver 1234 < source_filename
</syntaxhighlight>
 
=== 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
<pre>
service --status-all  # output format is clean
 
sudo initctl list      # show the process number too
</pre>
where in the output "+" means started, "-" stopped, and "?" unknown.
 
=== Google Drive or other cloud services ===
* [https://www.makeuseof.com/tag/access-google-drive-ubuntu/ How to Access Your Google Drive Account on Ubuntu] (3/5/2018)
* [https://community.linuxmint.com/tutorial/view/2051 How To mount Google drive and use in Linux Mint17 Cinnamon], [https://www.linuxbabe.com/cloud-storage/install-google-drive-ocamlfuse-on-ubuntu-16-04-linux-mint-18 Install Google Drive Ocamlfuse on Ubuntu 16.04, Linux Mint 18, Debian 8]
* [https://www.howtoforge.com/tutorial/how-to-access-your-google-drive-account-using-overgrive/  How to access your Google Drive account using overGrive]
* Use [http://rclone.org rclone] program. See http://wiki.linuxquestions.org/wiki/Rsync_with_Google_Drive
* [https://www.howtoforge.com/tutorial/how-to-access-google-drive-from-linux-gdrive/ How to access your Google Drive account from Linux command line using Gdrive]
 
=== Pydio: alternative to GDrive ===
[https://www.howtoforge.com/tutorial/debian-pydio-installation/amp/ How to Install Pydio Web File Manager on Debian 9]
 
=== Video rip/convert/transcoder ===
* [https://handbrake.fr/ Handbrake]
<pre>
sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-gtk
 
sudo apt-get install handbrake-cli
</pre>
 
* libav-tools
To convert youtube flv file to mp4.
<pre>
sudo apt-get install libav-tools
avconv -i INPUT.flv -codec copy OUTPUT.mp4
</pre>
 
To merge audio and video
<pre>
# 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
</pre>
 
To extract audio only:
<pre>
avconv -i INPUT.flv -codec copy -vn OUTPUT.mp4
</pre>
 
* ffmpeg [https://www.virag.si/2012/01/web-video-encoding-tutorial-with-ffmpeg-0-9/ method]
* [https://www.ostechnix.com/create-video-pdf-files-linux/ How To Create A Video From PDF Files In Linux]
 
=== PC build for video editing ===
[http://www.makeuseof.com/tag/best-video-editing-4k-pc-build/ Video Editing 4K PC Build: Creating Content for Under a Grand]
 
=== Video editing in Linux ===
* [http://www.trelby.org/ Trelby] - A free, multiplatform, feature-rich screenwriting program!
* https://wiki.ubuntu.com/ScreenCasts/VideoEditing
* http://opensource.com/life/15/1/current-state-linux-video-editing
* http://www.makeuseof.com/tag/top-6-free-video-editors-mac-os/
* http://www.linux-magazine.com/Issues/2015/171/Video-Editor-Roundup/(offset)/9  with a conclusion
* [https://filmora.wondershare.com/video-editor/free-linux-video-editor.html Top 10 Linux Video Editor to Edit Videos on Linux with Ease] (11/12/2016)
 
==== [https://www.shotcutapp.com/ Shotcut] ====
It is a cross-platform open source software. See [https://www.pcworld.com/article/3240982/software/the-best-free-video-editing-software.html 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.
 
==== [http://www.pitivi.org/ Pitivi] ====
 
==== [http://www.blender.org/ Blender] ====
Looks very professional too. Windows/Linux/OSX (binary files are provided). Worth to try.
 
==== [https://kdenlive.org/ Kdenlive] ====
More complicated than OpenShot. Worth to try. Ubuntu 16.04.1 is needed.
 
==== [https://www.youtube.com/editor 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 [https://www.quora.com/Which-Video-Editor-will-let-you-add-clickable-links-and-annotations-inside-your-video-Is-YouTube-the-only-tool-that-allows-you-to-do-this this post] for a discussion.
* Add photos
 
'''Bad'''
* Music cannot have fade in/out
 
'''Notes'''
* [http://www.makeuseof.com/tag/youtube-annotations-everyone-hates/ YouTube Kills Annotations Because Everyone Hates Them] Mar 17, 2017
* [https://www.thanassis.space/youtube.html Offline playback of Youtube videos and their annotations]
* [https://www.4kdownload.com/blog/2015/04/28/youtube-annotations-and-subtitles-whats-difference/ YouTube Annotations And Subtitles: What’s The Difference?]
* [http://nekotears.blogspot.com/2013/07/download-annotation-and-cc-from-youtube.html Download Annotation or CC from Youtube] & [http://www.nikse.dk/SubtitleEdit Subtitle Edit] (free and open source software)
* [https://www.youtube.com/watch?v=AKMeiYJl5ec Save YouTube Annotations to Srt (Subtitle) File for Offline Viewing of Videos (Part 2 of 2)] & [https://github.com/germanger/youtubeannotations-to-srt Convert youtube XML annotations to SRT]
 
==== 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 ====
[https://en.wikipedia.org/wiki/Comparison_of_subtitle_editors Comparison of subtitle editors]
* [http://www.aegisub.org/ Aegisub] (Cross platform).
** Tutorials (video) A [https://www.youtube.com/watch?v=z7E6IyUY9ik Timing Subtitles] and a [https://www.youtube.com/watch?v=jNHbpU_xQBk How to Hardsub / subtitle a video] using [http://www.videohelp.com/software/XviD4PSP XviD4PSP].
** Tutorial (text) [http://www.makeuseof.com/tag/subtitles-text-editor-aegisub/ How To Make Your Own Subtitles With Any Text Editor & Aegisub]
** [http://docs.aegisub.org/manual/Attaching_subtitles_to_video Attaching subtitles to video], [http://forum.aegisub.org/viewtopic.php?f=5&t=1991&view=unread How to save your video in Aegisub after subbing?], [http://www.makeuseof.com/answers/put-hard-subtitles-video-aegisub/ How do I put hard subtitles in a video with Aegisub?], [https://www.reddit.com/r/PleX/comments/4fnus7/hardsub_ass_file_into_any_video_just_using_vlc_221/ Hardsub .ass file in a video with VLC], [https://www.macxdvd.com/mac-dvd-video-converter-how-to/handbrake-add-soft-hard-subtitle-to-movie.htm Hard sub with HandBrake], [https://chibimink.wordpress.com/2012/01/29/making-hardsub-hard-subtitle-with-virtualdub/ Hard sub with VirtualDub].
* [http://home.gna.org/subtitleeditor/ Subtitle Editor] (Linux)
* [http://amara.org/en/ Amara] (Online editor, used in professional films). [https://www.youtube.com/watch?v=QPiEFc_lV9Q How to Caption YouTube Videos with Amara]
* [http://www.nikse.dk/subtitleedit/ Subtitle Edit] (Windows)
 
For TV captions, use white color font with black color for borders and transparent background.
 
==== [http://www.openshot.org/ OpenShot-qt] ====
* It is easier and simpler than Kdenlive. Good for beginners.
* Better if the CPU is good and has more cores
* When merge audio and video, put video at the last track (i.e. audio first). See [http://www.humans-enabled.com/2011/06/how-to-add-music-to-video-with.html here] on how to disable audio from the video track.
* Youtube
** https://www.youtube.com/user/xxlray/videos. [https://www.youtube.com/watch?v=U7BXKYlrf-g Slideshow video], [https://www.youtube.com/watch?v=EIxa11ze9E4 Cut], [https://www.youtube.com/watch?v=4oZwOVoYsUI Picture in picture], and [https://www.youtube.com/watch?v=KsCIuPQTbWo Chroma keying] (allow to change the background).
** [https://www.youtube.com/watch?v=l2V8RiqsrcA OpenShot vs KdenLive]
** Blur an area: [https://www.youtube.com/watch?v=I7Ls7YPqsOE one], [https://www.youtube.com/watch?v=_-IIWBcS6jM two] and [https://www.youtube.com/watch?v=I7Ls7YPqsOE three].
** [https://www.youtube.com/watch?v=mB64rtc5X8c Overlay a text]
* [https://ubuntustudio.org/tour/video/ UbuntuStudio]
* [http://www.makeuseof.com/tag/edit-video-linux-openshot-2-0/  How to Edit a Video in Linux With OpenShot 2.0] (11/19/2016)
* [http://www.pcworld.com/article/230531/free_openshot_video_editor_is_tremendous.html PC World] (2011)
<syntaxhighlight lang='bash'>
sudo apt-get install openshot
</syntaxhighlight>
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 [https://answers.launchpad.net/openshot/+faq/1040 libx264 code]. On Ubuntu, I open software center and seach 'libavformat'. I choose 'libavformat-extra-53'.
 
[https://www.howtoforge.com/tutorial/an-introduction-to-video-editing-in-openshot-2-0/ 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 [https://www.youtube.com/audiolibrary/music 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.
 
[https://answers.launchpad.net/openshot/+question/294896 One suggestion] is to use VLC. VLC -> Video -> Take Snapshot. The snapshot will be automatically created in ~/Pictures/ directory (*.png format).
 
===== Procedure =====
# Put audio and video files in one folder
# 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)
# openshot -> Save (arrow/download-like button)
# 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.
# 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.
# Upload to Youtube. Use Youtube video editor to include annotation.
 
==== [https://trac.videolan.org/vlmc/ VideoLAN Movie Creator] ====
 
==== [http://ffdiaporama.tuxfamily.org/ ffdiaporama] ====
Create videos from images, movie clips and music.
 
==== [https://code.google.com/archive/p/flowblade/ Flowblade Movie Editor] ====
It is written in Python. Only Linux version is available (no Windows nor OS X). Good for beginners.
<syntaxhighlight lang='bash'>
sudo apt-get install flowblade
</syntaxhighlight>
 
==== [https://www.lwks.com/ Lightworks] ====
Free and Pro versions are available. Windows/Linux/OSX.
 
=== Youtube command line tools ===
 
==== Play audio only ====
http://unix.stackexchange.com/questions/229787/audio-only-youtube-player/229790#229790
 
<syntaxhighlight lang='bash'>
# 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
</syntaxhighlight>
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!
 
==== '''[https://github.com/mps-youtube/mps-youtube 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 [http://www.webupd8.org/2014/11/youtube-command-line-player-and.html article] on webupd8.
* More keyboard controls can be found on the webpage of [https://github.com/np1/mps 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).
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
 
[http://lifehacker.com/mps-youtube-is-a-terminal-based-youtube-player-and-down-1651752380 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''')
<pre>
  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
</pre>
 
The screenshot shows mpsyt contains basic playing keyboard shortcuts.
 
[[File:Mps-youtube.png|200px]]
 
[Update 4-7-2017]: to fix an [https://github.com/mps-youtube/mps-youtube/issues/376 error] Signature extraction failed: Traceback (most recent call last):
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
 
==== Download youtube video using command line ====
<syntaxhighlight lang='bash'>
sudo apt-get install youtube-dl
</syntaxhighlight>
* 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
<syntaxhighlight lang='bash'>
$ sudo add-apt-repository ppa:heyarje/libav-11 && sudo apt-get update
$ sudo apt-get install libav-tools
</syntaxhighlight>
(not tested) [https://forums.linuxmint.com/viewtopic.php?t=197316 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 [http://askubuntu.com/questions/486297/how-to-select-video-quality-from-youtube-dl this post]
<syntaxhighlight lang='bash'>
# 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.
</syntaxhighlight>
This assumes Ubuntu has installed '''avconv'''; otherwise video(mp4) and audio(m4a) files will be downloaded separately. To install avconv, run
<syntaxhighlight lang='bash'>
sudo apt-get install libav-tools
</syntaxhighlight>
* To convert the video to mp3 format, use soundconverter
<syntaxhighlight lang='bash'>
sudo apt-get install soundconverter
</syntaxhighlight>
* [http://www.webupd8.org/2014/11/youtube-command-line-player-and.html Play/Download youtube video] using [https://github.com/np1/mps-youtube mps-youtube]
<syntaxhighlight lang='bash'>
mps-youtube
</syntaxhighlight>
* 4k videos [http://www.imaging-resource.com/news/2014/11/19/samsung-nx1-4k-video-samples-and-new-full-res-frame-grabs-available-for-do samples] (vlc v2.1.4 cannot play)
 
=== Unity ===
==== Unity LauncherSwitcher ====
[http://www.ubuntugeek.com/unity-launcherswitcher-allow-users-to-set-up-different-workspaces-for-different-task-categories.html Ubuntugeek.com]
 
==== Create Unity Launcher ====
Take RStudio for example,
 
* [http://askubuntu.com/questions/127290/setting-program-logo-in-unity-launcher-missing-icons-folder 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/''' .
* [https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles 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).
 
[http://www.willus.com/k2pdfopt/help/ubuntu.shtml 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 [http://www.howtogeek.com/202708/how-to-convert-the-unity-launcher-into-a-dock-style-launcher/ 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
 
<syntaxhighlight lang='bash'>
echo "blacklist floppy" | sudo tee /etc/modprobe.d/blacklist-floppy.conf
sudo rmmod floppy
sudo update-initramfs -u
</syntaxhighlight>
 
=== Application Launcher ===
==== [https://github.com/KELiON/cerebro Cerebro] ====
[http://www.omgubuntu.co.uk/2017/02/cerebro-is-a-spotlight-linux-equivalent Cerebro is an Open Source OS X Spotlight Equivalent for Linux]
 
==== [https://github.com/Ulauncher/Ulauncher Ulauncher] ====
[http://www.omgubuntu.co.uk/2017/02/ulauncher-lightweight-app-launcher-linux Ulauncher is a Lightweight App Launcher for Linux Desktops]
 
==== [https://launchpad.net/synapse-project Synapse] ====
[http://www.omgubuntu.co.uk/2016/10/your-favourite-alfred-app-launcher-linux Synapse or Albert — What’s Your Favourite App Launcher for Linux?]
 
==== [http://do.cooperteam.net/ Gnome Do] ====
Release June 2009
 
=== What date was the system installed ===
<pre>
ls -l /var/log/installer
</pre>
 
=== What is the last log in time for users ===
<pre>
lastlog  # all users
last    # current user
</pre>
 
=== What is the reboot time ===
<pre>
last reboot
</pre>
 
=== Crop an image ===
<pre>
sudo apt-get install gthumb
</pre>
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 ===
* [http://www.xmind.net/ xmind]
* [http://freemind.sourceforge.net/wiki/index.php/Main_Page FreeMind]
 
=== KeePass ===
Search Ubuntu Software Center to install [http://www.keepassx.org KeePassX] (more reviews) or [http://keepass.info 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,
<pre>
sudo apt-get install keepass2
</pre>
 
Note:
* Foe latest version, use [https://launchpad.net/~jtaylor/+archive/ubuntu/keepass Julian Taylor’s PPA].
<pre>
sudo add-apt-repository ppa:jtaylor/keepass
sudo apt-get update
sudo apt-get install keepass2
</pre>
* Android: KeePassDroid
* Chrome: [https://chrome.google.com/webstore/detail/chromeipass/ompiailgknfdndiefoaoiligalphfdae?hl=en ChromeIPass] with KeePassHttp. See the [https://github.com/pfn/passifox/ source code].
 
Security:
* [http://lifehacker.com/keepass-vulnerability-could-let-attackers-steal-your-pa-1781486764 KeePass uses unencrypted HTTP requests when retrieving updates]
 
==== KeePass with KeeAgent ====
http://code.mendhak.com/keepass-and-keeagent-setup/
 
=== Update Firefox ===
See https://help.ubuntu.com/community/FirefoxNewVersion. The following instruction is used to get security-testing packages.
<pre>
sudo add-apt-repository ppa:ubuntu-mozilla-security/ppa
sudo apt-get update
sudo apt-get install firefox
</pre>
 
Or use the official PPA method. See [http://libre-software.net/how-to-install-firefox-on-ubuntu-linux-mint/ How to install Firefox 57 “Quantum” on Linux Mint, Ubuntu, Debian, CentOS, Fedora…], [https://itsfoss.com/firefox-quantum-ubuntu/ How to Install Firefox Quantum in Ubuntu and other Linux Right Now]
<syntaxhighlight lang='bash'>
sudo add-apt-repository ppa:mozillateam/firefox-next
sudo apt update && sudo apt upgrade
</syntaxhighlight>
 
=== Bluetooth ===
* [https://www.howtoforge.com/tutorial/how-to-send-sound-through-bluetooth-on-linux/ How to send sound through Bluetooth on Linux] from HowToForge.
* https://wiki.debian.org/BluetoothUser
* https://help.ubuntu.com/community/BluetoothSetup
* [http://askubuntu.com/questions/474839/bluetooth-is-disable-on-ubuntu-14-04 To turn Bluetooth ON when your systeem starts up]
* https://wiki.archlinux.org/index.php/Bluetooth_headset
* [http://raspberrypi.stackexchange.com/questions/934/how-do-i-install-bluetooth-for-my-mouse-and-keyboard How to install bluetooth for my mouse and keyboard] for my Raspberry Pi.
<syntaxhighlight lang='bash'>
* 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
</syntaxhighlight>
Then run '''lsusb | grep Bluetooth''' command which will shows the name of your bluetooth device.
 
* https://wiki.archlinux.org/index.php/Bluetooth
<syntaxhighlight lang='bash'>
sudo apt-get install bluez
</syntaxhighlight>
 
On my bluetooth adapter, the '''lsusb''' shows,
<syntaxhighlight lang='bash'>
$ lsusb
Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
...
$ sudo hcitool dev
Devices:
hci0 00:1A:7D:DA:71:09
</syntaxhighlight>
 
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 ====
* Bluetooth 4.0 Receiver A2DP Wireless Adapter from [http://www.amazon.com/Mpow-Streambot-Bluetooth-Receiver-Streaming/dp/B00MJMV0GU/ref=sr_1_4?s=electronics&ie=UTF8&qid=1463170351&sr=1-4&keywords=bluetooth+receiver Mpow Streambot] or [http://www.amazon.com/Bluetooth-Receiver-DBPOWER-Wireless-Devices/dp/B012FRBINI?ie=UTF8&psc=1&redirect=true&ref_=oh_aui_detailpage_o00_s01 DBPOWER]
 
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#Output_audio_to_bluetooth|Windows OS]].
 
[[File:BluetoothAudioLinux.png|200px]]
 
=== Default applications and mime-types ===
See '''/etc/gnome/defaults.list'''.
 
[https://www.howtoforge.com/tutorial/how-to-easily-open-a-pdf-file-from-command-line-in-ubuntu/ How to easily open a PDF (or any) file from command line in Ubuntu]
 
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
 
=== 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 [http://www.techotopia.com/index.php/Image:Ubuntu_11_unity_battery_power_management_settings.jpg Dash -> power setting -> Brightness Settings]
 
=== Screensaver showing current time ===
==== xscreensaver + gltext ====
http://askubuntu.com/questions/64086/how-can-i-change-or-install-screensavers
 
<pre>
sudo apt-get install xscreensaver
# sudo apt-get remove gnome-screensaver
</pre>
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 [https://github.com/alexanderk23/gluqlo gluqlo (flip clock) screensaver]. However, it is not easy to make it to replace the gnome-screensaver.
<pre>
sudo apt-add-repository ppa:alexanderk23/ppa
sudo apt-get update
sudo apt-get install gluqlo
</pre>
* 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
<pre>
gluqlo -root                                \n\
</pre>
* 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 [http://askubuntu.com/questions/465194/how-to-disable-screen-lock-in-ubuntu-14-04-unity disable screen lock].
 
# Still follow the above instruction to remove gnome-screensaver and install xscreensaver. Set gluqlo as the only one screensaver.
# Go to Brightness & Lock panel from the Unity Launcher. And set Turn screen off when inactive: to ''Never''.
# 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.
# 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 ===
* https://help.ubuntu.com/community/RestrictedFormats/Flash
* http://www.howtogeek.com/193876/using-firefox-on-linux-your-flash-player-is-old-and-outdated/
 
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 [http://linuxg.net/how-to-install-chromium-and-enable-pepper-flash-plugin-on-all-the-supported-ubuntu-systems-and-their-derivatives/ this post]
<pre>
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
</pre>
The last step gives me an error: sudo: update-pepperflashplugin-nonfree: command not found
 
=== Gedit ===
* To split a screen, Do "Documents -> New Tab Group. No extra plugin is needed to download. I am using version 3.10.4 from Ubuntu 14.04.
* [https://github.com/Quixotix/gedit-restore-tabs Restore tabs] plugin. It works on my gedit 3.4 (ubuntu 12.04). Follow the instruction there exactly.
* [https://github.com/Quixotix/gedit-source-code-browser Source code browser] plugin. This makes gedit a good IDE for developing C++/Java code since the left panel can show symbols. Click F9 to show the side panel.
* [https://raw.githubusercontent.com/mig/gedit-themes/master/darkmate.xml Darkmate theme].
<pre>
cd /usr/share/gtksourceview-3.0/styles
sudo gedit darkermate.xml
</pre>
gedit > Edit > preferences > font and colors > color scheme.
==== Plugins ====
* Gedit has no built-in options to show special characters except through [https://wiki.gnome.org/GeditPlugins gedit-plugins] (sudo apt-get install gedit-plugins). See [http://stackoverflow.com/questions/17162851/option-to-display-control-characters-in-gedit Draw Spaces].
* [https://cs50.stackexchange.com/questions/2026/how-do-i-open-a-terminal-window-in-gedit How do I open a Terminal window in gEdit?]
*# sudo apt-get install gedit-plugins
*# Edit -> Preferences -> Plugins -> Embedded terminal
*# View -> Bottom panel
 
=== Text file line ending in DOS and Unix ===
[https://en.wikipedia.org/wiki/Newline A DOS/Windows text file can be converted to Unix format by simply removing all ASCII CR characters with]
<pre>
$ tr -d '\r' < inputfile > outputfile  # inputfile and outputfile cannot be the same
</pre>
or, if the text has only CR newlines, by converting all CR newlines to LF with
<pre>
$ tr '\r' '\n' < inputfile > outputfile
</pre>
 
=== [http://www.geany.org/ Geany] ===
'''Geany''' can be used to run a bash script file line by line. See [[Linux_Programming#Debugging_Scripts|Debugging_Scripts]].
 
==== Display special characters ====
Geany has a way to show special characters (Tabs/LF/CR). Edit > Preferences > Display > Tick, Show whitespace (tabs) & Show Line endings(CR/LF).
 
For DOS text file, the line ending is CR+LF.
 
For Unix text file, the line ending is LF.
 
==== Font size ====
Users can use either one of the following methods
# Edit -> Preferences -> Interface -> Fonts to adjust the font size.
# Keyboard bindings: Ctrl + Shift + '+' to increase the font size or Ctrl + '-' to decrease the font size. This does not affect the font size in Preferences.
 
==== Printing ====
The font size in Preferences affects the printing. The font size changed by using the keyboard bindings does not affect printing.
 
==== Remove vertical line ====
Edit -> Preferences -> Editor -> Display -> Uncheck Long line marker.
 
=== SQL ===
==== MySQL Workbench ====
http://www.mysql.com/products/workbench/
 
==== sqliteman ====
https://sourceforge.net/projects/sqliteman/
 
=== User Interface Designer ===
[https://glade.gnome.org/ Glade] - RAD tool to enable quick & easy development of user interfaces for the GTK+ toolkit and the GNOME desktop environment
 
[https://wiki.gnome.org/Apps/Devhelp Devhelp] - API documentation browser for GTK+ and GNOME
 
=== HTML editor ===
* Atom
* Bluefish
* [http://brackets.io/ Brackets] features
** Inline Editors
** Live Preview
** Preprocessor Support
* [http://www.monodevelop.com/ MonoDevelop]
* [http://kompozer.net/ Kompozer] and the installation instruction for [https://help.ubuntu.com/community/InstallKompozer Ubuntu].
* [http://bluegriffon.org/ BlueGriffon]: a new WYSIWYG content editor. The interesting thing is the software [http://www.bluegriffon-epubedition.com/BGEE.html BlueGriffon EPUB Edition]: a cross-platform Wysiwyg editor able to natively create and edit EPUB2 and EPUB3 ebooks!
 
=== npm and Javascript ===
See [[Javascript#npm_-_package_manager|npm package manager]] in Javascript.
 
=== chm reader ===
<pre>
sudo apt-get install xchm
</pre>
 
=== 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).
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
* https://help.ubuntu.com/community/CommonAccessCard
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
* Search "SCR3310 driver linux" on google.com.
<pre style="white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;">
# 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
</pre>
 
* Search "activcard driver linux" on google.com.
** https://militarycac.com/linux.htm
 
=== Chroot ===
* https://help.ubuntu.com/community/BasicChroot
* https://help.ubuntu.com/community/DebootstrapChroot
* http://www.thegeekstuff.com/2010/01/debootstrap-minimal-debian-ubuntu-installation/
* http://www.binarytides.com/setup-chroot-ubuntu-debootstrap/ (Works after a little change)
 
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
<pre>
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
</pre>
For a recap:
<pre>
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.
</pre>
 
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?
 
* [https://blog.night-shade.org.uk/2013/12/building-a-pure-debian-armhf-rootfs/ Building a pure Debian armhf rootfs]
* [https://www.stgraber.org/2012/02/03/ever-wanted-an-armel-or-armhf-container-on-an-x86-machine-its-now-possible-with-lxc-in-ubuntu-precise/ Create an armhf container on your x86 machine?]
 
=== Check/Diagnostic SD card ===
http://askubuntu.com/questions/69932/is-there-an-sd-card-diagnostic-utility
 
Look for Disk Utility on you dash (Alt+F2 and type 'disk')
 
=== [https://developer.ubuntu.com/en/snappy/ Ubuntu Snappy Core] ===
==== How Snappy packages are different from Deb ====
An article from [http://www.pcworld.com/article/2942267/why-ubuntu-plans-to-replace-traditional-linux-packages-with-something-better.html PCWorld]
 
* 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 ====
[http://www.omgubuntu.co.uk/2016/12/simple-guide-snapd-commands 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/
 
=== unable to open mtp device ubuntu 14.04 ===
[http://askubuntu.com/questions/463015/ubuntu-14-04-and-android-cant-see-phone-on-my-computer Use this tip].
<pre>
sudo apt-get install mtpfs
</pre>
 
=== Install/upgrade google chrome browser ===
<pre>
wget -N https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
</pre>
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 [https://www.reddit.com/r/chrome/comments/48oje6/linux_how_to_fix_failed_to_fetch/ reddit].
 
<syntaxhighlight lang='bash'>
$ 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
</syntaxhighlight>
Another suggestion to modify </opt/google/chrome/cron/google-chrome> (though the file exists) does not work .
 
[http://www.makeuseof.com/tag/install-chrome-linux-easily-migrate-browsing-windows/ How to Install Chrome on Linux and Easily Migrate Your Browsing From Windows]
<syntaxhighlight lang='bash'>
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
</syntaxhighlight>
 
=== Message of the day /etc/motd ===
* https://wiki.debian.org/motd
* [https://www.cyberciti.biz/faq/how-to-disable-ssh-motd-welcome-message-on-ubuntu-linux/ How to disable ssh motd welcome message on Ubuntu Linux]
 
=== .Trash-1000 folder ===
See [http://superuser.com/questions/169980/what-is-trash-and-trash-1000 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 ===
==== [https://github.com/baedert/corebird Corebird] ====
* https://gist.github.com/arraytools/4d1af59a7ebd58ab3941 (tested on Ubuntu 14.04)
 
==== [https://github.com/birdieapp/birdie Birdie] ====
[https://plus.google.com/+CassidyJames/posts/EzxrE4UyYVF Birdie vs Corebird]
 
=== Elasticsearch & Kibana ===
[https://www.howtoforge.com/tutorial/elasticsearch-and-kibana-installation-and-basic-usage-on-ubuntu-1604/ Elasticsearch and Kibana : installation and basic usage on Ubuntu 16.04]
 
=== TexLive ===
* [https://askubuntu.com/questions/485514/how-to-properly-install-and-use-texlive-with-package-manager-in-14-04 How to properly install and use texlive with package manager in 14.04]
* http://brettklamer.com/diversions/statistical/compile-r-for-data-science-to-a-pdf/
 
=== Recover files from Windows drives ===
<syntaxhighlight lang='bash'>
sudo fdisk –l
sudo apt-get install ntfs-3g
 
sudo mount -t ntfs-3g /dev/sdaX /PARTITION/POINT
</syntaxhighlight>
* http://www.makeuseof.com/tag/fix-corrupted-windows-ntfs-filesystem-ubuntu/
* [http://www.pcworld.com/article/2147063/linux-to-the-rescue-how-ubuntu-can-help-a-computer-in-distress.html Reset your Windows password]
 
== RHEL/CentOS ==
=== Download urls ===
* https://www.centos.org/download/
* [http://mirror.umd.edu/centos/7/isos/ U. of Maryland] mirror. Everything > DVD > Live > minimal.
 
=== DVD, everything, minimal ===
* Minimal: 800MB, no GUI
* DVD: 4.2GB
* Everything: 8.1GB
 
=== Installation screenshots ===
* [https://www.tecmint.com/red-hat-enterprise-linux-7-3-installation-guide/ Installation of Red Hat Enterprise Linux (RHEL) 7.3 Guide]. UEFI + GPT, Legacy BIOS +  MBR.
* [https://www.howtoforge.com/tutorial/centos-7-minimal-server/ How to Install a CentOS 7.3 Minimal Server] For a static IP address, I need to enter IP, subnet, gateway and DNS servers.
* [http://dev-random.net/how-to-install-a-centos-6-5-64bit-server/ How to install a CentOS 6 64Bit Server]
 
=== 30 Things to Do After Minimal RHEL/CentOS 7 Installation ===
http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/
 
=== Change hostname ===
* Change the ^HOSTNAME line in /etc/sysconfig/network
* Change the hostname in /etc/hosts
* Run /bin/hostname new_hostname for the hostname change to take effect immediately.
* Run /sbin/service syslog restart for syslog to log using the new hostname.
 
Note that using the command line 'hostname' to change the machine's hostname works only for the current session.
 
=== Check CentOS version ===
<syntaxhighlight lang='bash'>
$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
</syntaxhighlight>
 
=== switch to root ===
<syntaxhighlight lang='bash'>
su  # Press 'Enter'. It will ask for root's password.
</syntaxhighlight>
 
=== sudoer ===
Some distributions do not come with sudo command.
 
As root type:
 
visudo
 
and add a line
<syntaxhighlight lang='bash'>
MyUserName ALL = ALL
</syntaxhighlight>
 
=== sudo: wheel group ===
When I install the OS (Red hat 7.4) I have a chance to create a new user with administrator right. This user will be added to the '''wheel''' group.
 
See also [https://www.digitalocean.com/community/tutorials/how-to-create-a-sudo-user-on-centos-quickstart How To Create a Sudo User on CentOS]
 
=== openssh-server ===
* sshd is running by default (ps -ef | grep sshd)
* [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-ssh-configuration.html#table-ssh-configuration-configs-system System-wide configuration files]
 
=== Add an existing user to have sudo privilege ===
<syntaxhighlight lang='bash'>
sudo adduser USERNAME sudo
</syntaxhighlight>
See [https://help.ubuntu.com/community/RootSudo help.ubuntu.com].
 
=== What is my IP address ===
<syntaxhighlight lang='bash'>
ifconfig eth0
</syntaxhighlight>
 
=== What services get started at boot time ===
<syntaxhighlight lang='bash'>
chkconfig --list
</syntaxhighlight>
 
=== Is xxx service running ===
<syntaxhighlight lang='bash'>
xxx status
</syntaxhighlight>
 
=== What services are currently running ===
<syntaxhighlight lang='bash'>
ps -e
</syntaxhighlight>
and
<syntaxhighlight lang='bash'>
lsof -i
</syntaxhighlight>
will show you services that are listening to TCP or UDP endpoints.
 
=== Choosing a web hosting service for your website ===
* [http://www.makeuseof.com/tag/top-7-easy-and-free-web-hosting-services/ Top 7 Easy and Free Web Hosting Services] (7/18/2017)
* [http://www.lifehack.org/387041/10-things-you-should-know-when-choosing-web-hosting-service-for-your-website 10 Things You Should Know When Choosing A Web Hosting Service For Your Website]
 
=== Install Apache ===
* http://www.liquidweb.com/kb/how-to-install-apache-on-centos-7/
<syntaxhighlight lang='bash'>
# Step 1: Install Apache
sudo yum -y update
sudo yum -y install httpd
 
# Step 2: Allow Apache Through the Firewall
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --reload
netstat -ant | grep :80
 
# Step 3: Configure Apache to Start on Boot
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd
</syntaxhighlight>
* http://dev.antoinesolutions.com/apache-server
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Cluster_Administration/s1-apache-inshttpd-CA.html
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Managing_Confined_Services/chap-Managing_Confined_Services-The_Apache_HTTP_Server.html
 
=== Open ports in a firewall ===
* http://ask.xmodulo.com/open-port-firewall-centos-rhel.html
 
On CentOS/RHEL 7.
<syntaxhighlight lang='bash'>
# Open port 80
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload
# Check the updated rules with:
firewall-cmd --list-all
</syntaxhighlight>
 
On CentOS/RHEL 6
<syntaxhighlight lang='bash'>
# Open port 80
sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
sudo service iptables save
</syntaxhighlight>
 
To check
<syntaxhighlight lang='bash'>
$ netstat -tulpn | grep 8787
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:8787            0.0.0.0:*              LISTEN      -                 
$ netstat -tulpn | grep 80
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6      0      0 :::80                  :::*                    LISTEN      - 
</syntaxhighlight>
 
=== What network ports are open: lsof or netstat ===
'''lsof''' stands for ''List Open Files''.
 
<syntaxhighlight lang='bash'>
sudo yum install -y lsof
sudo lsof -i :22  # check port 22
sudo lsof -i :3838 # check port 3838
sudo lsof -i  | grep -i "listen"
              # for example *.ssh (LISTEN) is shown on the last column
# or
netstat -aut  # List only UDP or TCP connections
              # for example 0.0.0.0:ssh
              # It can show the foreign address.
# or
netstat -ant # Disable reverse dns lookup for faster output
            # for example 0.0.0.0:22 is shown on the 4th column
            # for shiny application, netstat -ant can grep 3838, but netstat -aut can't.
 
# or
netstat -plntu # can't show the true foreign address but it shows PID/Program name
</syntaxhighlight>
 
You can use '''lsof''' command for a list of things ([http://www.thegeekstuff.com/2012/08/lsof-command-examples/ 15 Linux lsof Command Examples])
* List processes which opened a specific file
* List opened files under a directory
* List opened files based on process names starting with
* List processes using a mount point
* List files opened by a specific user
* List all open files by a specific process
* Kill all process that belongs to a particular user
* List all network connections
* List processes which are listening on a particular port
* List all TCP or UDP connections
* List all Network File System ( NFS ) files
 
and the '''netstat''' command: [http://www.binarytides.com/linux-netstat-command-examples/ 10 basic examples of linux netstat command]
<syntaxhighlight lang='bash'>
# https://cyruslab.net/2014/07/11/installing-netstat-on-centos-7-minimal-installation/
sudo yum install net-tools
</syntaxhighlight>
 
==== ESTABLISHED connection from netstat output ====
Assuming you are using the default ssh port
<syntaxhighlight lang='bash'>
$ sudo netstat -aut | grep ssh
Proto Recv-Q Send-Q  Local Address      Foreign Address State
tcp      15      0  MyServerIP:ssh  58.218.198.170:14976 ESTABLISHED
tcp        0    68  MyServerIP:ssh 122.226.181.167:14976 ESTABLISHED
tcp        0    68  MyServerIP:ssh 122.226.181.167:56700 TIME_WAIT
tcp        0    68  MyServerIP:ssh  182.106.129.1:48887 SYNC_RECV
tcp        0    172  MyServerIP:ssh      ExpectedIP:50344 ESTABLISHED
</syntaxhighlight>
If you are using a non-default port for sshd, sometimes 'sudo netstat -aut' doesn't detect that port?? Use '''sudo netstat -plunt | grep sshd''' instead.
<syntaxhighlight lang='bash'>
$ sudo netstat -plunt | grep sshd --col
tcp        0      0 0.0.0.0:XX              0.0.0.0:*              LISTEN      23480/sshd     
tcp6      0      0 :::XX                  :::*                    LISTEN      23480/ssh
$ sudo netstat -aut | grep ":XX" --col
</syntaxhighlight>
 
[https://raspberrypi.stackexchange.com/questions/29399/strange-ip-connected-to-ssh Strange IP connected to ssh?] An ESTABLISHED connection does not indicate anything about the state of things with regard to the ssh protocol; it refers to the state of the connection with regard to the TCP protocol.
 
Check '''/var/log/auth.log''' for successful/failed connections
<syntaxhighlight lang='bash'>
$ sudo grep "Accepted password" /var/log/auth.log --col
$ sudo grep "XXX.XXX.XXX.XXX" /var/log/auth.log --col
</syntaxhighlight>
 
[https://askubuntu.com/questions/538443/whats-the-difference-between-port-status-listening-time-wait-close-wait What's the difference between port status “LISTENING”, “TIME_WAIT”, “ CLOSE_WAIT” and “ESTABLISHED”?]
 
=== What firewall rules do I in place ===
<syntaxhighlight lang='bash'>
iptables -L
</syntaxhighlight>
See [http://www.cyberciti.biz/tips/linux-iptables-examples.html this article]: 20 Iptables Examples For New SysAdmins from cyberciti.biz.
 
=== Routing table ===
How to read the routing table?
* http://www.cyberciti.biz/faq/what-is-a-routing-table/
* http://www.cyberciti.biz/faq/linux-unix-osx-bsd-windows-0-0-0-0-network-address/
 
Ubuntu wireless adapter:
<syntaxhighlight lang='bash'>
brb@brb-P45T-A:~$ 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 wlan0
192.168.1.0    0.0.0.0        255.255.255.0  U        0 0          0 wlan0
</syntaxhighlight>
 
Ubuntu virtual machine:
<syntaxhighlight lang='bash'>
brb@vm-1404:~$ netstat -rn
Kernel IP routing table
Destination    Gateway        Genmask        Flags  MSS Window  irtt Iface
0.0.0.0        10.0.2.2        0.0.0.0        UG        0 0          0 eth0
10.0.2.0        0.0.0.0        255.255.255.0  U        0 0          0 eth0
192.168.1.0    0.0.0.0        255.255.255.0  U        0 0          0 eth1
brb@vm-1404:~$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 08:00:27:ee:7d:45 
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feee:7d45/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:831 errors:0 dropped:0 overruns:0 frame:0
          TX packets:558 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:578902 (578.9 KB)  TX bytes:55508 (55.5 KB)
 
brb@vm-1404:~$ ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 08:00:27:cb:96:6c 
          inet addr:192.168.1.244  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fecb:966c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:84 errors:0 dropped:0 overruns:0 frame:0
          TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8287 (8.2 KB)  TX bytes:8966 (8.9 KB)
</syntaxhighlight>
 
A default gateway is set as follows:
<syntaxhighlight lang='bash'>
route add default gw IP_ADDRESS INTERFACE_NAME
 
route add default gw 192.168.0.1 wlan0
</syntaxhighlight>
 
=== What packages do I have installed ===
<syntaxhighlight lang='bash'>
rpm -qa | less
# or
rpm -qa | grep xxx
</syntaxhighlight>
 
=== Install/uninstall new packages ===
<syntaxhighlight lang='bash'>
rpm -Uvh foo-1.0-1.i386.rpm
 
# To install the package anyway and the same version you are trying to install is already installed
# -i: install
# -U: upgrade
# -h: print 50 hask marks as the package archive is unpacked
rpm -ivh --replacepkgs foo-1.0-1.i386.rpm
</syntaxhighlight>
 
To uninstall a package
<syntaxhighlight lang='bash'>
rpm -e foo  # not the name of the original package file foo-1.0-1.i386.rpm
</syntaxhighlight>
 
=== What version of package xxx do I have installed ===
<syntaxhighlight lang='bash'>
rpm -qi xxx
</syntaxhighlight>
 
=== Find out path where is package installed ===
https://www.cyberciti.biz/faq/yum-determining-finding-path-that-yum-package-installed-to/
<syntaxhighlight lang='bash'>
rpm -q {packageNameHere}
</syntaxhighlight>
 
=== List of available (uninstalled) packages ===
<syntaxhighlight lang='bash'>
yum list available
</syntaxhighlight>
 
=== List All Configured Repositories ===
<syntaxhighlight lang='bash'>
yum -v repolist
yum -v repolist | less
yum repolist
</syntaxhighlight>
 
To list only enabled repositores
<syntaxhighlight lang='bash'>
yum repolist enabled
</syntaxhighlight>
 
To list only disabled repositories
<syntaxhighlight lang='bash'>
yum repolist disabled
</syntaxhighlight>
 
To list available packages under a repo called ksplice-uptrack, enter:
<syntaxhighlight lang='bash'>
yum --disablerepo="*" --enablerepo="ksplice-uptrack" list available
</syntaxhighlight>
 
=== yum ===
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Packages_and_Package_Groups.html
 
==== Searching Packages ====
<syntaxhighlight lang='bash'>
yum search vim gvim emacs
</syntaxhighlight>
 
==== List packages ====
<syntaxhighlight lang='bash'>
yum list all  # list all available & installed
yum list installed
yum list available
 
yum grouplist
yum repolist  # Not reposlist
</syntaxhighlight>
 
==== Display package information ====
<syntaxhighlight lang='bash'>
yum info package_name…
</syntaxhighlight>
 
==== Listing Files Contained in a Package ====
<syntaxhighlight lang='bash'>
repoquery --list package_name
</syntaxhighlight>
 
==== install/remove ====
<syntaxhighlight lang='bash'>
yum install -y packagename1 packagename2
yum remove packagename1 packagename2
 
yum groupremove group
</syntaxhighlight>
 
==== yum equivalent of apt-get update ====
<syntaxhighlight lang='bash'>
yum check-update
</syntaxhighlight>
 
=== sendmail ===
* [https://sachinsharm.wordpress.com/2013/08/19/setting-up-sendmail-on-centosrhel-6-3/ Install sendmail on centos] 
* [http://ithelpblog.com/itapplications/howto-fix-postfixsmtp-network-is-unreachable-error/ Ipv4]
 
<syntaxhighlight lang='bash'>
su                            # type your root password to switch the account
yum install m4 telnet mailx
yum install sendmail sendmail-cf
nano /etc/mail/sendmail.mc
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
service sendmail restart
netstat -an | grep :25 | grep tcp
ps -ef | grep -v grep | grep -i sendmail
nano /etc/mail/local-host-names
service sendmail restart
chkconfig sendmail on
useradd testuser1
useradd testuser2 
passwd testuser2
mail -s "Test mail from testuser1" testuser2
tail /var/log/maillog
su testuser2 # run 'mail' command to see if the mail has been received.
 
nano /etc/mail/local-host-names # create a line, says, xyz.com
nano /etc/mail/sendmail.cf      # After the line of "Smart" relay host (may be null), edit as the following
                                # DSmailfwd.nih.gov
nano /etc/postfix/main.cf #  change inet_protocols from all to ipv4.
nano /etc/sysconfig/sendmail    # make sure DAEMON=yes
nano /etc/mail/relay-domains    # this is a new file with 1 line 128.231.90.107
service sendmail restart
mail -s "Test mail from testuser1" [email protected]
tail /var/log/maillog          # Should not see any ERR.
netstat -nutlap | grep 25
</syntaxhighlight>
 
=== Use TLP to Extend Linux Laptop Battery Life ===
* [http://linrunner.de/en/tlp/tlp.html TLP] – Linux Advanced Power Management
* [https://www.linuxbabe.com/ubuntu/tlp-linux-laptop-battery-life Use TLP to Extend Linux Laptop Battery Life on Ubuntu 16.04 LTS]
* https://www.tecmint.com/tlp-increase-and-optimize-linux-battery-life/
 
=== Power Manager for GNOME ===
 
'''The configuration defaults for GNOME power manager have not installed correctly. Cannot login'''
 
This error will results in a log-in problem except root account. The symptom is 50GB in root (/) is used up.
 
The problem was caused by a bug in yum where '''/var/cache/yum/x86_64/6Workstation''' takes about 42GB space. The 'yum' does not remove old generated .sqlite files.
 
See https://bugzilla.redhat.com/show_bug.cgi?id=632391
 
I use 'du -k' command to find out which directory took space. I use 'rm' command to delete the contents.
 
Even I delete the content, the directory still grows up daily.
 
=== Upgrade Python from 2.6.x to 2.7.x ===
[http://bicofino.io/blog/2014/01/16/installing-python-2-dot-7-6-on-centos-6-dot-5/ This instruction] tells how to install Python 2.7 from source.
<syntaxhighlight lang='bash'>
yum -y update
yum groupinstall -y 'development tools'
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget
wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
xz -d Python-2.7.8.tar.xz
tar -xvf Python-2.7.8.tar


# Enter the directory:
== Adobe alternatives ==
cd Python-2.7.8
[https://www.makeuseof.com/best-linux-alternatives-to-adobe-products/ The 8 Best Alternatives to Adobe Products That Run on Linux]


# Run the configure:
= Kernel =
./configure --prefix=/usr/local
== How to Roll Back the Kernel ==
[https://www.howtogeek.com/740797/how-to-roll-back-the-kernel-in-linux/ How to Roll Back the Kernel in Linux]


# compile and install it:
== System Call ==
make
* [https://arvindsraj.wordpress.com/2012/10/05/adding-hello-world-system-call-to-linux/ Adding hello world system call to Linux] (Ubuntu)
make altinstall
* [https://brennan.io/2016/11/14/kernel-dev-ep3/ Tutorial - Write a System Call]


# Checking Python version:
== Remove old kernels ==
[root@nicetry ~]# python2.7 -V
[https://www.cyberciti.biz/faq/ubuntu-18-04-remove-all-unused-old-kernels/ Ubuntu 18.04 remove all unused old kernels]
Python 2.7.8


wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
== /boot directory ==
Compare some files from two Ubuntu 20.04 machines.
* '''vmlinuz-5.8.0-48-generic''' or '''config-5.8.0-48-generic''' or '''System.map-5.8.0-48-generic''': same size
* '''initrd.img-5.8.0-48-generic''': not the same size


# Extract the files:
= BIOS =
tar -xvf setuptools-1.4.2.tar.gz
<ul>
cd setuptools-1.4.2
<li>[https://fwupd.org/ fwupdmgr]. I got the following message when I ran a ssh connection.
 
<pre>
# Install setuptools using the Python 2.7.8:
1 device has a firmware upgrade available.
python2.7 setup.py install
Run `fwupdmgr get-upgrades` for more information.
curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python2.7 -
</pre>
pip2.7 install virtualenv
<li>[https://askubuntu.com/a/1497749 How can I upgrade my device firmware from the command line?]
</syntaxhighlight>
<pre>
 
# (The first time only) install & run fwupdmgr
=== Install Meld ===
sudo apt update \
Have not found a solution yet. We need to install it from source. However, the source depends on
    && sudo apt install fwupd \
* Python 2.7 (see above for the instruction)
    && fwupdmgr refresh --force \
* GTK+ 3.6
    && fwupdmgr get-updates \
* GLib 2.34
    && fwupdmgr update
* PyGObject 3.8
* GtkSourceView 3.6
 
(Update) A binary version of meld is already available in the git. See [http://linuxg.net/how-to-install-meld-3-11-2-on-ubuntu-linux-mint-debian-fedora-opensuse-mageia-and-their-derivative-systems/ this post].
<syntaxhighlight lang='bash'>
$ cd ~/Downloads/
$ git clone https://git.gnome.org/browse/meld
$ cd meld
$ sudo ln -s /home/$USER/Downloads/meld/bin/meld /usr/bin/meld
</syntaxhighlight>
 
=== Install the EPEL repository ===
https://support.rackspace.com/how-to/install-epel-and-additional-repositories-on-centos-and-red-hat/
<syntaxhighlight lang='bash'>
sudo yum install epel-release
</syntaxhighlight>
If that command doesn’t work,
* CentOS and Red Hat Enterprise Linux 6.x
<syntaxhighlight lang='bash'>
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm
</syntaxhighlight>
* CentOS and Red Hat Enterprise Linux 7.x
<syntaxhighlight lang='bash'>
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh epel-release-latest-7*.rpm
</syntaxhighlight>


=== Adding, Enabling, and Disabling a Yum Repository ===
# (Every subsequent time thereafter) just run fwupdmgr once it's installed
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Managing_Yum_Repositories.html
fwupdmgr refresh --force \
 
    && fwupdmgr get-updates \
=== VirtualBox guest addition ===
    && fwupdmgr update</pre>
(Works on CentOS 7 & VB 5.0.40) https://wiki.centos.org/HowTos/Virtualization/VirtualBox/CentOSguest
</ul>
<syntaxhighlight lang='bash'>
yum install dkms
yum groupinstall "Development Tools"
</syntaxhighlight>
After running VBoxLinuxAdditions.run & reboot, GA does not work. However, after I run VBoxLinuxAdditions.run & reboot again, GA works.
 
(CentOS 6) Check out [http://www.if-not-true-then-false.com/2010/install-virtualbox-guest-additions-on-fedora-centos-red-hat-rhel/ this post].
<syntaxhighlight lang='bash'>
su
# click VirtualBox -> Devices -> Install guest addition
mkdir /media/VirtualBoxGuestAdditions
mount -r /dev/cdrom /media/VirtualBoxGuestAdditions
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
yum install gcc kernel-devel kernel-headers dkms make bzip2 perl
KERN_DIR=/usr/src/kernels/`uname -r`
export KERN_DIR
cd /media/VirtualBoxGuestAdditions
./VBoxLinuxAdditions.run
</syntaxhighlight>
(Update for 64-bit CentOS 6.5 + VirtualBox 4.3.18) The installation still failed and it showed a missing package which can be installed with
<syntaxhighlight lang='bash'>
yum install kernel-devel-2.6.32-431.el6.x86_64
</syntaxhighlight>
Then I re-run ./VBoxLinuxAdditions.run to finish the installation of guest addition. Reboot and GA works.
 
=== [http://rockstor.com/ Rockstor Linux] ===
Build and manage your own Linux & BTRFS powered advanced NAS and Cloud storage with ease
 
# Personal Cloud Server
# SMB Cloud Server
# Traditional NAS server
 
== Kernel ==
=== System Call ===
* [https://arvindsraj.wordpress.com/2012/10/05/adding-hello-world-system-call-to-linux/ Adding hello world system call to Linux] (Ubuntu)
* [https://brennan.io/2016/11/14/kernel-dev-ep3/ Tutorial - Write a System Call]
 
== Other Flavors ==
=== Arch linux, Manjaro Linux ===
==== Pacman ====
* http://unix.stackexchange.com/questions/6934/package-management-strategy-with-pacman
* Install openssh
<syntaxhighlight lang='bash'>
pacman -Sy openssh
</syntaxhighlight>


==== Manjaro Linux ====
= Other Flavors =
* GUI to swtich kernels. https://wiki.manjaro.org/index.php/Manjaro_Kernels
== Other tiny, lightweight Linux ==
* Install Google Chrome by installing Yaourt (pacman front) first
* [https://opensource.com/article/19/6/linux-distros-to-try 5 tiny Linux distros to try before you die]
* [https://www.makeuseof.com/tag/5-lightweight-linux-distros-ideal-intel-atom-processor-pc/ 8 Lightweight Linux Distros Ideal for Intel Atom Processor PCs] 2022


=== [https://alpinelinux.org/ Alpine Linux] ===
== Arch linux, Manjaro Linux ==
* https://en.wikipedia.org/wiki/Alpine_Linux
[[Arch_Linux|Arch Linux]]
* Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox.
* Include images for Raspberry, Generic ARM, Virtual, XEN, etc.

Latest revision as of 10:34, 16 November 2024

Live CD

https://livecdlist.com/

Run on RAM disk

See Grub -> Run live Linux on ram disk.

Download/Install

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

Ubuntu flavors and derivatives

Download mirror

https://launchpad.net/ubuntu/+cdmirrors. The mirrors are sorted by speed. UMD.

Full list of all flavors of Ubuntu

http://cdimages.ubuntu.com/. See Ubuntu 20.04 LTS Released. Download Now!

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

How To Install The Ubuntu 18.04.2 LTS Hardware Enablement Stack

UEFI and Legacy mode

Secure boot

I need to disable secure boot in order to boot Ubuntu.

LVM partition

See LVM

After installation

System program problem detected

sudo rm /var/crash/*

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

Things to do after installing Ubuntu

  • apt update; apt upgrade -y
  • edit ~/.bashrc to add alias, colored man pages, colored prompt, time stamp to bash prompt, time stamp to history command. To take those changes into effect, you do source ~/.bashrc .
    export LESS_TERMCAP_mb=$'\e[1;32m'  # Blinking text: bold green
    export LESS_TERMCAP_md=$'\e[1;34m'  # Bold text: bold blue
    export LESS_TERMCAP_me=$'\e[0m'     # End mode
    export LESS_TERMCAP_so=$'\e[01;47;34m'  # Standout: bold white on blue
    export LESS_TERMCAP_se=$'\e[0m'     # End standout mode
    export LESS_TERMCAP_us=$'\e[1;4;31m'  # Underlined text: bold underlined red
    export LESS_TERMCAP_ue=$'\e[0m'     # End underline
    
    export HISTSIZE=10000               # default is 1000, history command will use it
    export HISTFILESIZE=20000           # default is 2000, .bash_history file on disk 
    export HISTTIMEFORMAT="%Y-%m-%d %T "     # add time stamp to history 
    
    PS1="\[\033[1;34m\]\$(date +%H:%M%p) \w$\[\033[0m\] "
    
    alias nano="nano -c --softwrap"
    alias checkport='sudo lsof -i -P -n | grep LISTEN'
    
    alias sshnocheck="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
    alias scpnocheck='scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
    
    alias open='xdg-open'
    
  • edit ~/.ssh/config
  • install Chinese input
  • install graphics driver (16 Things To Do After Installing Ubuntu 16.04 LTS)
  • install media codecs
  • change power setting, night light (10 Things To Do After Installing Ubuntu 19.04)
  • install favorite software

Rescue mode

How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04

End of life date of Ubuntu release

https://wiki.ubuntu.com/Releases

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

As we can see use $UBUNTU_CODENAME is common between Ubuntu & Mint. This variable can be used in setting a repository for installing a new software. See the Brave example.

In Docker's installation guide, it uses the value (eg 'bionic') from lsb_release -cs which will give the same value of VERSION_CODENAME' on Mint Linux.

The taskbar in Windows is called a Panel in Linux Mint. If you open applications, you will see the application names showed in the application icons in the taskbar. That takes too much space. Cf macOS or Ubuntu Unity. See a screenshot here where the "Panel" is moved to the top and "Cairo Dock" is installed.

We can also add a program to Favorites. The favorites programs are located at the Mint Start Menu.

Pop_OS

Use The Recovery Partition

Create customized ubuntu iso

See Dual boot

Create your own Debian iso

MultiSystem – Create a MultiBoot USB from Linux

See Dual boot.

Minimal Ubuntu

https://help.ubuntu.com/community/Installation/MinimalCD

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:.

The Perfect Server

Live USB with persistent storage: mkusb

Selection of desktop environment

See Desktop environment.

Themes

Windows 10 theme

Make Linux Look Like Windows 10 With These Tips and Tweaks

GTK3

How To Use A Different GTK 3 Theme For Specific Applications

Orchis

Orchis Is A Cool GTK / GNOME Theme With Rounded Elements

Ubuntu Software Repository

See Ubuntu software repository.

Troubleshooting

What should I do when Ubuntu freezes?

(11/11/2020). Note that my mouse can move but it cannot click. The keyboard did not respond to some solutions like Ctrl+Alt+F1 or Alt+F2. SSh from another computer still works:) Press Alt+SysReq (or Alt+Print), do not release and then type 'REISUB' (lower case). This puts the keyboard in raw mode, ends tasks in various states, syncs the disks, etc, and finally reboots the machine.

(11/23/2020). Pop_OS freezes again. I should check /var/log/syslog via ssh.

Don't try this on a virtual machine. It will not work. It just restart the HOST machine.

(10/29/2021). The /var/log/syslog shows unusual lines containing lots of \00\00\00\00 and Inserted module 'lp' . Try a suggestion from Using syslog to diagnose a crash. Another report related to the specific CPU (NUC8i5BEH) NUC8i5BEH running Linux randomly freezes when idle.

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.

unable to open mtp device ubuntu 14.04

Use this tip.

sudo apt-get install mtpfs

Cannot log in in ubuntu 20.04

It's caused by ticking 'enable automatic logging in' at installation

No sound after suspend

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.

Monitor

Monitor resolution

Night light

Best Eye Care Software to Protect Your Eyes in Linux

Display Manager

Display server: Wayland Xorg

How to Switch Between Xorg and Wayland in Ubuntu & How to enable/disable wayland on Ubuntu 20.04 Desktop

echo $XDG_SESSION_TYPE

How can I tell if an application is using XWayland? 1. Running xlsclients in a terminal will list all the apps currently running which are using XWayland (cf native wayland). 2. Run xeyes

Power management

Battery

How to get Battery status notification when a battery is full or low

Suspend, hibernate

  • Automatic suspend will disable ssh connection, cron jobs, et al. PS. a server never goes to suspend.
  • Set Automatic Suspend Idle Time (Less Than 15 Min) in Ubuntu, Fedora, Debian
  • 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.

Swapfile

  • How to remove a swapfile.
    sudo swapoff /swapfile  # swapfile is located under the root
    sudo rm /swapfile
    free -h   # double check 
    # Remove the swap entry from /etc/fstab
    sudo nano /etc/fstab
    
  • Re-enable swap. How to Create and Increase Swap Space in Ubuntu 20.04
    sudo fallocate -l 2G /path/to/new_swapfile
    sudo chmod 600 /path/to/new_swapfile
    sudo mkswap /path/to/new_swapfile
    sudo swapon /path/to/new_swapfile
    
    sudo cp /etc/fstab /etc/fstab.bak
    echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
    
  • Change swap size in Ubuntu. It seems we need to delete the swapfile before we follow that.

Hard drive

Install a new hard drive

See also https://help.ubuntu.com/community/InstallingANewHardDrive, Fdisk Command in Linux and Mount drive

  1. Use ls /dev/sd* show connected disk drives
  2. Use sudo fdisk /dev/sdb command to create partition table. Then 'g', 'p', 'n', 'p', '1', ENTER, ENTER, 'w'.
  3. Use sudo mkfs -t ext4 /dev/sdb1 to create a new partition
  4. Use sudo mkdir /mnt/ssd to create a new mount point
  5. (One time mount) sudo mount /dev/sdb1 /mnt/ssd
  6. Use sudo nano -Bw /etc/fstab to do auto mount on boot
    /dev/sdb1    /media/mynewdrive   ext3    defaults     0        2
    /dev/sdc1    /media/mynewdrive   ext3    defaults     0        0
    
  7. sudo chown -R USERNAME:USERNAME /mnt/ssd to give the ownership to the USERNAME.

Add second hard disk (3TB) to Ubuntu 16.04

exFat/Format USB for Windows

How to Format a USB Disk as exFAT on Linux [Graphically and Command Line]

Ubuntu Disks utility

We can use it to write an image to the SD card. Right click the image file in the File Manager. Select 'Open with '-> 'Disk Image Writer'. Select 'Destination' and click 'Restore'.

BALENA ETCHER can have a problem with writing the ArkOS image.

Disk Usage Analyzer

It is actually called Baobab.

Check partition type

lsblk -f

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?.

Resize Active/Primary root Partition In Linux Using GParted Utility

How To Resize Active/Primary root Partition In Linux Using GParted Utility. Three utilities are introduced too.

  • e2fsck: e2fsck is a file system check utility that automatically repair the file system for bad sectors, I/O errors related to HDD.
  • resize2fs: The resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to enlarge or shrink an unmounted file system located on device.
  • e2image: The e2image program will save critical ext2, ext3, or ext4 filesystem metadata located on device to a file specified by image-file.

Change a partition's label

parted utility

How To Manage Disk Partitions Using Parted Command

sudo parted /dev/sda print free

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

Health check of the hdd: badblocks, dmesg, fsck

Linux check the physical health of a USB stick. badblocks and f3 tool.

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/.

Force Check Root Filesystem using fsck During Reboot

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 dd command to erase a hard disk.

use dd to erase a hard disk

The following command works on Live Ubuntu. We can use this method to erase a hard disk.

sudo dd if=/dev/zero of=/dev/sda bs=4M status=progress

Clone your linux hard drive

How to Clone Your Linux Hard Drive: 4 Methods

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

Rufus is a popular free and open source graphical tool to create bootable USB drives from Windows. It can be used to create not only bootable Windows drives from ISO files or disk images, but also create bootable Linux USB drives from 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

Mint mintStick

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

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.

Multiple boot USB

ventoy

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).

Automatically Mount USB Drives On Ubuntu Or Debian Server

Automatically Mount USB Drives On Ubuntu Or Debian Server With USBmount

Determine/install/switch Window Manager

sudo apt-get install wmctrl
wmctrl -m           

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

On an old/new Ubuntu the default window manager is Compiz/GNOME Shell, for xubuntu it is Xfwm4 and for BBB it is Openbox. We can use the neofetch command.

Jenkins

How to Install Jenkins Automation Server with Apache on Ubuntu 16.04

Automatic update, unattended upgrade

$ 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

How to find out if/why my Ubuntu/Debian Linux server needs a reboot/restart

  • See also the Grub page. When a new initrid image is downloaded, /boot/grub/grub.cfg will be updated to use the newest image.
    grep initrd.img /boot/grub/grub.cfg -n
    

Raspberry Pi

Shell example to get notification when you need to reboot

How to find out if Raspberry PI Linux OS needs a reboot

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)

Troubleshooting

  • Pop_OS.If the printer stops working, open the Printers Application again and click the gear icon, and select Remove Printer to remove the printer and its settings. Repeat the steps above to add the printer and try printing the test page again. This process usually resolves many printing issues.
  • io.elementary.appcenter took 2GB memory on Pop_OS 20.04; see Pop Shop not closing properly (sometimes)
  • Download driver from manufacturer website
  • To look at the CUPS (Common Unix Printing System) configuration and status window, please open this webpage: http://localhost:631. The "Help" menu provides help for lots of printer commands.
  • Debugging Printing Problems Ubuntu
    • avahi-browse -a -v -t -r can show the printer IP

Deep sleeping

Command line

  • lpstat
    • lpstat -t: see the status for all of the printers on the system, as well as the scheduler and all jobs
    • lpstat -p: Display all installed printers
    • lpstat -a: Display only those printers that are currently accepting print requests.
    • lpstat -o: Display all active print jobs
  • lp
    • lp example.pdf: print a single example.pdf file on your default printer
    • lp -d MFCL2700DW example.pdf: specify a printer via the -d switch:
    • Two-sided printing: lp -o sides=two-sided-long-edge example.pdf
    • lp -P 1,3,5-7,16 example.pdf : Print certain pages
    • man lp: Help
  • lpadmin
    • lpadmin -x: Delete a printer. PS I cannot delete a printer either using the GUI or the command line:(

LPR & Cupswrapper*

$ lpstat -R  # check queue

File:PrinterInstall.png

Paper Jam

Brother MFCL2710DW - Clearing paper jam errors

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
    ...

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 a program after logging 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. I am using this way to auto start conky; see here. How can I add new autostart programs in Lubuntu? If you’re not using a desktop environment check out ~/.bash_profile file.
  2. /etc/xdg/autostart
  3. search 'Startup Applications Preferences' in Dash/Menu/Preferences. I have 1) Calibre 2) Dropbox 3) SSH Key Agent (/usr/bin/gnome-keyring-daemon --start --components=ssh) . For Lubuntu, this option is available on version 19.04+.

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)

gnome-screenshot (preinstalled in Ubuntu)

# 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 (removed)

Shutter screenshot tool was removed from Debian Unstable and Ubuntu 18.10 . Consider flameshot.

# 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.

ksnip

Ksnip 1.6.0 Screenshot Software Released With System Tray Icon, Global Hotkeys, Watermarks And More

Note the snap version of the program does not allow me to save the file?

The deb binary file works perfectly.

To crop an image, click the "Crop" icon. It will select the border of the image ready for cropping. All you have to do is drag and resize the rectangle. See a screenshot below.

File:Ksnip.png

flameshot (good replacement of shutter)

Annotator

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

mtPaint, MyPaint, Pinta

Paint.NET_like_program

Either MyPaint (no tool) or Pinta (can't control font size) is not good at adding text to an image. GIMP is still the king.

Screencaster/Record desktop

OBS Studio (cross platform)

Blue Recorder

Peek

https://github.com/phw/peek 9.9k star, latest release 2020. It is possible to use Peek in a GNOME Shell Wayland session using XWayland by launching Peek with the X11 backend.

VokaScreenNG

kazam

It seems Kazam does not support Wayland yet. So use OBS Studio instead.

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

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

Second screen

Deskreen: share an app or the desktop

VirtScreen

https://github.com/kbumsik/VirtScreen

Mirroring display/screen

Wallpaper

Customize the desktop

Dock

Show date in top bar of desktop

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

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.

Move a Window Without Clicking the Titlebar

Hold down the Alt key and then click in the window anywhere, and move your mouse.. See here. For recent Ubuntu, we can hold the super key and drag the window anywhere. See Move and resize windows.

On new Ubuntu, the Settings -> Keyboard Shortcuts shows Alt + F7 can be used to move a Window. The method is to use the arrow keys to move the window up/down after we hit Alt + F7.

Snapping windows to left or right

  • Drag the window to left or right. I found when I drag the window to right, it just maximizes the window
  • Window key + Left/right key. It Works on Ubuntu 18.40.

How to Keep a Window Always on Top

How to Keep a Window Always on Top in Linux

Change mouse cursor size

Settings -> Universal Access

Network Manager

Find Available Network Interfaces On Linux

Find Available Network Interfaces On Linux

  1. ifconfig -a
  2. ip link show # OR ip addr
  3. ls /sys/class/net
  4. cat /proc/net/dev
  5. netstat -i
  6. nmcli device status # OR nmcli connection show

Restart the network

sudo service network-manager restart
# OR
sudo nmcli networking off
sudo nmcli networking on

avahi-daemon

Run sudo apt install avahi-daemon so we can use hostname.local to access the remote machine.

Set static IP

How to Configure Static IP Address on Ubuntu 22.04 LTS or How To Configure Static IP Address In Ubuntu (Easy Guide). Method 1: nmcli Command, Method 2: Netplan, Method 3: nmtui, 4: GUI.

My Ubuntu Server has two IP addresses, but only one is assigned in netplan, any ideas? Solution: assign static ones in the router to your computer's MAC address.

Starting with 17.10 release, Netplan is the default network management tool on Ubuntu. PS. another file we may want to check is /etc/dhcpcd.conf.

PS: replace eth0 as needed. On my Ubuntu box, it should be ens18 according to ip a. We can find out the device name by the default 00-netcfg.yaml file. Setting up Static IP address on Ubuntu Server 22.04.

$ sudo cat /etc/netplan/01-netcfg.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.1.199/24
      nameservers:
          addresses: [8.8.8.8, 1.1.1.1]
      routes:
        - to: default
          via: 192.168.1.1
$ sudo netplan apply # or sudo netplan --debug apply 
$ ip a               # no reboot is necessary

Now that I got a message when I tried above on the latest Ubuntu 20.04. `gateway4` has been deprecated, use default routes instead. To fix it, follow the instruction here by replacing gateway4 with routes with to and via.

Multiple IP addresses

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.

Local DNS

Set up OpenDNS

Set up OpenDNS on Linux Mint or Set custom DNS servers on Linux with Network Manager or resolv.conf

Select the Method: Automatic (DHCP) addresses only and enter 208.67.220.220, 208.67.222.222 into the DNS field, then click Save.

But after the change (and reboot), I don't have internet anymore.

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

Wifi problem troubleshooting

Wi-Fi Not Working in Linux? Here’s How to Fix it 2024. 1. Hardware or software, 2. Driver, 3. DNS.

How to Connect to WiFi using netplan

How to Connect to WiFi from the Terminal in Ubuntu Linux

Manage wifi network using nmcli and wavemon

Turn on/off wifi adapter using nmcli

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

Nmtui

How to Manage Linux Wi-Fi Network with Nmtui

Proxy

Internet Shut Down

IP scanner

  • Angry IP Scanner (Windows, Mac, Linux). GUI.
  • nmap utility; e.g. sudo nmap -sP 192.168.1.1/24
  • fing (terminal)

How to get connection to both wifi as well as LAN

wireless connection randomly drop off: iwconfig, iwconfig

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

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

sudo iwconfig  # List available wireless interfaces 

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      # get signal level, Bit rate

To check wifi connection information (SSID, channel, address, frequency, qualiyt, signal level, ...). How do I scan for Wireless Access Points?

sudo iwlist wlan0 scan

sudo iw dev wlan0 scan | egrep "signal:|SSID:" | sed -e "s/\tsignal: //" -e "s/\tSSID: //" | awk '{ORS = (NR % 2 == 0)? "\n" : " "; print}' | sort      # change wlan0 to the right interface

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

On my nuc desktop, it got -63 dBm (on Sunday it is -54 dBm). On Raspberry Pi zero, it shows -54 dBm (impressive). On Mint with Qualcomm Atheros AR93xx, it shows -56 dBm. On macbook pro, I got -70. On Raspberry Pi 3B (around the router), it shows -39 dBm.

How to interpret wireless quality indicators?.

VPN

See VPN

DHCP Server

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

Samba

Change automatic login

Open sudo nano /etc/gdm3/custom.conf and change the logic value true/false

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

sudo

How To Grant And Remove Sudo Privileges To Users On Ubuntu

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.

Note that when we use the terminal app Tabby, the directory color is easy to see.

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.

powerline

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

Font

Large text, monitor scaling, HiDPI displays

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
# OR
sudo apt-get install fonts-arphic-uming fonts-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.

Easy way

Tested on Ubuntu 18.04 and 19.10. Do not to go to "Input Method".

  1. Language support. Make sure Chinese (traditional) is selected. Log out and log in. This step is not needed when I try Pop!_os. No need to worry about keyboard input method system; the default 'none' is OK. Log out and log in.
  2. Choose Settings -> Region & Language -> Input Source -> Chinese (Taiwan).

On Debian 11, I first need to run sudo apt-get install ibus-chewing & ibus restart. Then log out and log in again. Go to settings-Region and Language. Input Sources - Other - Chinese. Select Chinese (Chewing). Done. Use Win+Space to switch input languages.

ibus

How To Setup Multilingual Input Method On Ubuntu 18.04.

ibus works fine on Pop_OS 20.04 (it does not have fcitx PLUS ibus is already running) . Step 1 is to make sure Chinese is included in Language Support (it's already in Pop_OS 20.04) Step 2. Use Settings and search for 'input sources'. Use "+" to add Chinese Chewing.

gcin

新注音 New Zhuyin

sudo apt-get install gcin

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.
  • On Lubuntu 18.04 LTS, fcitx works fine.
    1. add Chinese in 'Language Support'
    2. log out and log in (For live CD, the user name is lubuntu and the password is empty)
    3. click on fcitx icon > ConfigureFcitx. Uncheck the option Only Show Current Language in order to get a list of available input methods. Add Chinese Chewing. Close the Window.
    4. use Ctrl+Space keybinding to switch the language

/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

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’.
  • Using /etc/rc.local for custom scripts is a legacy method, and some modern Debian systems might not have this file or might not execute it. Consider using systemd units or other modern methods for more reliable and maintainable solutions.

crontab

Executing Commands and Scripts at Reboot & Startup in Linux

Back up DVDs

Top 5 Linux DVD RIP Software from cyberciti.biz.

dvdbackup command

It works and fast. It will create a new directory (no need to specify beforehand).

sudo apt install dvdbackup
dvdbackup # get usage

dvdbackup -i /dev/dvd -o ~/Videos/ -M
# -M means to back up the whole DVD

We can further create an ISO file from a directory using

genisoimage -o output_image.iso directory_name
# Or
mkisofs -lJR -o output_image.iso directory_name
# -l : Allow full 31 character filenames.
# -J : Generate Joliet directory records in addition to regular iso9660 file names.
# -R : Generate System Use Sharing Protocol (SUSP) and Rock Ridge (RR) records using the Rock Ridge protocol

Create an iso file from a CD/DVD or HD

See also

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 status=progress # worked in antiX
dd bs=4M if=/dev/sr0 of=~/DVD.iso status=progress 
# Works for me to back up some borrowed DVDs
# 
# Don't add the 'bs' parameter or you'll get an error reading '/dev/sr0': Input/output error
# or use VLC to watch a little bit of the DVD first to fix the problem (why it helps?)
# note that status=progress does not show the percentage. It shows how much is copied.
# OR
cat /dev/sr0 > ~/DVD.iso

For some reason I get an Input/output error. But after I use VLC to play the video, the Input/output error is gone when I try it again.

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

Method 3. Monitor the progress of percentage assume we know the disk size

sudo apt-get install pv
dd if=/dev/urandom | pv -s 2G | dd of=/dev/null

Method 4. To see the progress of dd once it's running, open another terminal and enter:

sudo kill -USR1 $(pgrep ^dd)

This will display dd progress in the dd terminal window without halting the process. If you're on BSD or OS X, use INFO instead of USR1. The USR1 signal will terminate dd.

If you would like to get regular updates of the dd progress, then enter:

watch -n5 'sudo kill -USR1 $(pgrep ^dd)'

watch will probe the dd process every -n seconds (-n5 = 5 seconds) and report without halting it.

Note the proper single quotes in the commands above.

HandBrake

It works but it loses the menu page on DVD.

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

SSHFS: mount a remote file system over ssh

Linux Console File Managers

Nautilus Files or Nemo (File Manager)

Bookmark the current directory to the sidebar

Ctrl + d. See also Files > Keyboard Shortcuts.

Ctrl + L

Change to a directory

Undo Ctrl+L

Press ESC.

Mount another Linux system in Nautilus

Very easy. Check out howtogeek.com

Eject USB drive

One or more applications are keeping the volume busy. One reason is I cd to one directory in the USB drive on the Terminal. If I move away, I can eject the drive.

Preview a file

Use the space bar to preview a file and click the space bar again or ESC to close the preview. Click "f" or F11 to preview the file in full-screen.

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.
  • Pale moon browser instruction, especially the icon part.

.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!

The Linux Directory Structure, Explained

https://www.howtogeek.com/117435/htg-explains-the-linux-directory-structure-explained/

Templates folder in the home directory

What is the “Templates” folder in the home directory for?

What purpose does the Public folder serve

gnome-sushi - Quick look

Get macOS ‘Quick Look’ on Ubuntu with GNOME Sushi

Plugin

Nemo

Mount and Unmount Storage Devices from the Linux Terminal

How to Mount and Unmount Storage Devices from the Linux Terminal

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/Super/Shift + 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
  • sudo apt install gnome-tweaks . From there, go to workspaces on the LHS choose static spaces. Choose the number of workspaces you like. Click on the super key to see all workspaces on the RHS. Drag and drop an app to move it to the desired workspace.
  • Super + left/right: snap the window to left/right
  • Super + upper/down: maximize/resize the window
  • Super + h: hide/minimize a window. I changed it to Super + m (overwrite its original meaning). On macOS, it is Command + m.

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

Hardware/Device manager

  • How to List Your Computer’s Devices From the Linux Terminal mount , lsblk, df , fdisk , The /proc Files , lspci , lsusb , lsdev , lshw , lsscsi , dmidecode, hwinfo.
  • 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.
    $ sudo lshw -short
    
  • For storage part, ubuntu provides a graphical tool. See "disk utility" on gnome based ubuntu or search for "disks" in launcher.
  • How to Use lsusb in Linux (With a Practical Example)
  • Get All Kind of System Information in Linux Terminal With inxi

Hardinfo, Hardinfo2

Find out motherboard information

# No root
cat /sys/devices/virtual/dmi/id/board_{vendor,name,version}

# Root
sudo dmidecode  | grep -A4 '^Base Board Information'

RAM

Linux Check Ram Speed and Type Commands

sudo apt install dmidecode
sudo dmidecode --type 17

Hard drive specification

# 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

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
sudo ufw delete allow 8069

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/range. For example, to allow a VNC access from a specific IP.
    # https://serverfault.com/a/74024
    sudo ufw allow from 192.168.1.0/24 to any port 5900
    
  • Deny by certain IP address
  • Deny by certain IP address and certain port

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.

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

Virtualize Linux

http://www.linuxuser.co.uk/features/how-to-virtualise-linux-part-1

CPU information

$ 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

CPU usage

import psutil
print psutil.cpu_percent()

Note not like the htop command, the result from psutil fluctuates a lot.

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.

gksu

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

Install sshd

apt-get update
apt-get install openssh-server

sftp, vsftpd and virtual users

ProFTPd

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.

XAMPP

How to Install XAMPP on Ubuntu 20.04

Sandstorm: self-hostable web productivity suite

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

UPnP server

See UPnP.

Storage server GlusterFS

https://www.howtoforge.com/tutorial/high-availability-storage-with-glusterfs-on-debian-8-with-two-nodes/

Security

Automatic security update

TPM

TPM-backed Full Disk Encryption is coming to Ubuntu

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

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

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

$ curl -L -O https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.7.0/sratoolkit.2.7.0-ubuntu64.tar.gz

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

Create .deb file

checkinstall command

dpkg-buildpackage command

Package maintenance

See Ubuntu package.

Software automation

Ansible

Ansible is a free and open source software that can be used to automate software provisioning, configuration management, and application deployment.

See Ansible

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

See SSL.

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

Streaming

Stream Videos, Music And Pictures From Gnome To Chromecast With Cast To TV Extension (v6 And v7 Released)

Keep a linux process running after log out

See also Terminal multiplexer page.

# nohup command-with-options &

If we use ssh -X to connect to a remote computer, the command can launch a GUI application on my local computer (without strange messages shown on the terminal).

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

Get normalized sound volume

The sound from some youtube video can be too low. The following solution seems to work on Ubuntu 18.04 (nuc).

Automatically adjust the volume based on content?. It works. A reboot is needed. Tested on this video. See the automatic change in setting after reboot. File:Soundnormalize.png.

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.

Trim

Trim an MP3 on your Mac. Open the file using QuickTime. "Cmd + t" to open the Trim function, or, you can also find the Trim function under the “Edit” menu. The rest is easy.

Compress audio files

How to Compress Large Audio Files: 5 Easy and Effective Ways

Audio editing

The Best Free Audio Editing Software

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

Music player

Podcast

White noise

SMPlayer: video player

MPV - terminal media player including youtube videos

See Youtube

Listen to the radio at the Linux terminal

Listen to the radio at the Linux terminal

SMTube: search and watch youtube

  • 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

GNOME mpv player

Simple GTK+ frontend for mpv.

https://celluloid-player.github.io/ The interface of SMPlayer looks old. The GNOME mpv player (now called celluloid looks better.

sudo add-apt-repository ppa:xuzhen666/gnome-mpv
sudo apt-get update
sudo apt install celluloid

Haruna

Haruna Video Player Is A Cool mpv GUI Frontend. It does not have deb package yet.

Youtube command line tools

Play audio only

# 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!

Youtube-dl

Youtube->Youtube-dl

Video editing in Linux

See Video.

Video rip/convert/transcoder

See Video.

Open Websites In A Floating, Borderless Window/Picture in picture

Open Websites In A Floating, Borderless Window With Pennywise

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).

See IP scan tools (eg arp-scan) to find out connected devices.

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

Java

Notifications

Send email

It is useful to several occations:

Send emails through gmail: mail

Configuring sendmail with GMail relay on Ubuntu 16.04

Send emails through gmail: sSMTP

CPU/system load

Cockpit

Conky: system resource monitor

See Conky.

Stacer - Linux System Optimizer and Monitoring

Stacer – The Linux System Optimizer You’ve Been Waiting For. Qt library. But it seems the memory usage will increase after a while.

Stacer.png

Mission Center: Windows Task Manager like

Grafana

Graphite

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).

CPU-X

CPU-X, An Alternative to CPU-Z for Ubuntu and Other Linux Distributions!. This is pre-installed in Calculate Linux. On ubuntu, run "sudo apt install cpu-x" to install it.

CoreFreq

http://www.tecmint.com/corefreq-linux-cpu-monitoring-tool/

System load indicator on desktop/GNOME resource monitor on taskbar

sudo apt-get install indicator-multiload

# sudo apt-get install indicator-cpufreq
# indicator-cpufreq

Alert When Memory Gets Low

A Shell Script to Send Email Alert When Memory Gets Low

Monitor CPU Utilization And Send Email

Linux Shell Script To Monitor CPU Utilization And Send Email

Top processes sorted by RAM or CPU

Find Top Running Processes by Highest Memory and CPU Usage in Linux
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

Monitor Resource Usage of a Single Process

Monitor Resource Usage of a Single Process

Hard drive: hdparm and smartctl

Hard disk speed

Benchmark -> Disk speed test

Hard disk directory size

See Display directory size with sorting and human readable by using the ncdu utility.

MART overall-health self-assessment test

On my Samsung SSD 860 EVO 500GB, SMART DATA was greyed out when I try the Disks utility. But GSmartControl and smartctl can get the data out

sudo smartctl --all /dev/sda | grep overall
$ SMART overall-health self-assessment test result: PASSED

Monitor/run a short test on a hard disk health by command line/GUI

Using smartctl

sudo apt install smartmontools
sudo smartctl -a /dev/sda

# Run a short test
$ sudo smartctl -t short /dev/sda # It will start the test in the background
$ sudo smartctl -l selftest /dev/sda

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

Free up disk space/clean up system space/remove or delete junk files

5 Easy Ways To Free Up Space (Remove Unwanted or Junk Files) on Ubuntu

system's hardware temperatures and voltages

Passwords and keys

GNOME Passwords and Keys

The Keyring Concept in Ubuntu: What is It and How to Use it? Mar, 2020

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/

Password manager

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

Netcat (nc) Command with Examples

# receiving host 
nc -l 5555 | tar xzvf -

# sending host
tar czvf - /path/to/dir | nc receiving.host.com 5555

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.

SysV init

Init is an initialization system

SysV init is named for System V Unix.

Init runs as PID 1. Parent process of all other processes on the system.

Runlevels represent discrete operational states.

$ runlevel
$ less /etc/init.d/ssh
$ ls -ld /etc/rc*
$ ls -l /etc/rc2.d
$ cat /etc/rc.local
$ sudo service networking restart
$ ls /etc/init.d/

systemd

How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions

systemd vs upstart

Cloud/online storage

Mounting

Mega

ownCloud

Use apt to install or go to the download page

One Drive

Dropbox

See Software > Dropbox.

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'

Back up google photos

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/

Microsoft Office

How to Install and Use Microsoft Office on Linux

Application Launcher

The 9 Best Linux App Launchers to Help You Get Stuff Done Faster

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 is the last log in time for users

lastlog  # all users
last     # current user

System Logs: rsyslog

logger command

We can write messages to ourself with the logger command.

$ logger "hello from the command line"
$ tail /var/log/syslog

Read/view the system logs

How to View System Log Files on Ubuntu 18.04 LTS

'Show Application' -> 'Logs'.

$ less /var/log/syslog
$ less /var/log/dpkg.log
$ ls /var/log
$ less /var/log/auth.log   
# use f/b or arrow keys or / to search
# we can search again by using / and enter
# we can restrict to lines containing the term by using & and the term

$ sudo journalctl | grep shutdown

Log rotate after a set period of time. Use zcat or aless to view archived files.

$ zcat syslog.4.gz

What is the reboot time

The following method does not show the reboot history.

last reboot

It seems the command only show 1 record on Ubuntu 18.04. But it shows lots of records on Ubuntu 20.04/Pop_OS 20.04. On mac, it shows a few records.

The above command only show the 'last' reboot time. If we want to see the boot history, see How to View System Log Files on Ubuntu 18.04 LTS. The GNOME Logs utility is best. At the top of the GUI, I can select the logs of the (boot) date. But it has a limit number of dates to choose from. The 2nd choice Log File Viewer utility is not useful since it does not provide a choice of the date. The command line approach is possible if we need to use grep to search of 'boot' in syslog or syslog.1 or syslog.X.gz files under /var/log/ directory. We may search for a very old boot log using this approach. For example, zcat /var/log/syslog6.log | grep boot.

What date/when was the system installed

ls -l /var/log/installer

For other OSs, follow How To Find Exact Installation Date And Time Of Your Linux OS. Replace 'dev/sda1' with the filesystem of the "/" partition. Replace /dev/sda1 with /dev/mmcblk0p2 on Raspbian,

$ sudo su
# dumpe2fs /dev/sda1 | grep 'Filesystem created:'
# OR
# tune2fs -l /dev/sda1 | grep 'Filesystem created:'

Maybe checking /etc/ssh would help if openssh-server was installed (such as sudo apt-get install openssh-server).

Both methods do not apply to the Ubuntu 18.04 from Odroid xu4 but looking at files under /var/log can still give a hint.

systemd-journald

Image/Photo

Image viewer on command line

Edit images using command line

4 ways to edit photos on the Linux command line

Crop an image

  • 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 & mtPaint can also take a screenshot of the desktop and crop the image.
  • gimp. https://docs.gimp.org/en/gimp-tutorial-quickie-crop.html

Rename files in batch

GUI To Batch Rename Files On Linux With Exif And Music Tags Support: Inviska Rename

View exif information

gThumb works fine.

Remove Metadata From Files: exiftool

How to Quickly Remove Metadata From Files on Linux

Mind-mapping

Sticky notes

Top Sticky Notes App for Ubuntu. Indicator-stickynotes is better than Xpad (I cannot move the app) and KNote (I cannot install it in gnome). How Install Sticky Notes in Ubuntu shows we can install a deb file if we don't want to add another PPA.

Password manager

KeePass

KeePass: Password Manager from Odroid magazine.

Choice 1: KeePassXC, KeePass Cross-Platform Community Edition. I can open kdbx file in KeePassXC. It also has a browser integration (auto-fill) functionality. See Getting Started With KeePassXC

sudo add-apt-repository ppa:phoerious/keepassxc
sudo apt-get update
sudo apt install keepassxc

Choice 2: KeePassX. Note that the kdbx file used in KeePass2 cannot be opened in KeePassX.

Choice 3: KeePass2 (this is what I am using now). There is no need to use ppa.launchpad.net to install from. You can install keepass2 by using sudo apt-get install keepass2 or install the latest version using Julian Taylor’s PPA.

sudo add-apt-repository ppa:jtaylor/keepass
sudo apt-get update
sudo apt-get install keepass2

On Android: KeePassDroid

Chrome browser (not OS) integration: See the source code.

Chromebook: KeePass2 for Chromebook

Security:

KeePass with KeeAgent

http://code.mendhak.com/keepass-and-keeagent-setup/

KeeWeb: Free cross-platform password manager compatible with KeePass

1Password

1Password Beta Arrives for Linux

Bitwarden

Bluetooth

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 mouse

My M590 mouse suddenly has a lag in response (Pop_OS 20.04). Don't know how to fix it.

The jerky movement/lag problem may be caused by other reason: nano receiver placement/positioning (e.g. moved the USB wireless receiver from the back to a port on the front of the PC), usb hub, other gadgets (e.g. phone) around the receiver.

Or increase the Mouse Speed in Settings.

Other solutions: How can I get rid of mouse lag under Ubuntu?

Apple Magic Touchpad

Apple Magic Trackpad 2 on Ubuntu Linux 20.04

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

Open the default graphical applications using the command line (mime-types)

See /etc/gnome/defaults.list.

# alias open='xdg-open'. Put this inside your ~/.bashrc or ~/.bash_aliases
xdg-open [name-of-PDF-file]

# If you want to use gnome-open, you need to install a package
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

xdg-open, xdg-mime

  • For some reason, even Chrome is my default browser (Ubuntu -> Settings -> Default applications) but when I use the xdg-open command to open a local HTML file, Brave is called. NB. the xdg-settings also 'thinks' chrome is the default browser. If I uninstall Brave, then VS code will be replaced to open local HTML files by xdg-open.
    $ xdg-settings get default-web-browser
    google-chrome.desktop
    $ xdg-mime query default x-scheme-handler/http
    google-chrome.desktop
    $ xdg-mime query default x-scheme-handler/https
    google-chrome.desktop
    
    $ xdg-mime query filetype myfile.html
    application/xhtml+xml

    The solution that works for me is to run sudo nano /usr/share/applications/defaults.list and remove lines contains 'brave' (the .list file is really a mess). After that, xdg-open myfile.html will use chrome to open it. See xdg-open default applications behavior, xdg-open & XDG MIME Applications & xdg-utils from archlinux.org.

    $ env XDG_UTILS_DEBUG_LEVEL=10  xdg-mime query default text/xhtml
    # A long list
  • On Peppermint 11, the open command located in /usr/bin is a symbolic link to /usr/bin/xdg-open.
  • How can I change the default application for a content type?
    xdg-mime default okularApplication_pdf.desktop application/pdf 
    
  • Change the default text editor xdg-mime default code.desktop text/plain

Change the default browser

How to open default browser from command line Linux

Change the default PDF app

Right click a pdf file, choose "Properties". Click on "Open With". Select an app and click "Set as default".

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.

Chroot

Chroot

Check/Diagnostic SD card, read-only file system

sudo mount -o remount,rw '/media/brb/KINGSTON8G'

When I check the difference of the output of 'mount' on the USB drive, I see it changes from (ro) to (rw).

# Before
$ mount
/dev/sdb1 on /media/brb/KINGSTON8G type vfat (ro, ...)
# After
$ mount
/dev/sdb1 on /media/brb/KINGSTON8G type vfat (rw, ...)
sudo fsck -Af -M # If not work, use the next solution

sudo fsck.ext4 -f /dev/sdb2 # From a live CD/USB drive, assume /dev/sdb2 is ext4 partition

The above commands do not help in my case.

AppImage file - new way of installing an application

See Snappy

Snappy

See Snappy.

Exclude snap partitions in the df command output

alias df='df -x"squashfs"'

Flatpak

See Snappy

Message Of The Day, login banner /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

Games

Take to the virtual skies with FlightGear, FlightGear

controller/joystick

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

Best apps

Adobe alternatives

The 8 Best Alternatives to Adobe Products That Run on Linux

Kernel

How to Roll Back the Kernel

How to Roll Back the Kernel in Linux

System Call

Remove old kernels

Ubuntu 18.04 remove all unused old kernels

/boot directory

Compare some files from two Ubuntu 20.04 machines.

  • vmlinuz-5.8.0-48-generic or config-5.8.0-48-generic or System.map-5.8.0-48-generic: same size
  • initrd.img-5.8.0-48-generic: not the same size

BIOS

  • fwupdmgr. I got the following message when I ran a ssh connection.
    1 device has a firmware upgrade available.
    Run `fwupdmgr get-upgrades` for more information.
    
  • How can I upgrade my device firmware from the command line?
    # (The first time only) install & run fwupdmgr
    sudo apt update \
        && sudo apt install fwupd \
        && fwupdmgr refresh --force \
        && fwupdmgr get-updates \
        && fwupdmgr update
    
    # (Every subsequent time thereafter) just run fwupdmgr once it's installed
    fwupdmgr refresh --force \
        && fwupdmgr get-updates \
        && fwupdmgr update

Other Flavors

Other tiny, lightweight Linux

Arch linux, Manjaro Linux

Arch Linux