Ubuntu system optimization strategy

Ubuntu as an open source system, many software experiences are not very good. After installing the system, you need to optimize it by yourself. Here is a summary of the online and your own work experience.

1, Update source

After installing Ubuntu, you need to replace it with a domestic software source, such as Alibaba cloud
Update software source: sudo apt get update

2, Remove redundant software

1. Open a terminal, input dpkg --list, press Enter, the terminal will output the following contents, and display all the software installed on your computer.
2. Find the name of the software you need to uninstall in the terminal. The list is to find the software package you want to uninstall in alphabetical order
3. Enter the command sudo apt get -- purge remove package name on the terminal (– purge is optional. Write this attribute to delete the software and its configuration file together. If you do not need to delete the configuration file, execute sudo apt get remove package name)
4. The following is the recommended deletion software:

sudo apt-get purge libreoffice-common \ #Delete libreoffice
                unity-webapps-common \ #Remove Amazon's links
                thunderbird* \ #Delete thunderbird mailbox
                rhythmbox * \ #Delete rhythmbox music player
                hplip* \ #Printing
                printer-driver*   #Print driver

sudo apt-get autoremove

Apt get remove will delete the package and keep the configuration file of the software
Apt get purge clears both the package and the software's configuration files

3, System settings

1. Set the time to use UTC
sudo vim /etc/default/rcS
Change UTC=no to UTC=yes
Make the time display of window s and linux consistent
2. Use alias to set command alias in Ubuntu
sudo vim ~/.bashrc

# -------short key begin-----------------------
alias remove ='sudo apt-get remove thunderbird totem rhythmbox empathy brasero simple-scan gnome-mahjongg aisleriot gnome-mines cheese transmission-common gnome-orca webbrowser-app gnome-sudoku landscape-client-ui-install'
alias autoremove='sudo apt-get autoremove'
alias update='sudo apt-get update'
alias cleardata='apt-get clean all'
alias tnef= 'tnef winmail.dat;convmv -f gbk -t utf8 --notest *'
#--------short key end------------------------

4, Install prerequisite software

1.ubuntu cannot install deb file solution

sudo apt install gdebi-core
sudo apt-get install gdebi

Then right click the. deb file you want to install, select Open With - > gdebi package installer, and the following window will appear. Click Install Package
sudo gdebi xxx.deb

2. install Vim
sudo apt-get install vim
vim configuration:
sudo vim /etc/vim/vimrc

""=========================conventional arrangement-begin================= 
" Do not use vi The keyboard mode, but vim Own
set nocompatible
" When processing unsaved or read-only files, pop-up confirmation
set confirm
"Collocation color
"colorscheme molokai
"colorscheme 256-jungle
"set number
set number
"Test file type
filetype on
"Number of rows in history
set history=1000
"Set background color
set background=dark
"syntax highlight 
set syntax=on
"Set mouse cursor available
set mouse=a
"Display the status line of cursor position in the lower right corner during editing
set ruler
"By default, find matches are highlighted, which turns off highlighting
set nohls
"Share clipboard  
set clipboard=unnamed 
"Automatic preservation
set autowrite
set foldenable              " Start folding
" Cursor moves to buffer 3 lines at the top and bottom of
set scrolloff=3
" Display blank space between divided windows for easy reading
set fillchars=vert:\ ,stl:\ ,stlnc:\
" allow backspace And cursor keys across line boundaries
set whichwrap+=<,>,h,l
"Inline substitution
set gdefault
"Encoding settings
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set viminfo+=!
" Do not break words with the following symbols
set iskeyword+=_,$,@,%,#,-
"Language settings
set langmenu=zh_CN.UTF-8
set helplang=cn
" Share external clipboard
set clipboard+=unnamed
"Show invisible characters
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
set list
"make Function
:set makeprg=g++\ -Wall\ \ %
""=========================conventional arrangement-end================= 
""=========================Code formatting-begin================= 
" Automatic indentation
set autoindent
set cindent
" by C Program provides auto indent
set smartindent
"Set up tab Make 4 spaces
set tabstop=4
" Unified indent to 4
set shiftwidth=4
set softtabstop=4
" Do not replace tabs with spaces
set noexpandtab
" Use tabs at the beginning of rows and segments
set smarttab
""=========================Code formatting-end================= 
""=========================Bracket auto completion setting-begin=================     
" Autocomplete parentheses, including braces
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
":inoremap < <><ESC>i
":inoremap > <c-r>=ClosePair('>')<CR>
imap{<CR> {<CR>}<ESC>O
" Autocomplete Quotes
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function ClosePair(char)
	if getline('.')[col('.') - 1] == a:char
		return "\<Right>"
		return a:char

" When pressing backspace key, judge the character before the current cursor. If it is a left bracket, delete the corresponding right bracket and the content in the middle of the bracket
function! RemovePairs()
let s:line = getline(".")
let s:previous_char = s:line[col(".")-1] " Gets the previous character of the current cursor
if index(["(", "[", "{"], s:previous_char) != -1
execute "normal! v%xi"
execute "normal! a\<BS>"
" When using backspace key to delete an open bracket, delete the corresponding right bracket at the same time
inoremap <BS> <ESC>:call RemovePairs()<CR>a
""=========================Bracket auto completion setting-end=================

3. Install Sogou input method

sudo gedit /etc/apt/sources.list file, add the apt source of ubuntu kylin
deb http://archive.ubuntukylin.com:10006/ubuntukylin trusty main

sudo apt-get update sudo apt-get install sogoupinyin

This allows apt to install and update Sogou ime.

4. Install WPS Office
sudo apt-get install wps-office
5. Install Oracle Java

yum remove openjdk uninstalls the openjdk that comes with the system
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer

Because the system comes with OpenJDK, there will be residue after uninstalling OpenJDK, resulting in running
java -version

The first line is not the java version number. It will be picked up java? Tool? Options: - javaagent: / usr / share / java / jayatanaag.jar. As a result, many scripts that detect the java version number will run in error. Therefore, you need to manually clear the residue.
sudo rm /usr/share/upstart/sessions/jayatana.conf

Delete the file / usr/share/upstart/sessions/jayatana.conf, and then run java version after restart, there will be no more picked up Java [tool] options: - javaagent: / usr / share / Java / jayatanaag.jar prompt.
6. Install Sublime Text 3
sudo add-apt-repository ppa:webupd8team/sublime-text-3 sudo apt-get update sudo apt-get install sublime-text
7. Install system indicator SysPeek
sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update sudo apt-get install syspeek
8. Customize DNS Server IP address of DHCP network

Sudo VIM / etc / DHCP / DHCP client.conf file, in line 21, the "reserved domain name servers"; in the next line, add the following two lines of DNS using aliyun and 114
prepend domain-name-servers; prepend domain-name-servers;

In this way, the DNS of aliyun can be used first, and the DNS of 114 can be used second.
9. Install git and VPN

git and vpn are good tools for programmers.
sudo apt-get install vpnc git
10. Install axel
axel is a multithreaded download tool for Linux command line interface. Compared with wget, it can specify multiple threads to download files in command line terminal at the same time.
sudo apt-get install axel

After installation, you can download it with multiple threads instead of wget.
11. Install openssh server
sudo apt-get install openssh-server

After installation, you can use ssh tools to log in remotely under Win. Of course, there is also a security risk. If you don't want to log in remotely, you can not install openssh server.
12. Install the ExFat file system driver

Ubuntu does not support the mounting of exFAT file system by default. You need to manually install the support of exFAT
sudo apt-get install exfat-fuse

After installing exfat fuse, you can mount the disks of the exfat partition.
13. Install lnav

lnav tool is a magic tool for viewing logs on the terminal interface
sudo apt-get install lnav

After installation, the log can be displayed in lnav color in the terminal.
14. Install compression software
The system does not have the function of decompressing rar file by default, and the unrar program is installed manually
sudo apt-get install unrar

After installation, you can extract the rar file with the command.

Use the following command to extract the file to the current directory.
unrar x test.rar

213 original articles published, 42 praised, 240000 visitors+
Private letter follow

Keywords: sudo Java vim Ubuntu

Added by mishasoni on Tue, 04 Feb 2020 07:03:26 +0200