Ubuntu 桌面环境使用

101 Ubuntu

2016-12-10  本文已影响14人  z嘉嘉嘉

思沃学院第一期学习任务 101 总结

Ubuntu历史

Ubuntu是世界最受欢迎完全开源的操作系统之一
详细描述 : ubuntu维基百科

快捷键学习

常用快捷键

Ctrl+Alt+F1:进入终端界面。
Ctrl+Alt+F7:回到图形界面。
Ctrl+Alt+T:进入伪终端,当然我们的大部分操作只需要在伪终端下操作即可。
Ctrl+D:关闭伪终端。
Ctrl+Alt+L:锁屏。

终端常用快捷键

Shift+Pageup/Page down:向上向下翻页
Tab:命令补全功能
Ctrl+Shift+c:复制
Ctrl+Shift+v:粘贴
Ctrl+a:移动到当前行开始位置
Ctrl+e:移动到当前行结尾
Ctrl+k:删除此处至末尾所有内容
Ctrl+u:删除此处至开始所有内容
Ctrl+l:刷新屏幕
Ctrl+c:杀死当前任务
Ctrl+s:挂起当前shell
Ctrl+q:重新启用挂起的shell
Alt+u:把当前词转化为大写
Alt+l:把当前词转化为小写
Alt+c:把当前词变成首字母大写
[参考]:文/TW安洋(简书作者)

常用命令学习

➜  ~ ls
Book       examples.desktop    Music           Public            wince3+1
Desktop    gradle-2.9-bin.zip  newRamlProject  Templates
Documents  IdeaProjects        pdf             Videos
Downloads  logs                Pictures        WebstormProjects
➜  ~ mkdir newDir
➜  ~ ls
Book       examples.desktop    Music           Public            wince3+1
Desktop    gradle-2.9-bin.zip  newRamlProject  Templates           newDir
Documents  IdeaProjects        pdf             Videos
Downloads  logs                Pictures        WebstormProjects

➜  ~ pwd
/home/zhyingjia

➜  ~ cd newDir 
➜  newDir pwd
/home/zhyingjia/newDir

➜  ~ rmdir newDir 
➜  ~ ls
Book       examples.desktop    Music           Public            wince3+1
Desktop    gradle-2.9-bin.zip  newRamlProject  Templates
Documents  IdeaProjects        pdf             Videos
Downloads  logs                Pictures        WebstormProjects
➜  newDir mkdir content
➜  newDir ls
content
➜  newDir cd ../
➜  ~ rmdir newDir 
rmdir: failed to remove 'newDir': Directory not empty
➜  ~ rm newDir 
rm: cannot remove 'newDir': Is a directory
➜  ~ rm -r newDir 
➜  ~ ls
Book       examples.desktop    Music           Public            wince3+1
Desktop    gradle-2.9-bin.zip  newRamlProject  Templates
Documents  IdeaProjects        pdf             Videos
Downloads  logs                Pictures        WebstormProjects

➜  newDir touch file1.txt
➜  newDir ls
content  file1.txt
➜  newDir cp file1.txt file2.txt
➜  newDir ls
content  file1.txt  file2.txt

➜  newDir ls
content  file1.txt  file2.txt
➜  newDir cp file2.txt content 
➜  newDir ls
content  file1.txt  file2.txt
➜  newDir cd content 
➜  content ls
file2.txt
➜  newDir ls
content  file2.txt
➜  newDir cd content 
➜  content ls
➜  content cd ../

//  重命名
➜  newDir mv file2.txt file.txt
➜  newDir ls
content  file.txt

//  移动
➜  newDir mv file.txt content 
➜  newDir ls
content
➜  newDir cd content 
➜  content ls
file.txt
➜  content ls            
file.txt
➜  content cat file.txt 
0 file test data
1 file test data
2 file test data
3 file test data
4 file test data
5 file test data
6 file test data
7 file test data
8 file test data
9 file test data
10 file test data
11 file test data
12 file test data
13 file test data


➜  content tail file.txt 
4 file test data
5 file test data
6 file test data
7 file test data
8 file test data
9 file test data
10 file test data
11 file test data
12 file test data
13 file test data
➜  content tail file.txt -n 3
11 file test data
12 file test data
13 file test data

➜  ~ grep "1 f" newDir/content/file.txt
1 file test data
11 file test data

➜  ~ grep "0 File" newDir/content/file.txt

➜  ~ grep "0 File" -i newDir/content/file.txt
0 file test data
10 file test data
➜  ~ cd newDir 

➜  newDir grep "0 File" -i -r 
content/file.txt:0 file test data
content/file.txt:10 file test data
➜  ~ find newDir -name content
newDir/content
➜  ~ find newDir -iname Content
newDir/content

➜  newDir ls
content
➜  newDir tar -cvf content.tar content 
content/
content/file.txt
➜  newDir ls
content  content.tar

➜  newDir tar -tvf content.tar
drwxrwxr-x zhyingjia/zhyingjia 0 2016-12-09 22:22 content/
-rw-rw-r-- zhyingjia/zhyingjia 242 2016-12-09 22:22 content/file.txt

➜  newDir rm -rf content
➜  newDir ls
content.tar
➜  newDir tar -xvf content.tar 
content/
content/file.txt
➜  newDir ls
content  content.tar
➜  content ls
file.txt
➜  content gzip file.txt 
➜  content ls
file.txt.gz
➜  content gzip -d file.txt.gz 
➜  content ls
file.txt

➜  content zip file.zip file.txt 
  adding: file.txt (deflated 100%)
➜  content ls
file.txt  file.zip
➜  content cd ../
➜  newDir ls
content
➜  newDir zip -r content.zip content 
  adding: content/ (stored 0%)
  adding: content/file.zip (stored 0%)
  adding: content/file.txt (deflated 100%)
➜  newDir ls
content  content.zip
// 因为解压的时候会有命名冲突,因此将content.zip移动到content下进行操作
➜  newDir mv content.zip content/
➜  newDir ls
content
➜  newDir cd content 
➜  content ls
content.zip  file.txt  file.zip
➜  content unzip -l content.zip 
Archive:  content.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2016-12-10 13:20   content/
      193  2016-12-10 13:20   content/file.zip
    10240  2016-12-10 13:05   content/file.txt
---------                     -------
    10433                     3 files
➜  content unzip content.zip 
Archive:  content.zip
   creating: content/
 extracting: content/file.zip        
  inflating: content/file.txt        
➜  content ls
content  content.zip  file.txt  file.zip

➜  ~ bash
zhyingjia@zhyingjia-Inspiron-5437:~$ help
GNU bash, version 4.3.46(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

 job_spec [&]                                                           history [-c] [-d offset] [n] or history -anrw [filename] or history>
 (( expression ))                                                       if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ >
... ...

zhyingjia@zhyingjia-Inspiron-5437:~$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all                  do not ignore entries starting with .
  -A, --almost-all           do not list implied . and ..
      --author               with -l, print the author of each file
  -b, --escape               print C-style escapes for nongraphic characters
      --block-size=SIZE      scale sizes by SIZE before printing them; e.g.,
                               '--block-size=M' prints sizes in units of
... ... 

zhyingjia@zhyingjia-Inspiron-5437:~$ zsh
➜  ~ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all                  do not ignore entries starting with .
  -A, --almost-all           do not list implied . and ..
      --author               with -l, print the author of each file
  -b, --escape               print C-style escapes for nongraphic characters
      --block-size=SIZE      scale sizes by SIZE before printing them; e.g.,
... ...

➜  ~ whatis ls
ls (1)               - list directory contents
➜  ~ whatis man
man (7)              - macros to format man pages
man (1)              - an interface to the on-line reference manuals

LS(1)                                                          User Commands                                                          LS(1)

NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...

DESCRIPTION
       List information about the FILEs (the current directory by default).  Sort entries alphabetically if none of -cftuvSUX nor --sort is
       specified.

       Mandatory arguments to long options are mandatory for short options too.

       -a, --all
              do not ignore entries starting with .

       -A, --almost-all
              do not list implied . and ..
... ... 
➜  ~ ping www.jianshu.com
PING www.jianshu.com (106.75.2.241) 56(84) bytes of data.
64 bytes from 106.75.2.241: icmp_seq=1 ttl=50 time=20.1 ms
64 bytes from 106.75.2.241: icmp_seq=2 ttl=50 time=20.4 ms
64 bytes from 106.75.2.241: icmp_seq=3 ttl=50 time=19.9 ms
64 bytes from 106.75.2.241: icmp_seq=4 ttl=50 time=19.7 ms
64 bytes from 106.75.2.241: icmp_seq=5 ttl=50 time=22.7 ms
64 bytes from 106.75.2.241: icmp_seq=6 ttl=50 time=19.8 ms

➜  ~ who
zhyingjia tty7         2016-12-10 12:28 (:0)
zhyingjia tty2         2016-12-10 13:44
➜  ~ su user1
Password: 
user1@zhyingjia-Inspiron-5437:/home/zhyingjia$ 
➜  ~ sudo useradd user1      // 使用管理员权限,创建一个用户: sudo useradd <username>

➜  ~ sudo passwd user1       // 使用管理员权限,修改用户密码 sudo passwd <username>
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

➜  ~ cd ../                            // 在home目录下使用管理员创建对应工作目录sudo  mkdir <username>
➜  /home ls
zhyingjia
➜  /home sudo mkdir user1
➜  /home ls
user1  zhyingjia

创建成功

➜  /home cd                        // 切换用户 su <username>
➜  ~ su user1
Password: 
user1@zhyingjia-Inspiron-5437:/home/zhyingjia$ 
Ctrl + D 退出当前 user1 用户终端
Ctrl + T 打开新终端

➜  ~ sudo userdel user1                 // 使用管理员权限删除指定用户 sudo userdel <username>
[sudo] password for zhyingjia: 

➜  ~ cd ../                                        // 回到home目录下,使用管理员权限,删除对应用户目录  sudo rm -rf <delusername>
➜  /home ls
user1  zhyingjia
➜  /home sudo rm -rf user1
➜  /home ls
zhyingjia
➜  /home 

删除完成
➜  ~ uname
Linux
➜  ~ uname -a
Linux zhyingjia-Inspiron-5437 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
➜  ~ free
              total        used        free      shared  buff/cache   available
Mem:        8077760     1424756     4778536      314972     1874468     6018344
Swap:             0           0           0
➜  ~ free -m
              total        used        free      shared  buff/cache   available
Mem:           7888        1391        4667         306        1829        5877
Swap:             0           0           0
➜  ~ free -g
              total        used        free      shared  buff/cache   available
Mem:              7           1           4           0           1           5
Swap:             0           0        

➜  ~ df
Filesystem     1K-blocks     Used Available Use% Mounted on
udev             4018760        0   4018760   0% /dev
tmpfs             807776     9732    798044   2% /run
/dev/sda1      144103744 27505216 109255224  21% /
tmpfs            4038880    20352   4018528   1% /dev/shm
tmpfs               5120        4      5116   1% /run/lock
tmpfs            4038880        0   4038880   0% /sys/fs/cgroup
tmpfs             807776       56    807720   1% /run/user/1000
➜  ~ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           789M  9.6M  780M   2% /run
/dev/sda1       138G   27G  105G  21% /
tmpfs           3.9G   20M  3.9G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           789M   56K  789M   1% /run/user/1000
➜  ~ ps
  PID TTY          TIME CMD
 9065 pts/4    00:00:00 zsh
 9902 pts/4    00:00:00 zsh
10422 pts/4    00:00:00 ps
➜  ~ top

top - 14:08:07 up  2:15,  2 users,  load average: 0.08, 0.14, 0.12
Tasks: 242 total,   1 running, 241 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.7 us,  0.9 sy,  0.0 ni, 97.2 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  8077760 total,  4771916 free,  1435888 used,  1869956 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  6011856 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND     
  934 root      20   0  377124  55856  41004 S   5.0  0.7   1:52.05 Xorg        
 9060 zhyingj+  20   0  588396  34860  27780 S   2.3  0.4   0:02.54 gnome-term+ 
 1885 zhyingj+  20   0 1542564 156032  73488 S   2.0  1.9   2:01.80 compiz      
 2528 zhyingj+  20   0  500092 122060  70992 S   0.3  1.5   1:38.04 chrome      
 4519 root      20   0       0      0      0 S   0.3  0.0   0:01.87 kworker/u8+ 
10460 zhyingj+  20   0   48976   4240   3540 R   0.3  0.1   0:00.01 top         
    1 root      20   0  185488   6124   3984 S   0.0  0.1   0:01.63 systemd     
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kthreadd    
    3 root      20   0       0      0      0 S   0.0  0.0   0:00.04 ksoftirqd/0 
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:+ 
    7 root      20   0       0      0      0 S   0.0  0.0   0:05.16 rcu_sched  
... ...

[参考]:29个你必须知道的Linux命令

总结 + 感受

参考

学习资料

上一篇 下一篇

猜你喜欢

热点阅读