This knowledge point :Linux system multi-terminal switching ,Linux users , Linuxremote Access tool use ,Linux under the important directory , the composition of the command , wildcard ,path problem of Linux , Comprehensive application of file operation
Why Learn Linux?
1. Many people say that. NET programmers only work in the Windows environment, do not understand the use of Linux, and do not understand the Linux commands, only with the mouse, only in the graphical interface to work. Actually just started to listen, in the heart quite uncomfortable, as a. NET programmer, I am familiar with the work under Windows, because we do not need to use the coding tools in the Linux environment, and a lot of PHP and Java programs, they are just a little bit of command, to despise us, do not understand Linux, then I was very uncomfortable, you contact, Understand is of course, do not understand the blame, in order not to be despised, I also want to contact with Linux, more than they are more familiar.
The advent of the 2.Linux era, with Microsoft Open source. NET, is bound to migrate. NET to multiple platforms, Linux because of its free and open source features, many companies in the future will be the server's operating system to build Linux, and will migrate the. NET platform to the platform, Therefore, the. NET programmer to learn Linux is imperative, in order not to be abandoned by the times, then they must progress, the Linux as a part of the work, then it is not laborious to learn.
Start Learning Linux
To prepare the Linux system, I installed the VMware virtual machine software, the fool installs the CentOS6.7 operating system, regarding chooses the Linux system version the question, I mainly looks at the current company builds the server to choose the Linux version, as well as the study cost to consider, Finally, CentOS was selected.
Multi-terminal and switching of Linux systems
The so-called multi-terminal, according to my understanding, is a number of users, different users have a different environment, we do not affect each other. Because I installed the CentOS6.7, so one in the graphical interface.
CentOS has a total of 6 terminals, the graphical interface is also one of the terminals, corresponding to the keyboard F1, the other 5 corresponding to this F2~F6, are console terminal
Note: If you enter the console terminal from the graphical interface, the shortcut key is: ctrl+alt+ (F1~F2), if you go from the console to the rest of the terminal, just press ALT+F1~F6, (I do not know whether to install this virtual machine problem, you need to press Ctrl)
Linux Terminal's account password
I do not know that I understand this is not accurate, anyway, super Administrator is root, password is installed when the password is filled, of course, Linux and other users,
How Linux uses commands (small white dedicated)
For a small white to say ... Linux may be installed after entering the graphical interface, where to hit the command is not known .... (I used to be ...) I chose the shortcut key Alt+f2 enter the terminal, and then enter the account password entered the system,
Connecting Linux systems remotely using tools
With SECURECRT, you can connect to Linux remotely under window. After downloading, after authorization (please use genuine =_=!), enter into the interface
In the menu bar-->file-->quick connet--> Select SSH2, fill in hostname (address, do not know the virtual machine IP, under linux command line ifconfig), Username:root,---> Click Connect---> enter your password.
Last appearance interface
This is equivalent to the console of the terminal, if the white bottom is not good-looking, not like Linux, then you can click the session to find the corresponding Linux terminal to connect, right-click Properties, enter the option, in the Terminal-->emnulation- > Drop-down box to choose a Linux theme to become Linux,
Make the font bigger: Ctrl + mouse wheel
Select Send Protocol no-op to prevent the terminal from connecting to the server from being cleared.
After using the Remote administration tool, it is the same as the command line of the terminal used in Linux, so it is sucurecrt directly with this remote management tool.
Linux Important Directory
After the LS command, the blue is displayed as a directory , the white is displayed as a file , the green represents the executable file , and the light blue represents the symbolic link
There are a number of important directories:
Bin: There are a bunch of commands
ETC: It is stored in some important configuration files, Linux some configuration, what network environment are stored here
Proc: Virtual directory, some files generated during the system operation, through the contents of the system to understand the internal situation, the equivalent of a system opened a window to see some internal information inside the system
Sbin: Also holds the command, but it is to save some of the lower level close to the physical operation of the command, such as what shutdown boot, modify the system time and so on, involving some physical hardware operations, but the need for higher permissions,
Home: The main working directory, equivalent to a base of the login, each user has their own master working directory, if it is the root user, is in the root file in the directory
The composition of the command
The display of each command line consists of: if the normal user is $,root # is # if it is displayed as ~ in the current directory where the chart is in, the current main working directory is entered
View the command user manual
Use man Commond can bring up the manual of the command, press f can next page, press B can go to a page, press Q to exit the command manual
Linux basic commands (each subsequent section will be updated continuously)
AddUser username Add a new user
passwd Username Modify User Password
SU username using username user Login Terminal
Date of the current system
Hwclock the clock of the hard drive
Clear clears the information on the screen
Cal Calendar
Who is currently online
uname information about the current system
Top view the currently launched task, system dynamic information, can monitor the system load
Shutdown now shuts down, and if not, it waits for all users logout to be turned off.
Logout exiting the current user, but not shutting down the computer
PWD View your current directory
----------The following command to manipulate the file----
echo Content > Directory/filename indicates that if Fliename is turned on, the content is output, ">" represents output redirection, and if not, the content is output directly from the screen
Touch FileName Creates a 0-byte file, and if you touch a file that already exists, it will change the last open timestamp of the file.
Chown Newuser/directory/filename Change the owner of the file, that is the owner Ls-l see, the third parameter needs to take a path
Chgrp Newuser/directory/filename Change owner Group
LS list lists the files or subdirectories of the currently open Directory
Cat Catalog Open file or Open Directory
RM remove Delete file or file directory
MV Move directory or change file name
CP Copy copy File
mkdir make directory Create directory
CD Change directory changes the current catalog
RmDir Remove Directory
Use Ls-l to list detailed catalogs or their detailed information
Using wildcard characters
*: Represents 0 or more of any character in its location
?: represents only one arbitrary character in its position
[]: In its position, there is [] any character set, if it is continuous can be written as [1-9][a-z][a-za-z]
Plain Letters: For example, write a? Then in the first one must match a
Directory and path of files under Linux
All files are from the root directory/start.
The path is represented by: relative path and absolute path example: relative path: I want to access K---->cd/a/e/k absolute path: I am currently in G but I want to access H----> CD. /.. /d/h
As a programmer, we also know what absolute paths and relative paths are,
Comprehensive application of file operation
First, the default name to prevent confusion: text indicates the content, file at the beginning of the presentation files, directory at the beginning of the table of contents
Create a file : [[email protected] ~]# echo text >/root/filea---> Indicates that a Filea file is created in the root directory and the text is output if the file is opened
Open a file : [[email protected] ~]# cat filea--> is now in the root directory, so use cat to open the file directly Filea
Return to main working directory: enter the CD directly
Change file name : [[email protected] ~]# MV Filea Fileb---> Use MV to rename MV action the first parameter: the original file name, can take the path of the second parameter, need to change the name
copy a file : [[email protected] ~]# CP Fileb FILEC----> apply CP for file copy, CP action first parameter: the name of the original file, you can take the second parameter of the path, copy the original file into a text in the directory Piece Name
Create a directory : [[email protected] ~]# mkdir directory1----> Create a file directory mkdir create a folder named Directory1 directly in the current directory. If you want to create a different path, then take the path.
move to a file in the directory : [[email protected] ~]# mv Fileb directory1----->MV is to move the file, if the second parameter parameter is a directory, then it is moved to the directory, if not the directory, it is Changed its name.
If a folder does not exist in a directory, how to create : [[email protected] ~]# mkdir-p directory2/directory3----->directory2 If this directory does not exist, Ordinary mkdir without parameters, can not be created, if with the parameter-p to create a
Delete file : [[email protected] directory3]# RM file333---> will prompt rm:remove regular file ' file333 '? If delete is filled in Y, do not delete n
Modify the permissions of the file rwx : [[email protected] ~]# chmod a+x filec----> Use chmod command a+x it is user,group,othor permission to modify the meaning of A to all X is the corresponding executable permission, or it can be R or W
[[email protected] ~]# chmod a-x Filec----> is the right to delete x
[Email protected] ~]# chmod u+x filec---->a replaced by U is for user permissions, respectively corresponding to the first letter
a hard link is to share a sub-file with another directory : [[email protected]ocalhost ~]# ln directory1/fileabc dirctory3----> Directory1 F ILEABC file link to Directory3, so in 3 can also open FILEABC, equivalent to the program in the high clustering, modified FILEABC, while two directories read is the modified content, equivalent to a number of dads, although modified after the two dad can be shared, But one of the dads was removed, but another dad could read the file, and if it was to be deleted, it would have to be deleted from both sides.
Create a link to another directory or file : [[email protected] directory1]# ln-s. /directory2/directory3 link----->ln-s point to another directory or file for fast open, only the LS link to test whether link points to a different directory
Just on a few courses, the summary of the operation, Linux as an operating system of course is broad and profound, the road is still long, but for the management of the document has a basic understanding.
. NET Programmer Learning Linux (i)