Ubuntu settings

This article contains mainly the useful stuff I found in the Internet, but there are some things which I developed myself. This is my cheat-sheet, in order not to search the web again. If it turns out to be useful for somebody else, I will only be glad. These settings were made for Ubuntu 18.04 LTS.

Here’s the previous version for Ubuntu 16.04 LTS: Ubuntu16_settings.txt

========================= Make clonezilla live USB =====================
Format a USB flash stick into FAT32 and label it CZILLA-USB


cd ~/Downloads
wget https://dotsrc.dl.osdn.net/osdn/clonezilla/71320/clonezilla-live-20190707-disco-amd64.zip
unzip ~/Downloads/clonezilla-live-20190707-disco-amd64.zip -d /media/drew/CZILLA-USB
rm ~/Downloads/clonezilla-live-20190707-disco-amd64.zip
cd /media/drew/CZILLA-USB/utils/linux
sudo bash makeboot.sh /dev/sdd4

============================ Clonezilla -- make and restore partition image in batch/unattended mode  =====================

Add the following text to grub.cfg file, which is located in /boot/grub directory on your live USB or CD. The text should be added before this line:

menuentry "Clonezilla live (Default settings, VGA 800x600)"{

<<<<<<<<<<<

menuentry "Make image unattended from sda to 03-all"{
  search --set -f /live/vmlinuz
  linux /live/vmlinuz boot=live config noswap nolocales edd=on nomodeset noprompt ocs_prerun="mount /dev/sdb1 /mnt" ocs_prerun1="mount --bind /mnt/Backup/DiskImages /home/partimag/" ocs_live_run="ocs-sr -q2 -c -j2 -z1p -i 4096 -sfsck -scs -senc --batch -p reboot savedisk 03-all sda" ocs_live_extra_param="" ocs_live_keymap="NONE" keyboard-layouts=NONE ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia nosplash ocs_numlk=on
  initrd /live/initrd.img
}

menuentry "Restore image unattended from 03-all to sda3"{
  search --set -f /live/vmlinuz
  linux /live/vmlinuz boot=live config noswap nolocales edd=on nomodeset noprompt ocs_prerun="mount /dev/sdb1 /mnt" ocs_prerun1="mount --bind /mnt/Backup/DiskImages /home/partimag/" ocs_live_run="ocs-sr -g auto -e1 auto -e2 -r -j2 -k --batch -p reboot restoreparts 03-all sda3" ocs_live_extra_param="" ocs_live_keymap="NONE" keyboard-layouts=NONE keyboard-layouts=NONE ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia nosplash ocs_numlk=on
  initrd /live/initrd.img
} 

>>>>>>>>>>

Then replace the following parameters with your values in al places:
sda3 -- imaged partition 
03-all -- image name
/dev/sdb1 -- drive that will store the image
Backup/DiskImages -- path on the drive that will store the image
sda -- imaged drive


==================================== Edit ISO including bootable ones ==============================

sudo apt-get install isomaster

OR

https://poweriso.com/download-poweriso-for-linux.htm


============================ /tmp directory in RAM ===================
sudo gedit /etc/fstab

tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,mode=1777,size=8192M 0 0


================== Google calendar to accept invitations in Thunderbird 60 ===================

- In Preferences > Advanced (Tab) > General (stealthy subtab) > Config Editor (Button)
- Search for "calendar.google.enableEmailInvitations" and ensure the property is set to true
- Go to the calendar you want to use with your email, right click it and select "Properties"
- Change the "Email" field to the account you want to process invites for
- Click "OK"
- Go to an email invitation and you should now see the accept and decline buttons.


============== Cyrillic characters in Windows archives ================
sudo apt-add-repository ppa:hanipouspilot/file-roller
sudo apt-get update
sudo apt-get install file-roller


===================== Enable Edit As Administrator =====================

sudo apt install nautilus-admin
sudo nautilus -q


======================= Create ramdisk and start Digikam with its DB on ramdisk -- but better make /tmp in RAM ====================
sudo mkdir /mnt/ramdisk

/opt/digikam/start_with_ramdisk.sh :

pkexec mount -t tmpfs -o rw,size=512M tmpfs /mnt/ramdisk
cp -r -f /home/user1/Documents/digikam_db /mnt/ramdisk
sh /opt/digikam/AppRun
cp -r -f /mnt/ramdisk/digikam_db /home/drew/Documents
#pkexec umount /mnt/ramdisk
#the ramdisk will be unmounted after the next reboot

==================== Export OpenWRT router config ===============

ssh root@192.168.1.1 "uci export" > router.conf



============== Update installed software ==========

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

#========================== Make Linux use 'Local' time ==========================
timedatectl set-local-rtc 1

#================ Set the grub timeout and the grub default boot entry ===========

sudo gedit /etc/default/grub
sudo update-grub


====================================== Mount NTFS partition in fstab =======================

sudo mkdir /media/d1
sudo mkdir /media/d2
sudo blkid
sudo gedit /etc/fstab
UUID=7020AE1B20ADE874 /media/d1 ntfs-3g permissions,windows_names,locale=en_US.utf8 0 0
UUID=00C0C2ECC0C2E6CE /media/d2 ntfs-3g permissions,windows_names,locale=en_US.utf8 0 0

sudo mount -a


#=================== Simple GUI adjustments ==========================
- Desktop backround solid color
- remove unneccessary icons from the launcher
- keyboard repeat delay: Settings > Universal Access > Typing > Repeat keys -- Speed setting works in inverse
- Nautilus Bookmarks: drag and drop
- Language Support + Regional Formats
- Shortcuts on desktop
- Time & Date settings -- 24 H
- Install LibreOffice and adjust settings (name, units)
- setup Thunderbird: Startup Applications
- login to Firefox
- Link colors in LibreOffice Calc: Tools > Options > LibreOffice > Application Colors > Text Document > Field Shading 


======================== Switch lang with Alt-Space =========================

https://askubuntu.com/questions/1029588/18-04-ctrlshift-to-change-language

sudo apt-get install gnome-tweaks
gnome-tweaks
	Select Keyboard & Mouse tab
	Click Additional Layout Options button
	Expand Switching to another layout
gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['']"
gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward  "['']"
gsettings set org.freedesktop.ibus.general.hotkey triggers "['']"


======================== Enable Shell in Gnome tweaks =============

Enable ‘Shell theme’ in Gnome Tweak Tool in Ubuntu
=========== Install LibreOffice via PPA (snap version is slow) ======================= sudo add-apt-repository ppa:libreoffice/ppa sudo apt-get update sudo apt-get install libreoffice sudo apt-get install ppa-purge && sudo ppa-purge ppa:libreoffice/ppa ============== Install Thunderbird from PPA (snap version is old) ============== sudo add-apt-repository ppa:mozillateam/ppa sudo apt-get update sudo apt-get dist-upgrade sudo apt install thunderbird sudo apt-get install ppa-purge && sudo ppa-purge ppa:mozillateam/ppa ===================================================== ============ Laptop goes to sleep with lid closed before login and after logout =============== sudo gedit /etc/systemd/logind.conf Search for these lines and make them look like this (possibly by removing # in front or replacing suspend with ignore): HandleLidSwitch=ignore HandleLidSwitchDocked=ignore #============================= Disable password prompt in sudo (convenient but not secure -- do not forget to change it back!) ============================== #1. sudo visudo #Change: %sudo ALL=(ALL:ALL) ALL #to %sudo ALL=(ALL) NOPASSWD:ALL #2. sudo nano /etc/polkit-1/localauthority/50-local.d/99-nopassword.pkla [No password prompt] Identity=unix-group:sudo Action=* ResultActive=yes =============== Double Commander (snap version is old) ====================== sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/Alexx2000/xUbuntu_18.04/ /' > /etc/apt/sources.list.d/home:Alexx2000.list" wget -nv https://download.opensuse.org/repositories/home:Alexx2000/xUbuntu_18.04/Release.key -O Release.key sudo apt-key add - < Release.key sudo apt update sudo apt install doublecmd-gtk Configuration > Options -- "File views"->"Sorting directories"="sort like files and show first" Configuration > Options-Colors-File types Configuration > Options-Fonts-Main font Configuration > Options-Icons -- 16x16 Configuration > File views -- Show system and hidden files Configuration > Options > Behaviors > Drive black list: /home/ssh-ate/ATE;/home/ssh-ate/Dist;/home/ssh-ate/Dist-Work;/home/ssh-ate/Docs;/home/ssh-ate/ArchiveProjects;/home/ssh-ate/SupplierInfo;/home/ssh-ate/Lang;/home/ssh-ate/Music;/home/ssh-ate/Storage;/home/ssh-ate/video;/home/ssh-ate/inbox;/run/user/1000/gvfs;/media/user1/Win;*telegram-desktop.mnt;/run/snapd/ns*;/home/guests/Inbox-d2;/home/guests/video #==================== Install Notepadqq ================== sudo snap install --classic notepadqq #=================== Disable Gnome animation ========================= 0. Install Gnome Tweak Tool using Ubuntu Software 1. Appearance > Animations = Off =========================================== User groups ================================== sudo addgroup GROUP sudo adduser USERNAME GROUP groups USERNAME ================================= Share folder for Windows =============================== sudo apt-get install samba sudo useradd user2 sudo smbpasswd -a user2 sudo gedit /etc/hostname sudo gedit /etc/samba/smb.conf [global] usershare owner only = false workgroup = ATE and add to the end of the file: [d1] path = /media/d1 available = yes valid users = user1 read only = no browsable = yes public = yes writable = yes [d2] path = /media/d2 available = yes valid users = user1 read only = no browsable = yes public = yes writable = yes [User2] path = /media/d1/User2 available = yes valid users = user2 read only = no browsable = yes public = yes writable = yes [Pics] path = /media/d1/Pics available = yes valid users = user2 read only = no browsable = yes public = yes writable = yes path = /media/d2/video available = yes valid users = user2 read only = no browsable = yes public = yes writable = yes sudo gedit /etc/security/limits.conf add to the end: * - nofile 16384 root - nofile 16384 sudo service smbd restart ================================ Mount Windows Share ======================= https://ubuntuforums.org/showthread.php?t=2078120 sudo apt-get install cifs-utils sudo mkdir /media/user1/user1-pc-d sudo mkdir /media/user1/user1-pc-e sudo gedit ~/.smbcredentials username=msusername password=mspassword sudo chmod 600 ~/.smbcredentials sudo gedit /etc/fstab //user1-pc/d /media/user1/user1-pc-d cifs credentials=/home/user1/.smbcredentials,iocharset=utf8,sec=ntlm 0 0 //user1-pc/e /media/user1/user1-pc-e cifs credentials=/home/user1/.smbcredentials,iocharset=utf8,sec=ntlm 0 0 sudo mount -a =================== Install Skype ================================================= sudo -s cd ~/Downloads wget https://go.skype.com/skypeforlinux-64.deb dpkg -i skypeforlinux-64.deb rm skypeforlinux-64.deb =================== Install Viber -- not needed in latest version: replace libcurl3 with libcurl4 to avoid conficts with virtualbox ================================================= cd ~/Downloads wget http://download.cdn.viber.com/cdn/desktop/Linux/viber.deb dpkg-deb -x viber.deb viber dpkg-deb --control viber.deb viber/DEBIAN gedit ./viber/DEBIAN/control repace "libcurl3" with "libcurl4" dpkg -b viber vibernew.deb sudo dpkg -i vibernew.deb ============== Install Telegram ============= Install from Ubuntu Software OR sudo snap install telegram-desktop ================ Install 7zip and rar =========================================== sudo apt-get update sudo apt-get install rar unrar sudo apt-get install p7zip-rar p7zip-full ================ Start Chrome with a certain profile ================ google-chrome --profile-directory=Default google-chrome --profile-directory="Profile 1" ========================== Install Canon Lide 120 scanner driver ========================== sudo add-apt-repository ppa:rolfbensch/sane-git sudo apt-get install simple-scan sane-utils libsane libsane-common libsane-extras sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get -f install sudo gedit /lib/udev/rules.d/40-libsane.rules Add to the end: # Canon CanoScan Lide 120 ATTRS{idVendor}=="04a9", ATTRS{idProduct}=="190e", ENV{libsane_matched}="yes" Save, reboot, and run: sudo sane-find-scanner -v -v ========================== Install Canon LBP printer driver ========================== http://help.ubuntu.ru/wiki/canon_capt ========================== Install Java JRE or JDK ========================== sudo apt-get install default-jre sudo apt-get install default-jdk ========================== Java enabled browser ========================== palemoon ========================== Install Pulse Secure Client =================== cd ~/Downloads wget http://trial.pulsesecure.net/clients/ps-pulse-linux-5.3r3.0-b1021-ubuntu-debian-64-bit-installer.deb sudo dpkg -i ~/Downloads/ps-pulse-linux-5.3r3.0-b1021-ubuntu-debian-64-bit-installer.deb /usr/local/pulse/PulseClient_x86_64.sh install_dependency_packages ============ Disable Pidgin notifications =============== Ctrl-U -- Libnotify Popups -- Configure plugin ========================== Install Virtualbox 6.0.4 =================== cd ~/Downloads wget https://download.virtualbox.org/virtualbox/6.0.4/virtualbox-6.0_6.0.4-128413~Ubuntu~bionic_amd64.deb sudo dpkg -i ~/Downloads/virtualbox-6.0_6.0.4-128413~Ubuntu~bionic_amd64.deb wget https://download.virtualbox.org/virtualbox/6.0.4/Oracle_VM_VirtualBox_Extension_Pack-6.0.4-128413.vbox-extpack sudo virtualbox Oracle_VM_VirtualBox_Extension_Pack-6.0.4-128413.vbox-extpack sudo adduser $USER vboxusers In BIOS chage secure boot settings from “Windows UEFI” to “Other OS” and execute: modprobe vboxdrv =================== Install Teamviewer ============================= sudo apt-get install libqt5x11extras5 qtdeclarative5-controls-plugin qtdeclarative5-dialogs-plugin sudo apt-get -f install cd ~/Downloads wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb sudo dpkg -i ~/Downloads/teamviewer_amd64.deb https://download.teamviewer.com/download/linux/teamviewer_amd64.deb --------Login screen locked ---------------- sudo gedit /etc/gdm3/custom.conf WaylandEnable=false ============= Install Gnome panel (taskbar) also used for creating Desktop shortcuts (Launchers) through GUI ============ sudo apt update sudo apt install gnome-panel gnome-desktop-item-edit --create-new ~/Desktop OR gedit ~/Desktop/Chrome-home.desktop #!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Exec=/usr/bin/google-chrome --profile-directory=Default Name=Chrome home Comment=Chrome home Icon=/opt/google/chrome/product_logo_256.png gedit ~/Desktop/Chrome-work.desktop #!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Exec=/usr/bin/google-chrome --profile-directory="Profile 1" Name=Chrome work Comment=Chrome work Icon=/opt/google/chrome/product_logo_256.png Then allow execution in properties. ============== Sync folders -- Unison ============== Install from Ubuntu Software Run via launcher: /snap/unison-jz/19/bin/unison-2.51 -dontchmod -perms 0 Profiles stored at /home/user1/.unison/*.prf common.prf # Helps out a lot on Windows fastcheck = true # place new files at the top of the list sortnewfirst = true # turn on ssh compression rshargs = -C # Do not sync permissions dontchmod = true perms = 0 ignore = Name Thumbs.db ignore = Name *~ ignore = Name *.tmp ignore = Name _SYNCAPP ignore = Name metadata.xml unison profilename -batch ================== Windows software ================ - Dropbox -- Ubuntu Software - Draftsight (http://dl-ak.solidworks.com/nonsecure/draftsight/2018SP1/draftSight.deb) - text editor: notepadqq (regular expressions not working), Geany, SciTE - File manager -- Double Commander - FTP server -- OpenSSH - video player -- VLC, KM Player? - ultraISO -- UNetbootin + sudo apt-get install isomaster - photo manager -- digikam (alternatives: gThumb, KPhotoAlbum, Darktable, F-Spot, GTKRawGallery, Picty, Fotoxx) - ebook converter -- Calibre - audio capture -- Audio Recorder - audio editor -- Audacity - video capture (Screen recorder) -- Open Broadcaster Software (OBS) - video convert -- Handbrake (Selene?) - Video Editor -- Kdenlive - PDF Reader -- Evince ===================== Install Handbrake ============= sudo add-apt-repository ppa:stebbins/handbrake-releases sudo apt-get update sudo apt-get install handbrake-gtk sudo apt-get install handbrake-cli ==================== Install Selene =========== sudo apt-add-repository -y ppa:teejee2008/ppa sudo apt-get update sudo apt-get install selene =============== Install DraftSight ====================== cd ~/Downloads wget http://dl-ak.solidworks.com/nonsecure/draftsight/2019SP1/draftSight.deb sudo dpkg -i ~/Downloads/draftSight.deb ================ Install Audacity ================ sudo add-apt-repository ppa:ubuntuhandbook1/audacity sudo apt-get update sudo apt-get install audacity ============== Install Calibre ==================== sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main()" ====================== Install Audio Recorder =============== sudo add-apt-repository ppa:audio-recorder/ppa sudo apt-get -y update sudo apt-get install --reinstall audio-recorder ========== Install digikam -- /tmp should be in RAM =============== mkdir ~/digikam cd ~/digikam wget https://download.kde.org/stable/digikam/6.1.0/digikam-6.1.0-x86-64.appimage #!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Icon[en_US]=gnome-panel-launcher Name[en_US]=Digikam Exec=sh /home/user1/digikam/start_with_ramdisk.sh Name=Digikam Icon=/home/user1/digikam/digikam.png #!/bin/bash cp -r -f ~/digikam/digikam_db /tmp ~/digikam/digikam-6.1.0-x86-64.appimage cp -r -f /tmp/digikam_db ~/digikam rm -r -f /tmp/digikam_db ================== Install RDP ================ https://askubuntu.com/questions/592537/can-i-access-ubuntu-from-windows-remotely sudo apt-get update sudo apt-get install xrdp sudo apt-get install xfce4 echo xfce4-session >~/.xsession sudo gedit /etc/xrdp/startwm.sh The content should look like this (pay attention to the last line and ignore . /etc/X11/Xsession): " #!/bin/sh if [ -r /etc/default/locale ]; then . /etc/default/locale export LANG LANGUAGE fi startxfce4 " sudo service xrdp restart ==================================== Mount shares inside vbox ============================== ==================================== Mount shares inside vbox ============================== https://gist.github.com/estorgio/1d679f962e8209f8a9232f7593683265 Install Guest Additions CD image... sudo apt-get update sudo apt-get install build-essential linux-headers-`uname -r` sudo /media/cdrom/./VBoxLinuxAdditions.run sudo shutdown -r now mkdir /home/andrew/vboxshare sudo mount -t vboxsf shared /home/drew/vboxshare sudo nano /etc/fstab shared /home/drew/vboxshare vboxsf defaults 0 0 sudo nano /etc/modules Add the following line to /etc/modules and save vboxsf shutdown -r now ====================== Install WCM Commander (but Double Commander recommended) ===================================== 1. http://wcm.linderdaum.com/downloads/ #OR the latest version using GIT source: 2.1 Goto https://github.com/corporateshark/WCMCommander/ 2.2 Download ZIP 2.3 Unpack 2.4 Install "Synaptic Package Manager" using "Ubuntu Software" 2.5 Using Synaptic, install packages : libX11-dev libfreetype6-dev libssh2-1-dev libsmbclient-dev 2.6 Run in WCMCommander-master make all -B sudo make install -d /usr/bin ================ Remote desktop via VNC =============== vino-preferences gsettings set org.gnome.Vino require-encryption false #and forward port 5900 on the router ================== Configure cron scheduled tasks =========== touch ~/cronjobs.txt gedit ~/cronjobs.txt 0 20 * * * /snap/unison-jz/13/bin/unison-2.51 Work-Backup -batch -dontchmod -perms 0 30 20 * * 5 sh ~/archive-work.sh touch ~/archive-work.sh gedit ~/archive-work.sh #!/bin/sh 7z a -pPASSWORD /media/d2/Inbox-d2/Backup/Work-$(date +%Y-%m-%d).7z /media/d1/Work > archive-work.log Make it hidden and executable: cmod 700 ~/archive-work.sh crontab -u user1 ~/cronjobs.txt crontab -l grep CRON /var/log/syslog ================= Install OpenVPN =============== sudo apt-get update sudo apt-get install openvpn sudo openvpn --config /media/d1/configfile.ovpn ============ Install OpenSSH ================= https://www.digitalocean.com/community/tutorials/how-to-enable-sftp-without-shell-access-on-ubuntu-16-04 https://en.wikibooks.org/wiki/OpenSSH/Cookbook/File_Transfer_with_SFTP#SFTP-only_Accounts sudo apt install openssh-server sudo mkdir -p /home/ssh-grp sudo chown user1:grp /home/ssh-grp sudo chgrp grp /home/ssh-grp sudo mkdir -p /home/ssh-grp/ftp-dir1 sudo mkdir -p /home/ssh-grp/ftp-dir2 sudo chown root /home/ssh-grp sudo gedit /etc/fstab /media/d1/FTP/dir1 /home/ssh-grp/ftp-dir1 none bind /media/d1/FTP/dir2 /home/ssh-grp/ftp-dir2 none bind sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults sudo gedit /etc/ssh/sshd_config Port NNN PermitRootLogin no Subsystem sftp internal-sftp #add to the end: Match user user1 ChrootDirectory /media ForceCommand internal-sftp PasswordAuthentication yes PermitTunnel no AllowAgentForwarding no AllowTcpForwarding no X11Forwarding no Match Group grp ChrootDirectory /home/ssh-grp ForceCommand internal-sftp PasswordAuthentication yes PermitTunnel no AllowAgentForwarding no AllowTcpForwarding no X11Forwarding no tail -f /var/log/auth.log sudo systemctl restart ssh ================= Hide users =============== printf "[User]\nSystemAccount=true" | sudo tee /var/lib/AccountsService/users/user1 > /dev/null =========== Firewall ============= https://www.digitalocean.com/community/tutorials/how-to-setup-a-firewall-with-ufw-on-an-ubuntu-and-debian-cloud-server sudo apt-get install ufw sudo ufw status sudo ufw app list sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow 11111/tcp sudo ufw deny OpenSSH sudo ufw allow Samba sudo ufw allow CUPS sudo ufw enable sudo ufw status =========== File permissions ======= http://manpages.ubuntu.com/manpages/xenial/en/man8/ntfs-3g.8.html
Ownership and Permissions
sudo chown -R user1:user1 /media/d1 sudo chmod -R u+rwX,g+rX,go-w,o-rX /media/d1 sudo chown -R user1:user1 /media/d2 sudo chmod -R u+rwX,g+rX,go-w,o-rX /media/d2 sudo chgrp -R ate /media/d1/dir1 sudo chgrp -R ate /media/d1/dir2 sudo chown -R user2:home /media/d1/dir3 sudo chmod -R g+w /media/d1/dir3 sudo chmod -R o+X /media/d1/dir3 sudo chmod -R g+w /media/d1/FTP/inbox ========================== Make ISO image ================= mkisofs -allow-lowercase -allow-multidot -J -joliet-long -jcharset utf-8 -o /media/d1/Pics/My_photo/Archive/2017.iso /media/d1/Pics/My_photo/2017/08-July ================ Download an offline website mirror, make and mount ISO image =============== sudo apt-get install webhttrack bash process_after_httrack.sh sudo mkdir /media/user1/iso sudo mount -o loop /media/d1/Stasia/offline-websites/doctorberezovska_com_2018-02-25.iso /media/user1/iso sudo umount /media/user1/iso -----------process_after_httrack.sh--------- #!/bin/bash source_path=/media/d2/Temp/HTTrack project_name=doctorberezovska_com temp_path=/media/d1/Temp iso_path=/media/d1/Stasia/offline-websites url_prefix=http:/ pagename=index.html basepath=$temp_path/$project_name cp -r $source_path/$project_name $temp_path rm -rf $basepath/hts-cache #delete all folders "feed" find $basepath -type d -name feed -exec rm -r {} \; #delete all files index????.html find $basepath -type f -name index????.html -exec rm -r {} \; find $basepath -type f -name index.html -size 0c > empty_indexes.txt #download empty index.html files while read -ru 3 LINE; do #replace basepath with http prefix in each line urlpath=${LINE/$basepath/$url_prefix} #delete index.html in each line urlpath=${urlpath/$pagename} wget -k --output-document="$LINE" $urlpath done 3< empty_indexes.txt find $basepath -type f -name *.html > all_html.txt while read -ru 3 LINE; do #Replace http://doctorberezovska.com/ with ../ #Some links are not replaced by HTTrack. This replacement will only work for level 1 pages, but they are the majority. A universal replacement is too complicated. #Also delete trash after sed -i 's_http://doctorberezovska.com/_../_g;/<\/html>/q' $LINE done 3< all_html.txt grep Error: $basepath/hts-log.txt >errors.txt rm -rf $basepath/hts-log.txt mkisofs -r -iso-level 4 -o $iso_path/$project_name"_"$(date +%Y-%m-%d).iso $basepath rm -rf $basepath ---------------------------------------------- ========================== Burn ISO e.g. ================ sudo fdisk -l sudo umount /dev/sdd sudo dd bs=4M if=/media/d1/Dist/Util/Hdd-tools/WinPE10_8_Sergei_Strelec/WinPE10_Sergei_Strelec_x64_2018.01.05_English_lite.iso of=/dev/sdd status=progress oflag=sync OR if bootable USB flash sudo add-apt-repository ppa:gezakovacs/ppa sudo apt-get update sudo apt-get install unetbootin sudo QT_X11_NO_MITSHM=1 /usr/bin/unetbootin ====================== SVN and Git GUI client ================= sudo add-apt-repository ppa:rabbitvcs/ppa sudo apt-get update sudo apt-get install rabbitvcs-cli rabbitvcs-core rabbitvcs-gedit rabbitvcs-nautilus rabbitvcs-nautilus3 sudo apt-get remove rabbitvcs* OR RapidSVN in UbuntuSoftware rep =========== Check existing application =============== /usr/share/applications ========== Download Youtube video ======== sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl sudo chmod a+rx /usr/local/bin/youtube-dl ============= Separate output audio devices for each app ============================ sudo apt-get install pavucontrol pavucontrol =============== Change display resolution ============== xrandr --output HDMI-1 --mode 1920x1200 xrandr --output HDMI-1 --mode 1920x1080 xrandr --output HDMI-1 --mode 1280x960 ========== Access Google Drive ========== GUI - https://www.omgubuntu.co.uk/2016/08/use-google-drive-ubuntu-16-04-linux-desktops Mount - https://www.techrepublic.com/article/how-to-mount-your-google-drive-on-linux-with-google-drive-ocamlfuse/ Mount - http://xmodulo.com/mount-google-drive-linux.html =============== On input source change the scroll lock toggles ======================= sudo gedit /etc/default/keyboard XKBOPTIONS="grp:alt_shift_toggle,grp_led:scroll" #XKBOPTIONS="grp:alt_shift_toggle" gsettings reset org.gnome.desktop.input-sources xkb-options ========================= Batch resize images recursively ================================= sudo apt-get update sudo apt-get install imagemagick -y OR (compile if needed) sudo apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y cd ~/Downloads wget https://www.imagemagick.org/download/ImageMagick.tar.gz tar xf ImageMagick.tar.gz cd ImageMagick-7* ./configure make sudo make install sudo ldconfig /usr/local/lib find . -name '*.jpg' -execdir mogrify -resize 1920x1440 {} \; find . -name '*.JPG' -execdir mogrify -resize 1920x1440 {} \; find . -name "*.jpg" | xargs mogrify -resize 50% find . -name "*.JPG" | xargs mogrify -resize 50% find . -name '*.png' -execdir mogrify -format jpg {} \; find . -name '*.PNG' -execdir mogrify -format jpg {} \; ========== Disable MySQL from startup ========= sudo /etc/init.d/mysql stop sudo systemctl disable mysql sudo systemctl enable mysql sudo /etc/init.d/mysql start =============== Rename all .MP3 to .mp3 files =========== sudo apt install rename rename 's/.MP3$/.xxx/' *.MP3 rename 's/.xxx$/.mp3/' *.xxx ============ Randomize (shuffle) all .mp3 files ================= for f in *.mp3 *.MP3; do mv "$f" $RANDOM.mp3; done ==================== Batch rename files in text editor ================= sudo apt install renameutils qmv ================================ Clean up ========== sudo apt autoremove sudo apt-get autoremove sudo apt-get clean journalctl --vacuum-time=2d dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge sudo sh delete_old_snaps.sh #!/bin/bash # Removes old revisions of snaps # CLOSE ALL SNAPS BEFORE RUNNING THIS set -eu snap list --all | awk '/disabled/{print $1, $3}' | while read snapname revision; do snap remove "$snapname" --revision="$revision" done

7 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *