Lesson One: Basic command usage for Linux and the use of the Man manual
1: ls List File lists
-A lists all directories (including hidden files)
-d lists the directory itself without listing the data in the directory example: Ls-ld/home
-H list the file's capacity
Example: [[email protected]/]# ls-hld/etc/
Drwxr-xr-x. 135 root root 8.0K Sep 07:23/etc/
Simple use of ls-h
[Email protected]/]# ls-h
Bin Dev etc Lib media opt root sbin sys usr
Boot DOUBLE Home lib64 mnt proc run SRV tmp var
Found by man-H,--human-readable
With-l, print sizes in human readable format (e.g., 1K 234M 2G)
Therefore, the general-H parameter should be combined with the-L "with-l"
-I lists the contents of the file and displays the file amount node number Inode
The Inode "Inode" is translated into Chinese as an index node. Partition of each storage device or storage device (storage device is hard disk, floppy disk, USB stick ...) After being formatted as a filesystem, there should be two parts, one for the inode, and the other for the Block,block to store the data. The inode is the information that is used to store this data, including file size, owner, attribution user group, read-write permission, and so on. The Inode indexes the information for each file, so there is a value for the inode. According to the instructions, the operating system can find the corresponding file by the Inode value. 』
-S sorts files by size rather than filenames
-T sorts files in time
"Both are used in conjunction with-L"
-s sort by file size
--sort=word
Sort by WORD instead of name:none (-u), size (-s), Time (-T), version (-v), extension (-X)
2:CD change the working directory
Note When using CDs:. Represents the current directory
.. Represents a top-level directory
~ Indicates the current user's home directory ~username represents the user's home directory
-Indicates that the previous directory used was "not relevant to the current directory"
3:pwd View current Path
4 : mkdir Create a directory
-P can create a directory recursively
-M can directly configure file permissions
[[email protected] home]# mkdir-m 777 test; LS-LD test
Drwxrwxrwx. 2 root root 6 Sep 08:09 test "
5 : rmdir Delete an empty directory
[Email protected] text]# rmdir hehe
rmdir:failed to remove ' hehe ': not a directory
[Email protected] text]# CD.
[Email protected] root]# rmdir text/
rmdir:failed to remove ' text/': Directory not empty
Therefore, you can only delete an empty directory, you can not delete the file
[[email protected] home]# ls
Hao Root Westos
[Email protected] home]# rmdir-p root/text/
[[email protected] home]# ls
Hao Westos
Use the-p parameter to recursively delete empty directories
6 : Touch is used to modify the file timestamp, or to create a new file that does not exist .
Timestamp: Each file contains three time
1.modification Time (Modified): The contents of the file are changed when they are not permissions and properties
2.status times: When permissions and properties of a file are changed
3.access time: When a file is taken
7 : RM Delete a file
Typically use RM-FR to force recursion to delete a file or directory
8 : CP Copy
Copying files and creating connection files
9 : MV move a file or directory or change a name
10:vim a very useful text editor (detailed later)
11:cat View text Files
A : More View text files (less useful) use pipe breaks to easily see the results of the output
- : Find find a file or directory ( Find–name file name)
14:file file name (shows what the file is)
15:tar (archive command)
Compression: tar-jcv-f filename.tar.bz2 the file or directory name to be compressed
Enquiry: tar-jtv-f filename.tar.bz2
Unzip: tar-jxv-f filename.tar.bz2-c Directory to unzip
16:find command
find. –name *lin.text* ( finds files with lin.text in the current directory )
Find/-name *.conf
Find/-perm 777 ( file with file permissions of 777 )
Find /-type d ( lookup type is directory,l is link, etc. )
Find/-user User name (find belongs to a user) similarly Find/-group Group name Find/-size specifies the size.
Linux Learning Basics Command--9.24