Linux commands are used to manage Linux systems. For a Linux system, whether it is a central processor, memory, disk drive, keyboard, mouse, or user, it is a file. the Linux system Management Command is the core of its normal operation, similar to the previous doscommand. There are two types of linux commands in the system: built-in Shell commands and Linux commands. There are a lot of linux commands... There are no more than 4000, or at least about 3500, so we cannot all learn so many commands,
Linux commands are used to manage Linux systems. For a Linux system, whether it is a central processor, memory, disk drive, keyboard, mouse, or user, it is a file. the Linux system Management Command is the core of its normal operation, similar to the previous doscommand. There are two types of linux commands in the system:Built-in Shell commandsAndLinux Commands.
There are a lot of linux commands... There are no more than 4000, or at least about 3500. we cannot learn so many commands, nor can we finish learning them .... Just like java APIs, we only need to remember some frequently-used commands. if you use them, just google them.
Below are some common commands for the time being:
Shutdown-h now shutdown-r now restart reboot now restart su-if the current user is normal, enter this command to switch to the administrator user (root ), if you want to switch to another user, enter the su-user name, for example, su-xiaoluologout, to log out from the current user (if it is on a GUI terminal, enter the exit command to exit the current user) cd switch Directory. for example, cd/indicates switching to the linux root directory !!(/) Indicates the root directory.] Pwd shows the user's current command path (this command is used in many ways. if you do not know the current folder in the command line, you can enter this command pwd
The user management commands for creating and deleting users are as follows:
Useradd username [add a user] for example: useradd xiaoluopasswd username [change password for the specified username] for example: passwd xiaoluouserdel username [delete a user, however, the user's subfolders in the home file are retained. for example, userdel xiaoluouserdel-r username: [delete a user and delete the subfolders of the user in the home folder together with the user.] for example: userdel-r xiaoluo
Speaking of linux, a famous editor under linux must be mentioned here --Vi editor... I believe that anyone who has worked in linux development is not familiar with this editor. on the windows platform, there are even software similar to the vi editor (gvim editor ). For more information about the vi editor and tips, click http://baike.baidu.com/view/908054.htm.
The following is a simple example to get a preliminary understanding of the use of the vi editor. (Use the vi editor to create a Hello. java program and compile and run it)
Procedure:
① Input vi Hello in the command line prompt. java ② enter I [enter the editing status] ③ press esc [enter the command line input status] ④ Press: [in this way, you can enter the command.] ⑤ Press wq to [save and exit], q! [Do not save and exit] ⑥ ls [view the file name of the current directory] ls-l [view the details of the current directory] 7. compile and execute the program you just compiled! (Javac, java)
The preceding is a simple example written in the vi editor. in linux, you can use the vi editor to edit a file as long as you have the file permission.
In the preceding example, a new command is displayed.LsSo 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 files and directories in a long list] such: ls-l/homels-a [list hidden files and directories] such as ls-a/homemkdir [create a directory]. for example: mkdir xiaoluormdir [delete an empty directory], for example: rmdir xiaoluo (only empty directories can be deleted. if there are other files in this directory, this command is invalid) touch [create an empty file] for example: touch Test. java
The following are some common commands:
Cp [copy command] such as cp/home/Test. java/(set Test. copy the java file to the root directory.) cp-r dir1 dir2 [-r indicates recursion. copy the folder represented by dir1 and the files in it to the dir2 path.] for example: cp-r/home/xiaoluo/(copy the xiaoluo folder under home to the root directory) mv [move file and change file name] for example: mv/home/Test. java/(indicates. java file to the root directory) mv/Test. java/Hello. java. change the java file name to Hello. java) rm [delete files and directories] such as rm/Test. java (Test. java delete) [Note: If this file is a folder, it cannot be deleted] rm-rf *【(-R indicates recursion and f indicates force deletion.) Delete all contents, including directories and folders.] for example, rm-rf/home/xiaoluo (force delete the xiaoluo folder under home) ln [create a symbolic link, similar to the shortcut in windows (root permission or corresponding user permission is required). The ln-s source target is as follows: ln-s/etc/inittab (this will create an inittab link under the root directory, which points to the inittab file under the etc directory) more [display file content, with paging] less [display file content, with paging] If a file contains a lot of content, you can use the more command to paging it, such as: more/etc/prelink. conf (to prelink under etc. conf file content is displayed by page) | 【Pipeline command] [This command is used in many linux systems] (| the function of this command is to deliver the result of the previous command to the next command for processing), such: ls/etc | more (| the previous command shows all the files and directories in the etc folder. | the subsequent command is displayed on pages, therefore, this command is used to display all files and directories under The etc directory by page. grep [query content in the text] is used in many ways, such: grep "xiaoluo"/home/Test.txt (query the line of text information containing xiaoluo in the Test.txt file) if you need to display the number of lines of the text to be queried, use: grep-n "xiaoluo"/home/test.txt(query the number of rows where xiaoluo is located in the test.txt file and modify all texts) find [search for files and directories] such as find/home-name Test. java (the name is Test in the home folder or in all subfolders in home. java files) the redirection command [>>>,<] such as: ls-l/etc> a.txt prepare file will overwrite the previous information) ls-al/etc> aa.txt (add the following information in etcto the information in the aa.txt file) input aaa <bbb
I almost forgot a very important command:
[Cat, vi] (the cat command can only view files. The vi command can view and modify files. for some key files, we generally use the cat command to view them)For example, cat/etc/profile (only view the content in the file) vi/etc/profile (view and modify the content in the file)
Subsequent blog posts will continue to record the details of the Linux system and add more common Linux commands.