1) 将用户信息数据库文件和组信息数据库文件纵向合并为一个文件/1.txt(覆盖)
[root@bogon ~]# cp /etc/passwd ./
[root@bogon ~]# cp /etc/group ./ 
[root@bogon ~]# 
[root@bogon ~]# ll
total 8
-rw-r--r-- 1 root root  581 Mar 16 14:55 group
-rw-r--r-- 1 root root 1150 Mar 16 14:55 passwd
[root@bogon ~]# cat ./passwd  >1.txt
[root@bogon ~]# cat ./group   >1.txt
[root@bogon ~]# cat 1.txt

2) 将用户信息数据库文件和用户密码数据库文件纵向合并为一个文件/2.txt(追加)
[root@bogon ~]# cat ./passwd  >>2.txt
[root@bogon ~]# cat ./group  >>2.txt
[root@bogon ~]# cat 2.txt

3) 将/1.txt、/2.txt两个文件打包为/1.tar 
[root@bogon ~]# tar cvf 1.tar 1.txt 2.txt 
1.txt
2.txt
[root@bogon ~]# ls -l 
-rw-r--r-- 1 root root  885 Mar 16 14:57 1.tar

4) 使用gzip命令压缩1.txt文件名为1.txt.gz
[root@bogon ~]# gzip 1.txt
[root@bogon ~]# ls -l 
-rw-r--r-- 1 root root  346 Mar 16 14:55 1.txt.gz
5) 解压缩1.txt.gz
[root@bogon ~]# gunzip 1.txt.gz
[root@bogon ~]# ls -l 
-rw-r--r-- 1 root root  346 Mar 16 14:55 1.txt
6) 使用bzip2压缩1.txt压缩后文件名为1.txt.bz2
[root@bogon ~]# bzip2 1.txt
[root@bogon ~]# ls -l 
-rw-r--r-- 1 root root  322 Mar 16 14:55 1.txt.bz2

7) 解压缩1.txt.bz2
[root@bogon ~]# bunzip2 1.txt.bz2 
[root@bogon ~]# ls -l 
-rw-r--r-- 1 root root  581 Mar 16 14:55 1.txt

8) 解包1.tar,解包后文件存放到/tmp目录下
[root@bogon ~]# tar xf 1.tar -C /tmp/
9) 使用tar命令打包并且压缩/1.txt、/2.txt,得到的文件名为1.tar.gz
[root@bogon ~]# tar zcvf 1.tar.gz 1.txt 2.txt 
[root@bogon ~]# ls -l 
-rw-r--r-- 1 root root  885 Mar 16 15:10 1.tar.gz

10) 解包1.tar.gz,解包后文件存放到/tmp目录下
[root@bogon ~]# tar xf 1.tar.gz -C /tmp/

11) 使用vi编辑器编辑文件/1.txt进入编辑模式写入内容“hello world”
[root@bogon ~]# vi wen.txt
i -> 输入hello world -> Esc-->:wq
[root@bogon ~]# cat wen.txt 
hello world

12) 进入命令行模式复制改行内容,在下方粘贴80行
vi wen.txt
光标在hello那行-->yy80p
13) 快速移动光标到文件的最后一行
Shift+GG
14) 快速移动光标到当前屏幕的中间一行
Shift+M
15) 快速移动光标到文件的第五行
:5
16) 在下方插入新的一行内容“welcome to beijing”
Shift+GG
o
输入welcome to beijing
ESC
:wq

echo "welcome to beijing" >> wen.txt
17) 删除刚插入的一行
Shift+GG
dd
18) 撤销上一步的操作
u
19) 进入扩展模式,执行文件的保存退出操作
Esc -> :wq

20) 开启Linux系统前添加一块大小为20G的SCSI硬盘
虚拟机添加,需要关闭linux
21) 开启系统,右击桌面,打开终端
22) 为新加的硬盘分区,一个主分区大小为10G,剩余空间给扩展分区,在扩展分区上划分两个逻辑分区,大小各5G
fdisk -l
fdisk /dev/sdb
p 查看
n 新建
   p  主分区
   e  扩展
   l  逻辑

23) 格式化主分区为ext3系统
mkfs.ext3  /dev/sdb1
24) 格式化两个逻辑分区为ext4系统
mkfs.ext4 /dev/sdb5
mkfs.ext4 /dev/sdb6

25)建立/etc/passwd的软连接文件,放在/tmp目录下
[root@bogon ~]# ln -s /root/passwd  /tmp/ln-passwd

26)建立/etc/passwd的硬链接文件,放在/boot下,如果不成功,思考是为什么
[root@bogon ~]# ln /root/passwd /boot/ln-passwd
如果不在同一块硬盘不能建立硬链接
27)查看刚刚建立的软连接,源文件与目标文件的inode
[root@bogon ~]# ls -il /root/passwd 
1557863 -rw-r--r-- 2 root root 1150 Mar 16 14:55 /root/passwd
[root@bogon ~]# ls -il /tmp/ln-passwd 
819212 lrwxrwxrwx 1 root root 12 Mar 16 15:27 /tmp/ln-passwd -> /root/passwd
28)查看刚刚建立的硬连接,源文件与目标文件的inode
[root@bogon ~]# ls -il /root/passwd 
1557863 -rw-r--r-- 2 root root 1150 Mar 16 14:55 /root/passwd
[root@bogon ~]# ls -il /boot/ln-passwd
1557863 -rw-r--r-- 2 root root 1150 Mar 16 14:55 /boot/ln-passwd

29)

查看进程:  lsof -i : 进程号

杀进程:kill -9 :要杀的进程号

linux---tar命令,vim编辑器,磁盘分区,挂载,链接的更多相关文章

  1. tar命令-vi编辑器-磁盘分区及格式化-软链接及硬链接文件

    一.tar命令 1.将用户信息数据库文件和组信息数据库文件纵向合并为一个文件/1.txt(覆盖) [root@localhost  /] #  cat  /etc/passwd  /etc/group ...

  2. Linux crond任务调度(定时任务),Linux磁盘分区/挂载

    一.crond任务调度 1.基本语法 crontab [选项] -e : 编辑 crontab定时任务 -l : 查询crontab -r : 删除当前用户所有的crontab任务 例子: 每分钟执行 ...

  3. Linux的VMWare中Centos7磁盘分区管理 fdisk分区和制作文件系统格式化和开机自动挂载

    一.硬盘的组成零件扇区 磁道 磁盘容量 磁盘分区 简介 硬盘由容量.柱面数.磁头数.扇区数 C/H/S, Cylinder, Head, Sector(柱面/磁头数/扇区数) 1.磁头数表示硬盘总共有 ...

  4. Linux常用命令——文本编辑器Vim

    Linux常用命令--文本编辑器Vim Linux  Vim常用操作 插入命令 a 在光标所在字符后插入 A 在光标所在行尾插入 i 在光标所在字符前插入 I 在光标所在行首插入 o 在光标下插入新行 ...

  5. Linux系统Vi/Vim编辑器的简单介绍、安装/卸载、常用命令

    Linux系统Vi/Vim编辑器的简单介绍.安装/卸载.常用命令 1.介绍 vi(Visual Interface)编辑器是Linux和Unix上最基本的文本编辑器,工作在字符模式下.由于不需要图形界 ...

  6. 【转】Linux上vi(vim)编辑器使用教程

    Linux上vi(vim)编辑器使用教程 ------------------------------------------------------------ ikong ------------ ...

  7. Linux tar命令高级用法——备份数据

    Linux tar命令高级用法——备份数据 2015-12-31 Linux学习 Linux上有功能强大的tar命令,tar最初是为了制作磁带备份(tape archive)而设计的,它的作用是把文件 ...

  8. Windows & Linux 安装使用 Vim 编辑器 3分钟入门 - 精简归纳

    Windows & Linux 安装使用 Vim 编辑器 3分钟入门 - 精简归纳 JERRY_Z. ~ 2020 / 8 / 25 转载请注明出处! 目录 Windows & Lin ...

  9. aix磁盘分区挂载问题

    aix在进行磁盘分区挂载时,可能会报错

随机推荐

  1. ZenCart分类数量打折Category Quantity Discount插件

    附件:http://files.cnblogs.com/lzj87980239/Category_Quantity_Discount.rar 效果图后台1.将update.sql导入到数据库 2.将Y ...

  2. [React-Native]入门(Hello World)

    (1)需要一台Mac(OSX),这个是前提,建议还是入手一本啦. (2)在Mac上安装Xcode,建议Xcode 6.3以上版本 (3)安装node.js:https://nodejs.org/dow ...

  3. mac shell

    查看所有shell:cat /etc/shells 查看当前正在使用的shell:echo $SHELL 切换shell:chsh -s /bin/zsh

  4. Python之路——线程池

    1 线程基础 1.1 线程状态 线程有5种状态,状态转换的过程如下图所示: 1.2 线程同步——锁 多线程的优势在于可以同时运行多个任务(至少感觉起来是这样,其实Python中是伪多线程).但是当线程 ...

  5. 在Ubuntu14.4(32位)中配置I.MX6的QT编译环境

    1,开发工具下载 一,下载VMware Workstation虚拟机 地址:http://1.xp510.com:801/xp2011/VMware10.7z 二,下载Ubuntu 14.04.5 L ...

  6. HDFS只支持文件append操作, 而依赖HDFS的HBase如何完成数据的增删改查

    转:http://www.th7.cn/db/nosql/201510/135382.shtml 1. HDFS的文件append功能 早期版本的HDFS不支持任何的文件更新操作,一旦一个文件创建.写 ...

  7. C++之MFC基本设置

    1 设置单元格的值 1) 选中指定单元格,使用SetValue设置值 CellName.Format(_T("A%d"),i);//单元格的名称 range.AttachDispa ...

  8. Python学习笔记之函数参数传递 传值还是传引用

      在学完Python函数那一章节时,很自然的的就会想到Python中函数传参时传值呢?还是传引用?或者都不是? 在回答上面的问题之前我们先来看看下面的代码: 代码1: def foo(var): v ...

  9. 20145314郑凯杰 《Java程序设计》第9周学习总结 积极主动敲代码

    20145314郑凯杰 <Java程序设计>第9周学习总结 教材学习内容总结 第十六章 ①JDBC(Java DataBase Connectivity) 即java数据库连接,是一种用于 ...

  10. chrome调试工具

    Chrome调试面板 Chrome 开发者工具是一套内置在Google Chrome中Web开发和调试工具.使用开发者工具来重演,调试和剖析您的网站.其中常用的有Elements(元素面板).Cons ...