Ubuntu: Difference between revisions

From 太極
Jump to navigation Jump to search
(45 intermediate revisions by the same user not shown)
Line 16: Line 16:


== Download mirror ==
== Download mirror ==
https://launchpad.net/ubuntu/+cdmirrors. The mirrors are sorted by speed.  
https://launchpad.net/ubuntu/+cdmirrors. The mirrors are sorted by speed. [https://mirror.umd.edu/ubuntu-iso/ UMD].


=== Full list of all flavors of Ubuntu ===
=== Full list of all flavors of Ubuntu ===
Line 30: Line 30:


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


== LVM partition ==
== LVM partition ==
Line 222: Line 227:
* [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]
* [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]
* [https://itsfoss.com/display-manager/ Linux Jargon Buster: What is Display Manager in Linux?]
* [https://itsfoss.com/display-manager/ Linux Jargon Buster: What is Display Manager in Linux?]
== Display server: Wayland Xorg ==
[https://itsfoss.com/switch-xorg-wayland/ How to Switch Between Xorg and Wayland in Ubuntu]
<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'''


= Power management =
= Power management =
Line 254: Line 266:
[http://withr.me/add-new-hard-disk-3tb/ Add second hard disk (3TB) to Ubuntu 16.04]
[http://withr.me/add-new-hard-disk-3tb/ Add second hard disk (3TB) to Ubuntu 16.04]


== exFat ==
== 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]]
[https://itsfoss.com/format-exfat-linux/ How to Format a USB Disk as exFAT on Linux [Graphically and Command Line]]


== Ubuntu Disks utility ==
== 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 [https://github.com/christianhaitian/arkos/wiki ArkOS image].


== Disk Usage Analyzer ==
== Disk Usage Analyzer ==
Line 646: Line 661:
* [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?]
* [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.
* [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
** Deb version
** The deb version only has i386 version?
** The deb version only has i386 version?
Line 864: Line 881:
</pre>
</pre>


== Pinta, mtPaint, MyPaint ==
== mtPaint, MyPaint, Pinta ==
[[#Paint.NET_like_program|Paint.NET_like_program]]
[[#Paint.NET_like_program|Paint.NET_like_program]]
<pre>
 
sudo apt install pinta
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.
</pre>
Now open an image. Use the top left icon to select a rectangle area. Now click Edit -> Crop to selection. Done.


= Screencaster/Record desktop =
= Screencaster/Record desktop =
Line 877: Line 892:
* [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.
* [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.
* [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!)
* [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!)
* [https://www.makeuseof.com/best-linux-screen-recording-apps/ The 8 Best Linux Screen Recording Apps to Capture Your Screen]


== [https://launchpad.net/kazam kazam] ==
== [https://launchpad.net/kazam kazam] ==
Line 930: Line 946:


= Second screen =
= Second screen =
== Deskreen ==
== 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.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]
* [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.


== VirtScreen ==
== VirtScreen ==
Line 949: Line 971:


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


Line 1,008: Line 1,034:
== Set static IP ==
== Set static IP ==
[https://www.makeuseof.com/configure-static-ip-address-settings-ubuntu-22-04/ How to Configure Static IP Address on Ubuntu 22.04 LTS]. Method 1: nmcli Command, Method 2: Netplan, Method 3: GUI.
[https://www.makeuseof.com/configure-static-ip-address-settings-ubuntu-22-04/ How to Configure Static IP Address on Ubuntu 22.04 LTS]. Method 1: nmcli Command, Method 2: Netplan, Method 3: GUI.
[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]


[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.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://linuxize.com/post/how-to-configure-static-ip-address-on-ubuntu-18-04/ Ubuntu 18.04]. [https://www.tecmint.com/set-static-ip-address-in-ubuntu/#ubuntuserver How to Configure Static IP Address on Ubuntu 20.04] Starting with 17.10 release, '''Netplan''' is the default network management tool on Ubuntu. Below is an example on Ubuntu 18.04. PS. another file we may want to check is '''/etc/dhcpcd.conf'''.
[https://linuxize.com/post/how-to-configure-static-ip-address-on-ubuntu-18-04/ Ubuntu 18.04]. [https://www.tecmint.com/set-static-ip-address-in-ubuntu/#ubuntuserver How to Configure Static IP Address on Ubuntu 20.04] Starting with 17.10 release, '''Netplan''' is the default network management tool on Ubuntu. Below is an example on Ubuntu 18.04. 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'''.
<pre>
<pre>
$ sudo cat /etc/netplan/01-netcfg.yaml
$ sudo cat /etc/netplan/01-netcfg.yaml
Line 1,026: Line 1,056:
       nameservers:
       nameservers:
           addresses: [8.8.8.8, 1.1.1.1]
           addresses: [8.8.8.8, 1.1.1.1]
$ sudo netplan apply
$ sudo netplan apply # or sudo netplan --debug apply  
$ ip a
$ ip a               # no reboot is necessary
</pre>
</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.


[https://www.cyberciti.biz/faq/add-configure-set-up-static-ip-address-on-debianlinux/ How to set up static IP address on Debian Linux 10/11].  
[https://www.cyberciti.biz/faq/add-configure-set-up-static-ip-address-on-debianlinux/ How to set up static IP address on Debian Linux 10/11].  
Line 1,170: Line 1,201:
* nmap utility; e.g. '''sudo nmap -sP 192.168.1.1/24'''  
* nmap utility; e.g. '''sudo nmap -sP 192.168.1.1/24'''  
* fing (terminal)
* fing (terminal)
== How to get connection to both wifi as well as LAN ==
* [https://askubuntu.com/a/639425 How to get connection to both wifi as well as LAN in ubuntu 14.04 LTS?]
** 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]


== wireless connection randomly drop off: iwconfig, iwconfig ==
== wireless connection randomly drop off: iwconfig, iwconfig ==
Line 1,380: Line 1,418:


= Font =
= Font =
== Large text ==
== Large text, monitor scaling, HiDPI displays ==
This is useful on large screen displays or TVs.  
* 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
Settings -> Universal Access on Ubuntu or Accessibility on Linux Mint. Turn on "Large text". Each application's name on the Linux Mint's taskbar, title on each application and texts in applications will be increased.
* https://wiki.archlinux.org/title/HiDPI


== Install Microsoft Font in linux suite ==
== Install Microsoft Font in linux suite ==
Line 1,619: Line 1,657:


= Nautilus [https://wiki.gnome.org/action/show/Apps/Files Files] or Nemo (File Manager) =
= Nautilus [https://wiki.gnome.org/action/show/Apps/Files Files] or Nemo (File Manager) =
[https://www.makeuseof.com/best-nautilus-tweaks-linux/ The 11 Best Nautilus Tweaks to Get More Out of the File Manager on Linux]
== Bookmark the current directory to the sidebar ==
== Bookmark the current directory to the sidebar ==
Ctrl + d. See also Files > Keyboard Shortcuts.  
Ctrl + d. See also Files > Keyboard Shortcuts.  
Line 1,917: Line 1,957:


= ProFTPd =
= 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]
* [https://www.makeuseof.com/install-proftpd-on-ubuntu/ How to Install and Set Up ProFTPD With TLS on Ubuntu]


= Install LAMP =
= Install LAMP =
Line 2,232: Line 2,272:


= Keep a linux process running after log out =
= Keep a linux process running after log out =
See also [[Terminal_multiplexer|Terminal multiplexer]] page.
* http://linux.101hacks.com/unix/nohup-command/
* http://linux.101hacks.com/unix/nohup-command/
* http://serverfault.com/questions/311593/keeping-a-linux-process-running-after-i-logout
* http://serverfault.com/questions/311593/keeping-a-linux-process-running-after-i-logout
* [https://www.howtogeek.com/804823/nohup-command-linux/ How to Use the nohup Command in Linux]
<pre>
<pre>
# nohup command-with-options &
# nohup command-with-options &
Line 2,266: Line 2,309:


You might also want to set the default player in the sound menu.
You might also want to set the default player in the sound menu.
== Trim ==
[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.
== Compress audio files ==
[https://www.makeuseof.com/tag/tools-compress-audio-files/ How to Compress Large Audio Files: 5 Easy and Effective Ways]


== Audio editing ==
== Audio editing ==
Line 2,347: Line 2,396:


== Music player ==
== Music player ==
[https://www.makeuseof.com/best-linux-music-player-apps/ The 15 Best Linux Music Player Apps]
* [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


== Podcast ==
== Podcast ==
Line 2,690: Line 2,740:


== Grafana ==
== Grafana ==
* [https://www.howtoforge.com/tutorial/ubuntu-grafana-monitoring/ How to Install Grafana Monitoring Tool on Ubuntu 18.04 LTS]
* [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]
* [https://www.instructables.com/id/Bird-Feeder-Monitor-V20/ Bird Feeder Monitor V2.0]
== 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]


== I-Nex ==
== I-Nex ==
Line 2,705: Line 2,760:
http://www.tecmint.com/corefreq-linux-cpu-monitoring-tool/
http://www.tecmint.com/corefreq-linux-cpu-monitoring-tool/


== System load indicator on desktop ==
== 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]
* [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].


It is used to view system information (cpu, memory, network) in real-time.
<pre>
<pre>
sudo apt-get install indicator-multiload
sudo apt-get install indicator-multiload
Line 2,722: Line 2,778:
[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]
[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]


== GNOME resource monitor on taskbar ==
== Top processes sorted by RAM or CPU ==
* '''sudo apt install indicator-multiload'''  See [https://askubuntu.com/a/866337 How can I add the current CPU usage to my menu bar as a percentage?]. 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].
[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'''
 
== Monitor Resource Usage of a Single Process ==
[https://www.baeldung.com/linux/monitor-process-resource-usage Monitor Resource Usage of a Single Process]


= Hard drive: hdparm and smartctl =
= Hard drive: hdparm and smartctl =
Line 2,939: Line 2,998:


== Dropbox ==
== Dropbox ==
* From the official website:
See [[Software#Ubuntu|Software > Dropbox]].
** [https://www.dropbox.com/install-linux Dropbox Headless Install via command line]
** [https://help.dropbox.com/installs-integrations/desktop/uninstall-dropbox How to uninstall Dropbox on your computer]
** [https://help.dropbox.com/installs-integrations/desktop/advanced-reinstall How to run an advanced reinstall of Dropbox]
* [https://www.linuxbabe.com/ubuntu/install-dropbox-headless-ubuntu-server How to Install Dropbox on a Headless Ubuntu Server] 2020
<ul>
<li>[https://www.how2shout.com/linux/install-dropbox-gui-or-headless-on-ubuntu-20-04-lts/ How to install Dropbox GUI or Headless on Ubuntu 20.04 LTS] (works)
{{Pre}}
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
~/.dropbox-dist/dropboxd
sudo wget -O /etc/systemd/system/[email protected] \
  https://raw.githubusercontent.com/joeroback/dropbox/master/dropbox%40.service
sudo systemctl enable dropbox@$(whoami)
sudo systemctl start dropbox@$(whoami)
sudo systemctl status dropbox@$(whoami)
curl -LO https://www.dropbox.com/download?dl=packages/dropbox.py
sudo mv dropbox.py /opt/
sudo ln -s /opt/dropbox.py /usr/bin/dropbox
 
sudo dropbox update
</pre>
Question: how to know there is a new update?
</li>
</ul>
* [https://linoxide.com/install-dropbox-ubuntu/ Some command-line examples]


== Google Drive ==
== Google Drive ==
Line 3,117: Line 3,152:
== View exif information ==
== View exif information ==
gThumb works fine.
gThumb works fine.
== Remove Metadata From Files: exiftool ==
[https://www.makeuseof.com/remove-metadata-from-files-in-linux/ How to Quickly Remove Metadata From Files on Linux]


= Mind-mapping =
= Mind-mapping =
* [http://www.xmind.net/ xmind]
* [http://www.xmind.net/ xmind]
* [http://freemind.sourceforge.net/wiki/index.php/Main_Page FreeMind]
* [http://freemind.sourceforge.net/wiki/index.php/Main_Page FreeMind]
= Sticky notes =
[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).
[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.


= Password manager =
= Password manager =
Line 3,156: Line 3,198:


=== [https://github.com/keeweb/keeweb KeeWeb]: Free cross-platform password manager compatible with KeePass ===
=== [https://github.com/keeweb/keeweb KeeWeb]: Free cross-platform password manager compatible with KeePass ===
[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-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]
[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.
It can open from WebDAV, Dropbox (sync and offline access), Google Drive, OneDrive, ...
 
A Docker exists for the self hosting method.


== 1Password ==
== 1Password ==
Line 3,278: Line 3,317:
== Change the default browser ==
== Change the default browser ==
[https://linuxhint.com/open-default-browser-command-line-linux/ How to open default browser from command line Linux]
[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 =
= Unity display timeout =
Line 3,402: Line 3,444:


= AppImage file - new way of installing an application =
= AppImage file - new way of installing an application =
http://appimage.org/ AppImage
See [[Snappy#AppImage|Snappy]]
 
We need to make the file executable before we can open it. Right click the file, Properties -> Permissions.
 
'''One problem of the AppImage files is they cannot be found in Ubuntu's launcher/search function.'''
 
[http://askubuntu.com/questions/774490/what-is-an-appimage-how-do-i-install-it What is an “AppImage”? How do I install it?]
* AppImages can be downloaded and '''run without installation or the need for root rights'''.
* The key idea of the AppImage format is one app = one file. Every AppImage contains an app and all the files the app needs to run. In other words, each AppImage has no dependencies other than what is included in the targeted base operating system(s).
* [https://bytexd.com/how-to-install-and-configure-appimage-on-ubuntu/ Pros and Cons] No proper update system for AppImage currently. Terminal command completion solution doesn’t work
* [https://linuxconfig.org/how-to-create-an-integrated-application-launcher-for-an-appimage-file-in-ubuntu How to Create an Integrated Application Launcher For an Appimage file in Ubuntu]
* [https://itsfoss.com/cant-run-appimage-ubuntu/ Can’t Run AppImage on Ubuntu 22.04? Here’s How to Fix it]
 
Some examples
* [http://avidemux.sourceforge.net/download.html Avidemux]
* Cura
* [https://www.falkon.org/download/ falkon] browser
* [https://inkscape.org/ Inkscape]


= Snappy =
= Snappy =
Line 3,429: Line 3,454:
</pre>
</pre>


= [https://flatpak.org/ Flatpak] and Flathub =
= Flatpak =
* Sublime, GIMP, Spotify, Visual Studio Code, Marker, Gradio, VLC, Android Studio, Audacity, Atom, FileZilla, draw.io desktop, [https://flathub.org/apps/details/com.github.geigi.cozy Cozy] and others.
See [[Snappy#Flatpak|Snappy]]
* [https://flatpak.org/setup/ Flatpak setup], [http://docs.flatpak.org/en/latest/using-flatpak.html Using flatpak]
* [https://www.addictivetips.com/ubuntu-linux-tips/use-and-install-flatpak/ How To Use And Install FlatPak On Linux].
* [https://www.omgubuntu.co.uk/2019/02/how-to-install-flatpak-on-ubuntu-flathub How to Install Flatpak and Use Flatpak Ubuntu (Step-by-Step Guide)]
 
Consider the [https://flathub.org/apps/details/de.haeckerfelix.gradio Gradio] app.
{{Pre}}
$ flatpak install de.haeckerfelix.gradio.flatpakref # it will ask the password in a new window
$ flatpak uninstall de.haeckerfelix.gradio
</pre>
Now we can launch the Gradio app from the Launch Menu.
 
Note: no 'sudo' is required.
 
== Remove unused flatpak runtimes ==
[https://www.linuxuprising.com/2019/02/how-to-remove-unused-flatpak-runtimes.html How To Remove Unused Flatpak Runtimes To Free Up Disk Space]
 
== How to update a flatpak app ==
[https://www.linux.com/training-tutorials/how-install-and-use-flatpak-linux  How to Install and Use Flatpak on Linux]
 
<pre>
flatpak list
 
sudo flatpak update org.gimp.GIMP
</pre>
 
== Where are the files ==
https://github.com/flatpak/flatpak/wiki/Filesystem
 
* .local/share/flatpak
* /var/lib/flatpak/app


= Message Of The Day, login banner /etc/motd =
= Message Of The Day, login banner /etc/motd =
Line 3,478: Line 3,473:
* [https://github.com/Grumbel/jstest-gtk/ jstest-gtk]  
* [https://github.com/Grumbel/jstest-gtk/ jstest-gtk]  
* [https://www.howtoforge.com/tutorial/how-to-configure-your-gamepad-on-ubuntu/ Xbox wireless Gamepad]
* [https://www.howtoforge.com/tutorial/how-to-configure-your-gamepad-on-ubuntu/ Xbox wireless Gamepad]
* [https://askubuntu.com/questions/32031/how-do-i-configure-a-joystick-or-gamepad How do I configure a joystick or gamepad?]
* [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]


= Twitter client =
= Twitter client =
Line 3,526: Line 3,538:
* '''vmlinuz-5.8.0-48-generic''' or '''config-5.8.0-48-generic''' or '''System.map-5.8.0-48-generic''': same size
* '''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
* '''initrd.img-5.8.0-48-generic''': not the same size
= BIOS =
[https://fwupd.org/ fwupdmgr]. I got the following message when I ran a ssh connection.
<pre>
1 device has a firmware upgrade available.
Run `fwupdmgr get-upgrades` for more information.
</pre>


= Other Flavors =
= Other Flavors =

Revision as of 22:38, 26 February 2023

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

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
  • edit ~/.bashrc to add alias, colored man pages, colored prompt, time stamp to bash prompt, time stamp to history command
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
export HISTSIZE=
export HISTFILESIZE=
export HISTTIMEFORMAT="%y%m%d %T "
PS1="\[\033[1;34m\]\$(date +%H:%M%p) \w$\[\033[0m\] "
alias nano="nano -c --softwrap"
alias sshnocheck="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
alias open='xdg-open'

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 resolution

xrandr. It shows as 20" 1360x768 (16:9) on my 2005 19" Sharp TV 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).

Display Manager

Display server: Wayland Xorg

How to Switch Between Xorg and Wayland in Ubuntu

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

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

If you like to suspend immediately, use

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

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.

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

https://github.com/ventoy/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

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)

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

gnome-screenshot (preinstalled in Ubuntu)

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

# Current window
gnome-screenshot -w

# an area
gnome-screenshot -a

# delay
gnome-screenshot --delay=[SECONDS]

# interactive mode
gnome-screenshot -i

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

# copy to the clipboard
gnome-screenshot -c

Shutter (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

kazam

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

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

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

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

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

A good introduction Create Screencast Videos With Ease Using Kazam

SimpleScreenRecorder (Qt based)

source code and this article

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

VokaScreen

It is used in youtube videos of QML tutorials.

Istanbul

Saved files are in the ogg format.

sudo apt-get install istanbul

RecordMyDesktop

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

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

OBS Studio (cross platform)

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

Netplan and Ubuntu 18.04

How to configure Network Settings in Ubuntu 18.04 Bionic Beaver

Set static IP

How to Configure Static IP Address on Ubuntu 22.04 LTS. Method 1: nmcli Command, Method 2: Netplan, Method 3: GUI.

How to Add an Additional IP Address to Your Linux Server

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.

Ubuntu 18.04. How to Configure Static IP Address on Ubuntu 20.04 Starting with 17.10 release, Netplan is the default network management tool on Ubuntu. Below is an example on Ubuntu 18.04. 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.

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

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.121.199/24
      gateway4: 192.168.121.1
      nameservers:
          addresses: [8.8.8.8, 1.1.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.

How to set up static IP address on Debian Linux 10/11. Information below is outdated on Ubuntu but works on Debian.

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

Now edit the file /etc/network/interfaces

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

After it, restart the network by issuing

# /etc/init.d/networking restart
sudo service network-manager restart

OR sudo reboot

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

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

How to Install a DHCP Server in Ubuntu and Debian

File Server

Network File System (NFS)

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

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

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

Server part:

sudo apt-get install nfs-kernel-server

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

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

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

To start the NFS server:

sudo service nfs-kernel-server start

Client part:

PS.

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

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

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

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

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

Some help:

Boot from an NFS server

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

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

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

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

Samba

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.

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

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

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

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

Nautilus Files or Nemo (File Manager)

The 11 Best Nautilus Tweaks to Get More Out of the File Manager on Linux

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.

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

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

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

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

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

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.

Stacer.png

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

https://www.howtoforge.com/tutorial/ubuntu-performance-monitoring/

$ sudo apt-get install lm-sensors
$ sensors

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

Feh is a light-weight command-line image viewer for Linux

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.

Other Flavors

Other tiny, lightweight Linux

Arch linux, Manjaro Linux

Arch Linux

SparkyLinux

7 Best Rolling Release Linux Distributions for People Who Want the Latest and Greatest of Kernel and Software 2021: openSUSE Tumbleweed, Arch Linux, Manjaro Linux, Solus Linux, Debian Testing, Void Linux, Gentoo Linux.

SparkyLinux is a lightweight, fast and simple Linux distribution designed for both old and new computers featuring customised Enlightenment and LXDE desktops. It has been built on the "testing" branch of Debian GNU/Linux.

It has two flavors of images: Stable and (Semi)Rolling (another good choice is MX Linux).

For example, r-base and ddclient programs are the latest when I checked them on my rolling release SparkyLinux.

Minimum system requirements

Past releases