Process to set up Ubuntu environment for personal laptop.
- 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
- 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
- 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.
- 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
- Configure Firefox
- Restore previous section
- Always ask you where to save files
- Install Adblock Plus and EverSync
- Ubuntu hangs on boot
(Source: https://askubuntu.com/questions/764568/ubuntu-16-04-hangs-on-shutdown-restart)
- 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
- 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
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-415 # Use the latest one
- Install R & RStudio on Ubuntu
(Source: https://gist.github.com/mGalarnyk/41c887e921e712baf86fecc507b3afc7#file-rstudioubuntu1604-sh)
- Install Anaconda with zsh
(Source: https://stackoverflow.com/questions/31615322/zsh-conda-pip-installs-command-not-found)
- Fix GPG Error
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
- 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
- Move /home to a new partition
(source: https://help.ubuntu.com/community/Partitioning/Home/Moving)
- Solve BIOS and UEFI incompatibility
(Source: http://www.rodsbooks.com/refind/)
Install rEFInd
- Install Vietnamese keyboard
(Source: https://vinasupport.com/huong-dan-cai-bo-go-tieng-viet-ibus-unikey-tren-ubuntu/)
Use ibus-ubuntu
- Fix
error: unknown filesystem
while installing Arch Linux
(Source: https://askubuntu.com/questions/142300/how-to-fix-error-unknown-filesystem-grub-rescue)
- 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
- Fix "Unable to lock the administration directory"
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
sudo dpkg --configure -a
- Recursively find all files with a given name
find . -name "foo*"
- The difference between
$
and#
in command line commands?
$
is there to tell you that this command needs to be executed as a regular user. #
commands must be executed as root
# sudo apt install wajig
wajig large
git branch -r | grep "^ ${REMOTE}/" | sed "s|^ ${REMOTE}/|:|" | grep -v "^:HEAD" | grep -v "^:${MASTER}$" | xargs git push ${REMOTE}
touch ~/.ssh/config
chmod 600 ~/.ssh/config
ssh-copy-id remote_username@server_ip_address
- Share keyboard and mouse between multiple computers
For now, only work if Ubuntu is a server and Windows is a client
- Install zsh plugins
- autosuggestions: https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md
- command not found: https://askubuntu.com/questions/34978/configuring-to-detect-if-a-command-does-not-exist-suggest-installation
[[ -a "/etc/zsh_command_not_found" ]] && . /etc/zsh_command_not_found
- Sort directories by size
du -h --max-depth=1 | sort -hr
Use this command to find the big files, then delete only the big files.
du -hs /tmp /var/log
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
find . -type f -exec sed -i "s/foo/bar/g" {} \;
- 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 uv_update="uv self update"
alias maintain="sync_clock; snap_update; update; upgrade; dist; autorm; autoclean; uv_update"
It's a nightmare. Not sure which one works.
- Atom: [Linter] Error running clang: Failed to spawn command clang
Must install clang
:
sudo apt install clang
sudo apt-get install ubuntu-restricted-extras
sudo nano /etc/environment
Then
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
Run the command set -x
to see which library causes the slowness. Run set +x
to turn it off
git config --add oh-my-zsh.hide-status 1
git config --add oh-my-zsh.hide-dirty 1
- launch ibus-setup,
- select emoji tab,
- change the shortcut or remove it
dpkg -L <package>
- Find public IP using command line
curl ifconfig.me
- Check if a port is open for an IP/VM/site
telnet <Public IP> <port>
- 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"' _ {} \;
- 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
- 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