Ubuntu16.04常用操作和命令

在Ubuntu系统中查看系统的磁盘使用情况

yitian@ubuntu:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           393M   12M  381M   3% /run
/dev/sda1        23G   19G  3.1G  86% /
tmpfs           2.0G  356K  2.0G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs           393M   72K  393M   1% /run/user/1000
tmpfs           393M     0  393M   0% /run/user/0

Ubuntu16.04 关闭防火墙

yitian@ubuntu:~/mesosinstall/sbin$ sudo ufw disable
[sudo] password for yitian: 
Firewall stopped and disabled on system startup

Ubuntu16.04 设置root用户登陆密码

在安装完成Ubuntu之后,root用户默认为无密码的状态,需要使用如下命令进行设置并登陆。

yitian@ubuntu:/etc$ su root
Password: 
su: Authentication failure

yitian@ubuntu:/etc$ sudo passwd
[sudo] password for yitian: 
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

yitian@ubuntu:/etc$ su root
Password: 

Ubuntu16.04 Install Git

yitian@ubuntu:~/aurora$ sudo apt install git
[sudo] password for yitian: 
Reading package lists… Done
Building dependency tree       
Reading state information… Done
The following additional packages will be installed:
   git-man liberror-perl
Suggested packages:
   git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk
   gitweb git-arch git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
   git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 302 not upgraded.
Need to get 3,857 kB of archives.
After this operation, 25.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 liberror-perl all 0.17-1.2 [19.6 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 git-man all 1:2.7.4-0ubuntu1.3 [736 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 git amd64 1:2.7.4-0ubuntu1.3 [3,102 kB]
Fetched 3,857 kB in 52s (73.1 kB/s)                                            
Selecting previously unselected package liberror-perl.
(Reading database … 181225 files and directories currently installed.)
Preparing to unpack …/liberror-perl_0.17-1.2_all.deb …
Unpacking liberror-perl (0.17-1.2) …
Selecting previously unselected package git-man.
Preparing to unpack …/git-man_1%3a2.7.4-0ubuntu1.3_all.deb …
Unpacking git-man (1:2.7.4-0ubuntu1.3) …
Selecting previously unselected package git.
Preparing to unpack …/git_1%3a2.7.4-0ubuntu1.3_amd64.deb …
Unpacking git (1:2.7.4-0ubuntu1.3) …
Processing triggers for man-db (2.7.5-1) …
Setting up liberror-perl (0.17-1.2) …
Setting up git-man (1:2.7.4-0ubuntu1.3) …
Setting up git (1:2.7.4-0ubuntu1.3) …
yitian@ubuntu:~/aurora$

Ubuntu16.04 Install Vim

Ubuntu默认安装的为vi工具,而没有安装vim工具,下面为vim的安装过程。

root@ubuntu:/usr/java# sudo apt-get install vim 
Reading package lists… Done
Building dependency tree       
Reading state information… Done
The following additional packages will be installed:
   vim-runtime
Suggested packages:
   ctags vim-doc vim-scripts vim-gnome-py2 | vim-gtk-py2 | vim-gtk3-py2
   | vim-athena-py2 | vim-nox-py2
The following NEW packages will be installed:
   vim vim-runtime
0 upgraded, 2 newly installed, 0 to remove and 303 not upgraded.
Need to get 6,199 kB of archives.
After this operation, 30.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim-runtime all 2:7.4.1689-3ubuntu1.2 [5,164 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim amd64 2:7.4.1689-3ubuntu1.2 [1,036 kB]
Fetched 6,199 kB in 20s (300 kB/s)                                             
Selecting previously unselected package vim-runtime.
(Reading database … 175107 files and directories currently installed.)
Preparing to unpack …/vim-runtime_2%3a7.4.1689-3ubuntu1.2_all.deb …
Adding ‘diversion of /usr/share/vim/vim74/doc/help.txt to /usr/share/vim/vim74/doc/help.txt.vim-tiny by vim-runtime’
Adding ‘diversion of /usr/share/vim/vim74/doc/tags to /usr/share/vim/vim74/doc/tags.vim-tiny by vim-runtime’
Unpacking vim-runtime (2:7.4.1689-3ubuntu1.2) …
Selecting previously unselected package vim.
Preparing to unpack …/vim_2%3a7.4.1689-3ubuntu1.2_amd64.deb …

Unpacking vim (2:7.4.1689-3ubuntu1.2) …
Processing triggers for man-db (2.7.5-1) …
Setting up vim-runtime (2:7.4.1689-3ubuntu1.2) …
Setting up vim (2:7.4.1689-3ubuntu1.2) …
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode

 

你可能感兴趣的:(Linux/Ubuntu)