Skip to content

Problems and solutions when setting up various Linux distros for personal laptop.

License

Notifications You must be signed in to change notification settings

tqa236/OS-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ubuntu configuration

Process to set up Ubuntu environment for personal laptop.

  1. Fix Time Differences in Ubuntu 16.04 & Windows 10 Dual Boot

(Source: http://ubuntuhandbook.org/index.php/2016/05/time-differences-ubuntu-1604-windows-10/)

timedatectl set-local-rtc 1 --adjust-system-clock
  1. Set the grub default boot entry to remember last choice

(Source: https://askubuntu.com/questions/148662/how-to-get-grub2-to-remember-last-choice)

Put the following in /etc/default/grub:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then run:

sudo update-grub
  1. Install terminator
sudo apt update
sudo apt install terminator

If there is a No release file error, go to Software & Updates -> Other Software and uncheck 2 lines that have the word Terminator in them.

  1. Install Atom

Update (02/02/2020)

sudo snap install atom --classic

(Source: https://flight-manual.atom.io/getting-started/sections/installing-atom/)

curl -sL https://packagecloud.io/AtomEditor/atom/gpgkey | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packagecloud.io/AtomEditor/atom/any/ any main" > /etc/apt/sources.list.d/atom.list'
sudo apt update
sudo apt install atom

If there is a public key error, see #11, replace the public key in #11 buy the public key shown on terminal

Python packages: atom-beautify, autocomplete-python, compare-files, docblock-python, linter, linter-flake8, linter-pydocstyle, pretty-json, python-autopep8, python-tools, python-yapf, script, linter-mypy, linter-pylint

C++ packages: atom-ctags, atomic-rtags, autocomplete-ctags, linter-clang, atom-terminal-panel, switch-header-source

  1. Configure Firefox
  • Restore previous section
  • Always ask you where to save files
  • Install Adblock Plus and EverSync
  1. Ubuntu hangs on boot

(Source: https://askubuntu.com/questions/764568/ubuntu-16-04-hangs-on-shutdown-restart)

  1. Ubuntu 16.04 freezes on restart

Update 2020/06/02 for Ubuntu 20.10: Need to upgrade graphic drivers

(Source: http://michalorman.com/2013/10/fix-ubuntu-freeze-during-restart/)

Put the following in /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash reboot=pci"

Then run:

$ sudo update-grub
  1. Update graphical card drivers for Ubuntu

Update 2020/06/02 for Ubuntu 20.10 (https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-20-04-focal-fossa-linux)

ubuntu-drivers devices
sudo ubuntu-drivers autoinstall

(Source: https://www.howtogeek.com/242045/how-to-get-the-latest-nvidia-amd-or-intel-graphics-drivers-on-ubuntu/)

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-415 # Use the latest one
  1. Install R & RStudio on Ubuntu

(Source: https://gist.github.com/mGalarnyk/41c887e921e712baf86fecc507b3afc7#file-rstudioubuntu1604-sh)

  1. Install Anaconda with zsh

(Source: https://stackoverflow.com/questions/31615322/zsh-conda-pip-installs-command-not-found)

  1. Fix GPG Error
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5

(Source: https://chrisjean.com/fix-apt-get-update-the-following-signatures-couldnt-be-verified-because-the-public-key-is-not-available/)

  1. Add conda environment to Jupyter Lab

(Source: https://stackoverflow.com/questions/53004311/how-to-add-conda-environment-to-jupyter-lab)

$ conda activate cenv
(cenv)$ conda install ipykernel
(cenv)$ ipython kernel install --user --name=<any_name_for_kernel>
(cenv($ conda deactivate
  1. Move /home to a new partition

(source: https://help.ubuntu.com/community/Partitioning/Home/Moving)

  1. Solve BIOS and UEFI incompatibility

(Source: http://www.rodsbooks.com/refind/)

Install rEFInd

  1. Install Vietnamese keyboard

(Source: https://vinasupport.com/huong-dan-cai-bo-go-tieng-viet-ibus-unikey-tren-ubuntu/)

Use ibus-ubuntu

  1. Fix error: unknown filesystem while installing Arch Linux

(Source: https://askubuntu.com/questions/142300/how-to-fix-error-unknown-filesystem-grub-rescue)

  1. Auto-intall all Atom packages

(Source: https://discuss.atom.io/t/installed-packages-list-into-single-file/12227/2)

apm list --installed --bare > package-list.txt
apm install --packages-file package-list.txt
  1. Fix "Unable to lock the administration directory"

(Source: https://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process)

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
sudo dpkg --configure -a
  1. Recursively find all files with a given name
find . -name "foo*"
  1. The difference between $ and # in command line commands?

(Source: https://stackoverflow.com/questions/35104339/what-does-the-mean-in-command-line-commands/48215530#48215530)

$ is there to tell you that this command needs to be executed as a regular user. # commands must be executed as root

  1. Check for large softwares
# sudo apt install wajig
wajig large
  1. Delete all remote branches except master on Git
git branch -r |  grep "^  ${REMOTE}/" | sed "s|^  ${REMOTE}/|:|" | grep -v "^:HEAD" | grep -v "^:${MASTER}$" | xargs git push ${REMOTE}
  1. Create ssh config file to connect to a remote server
touch ~/.ssh/config
chmod 600 ~/.ssh/config
  1. ssh connect without password
ssh-copy-id remote_username@server_ip_address
  1. Share keyboard and mouse between multiple computers

(Souce: https://askubuntu.com/questions/1064465/free-software-to-share-mouse-and-keyboard-between-linux-and-windows)

For now, only work if Ubuntu is a server and Windows is a client

  1. Install zsh plugins
[[ -a "/etc/zsh_command_not_found" ]] && . /etc/zsh_command_not_found
  1. Sort directories by size
du -h --max-depth=1 | sort -hr
  1. cannot create temp file for here-document: No space left on device

Use this command to find the big files, then delete only the big files.

du -hs /tmp /var/log 
  1. Delete caches

This will delete everything in your .cache that was last accessed more than a year ago

find ~/.cache/ -type f -atime +365 -delete

If you're nervous about running it, this will show you what's going to be deleted:

find ~/.cache/ -depth -type f -atime +365
  1. Find and remove content with sed
find . -type f -exec sed -i "s/foo/bar/g" {} \;
  1. Update all
alias sync_clock="sudo ntpdate pool.ntp.org"
alias snap_update="sudo snap refresh"
alias update="sudo apt update -y"
alias upgrade="sudo apt full-upgrade -y"
alias dist="sudo apt dist-upgrade -y"
alias autorm="sudo apt autoremove -y"
alias autoclean="sudo apt autoclean"
alias conda_update="conda update -n base conda -y; conda update --all -y"

alias maintain="sync_clock; snap_update; update; upgrade; dist; autorm; autoclean; conda_update"

  1. Install Ubuntu from Windows without a USB

It's a nightmare. Not sure which one works.

  1. Atom: [Linter] Error running clang: Failed to spawn command clang

Must install clang:

sudo apt install clang
  1. Open an mp4 video
sudo apt-get install ubuntu-restricted-extras
  1. Set JAVA_HOME
sudo nano /etc/environment

Then

JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
  1. Debug slow zsh

Run the command set -x to see which library causes the slowness. Run set +x to turn it off

  1. Make zsh's git module run faster
git config --add oh-my-zsh.hide-status 1
git config --add oh-my-zsh.hide-dirty 1
  1. Terminator's Ctrl+Shift+E not working in Bionic
  • launch ibus-setup,
  • select emoji tab,
  • change the shortcut or remove it
  1. Find package location installed by apt
dpkg -L <package>
  1. Find public IP using command line
curl ifconfig.me
  1. Check if a port is open for an IP/VM/site
telnet <Public IP> <port>
  1. Unzip multiple files to a folder with the same name (https://askubuntu.com/questions/518370/extract-several-zip-files-each-in-a-new-folder-with-the-same-name-via-ubuntu-t)

The flag -n is used to unzip only non existed files (https://askubuntu.com/questions/994731/how-to-skip-unzipping-a-file-that-already-exists)

find . -name '*.kmz' -exec sh -c 'unzip -n -d "${1%.*}" "$1"' _ {} \;
  1. Remove a file from a Git repository without deleting it from the local filesystem (https://stackoverflow.com/questions/1143796/remove-a-file-from-a-git-repository-without-deleting-it-from-the-local-filesyste)
git rm --cached mylogfile.log
  1. Fix a corrupt zsh history file (https://shapeshed.com/zsh-corrupt-history-file/)
mv ~/.zsh_history ~/.zsh_history_bad
strings -eS ~/.zsh_history_bad > ~/.zsh_history
fc -R ~/.zsh_history
rm ~/.zsh_history_bad

About

Problems and solutions when setting up various Linux distros for personal laptop.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published