Linux basic commands

Source: Internet
Author: User
Tags bz2 first string rar

To see if it is a virtual machine: CAT/PROC/SCSI/SCSI

How Linux Systems View version information: 1.uname-a 2.cat/proc/version 3.cat/etc/issue 4.lsb_release-a
View memory Size: Cat/proc/meminfo |grep memtotal

Enter "Cat/etc/issue", which shows the release version information
Lsb_release-a (for all Linux, including Redhat, SuSE, Debian and other distributions, but to install LSB under Debian)

Port monitoring: Netstat-nat
Example: Renaming directory A to B
MV A B
Shutdown process: cd/root/wsh/7164
Exit Current operation: Crtl+z
Get Time: Date
Reset: This command will completely refresh the terminal screen, the previous terminal input operation information will be emptied, so although relatively refreshing, but the entire command process is a bit slow, less use.

The 1.tail command is used to enter the trailing content in the file. The tail command displays the last 10 lines of the specified file on the screen by default. Press CTRL + C to exit
2. Tail-n FileName Description: Displays the last 20 lines of the filename.
3. TAIL-R-N FileName Description: Reverse shows the last 10 lines of filename.
-F This parameter is used to monitor file growth.
-c number reads the specified file from the number byte location
-N number reads the specified file from the number line position.

Enter URL path command: wget

PS: Show a process
-e: Show All Programs
-F: Display Uid,ppip,c,stime
grep: Finding
| pipe command
View the MySQL process through ps-ef|grep MySQL


Show process information: Top
Show full command: top-c
Setting Information updates: Top-n 2
Setting Information update time: top-d 3
See how many files are in the current folder: LS |wc-w
command to find a process: PS aux |grep java
Kill process: kill-9 process number
PS aux
Show other user-initiated processes (a)
View your own processes in the system (x)
The user who started the process and the time it started (U)

Change account number to Root:su-c is root
mysqladmin-u root-p Password "Enter new password"
Delete folder: Use the RM-RF directory name command to
-R is recursive down, no matter how many levels of directory, delete
-F is directly forcibly deleted, without any hint of meaning

If you copy file1 from the/test1 directory to the/TEST3 directory and change the file name to File2, you can enter the following command:
Cp/test1/file1/test3/file2
Copy files from one machine to another Linux machine: scp-r file name [Email protected]:/parent Folder
Scp-r/etc [email protected]:/opt

View IP Address: ifconfig-a

Find folder: Find-name folder name

command to enter VI
VI FileName: Opens or creates a new file and places the cursor at the beginning of the first
VI +n FileName: Opens the file and places the cursor at the beginning of nth
VI + FileName: Opens the file and places the cursor at the beginning of the last line
VI +/pattern FileName: Opens the file and places the cursor at the first string that matches the pattern
Vi-r FileName: The last time you were editing with VI, a system crash occurred, restoring filename
VI filename....filename: Open multiple files, edit them sequentially

Start server: Service MySQL start
Stop mode: Service MySQL stop
Restart mode: Service MySQL restart

Show All directories: LL
Jump to the top level directory:. /
Show files in directory: CD directory name
Edit File: VI
CPU Architecture: ISCPU

Unpack tar.gz Package: Tar ZVXF package Name
Unzip the TAR package: TAR-XVF File.tar
Unzip the ZIP package: Unzip File.zip
Decompression RAR Package: Unrar e File.rar
Unzip to the specified directory: Tar XVF package name-C destination Folder
Unzip-o-d/home/sunny Myfile.zip
Unzip the Myfile.zip file to/home/sunny/
-O: Overwrite the file without prompting;
-d:-d/home/sunny indicates that the file is extracted to the/home/sunny directory;
1, *.tar with TAR–XVF decompression
2, *.gz with gzip-d or gunzip decompression
3, *.tar.gz and *.tgz with TAR–XZF decompression
4, *.bz2 with bzip2-d or with BUNZIP2 decompression
5, *.tar.bz2 with TAR–XJF decompression
6, *. Z Extract with Uncompress
7, *.tar. Z Extract with Tar–xzf
8, *.rar with Unrar e decompression
9, *.zip with unzip decompression

View installation help:./install–h
Download: wget
View system current configuration handle maximum value: Ulimit–a
2048 Modify the handle maximum value to 2048:ulimit–n

Access database: Mysql-uroot-p
Display database: show databases;
Select database: Use database name;
Show tables in the database: show tables;
Display the structure of the data table: describe table name;
Show Table records: SELECT * from table name
Exit MySQL command: Exit (enter)
View all users: SELECT DISTINCT CONCAT (' User: ', user, ' ' @ ', host, '; ') as query from Mysql.user;

Linux basic commands

Related Article

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.