Llinux commands and llinux commands

Source: Internet
Author: User

Llinux commands and llinux commands

1. Shut down and restart
1) Shutdown
Shutdown-h now (shutdown immediately)
Shutdown-h 5 (shutdown in 5 minutes)
2) Restart
Shutdown-r now (restart now)
Shutdown-r 5 (restart in 5 minutes)
Reboot (restart immediately)
2. Remote Logon
1) ssh Logon
Ssh-l username-p port destination machine IP Address
2) quit
Exit
3. help Command -- help
Shutdown -- help
Ssh -- help
Ifconfig -- help
Man instruction manual
Man ssh
4. File-related commands
1) cd
Switch the cd app to the app directory
Cd... switch to the previous directory
Cd/switch to the system root directory
Cd-switch to the previous directory
Cd ~ Same as cd-
Switch cd to the user's home directory
2) ll, ls, dir
Ls-view the content of the current directory
Ls-l View content in the form of a list
Ls/View/directory content
Ls-a view all content
Ll is equivalent to ls-l
3) mkdir and rmdir
Mkdir create the app directory in the current directory
Mkdir-p app/test create cascade directory
Rmdir app deletes an empty app directory
4) cat, more, less
Cat display file content
More show more content
Less is similar to more. You can use pgup and pgdn to control the top and bottom pages.
5) tail
Tail is used to display the last few lines of the file.
Tail-10/etc/password View the last 10 lines of content
Tail-f catalina. log dynamic view log
Ctrl + c to end viewing
6) rm
Rm a.txt deletion needs confirmation
Rm-f a.txt Delete directly
Rm-r a: delete a directory
Rm-rf a does not ask for Recursive Deletion
Rm-rf * Delete all files
Rm-rf/* suicide
7) cp and mv
Cp a.txt B .txt copies a.txt to B .txt
Copy cp a.txt/tem to the specified folder
Copy directory cp-R/temp/test1
Mv a.txt ../move a.txt to the parent directory
Mv a.txt B .txt rename a.txt as B .txt
8) Packaging command tar
Tar-cvf xxx.tar./* pack all contents in the current directory into a xxx.tar File
Tar-czvf xxx.tar.gz./* pack all contents in the current directory into the xxx.tar.gz file.
Tar-xvf xxx.tar.gz decompress the package to the current directory.
9) grep
Grep lang a. cfg search for lang in the file
Grep lang a. cfg -- color highlighted
Grep lang a. cfg -- color-A 10-B 5 show the first five rows and the last 10 rows
10) Others
Pwd displays the current directory
Touch creates an empty file
Ll-h friendly display file size
Wget download resources
5. File Creation and editing
Vi can be viewed or edited
Switch esc to Command Line Mode
Switch to insert mode by I, o, and
By: switch to the row Mode
6. Combined commands
1) Redirect output> and>
Cat/etc/passwd> a.txt directs the output to a.txt
Cat/etc/passwd> a.txt output and append
2) "|" MPS queue
Ps-ef | grep java query name contains java Processes
3) & command execution control
The preceding command is successfully executed.
7. Network commands
1) ifconfig displays or sets network devices
Ifconfig displays network devices
Ifconfig eth0 up enable eth0 Nic
Ifconfig eth0 down disable eth0 Nic
2) ping to check whether the network is smooth
3) view the network port with netstat
Netstat-an | grep 3306 view port 3306 usage
8. Manage commands
1) command 1
Date: display or set the system time
Date: displays the current system time
Date-s xxxx set system time
Df Displays disk Information
Df-h friendly display size
Free Display memory status
Free-m in mb
Top management programs in execution
2) command 2
Clear Screen
The status of a running ps Process
Ps-ef view all processes
Ps-ef | grep ssh searches for a process
Kill and kill Processes
Kill 1122 kill the 1122 Process
Kill-9 1122 force kill the process numbered 1122
Killall java kills all java Processes
3) command 3
Du: displays the directory or file size.
Du-h shows the current directory size
Who displays the user information currently logged on to the system
View the current host name
Modify: vi/etc/sysconfig/network
Uname: displays system information
Uname-a displays detailed information about the Local Machine
9. Multiple users
1) The user creates, modifies, and deletes the password.
Useradd Add User
Useradd test add test user
Useradd test-d/home/t1 specify the home Directory of the user
Passwd settings Change Password
Passwd test sets the password for the test user
Userdel delete a user
Deleting userdel test the user test will not delete the home directory.
Userdel-r test: Delete the user and home Directory
2) User Group
Groupadd
Groupadd public create public group
Useradd u1-g public create user-specified group
Groupdel: to delete a group, you must first Delete the restructured user Member.
Groupdel public
3) view the UID and GID of the user.
4) su command
Switch su u1 to u1 user
Su-u1 switches to u1 user, and the environment will also switch to u1 user's Environment
5) account files
/Etc/passwd User File
/Etc/shadow password file
/Etc/group information file
10. Permission
-Rwxrwxr --
1) Three file types in linux
-Common files
D directory file
C character Device File
S block Device File
2) File Permission Management
Chmod permission to change files or directories
Chmod u = rwx, g = rx, o = rx a.txt
All chmod 000 a.txt users do not have any permissions.
Chmod 777 a.txt all Permissions
Chown: Change the owner of a file or directory
Chown u1: public a.txt
Chown-R u1: public dir

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.