生信星球培训第五十四期

学习小组Day2笔记--ksprings

2020-04-18  本文已影响0人  ksprings

感谢生信星球提供的服务器练习账号

Day2-linux常用命令.png

一、服务器登录

二、常用命令及参数

tips :善用Tab补全命令

1. pwd 显示当前工作目录/路径

bio05@VM-0-10-ubuntu:~$ pwd
/home/bio05

2. mkdir 创建目录

3. ls 显示目录、文件

bio05@VM-0-10-ubuntu:~$ ls -a
.  ..  .bash_history  .bash_logout  .bashrc  .cache  .gnupg  .profile
bio05@VM-0-10-ubuntu:~$ mkdir test
bio05@VM-0-10-ubuntu:~$ ls -a
.  ..  .bash_history  .bash_logout  .bashrc  .cache  .gnupg  .profile  test
bio05@VM-0-10-ubuntu:~$ 

4. rm 删除

bio05@VM-0-10-ubuntu:~$ rmdir test
bio05@VM-0-10-ubuntu:~$ ls -a
.  ..  .bash_history  .bash_logout  .bashrc  .cache  .gnupg  .profile
bio05@VM-0-10-ubuntu:~$ touch test.txt
bio05@VM-0-10-ubuntu:~$ ls
test.txt
bio05@VM-0-10-ubuntu:~$ rm test.txt 
bio05@VM-0-10-ubuntu:~$ ls
bio05@VM-0-10-ubuntu:~$ 

5. cd 切换目录

bio05@VM-0-10-ubuntu:~$ mkdir tmp
bio05@VM-0-10-ubuntu:~$ pwd
/home/bio05
bio05@VM-0-10-ubuntu:~$ cd tmp
bio05@VM-0-10-ubuntu:~/tmp$ pwd
/home/bio05/tmp
bio05@VM-0-10-ubuntu:~/tmp$ 

6. vi 新建文件/脚本

bio05@VM-0-10-ubuntu:~/tmp$ vi helloworld.txt
bio05@VM-0-10-ubuntu:~/tmp$ ls
helloworld.txt

7. cat/head/tail 显示全部 / 前面 / 后面文件内容

bio05@VM-0-10-ubuntu:~/tmp$ cat helloworld.txt 
one
two
three
four
five
six
seven
eight
nine
ten
bio05@VM-0-10-ubuntu:~/tmp$ head -n4 helloworld.txt 
one
two
three
four
bio05@VM-0-10-ubuntu:~/tmp$ tail -n5 helloworld.txt 
six
seven
eight
nine
ten

8. cp 复制

bio05@VM-0-10-ubuntu:~/tmp$ cp helloworld.txt new.txt
bio05@VM-0-10-ubuntu:~/tmp$ ls
helloworld.txt  new.txt
bio05@VM-0-10-ubuntu:~/tmp$ cat new.txt 
one
two
three
four
five
six
seven
eight
nine
ten

9. mv 移动或重命名

bio05@VM-0-10-ubuntu:~/tmp$ tree ~
/home/bio05
└── tmp
    ├── helloworld.txt
    └── new.txt

1 directory, 2 files
bio05@VM-0-10-ubuntu:~/tmp$ mv new.txt ~
bio05@VM-0-10-ubuntu:~/tmp$ tree ~
/home/bio05
├── new.txt
└── tmp
    └── helloworld.txt

1 directory, 2 files
bio05@VM-0-10-ubuntu:~/tmp$ cd ..
bio05@VM-0-10-ubuntu:~$ ls
new.txt  tmp
bio05@VM-0-10-ubuntu:~$ mv new.txt old.txt
bio05@VM-0-10-ubuntu:~$ ls
old.txt  tmp

三、学习资源

四、思考题

bio05@VM-0-10-ubuntu:~$ ls -l
total 8
-rw-rw-r-- 1 bio05 bio05   49 Apr 18 16:21 old.txt
drwxrwxr-x 2 bio05 bio05 4096 Apr 18 16:26 tmp
bio05@VM-0-10-ubuntu:~$ ls -lh
total 8.0K
-rw-rw-r-- 1 bio05 bio05   49 Apr 18 16:21 old.txt
drwxrwxr-x 2 bio05 bio05 4.0K Apr 18 16:26 tmp
bio05@VM-0-10-ubuntu:~$ uname -a
Linux VM-0-10-ubuntu 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
bio05@VM-0-10-ubuntu:~$ free -lh
              total        used        free      shared  buff/cache   available
Mem:           1.8G        323M         94M        5.5M        1.4G        1.3G
Low:           1.8G        1.7G         94M
High:            0B          0B          0B
Swap:            0B          0B          0B
bio05@VM-0-10-ubuntu:~$ df -lh
Filesystem      Size  Used Avail Use% Mounted on
udev            885M  4.0K  885M   1% /dev
tmpfs           184M  5.5M  178M   3% /run
/dev/vda1        50G   25G   23G  53% /
tmpfs           917M   48K  917M   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           917M     0  917M   0% /sys/fs/cgroup
tmpfs           184M     0  184M   0% /run/user/1157
tmpfs           184M     0  184M   0% /run/user/1158
tmpfs           184M     0  184M   0% /run/user/1159
tmpfs           184M     0  184M   0% /run/user/1161
bio05@VM-0-10-ubuntu:~$ tree
.
└── old.txt

0 directories, 1 file
bio05@VM-0-10-ubuntu:~$ mkdir -p tmp/tmp1/tmp1.1
bio05@VM-0-10-ubuntu:~$ tree
.
├── old.txt
└── tmp
    └── tmp1
        └── tmp1.1

3 directories, 1 file
bio05@VM-0-10-ubuntu:~$ rm -r tmp
bio05@VM-0-10-ubuntu:~$ tree
.
└── old.txt

0 directories, 1 file
上一篇 下一篇

猜你喜欢

热点阅读