Linux Learning CentOS (ii)--some common commands for the initial knowledge of Linux
After installing CentOS6.4 on the VM, looking at the Linux system to run successfully, the heart small excited a ... But the road ahead of learning is still far away ...
The first time you learn a Linux system, you have to start with some basic Linux commands.
Linux commands are commands for managing a Linux system. For Linux systems, whether the CPU, memory, disk drives, keyboards, mice, or users are all files, the Linux System Management command is the core of its normal operation, similar to the previous DOS command. There are two types of Linux commands in the system: built-in shell commands and linux commands .
Linux commands are very much ... No more than 4,000, at least 3500 or so, we can not all go to learn so many orders, it is impossible to learn .... Just like the Java API, we just need to remember some of the commonly used commands, we can go to Google for a little bit.
Here are some of the commonly used commands for a temporary study:
Shutdown-h now immediately shuts down shutdown-r now reboot reboot now reboot
Su-If you are currently a normal user, enter this command to switch to the administrator user (root), and if you want to switch to another user, type Su-user name such as: Su-xiaoluo
Logout Log off from the current user (if it is a terminal in the graphical interface, enter the exit command to exit the current user)
CD switch directory "such as: CD/switch to the root directory of Linux!! (/) represents the root directory "
PWD shows the command under which path the user is currently in (This command is particularly used, and if you do not know the current folder in the command line, you can enter the command pwd
Next is the user Management command to create the user and delete the user:
Useradd User name "Add a user" such as: Useradd xiaoluopasswd username "Modify password for specified user name" such as: passwd xiaoluouserdel username "Delete a user, However, the user's subfolder under the home file will retain "such as: Userdel xiaoluouserdel-r username " To delete a user, and delete the subfolder along with the user in the home folder "such as: Userdel-r Xiaoluo
When it comes to Linux, here's a well-known editor for Linux-theVI editor ... The editor believes that people who have done Linux development are familiar with it, and even have software like the VI Editor (Gvim Editor) on the Windows platform. For more information and tips on how to use the VI editor, please click Http://baike.baidu.com/view/908054.htm to view
The following is a simple example to understand the VI Editor's use. (Create a Hello.java program with the VI editor and compile and run)
Steps :
① at the command prompt , type VI hello.java② input i "enter into the edit state" ③ type ESC "Enter the command line input status" ④ typing : "So you can enter the command. "⑤ -Wq" Save and Exit ", q! "Do not save and exit" ⑥ls "to view the file name of the current directory" ls-l "View current directory Detail file information" ⑦ compile and execute the program you just wrote! (Javac, Java)
The above is just a simple example written in the VI editor, in the Linux system, as long as you have the file permissions, you can use the VI editor to edit it
The above example has a new command LS , so now we have to introduce some common commands:
ls "List files and directories" such as: Ls/home (List all files and directories under Home) ls-l "List of files and directories displayed in a long list" such as: ls-l//
Ls-a "list hidden files and directories" such as: Ls-a/homemkdir "Create directory" such as: mkdir xiaoluormdir "Delete empty directory" such as: RmDir Xiaoluo (only empty directory can be deleted, if there are other files in the directory, the command is invalid) Touc H "Create empty file" such as: Touch Test.java
The following are some common commands:
CP "Copy command" such as: Cp/home/test.java/(the Test.java file under the home path is copied to the root directory) cp-r dir1 Dir2 "-R for recursion, the Dir1 represents the folder and the files inside the DIR2 path there."
such as: Cp-r/home/xiaoluo/(Copy the Xiaoluo folder under home to the root) MV "Move and change file name" such as: Mv/home/test.java/(means to move the Test.java file under home to the root directory)
Mv/test.java/hello.java (means to change Test.java file name to Hello.java) RM "Delete files and directories" such as: Rm/test.java (remove Test.java from the root directory) " Note: If the file is a folder, you cannot delete the "Rm-rf *" (- R for recursion, F for forced deletionDelete all content, including directories and folders "such as: Rm-rf/home/xiaoluo (forced removal of the Xiaoluo folder under Home) ln" To establish symbolic links similar to shortcuts in Windows (requires root or appropriate user rights) "Ln-s source target Objective: Ln-s/etc/inittab/inittab (This creates a inittab link in the root directory, which points to the Inittab file in the ETC directory) more "show file contents with pagination" Less "show file contents, with pagination" If there is a lot of content in one of our files, you can use the more command to page it out
such as: more/etc/prelink.conf (to etc, the contents of the prelink.conf file below the page display) | 【Pipeline Command"This command is used in many Linux systems" (| The function of this command is to hand over the results of the previous command to | The command that follows it) such as: Ls/etc | More (| The previous command is to display all files and directories in the ETC folder, | The next command is displayed in pagination form,
So the meaning of this command is to display all the files and directories in the ETC directory with pagination, grep "query content in text" This command is used very much as: grep "Xiaoluo"/home/test.txt ( Query the Test.txt file for the line containing the Xiaoluo text message)
If you need to show the number of rows that you are looking for, use: Grep-n "Xiaoluo"/home/test.txt (query the number of rows in the Test.txt file that the information is in and all text is changed) find "Search files and directories" such as: Xiaoluo -name Test.java (Find files named Test.java under the home folder or all subfolders in home) REDIRECT Commands >, >>, <, such as: Ls-l/etc> a.txt ( Write the following list information to "overwrite" in the A.txt file, and if the A.txt file does not exist before, create the A.txt file and write the information in it.
If a a.txt file is present, the previous information is overwritten) ls-al/etc>> aa.txt (Append the list information of etc to the Aa.txt file information) Enter information from the file AAA < BBB
Almost forgot a very important command:
"Cat, VI" (CAT command can only view files, vi command can view the file and can modify the file, for some of the key files we generally use the Cat command to view)
such as: Cat/etc/profile (just view the contents of the file) Vi/etc/profile (view, and can modify the contents of the file)
Subsequent posts will continue to record the bits and pieces of the Linux system that will add more common Linux commands.
Linux Learning CentOS (ii)--some common commands for the initial knowledge of Linux