Linux basic commands, you must see!

A, LINUX system simple description:

Linux security, efficiency, flexibility, unlike the windows as the face of the public, so universal, nor windows as there may be significant and easy to understand icons, it only has a large number of commands to operate.

But one thing to note, linux dangerous, because we are not familiar with, so in the beginning with accidentally delete important files or data.

 
Two, LINUX command brief:

LINUX command more, and each command by [man + command] to see this command has many parameters. Here we can slowly discover through our practice.

The following description will explain the various commands usage, for example, parameters can now also add that I just now after learning through discovery can continue to supplement and improve this document.

 
Third, the details of LINUX command:

1、cd

Description: Enter a folder

Usage: [cd + directory (folder)] {__ alimama_advert_con__}

For example:

[Cd] into the root directory can be queried by a pwd / root directory

[CD ..] into the upper level directory

[Cd /] into the root directory

[CD html] relative directory into which html

[Cd / var / www / html] into / var / www / html this absolute directory

 


2 ls

Description: Displays the following directory folder

Usage: [ls]

For example:

[Ls] to display files in the current directory folder or file

 
3、ls -l或ll

Description: The following detailed display a directory folder

Usage: [ls -l] or [ll]

For example:

[Ls -l] or [ll] detailed display files in the current directory folder or file


4、pwd

Description: Displays the current directory

Usage: [pwd]

For example:

[Pwd] displays the directory where the current location


5、cp

Description: Copy a file

Usage: [cp file folder / file]

For example:

[Cp aaa.txt / var / www / html] aaa.txt into the absolute directory / var / www / html inside by copying

[CP aaa.txt html] aaa.txt by copying the directory into opposite inside html html in the same directory and aaa.txt

[Cp aaa.txt bbb.txt] to copy aaa.txt to bbb.txt in the same directory

6、mv

Description: Cut a file

Usage: [mv]

For example:

[Mv aaa.txt / var / www / html] aaa.txt into the absolute directory / var / www / html inside by shearing

[Music Videos aaa.txt html] aaa.txt by cutting into the opposite inside aaa.txt html directory in the same directory and html

[Music Videos aaa.txt bbb.txt] aaa.txt cut to the same directory bbb.txt


7、rm

Description: Delete a file

Usage: [rm folder / file]

For example:

[Rm aaa.txt] to delete a file

[Rm aaa] to delete a folder

Common attributes:

rm -rf aaa.txt completely delete a file

 


8、mkdir

Description: Create a folder

Usage: [mkdir folder]

For example:

[Mkdir aaa] to create a folder

 


9、chmod

Description: modify the permissions of a file or folder

Special Note:

(1) forms: rwxrwxrwx 777

(2) Packet rights: their rights with the rights of other users of the user group permissions

(3) r is a readable value is 4, w is writable value is 2, x is an executable 1, - a value of 0 is no authority

r->4 w->2 x->1 rwx->7 rw->6 rx->5 wx->3

Usage: [chmod permissions to the folder / file]

For example:

[Chmod rwxrwxrwx aaa.txt] setting aaa.txt, which is the highest authority

[Chmod 777 aaa] aaa modify the permissions of a folder, which is the highest authority

 

10, takes

Description: extract the compressed file, there are a lot of decompression command, there decompress tar, tar.gz, zip, rar, and each type has unzip the file command

For different types of file compression and decompression, there are a lot of command, there are a lot of parameters

Usage: [tar parameters compressed files are compressed files]

Example: tar czvf aaa.tar.gz aaa aaa the file / folder compressed into compressed aaa.tar.gz

tar xzvf aaa.tar.gz decompressing the compressed aaa.tar.gz


11、cat

Description: View a text file

Usage: [cat aaa.txt]

For example: cat aaa.txt view the contents inside aaa.txt


12, vim / vi

Note: editing a text file

Usage: [vim aaa.txt]

Example: vim aaa.txt entering vim editor

Editing commands:

i enter the edit mode or a

esc exit the editor

: Q Quit

: W save

: Wq save and exit

: Q Force Quit!

:! Wq forced to save and exit

There are a particularly large number of editing commands, such as search, revoked. .


13、crontab

Description: Timing Run

Special Note:

* * * * * * php /var/www/html/aaa.php

Timeshare weeks sun and the moon command

Usage: [crontab -e]

Example: crontab -e timing of entering the editing mode Run

crontab -l command to enter the edit mode to view the timing of execution

12 11 * * / 1 7 php test.php month of Sundays 12:11 execute test.php file

 

14、shutdown

Description: Timing Run

Usage: [shutdown parameters Time]

For example: shutdown -h now shutdown now

shutdown -r now reboot now

Off Timer shutdown -h 11:50

 

15、init/telinit

Description: Off

Usage: [init / telinit parameters]

For example: init 0 Fast Shutdown

telinit 0 shutdown

 

Fourth, the use of LINUX command Example:

SSH [email protected] landed another LINUX operating system

service httpd restart httpd restart service

service mysqld stop service mysqld closed

service iptables status to view the status of the firewall

php aaa.php execute php file

ps aux | grep php // Check php process

top view process

kill 23423 kill thread

Kill all threads kill *

-R & lt SCP / var / Home [email protected]: / var / Home the front to the back of copy directories Directory

Backup mysqldump -u xxx -h xxx -P 3306 -p --all-databases> datebases.sql database

yum remove mysql-libs delete mysql libs

chkconfig --levels 235 mysqld on startup

/ Sbin / iptables -I INPUT -p tcp --dport 3306 -j ACCEPT open port 3306

mysql -uole -p olenew xulei1143 landing mysql background

find ./ -name "* .txt" | xargs grep "mergeDup"; on the server a full-text search string

The split -l 10000 a.txt a.txt by 000 rows into multiple files

ps -efww | grep php | grep -v grep | cut -c 9-15 | xargs kill -9 delete all processes

wget http://downloads.sourceforge.net/tcl/tcl8.5.12-src.tar.gz Download Get File

yum install gcc gcc installed

 

Five, LINUX shortcuts:

insert + ctrl to copy

insert + shift Paste

table shortcut keys, the most commonly used for the output of any command in a directory or a file when the prompt is displayed match

ctrl + c forced logout state various commands, such as top

 


VI Summary

I am here simply describe what it linux command, in fact, there are a lot of configuration on linux we need to understand and learn. Do not rely too much on command mysql editor, to multi-purpose mysql command, which is the lowest level, when they could have used a good understanding of the principles.

Guess you like

Origin blog.csdn.net/weixin_41109346/article/details/81987468