5-linux Foundation-3

Source: Internet
Author: User

Linux Basics-3

Last Class Review

Useradd username-u uid-g gid-c comment-d homedir-s Shell
Usermod username-u uid-g gid-c comment-d home
dir-s Shell
Usermod:

-a 追加-g<群组>:修改用户所属的群组;-G<群组>;修改用户所属的附加群组

File properties

- 普通文件d 目录文件l 连接文件b 块设备p 管道文件s socket文件

Permissions on the directory:

r:可以查看目录下内容w:可以创建文件和删除文件和修改文件名x:可cd进文件夹
Body processing command and tar command file merging:
cat a1.txt a2.txt>>a.txttouch {a..c}{1..3}.txt
Tar
-A或--catenate:新增文件到以存在的备份文件;  -B:设置区块大小;   -c或--create:建立新的备份文件;  -C <目录>:这个选项用在解压缩,若要在特定目录解压缩,可以使用这个选项。  -d:记录文件的差别;  -x或--extract或--get:从备份文件中还原文件;  -t或--list:列出备份文件的内容;  -z或--gzip或--ungzip:通过gzip指令处理备份文件;   -Z或--compress或--uncompress:通过compress指令处理备份文件;   -f<备份文件>或--file=<备份文件>:指定备份文件;  -v或--verbose:显示指令执行过程;  -r:添加文件到已经压缩的文件;  -u:添加改变了和现有的文件到已经存在的压缩文件;  -j:支持bzip2解压文件;   -v:显示操作过程;  -l:文件系统边界设置;  -k:保留原有文件不覆盖;  -m:保留文件不被覆盖;  -w:确认压缩文件的正确性;  -p或--same-permissions:用原来的文件权限还原文件;  -P或--absolute-names:文件名使用绝对名称,不移除文件名称前的“/”号;   -N <日期格式> 或 --newer=<日期时间>:只将较指定日期更新的文件保存到备份文件里;   --exclude=<范本样式>:排除符合范本样式的文件。
-c -v -tf -x -f -C tar vcf all.tar *       //归档不压缩,z是压缩,xz文件压缩率更高gzip all.tar     //生成 all.tar.gzgunzip all.tar.gz       //解压缩先归档再压缩:tar vxzf all.tar.gz * 解压缩 tar vxf all.tar.gz  //不需要z,万能格式解压缩
bzip2bzip2 test.tar  //生成 test.tar.bz2bunzip2 test.tar.bz2   //解压缩
VI
命令行模式: :编辑模式:  a i o 扩展模式: shift+:

Command-line mode:

G/shift+g :跳到文件末尾gg: 跳到文件开头$:行尾^:行首0:行首yy:复制当前行p:粘贴nyy:复制当前行下的n行到寄存器yy:复制当前行 10p:粘贴当前行下的10行dd:删除当前行,其实是剪切到寄存器u:撤销ctrl+r:恢复num+G:跳到第n行L:当前屏幕最后一列/ :查找 n往下跳

Extended mode:

:wq:q:wq!:q!:sed -i :s/需要修改还的内容/替换的内容/   修改当前行当前行:%s/需要修改还的内容/替换的内容/   修改全文,每行只修改第一个:%s/需要修改还的内容/替换的内容/g   修改全文(%)所有内容(g)
Initialization and service of the system
单用户模式:root身份 开机按 e,linux16 后面加上init /bin/sh +ctrl+s    翻车了http://blog.csdn.net/myth_hg/article/details/44727647mount -o remount,rw /

Single-user mode cracked root password:

Rescue mode hack root password

Rescue mode hack root password

5-linux Base-3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.