File filename #查看文件的类型
Chmod-r 777 dir/#文件夹, and the files under all change permissions
Chown Zhang:zhang dir/#将文件夹更改目录及所属的组
which PWD #命令所在的位置
Whereis pwd
CD ~zhang/# Switch to the user's home directory
cd-#切换到上一次用cd的目录
Mkdir-p/zhang/z #创建一个文件夹, parent folder does not exist and parent folder is created
Mkdir-p Zhang/{zz,xx,xx} #同时创建多个文件夹
Rmdir-p Zhang/zz #删除子文件夹, if the parent folder is empty, delete the parent folder
RM-RF Zhang #强制删除整个文件夹,-R means recursion
Ls-1 # 1, one of the files displayed under the folder
Ls-s #显示这个文件下的总的大小
Ls-h #以便于人类的方式查看大小
Ls-d #只查看文件的大小
LS-DL--time=ctime
Cp-rf/etc zhang/#文件的属性信息没有复制过来-P can copy property information
CP-A/etc zhang/a this option can be quite similar to the set of attributes above
Cp-u/etc/services/mnt/services # quite with update
CP systemlink filename #将ln对应的文件, copy
cp-d systemlink filename #复制的是链接-D
Basename/etc/grub/grub.conf #只显示文件名
Od-t What type of/bin/ls
Strings/bin/ls #查看非文本的内容
Vim filename
Touch filename #文件存在则更新到当先的时间
The permissions of the file are 666----because it cannot be executable when the file is created
The permissions for the folder are 777
The system default Umask value is 228 binary
Umask-s #可以查看使用的模式
lsattr filename View Special permissions
Chattr +a dirname #只能添加文件夹的内容, cannot delete, modify existing file
Chattr +i dirname #不能添加也不能删除
Chattr-i dirname #取消-Options
chmod u+s filename #在命令所有者的权限上, other people execute this command, others have the owner's permission
chmod u-s filename# de-set flag bit
chmod g+s dirname #这个文件夹下的所有的组, will inherit the group that belongs to
chmod o+t dirname #只能是在目录上, only in other locations; The files created are only root, and the owner can delete
Locate Qwer #通过数据库查找文件
Locate-i Qwer #忽略大小写
Ls/var/lib/mlocate/mlocate.db #会自动一天更新一次
UpdateDB #更新数据库
Find Directory-Property values
DD If=/dev/zero of=/file bs=1m count=3
-------------------------------------------------
------------------------------------------------
The composition of a disk:
1.bootsector Boot Sector
2.superblock Super Block
3.inode--which stores the file's attribute information, block
An inode has 128 bytes, pointing to a block consumes 4 bytes
An inode can point to a maximum of 128K
4.block--Each one has a number
When the file is too large
Direct Block Storage data
The indirect block contains information about other blocks.
Stat filename #查看文件的状态信息
ls-i filename #查看文件使用的inode
filefrag-v filename #查看文件的状态信息, which blocks are located inside the block
Dumpe2fs/dev/sda2 #查看磁盘的状态信息
Df-ht #T显示文件的类型
FDISK/DEV/SDA #去建立新的分区
PARTPROBE/DEV/SDA #更新分区表
Mkfs-t Ext3/dev/sda5 #格式化新建立的分区
Mkfs.ext4/dev/sda5
Mount/dev/sda5/mnt #挂在这个新建立的分区
Fsck/dev/sda5 #检查分区的坏道-C can show the process of checking
Badblocks/dev/sda5 #检查磁盘的坏道
Mount-o remount,ro/mnt #重新挂载, hangs in read-only mode
/etc/fstab #关于挂载的目录
Tune2fs-l/dev/sda5 #查看磁盘的信息
Gzip hosts
gzip-d hosts.gz #解压
Gzip-c hosts > Hosts.gz #压缩, and save the original file
Zcat hosts.gz
BZIP2 hosts
Bzip2-d hosts.bz2
Bzip2-c hosts > hosts.bz2
Bzcat hosts.bz2
Zip file.zip file
Unzip File.zip
Tar
C Create
V Visual
F Name after creation
Tar cvf one.tar--remove-files #打包好, delete original file
Tar xvf One.tar #解档文件
Tar xvf one.tar-c dirname/#-C solution to the specified folder
Tar TVF One.tar #查看文件
Tar xvf one.tar AA #解档其中的一个文件
--
Package and Compress
Tar zcvf one.tar.gz aa bb cc DD #gzip
Tar zxvf one.tar.gz
Tar jcvf one.tar.bz2 aa bb cc DD #bzip2
Tar jxvf one.tar.bz2
Incremental backup: Increases once, so recovery is also a once-in-a-time recovery
Differential backup: First full backup, then back up after the and together, reply to the time, only once
Backup level 0-9: Only backups that are smaller than the last backup level (backup grows content)
Incremental backup
Dump-0u-f Rech/0.dump/dev/sda3 #将/dev/sda3 Backup to Rech/1.dump
Dump-1u-f Rech/1.dump/dev/sda3 #将/dev/sda3 Backup to Rech/1.dump
Dump-2u-f Rech/2.dump/dev/sda3 #将/dev/sda3 Backup to Rech/1.dump
Differential backup:
Dump-0u-f Rech/0.dump/dev/sda3 #将/dev/sda3 Backup to Rech/1.dump
Dump-2u-f Rech/1.dump/dev/sda3 #将/dev/sda3 Backup to Rech/1.dump
Dump-1u-f Rech/2.dump/dev/sda3 #将/dev/sda3 Backup to Rech/1.dump
To view the backup file:
Restore-t-F Rech/1.dump
Go to the location where you need to reply, restore:
Restore-r-F Rech/0.dump
Restore-r-F Rech/1.dump
Restore-r-F Rech/2.dump
To recover specific data:
Restore-i-F Rech/0.dump
> ls #列出文件
> Add AA bb #要恢复的两个文件
>extrace
To create an image file:
DD If=/dev/zero of=/file1 BS=1MB count=1
DD If=/dev/zero of=/file2 BS=1MB count=1
DD If=/dev/zero of=/file3 BS=1MB count=1
Mkiosfs-o Xx.ios File1file2 File3
Mount
Mount-o Loop xx.ios/mnt
Copy the disc into one image:
Cp/dev/cdrom Xx.ios
Copy the hard drive:
DD If=file Of=/dev/sda3
Cpio command to use the Pipe-o package-I unpacking
Find-name ' file* ' | Cpio-o > Xx.cpio
Unpack
Cpio-iu < Xx.cpio
Linux Foundation (not finished)