ubuntu system
ubuntu是linux的发行版之一,从外观上分为有界面(ubuntu core)和无界面(ubuntu desktop)
download and install
connect to the Internect
note: need to restart sometimes
adjust screen size
Settings -> Displays -> Resolution(16:9) -> Scale(300%)
change the direction of scroll mouse
Settings -> Mouse&Touchpad -> Natural Scrolling(close)
terminal
open terminal
ctrl + alt +T
root permission
for ordinary user
rani@deliwar:~$
// rani: name of user
// deliwar: name of host
// ~: current directory
// $: not root user
for root user
root@Deliwar:/home/rani#
// root: root user
// deliwar: name of host
// /home/rani: system dierctory
// #: super user
note: root user is needed in Embedded Development
get root permission:
sudo passwd
(type passward twice as required)
su root
(type passward once)
or:
sudo su
(type passward)
exit from root
exit
install/uninstall application
download application
prepation:
1.connect to Internet
2.set download source
Software & Updates -> Ubuntu Software -> download from(...mirrors...tsinghua...)
3.apt update
download application
apt install xx
upgrade application
apt upgrade xx
uninstall application
1.apt search x or apt-cache pkgnames x // x: several first letters of the application name
2.uninstall application
apt remove xx // remain configuration
or
apt purge xx // delete configation and package
3.apt autoremove is needed at last to clear useless realationships and packages
folder operation
show all the folders in current directory
ls
go to next directory
cd xx(dirname)
go to former directory
cd /home/...(dirpath)
create new folder
mkdir xx
delete folder
rmdir xx
VIM
vim is the enhanced version of vi
create or open a file
vim test.c // if test.c exists, open it; else create it
three modes
normal mode: operate directly
edit mode: edit
order mode: operate with orders
to normal mode:
esc
to edit mode:
i
to order mode:
: or ? or / (for different functions)
in order mode
some orders
:set number -> show line number
:wq -> save and exit
/ad -> find "ad" in current file
?ad -> find "ad" in current file
direction
cursor taks no effects in vim. key ↑ ↓ ← → is needed
or in normal mode:
h -> left
j -> down
k -> up
l ->righ
first line
gg
last line
G
specific line
ngg
copy and paste
in normal mode:
copy and paste any
(cursor go to start)
v
(cursor go to end)
y
(cursor go to new start)
p
copy and paste single line
(cursor go to start)
yy
(cursor go to new start)
p
copy and paste several lines
(cursor go to start)
nyy //n lines from start line
(cursor go to new start)
p
delete
in edit mode:
del / ←
in normal mode:
delete single line
dd
delete sevsral lines
ndd //delete n lines from start line
in order mode:
m,nd // delete from m line to n line
note: in order mode, "enter" is needed; while in normal mode not
undo and redo
in normal mode:
u //undo
ctrl + r //redo
find
/xx
n // find the latter one
?xx
n // find the former one
replace
:%s /old/new/g
save
:wq // save and exit
:q! // don't save and exit
comparision between two and more files
vimdiff file1 file2 file3