How Linux views the disk's remaining space
[Email protected] var]# DF-HL
File system capacity has been used with available% mount points
/DEV/HDB2 75G 75G 0 100%/
/DEV/HDB1 99M 9.2M 85M 10%/boot
None 251M 0 251M 0%/dev/shm
What does that mean, how much space can I use. Can I see the remaining space in a directory? For example, how to check the remaining space of var. I can only see the space using the du command.
View a single directory with the following command
# Du-bs Dir_name
Linux Modify folder read and Write permissions
Added folder Aa1 want to enable all other users to have access to the file Aa1 read and Write permission
chmod o+rwx Aa1
By adding the-R parameter, you can pass read and write permissions to subfolders
For example Chmod-r 777/home/mypackage
Then the properties of the MyPackage folder and all subfolders underneath it become 777.
777 is read, write, execute permissions ...
View File Contents
VI Display these ~ means that this line of content is empty, you can directly press I into the editing mode to add content, OK press ESC exit edit mode, enter the command:: Wq, the return is saved to exit. Do not understand the suggestion to search the VI operation first.
VI file name #编辑方式查看, can be modified
Cat file name #显示全部文件内容
More file names #分页显示文件内容
Tail file name #仅查看尾部, you can also specify the number of rows
Head file name #仅查看头部, you can also specify the number of rows
Sed ' 1,$ ' p filename #这个可以指定起始行和结束行的, change 1 and $ to
TAR-CVFZ archive.tar.gz Dir1 Create a zipped package in gzip format
TAR-XVFZ archive.tar.gz Unzip a compressed package in gzip format
Unrar e file.rar//decompression rar
Unzip File.zip//Unzip zip
View File Size
Use the LS-LHT command to display all files in the current directory, with one column showing the size of the file.
If you want to see the size of a folder, you can use DU-SH *
Compression
TAR–CVF Jpg.tar *.jpg//package all JPG files in the directory into tar.jpg
TAR–CZF jpg.tar.gz *.jpg//pack all JPG files in the directory into Jpg.tar and compress them in gzip to generate a gzip compressed package named jpg.tar.gz
TAR–CJF jpg.tar.bz2 *.jpg//pack all JPG files in the directory into Jpg.tar and compress them in bzip2 to generate a bzip2 compressed package named jpg.tar.bz2
TAR–CZF jpg.tar.z *.jpg//pack all JPG files in the directory into Jpg.tar and compress them in compress to generate a umcompress compressed package named Jpg.tar.z
RAR a jpg.rar *.jpg//rar format compression, you need to download RAR for Linux first
Zip jpg.zip *.jpg//zip format compression, need to download zip for Linux First
Extract
1, *.tar with TAR–XVF decompression
2, *.gz with gzip-d or gunzip decompression
3, *.tar.gz and *.tgz with TAR–XZF decompression
4, *.bz2 with bzip2-d or with BUNZIP2 decompression
5, *.tar.bz2 with TAR–XJF decompression
6, *. Z Extract with Uncompress
7, *.tar. Z Extract with Tar–xzf
8, *.rar with Unrar e decompression
9, *.zip with unzip decompression
Find command in Linux--Look up file name
1. Look for a file named "elm.cc" in a directory
find/home/lijiajia/-name elm.cc
2. Find files in the file name that contain a character (such as "Elm")
find/home/lijiajia/-name ' *elm* '
find/home/lijiajia/-name ' elm* '
find/home/lijiajia/-name ' *elm '
3. Query according to the characteristics of the document
find/home/lijiajia/-amin-10 #查找在系统中最后10分钟访问的文件
find/home/lijiajia/-atime-2 #查找在系统中最后48小时访问的文件
find/home/lijiajia/-empty #查找在系统中为空的文件或者文件夹
find/home/lijiajia/-group Cat # finds files that belong to Groupcat in the system (tried, the command is incorrect.) )
find/home/lijiajia/-mmin-5 # Find files that have been modified in the last 5 minutes of the system
find/home/lijiajia/-mtime-1 #查找在系统中最后24 hours of modified files
find/home/lijiajia/-nouser #查找在系统中属于作废用户的文件 (I don't know what that means)
find/home/lijiajia/-amin #查找在系统中最后10分钟访问的文件
Find/home/ftp/pub-user Lijiajia #查找在系统中属于lijiajia这个用户的文件
(PS: The above is done under the/home/lijiajia/folder)
4. Find a file using a hybrid lookup method
Find/tmp-size +10000000c-and-mtime +2 #查找 a file larger than 10000000 bytes in the/tmp directory and modified within 48 hours
Find/tmp-user Tom-or-user George #查找 files belonging to the two users of Tom or George in the/tmp directory
Find/tmp! -USR Fred #查找 The files that are not part of Fred in the/tmp directory
Linux Common commands