Get out of the mouse and start with a deep mastery of Linux (i)
Order: As a program ape, often with the mouse operation, it is too embarrassing; play a graphical interface, too layman. Therefore intends to deepen the study of Linux, and will learn the footprints recorded, we share and mutual encouragement! Linux learning, personal feel to be divided into three pieces, are the basic concepts of Linux and Basic command of learning, Sheel script proficiency, the Linux kernel source of learning and analysis. Learn any technology, the foundation is very important, there are more than 3,000 commands in Linux, more than 200 common, we need to skillfully use more than 70 kinds. This article will introduce the important concepts and common commands in Linux!
1. Installation recommendations for Linux
If you are a novice, I do not recommend that you directly install a Linux system or a dual system, this is not wise. A more desirable approach is to install a VMware virtual machine. Then install your Linux system based on VMware. On the server side, the common Linux system is redhat, but the current redhat to charge a certain fee, so you can install CentOS or Ubuntu system for Linux learning journey.
2, Linux common directory role
/root directory/root home directory for super users
/bin command Save directory/tmp temp directory
/boot directory, start related files/sbin command save directory
/dev Device File save directory/proc write directly to memory
/etc configuration File save Directory/sys
Home directory/USR system software Resource Directory
/lib System Library Save Directory/usr/bin System command (normal user)
/MNT System mount Directory/usr/sbin system command (super User)
/media System mount directory/var system related document content
3, Command prompt
A prompt like [[email protected] ~] # is called a command prompt. This is very common when you use CTRL + ALT + T to open a terminal. You'll see the command prompt, which tells you what each symbol means in the command prompt.
[]: square brackets have no practical meaning
@: No special meaning
Root: The string in front of the current user name of the currently logged on system, if it is root on behalf of the Administrator (the administrator under Windows System is Administrator)
localhost: The string that follows the @ represents the IP address of the server host, or localhost if it is native
~: Represents the current location or directory (root current home directory/home/root)
4, command format
Command format: command [options] [parameters]
5, the contents of the query directory: LS
LS is often used with some options, and the common collocation options are as follows:
-A: Show all files, including hidden files
-D: View Directory properties
-H: User-friendly display file size
-I: Display inode (each file has a specific ID OK, inode refers to this ID)
-L: See detailed information about the file
Here's an in-depth talk about Ls-l's command.
The first column represents the file permissions (10-bit)
The first symbol in the first column represents the type of file and there are 7 types of files. There are three common (-representing ordinary files, D for directories, L for links), and the other four are block device files, character device files, socket files, and pipe files.
The other 9 symbols, each in a three-bit group. The first group represents the owner's permissions, the second group represents the permissions of the group to which it belongs, and the third group represents the other person's permissions. There are three permissions for the file, namely read (R), write (w), and execute (x).
6, Directory processing commands
Build directory: mkdir
If you need to create a directory recursively, you can add the-P option. That is, mkdir-p [directory name]. Recursively creating a directory means creating a parent directory before creating a level two directory.
directory where you switch: CD
Some of the commands to simplify switching directories are as follows:
CD ~: Enter the current user's home directory
Cd. : Enter the current directory
CD: Enter the parent directory
CD + ENTER: equivalent to CD + ~, into the user's home directory
CD-: Go to the last directory
Delete directory rmdir (less used)
Rm-r: Delete a directory (if there is a file in the directory will ask)
RM-RF: Delete a directory (there are files in the directory will not be queried, forced to delete)
Copy directory CP [options] [source file directory] [target directory]
Options:
-r: Copy directory
-P: File attribute copying
-D: If the source file is a linked file, copy the link property
-A: Equivalent to-PDR (the target file will be exactly the same as the original file, attributes are identical)
Cut or rename command mv (if the source and destination files are in the same directory, it is equivalent to renaming)
MV [source file or directory] [destination file or directory]
7 Linux compression and decompression commands
There are 5 common compression formats for Linux:. zip,. gz,. bz2,. tar.gz,. tar.bz2
Zip compression Format command operation
Zip [file name] [compressed filename] Compressed file
Zip r [Directory] [compressed directory] Compressed directory
unzip [file] [unzip file] unzip the file
Gzip Compressed Format command operation
gzip [source file] compressed to. gz format, the source file disappears
gzip-c [source file] compressed to. gz format, source file does not disappear
Gzip-d Decompression
Gunzip Decompression
BZIP2 Compression Format command operation
bzip2 [file] compressed to. bz2, source file not preserved
bzip2-k [file] compressed to. bz2, keep source file
Package Command Tar
TAR-CVF [Package file name] [source file] make the file into a tar package
Options:
-C: Packaging
-V: Display procedure
-F: Specifies the file name after packaging
. tar.gz compression format
TAR-ZCVF [Compressed package name. tar.gz] [source file] compressed into. tar.gz format
TAR-ZXVF [Compress package name. tar.gz] Unzip
Get out of the mouse and start with a deep mastery of Linux (i)