Learn Linux commands for beginners

Source: Internet
Author: User
Tags diff parent directory system log terminates root access

1. Powerful and usable shell

Shell: command-line tool. Bash: A terminal used by many mainstream Linux systems (Bourne-again Shell).

2. View Help Commands

Long format: Man--help; short format man-h

View command details: Man [command]

For example, man man means to view the help information of the man command itself.

3. Common system Work commands

1.echo: The value of the output string or variable extraction.

2.Date: Displays and sets the time or date of the system.

The above commands indicate the time to display, show the time in a specific format, set the time, and show today the day of the year.

3.reboot: Reboot the system (requires root permission to use: Su root)

4.poweroff: Shut down the system (requires root access)

5.wget: Download the network file. Format: wget [parameter] ([] denotes optional part)

6.PS: View the process status of the system. Format: PS [parameter]

7.Top: Dynamically monitor information such as process activity and system load. Windows Task Manager similar to the enhanced version.

8.pidof: Queries the PID value of a specified service. Format: pidof [parameter] [service name]

9.Kill: Terminates a service process for a specified PID. Format: Kill [Parameter] [PID] such as: Kill 1140

Killall: Terminates all processes for the service with the specified name. Format: killall [parameter] [process name]

4. System Status Detection commands

1.ifconfig: Obtain information such as network card configuration and networking status. Format: ifconfig [network Devices] [parameters]

The main view is the network card name (ENS32), inet after the IP address (192.168.122.1? ), the physical address of the NIC after ether (also known as the MAC address, 00:0c:29:b8:19:33), and the number of received packets and packets sent by the RX,TX and the cumulative traffic (RX packets 567 bytes 123718 (120.8 KiB), TX Packets 0 Bytes 0 (0.0 B)).

2.uname: View information such as system kernel and system version. Format: uname [-A]

3.Uptime: View the load information for the system.

The latter three digits represent 1 minutes, 5 minutes, and the average of the system load within 15 minutes, the lower the better.

4.Free: Displays the amount of system memory usage information. Format: Free [-h]

5.who: View the user terminal information of the currently logged in host. Format: who [parameter]

6.Last: View all system Log-in records. Format: last [parameter]

7.History: Displays the commands that have been executed historically. Format: History [-c] (-C empty command Chronicle)

8.Sosreport: Collects system configuration and schema information, and outputs diagnostic documents.

5. Working Directory Toggle Command

1.pwd: Displays the working directory currently in place. Format: pwd [options]

2.CD: Switch the working path. Format: CD [directory name]

CD-Indicates that the CD was returned to the last directory that was located. Indicates to enter the parent directory, cd~ switch the current user's home directory, the CD ~username represents the switch to the other user's home directory.

3.ls: Displays the file information in the directory. Format: LS [options] [file]

The-a parameter indicates that you see all files, including hidden files. -L represents details such as viewing the file's properties, size, and so on. -d means to view directory property information.

6. text File editing commands

1.Cat: View plain text files (with less content). Format: Cat [Options] [file] (-n Display line number)

2.MORE: View plain text files (more content). Format: More [options] File

Percent hint how much content has been read, a space or carriage return page.

3.Head: View the first n rows of a plain text document. Format: Head [options] [file]

4.Tail: View the last n rows of a plain text document or continuously refresh the content. Format: tail [options] [file]. Use the Tail-f file name when you want to view the latest files in real time

5.TR: Replaces characters in a text file. Format: TR [original character] [target character] such as: Cat Anaconda.cfg | tr [A-z] [a-z] means that all lowercase letters in the Anaconda.cfg file are converted to uppercase and output.

6.WC: Counts the number of lines, words, and bytes of the specified text. Format: WC [parametric] text

-L indicates that only the number of rows is displayed. -W and-C indicate that only the number of words and bytes are displayed.

7.Stat: View information such as the specific storage information and time of the file. Format: Stat file name

8.Cut: Extracts text characters by "column". Format: Cut [parameter] text

Extracts the contents of the first column with a colon as a spacer. -D Sets the interval symbol,-f sets the column to be viewed.

9.diff: Compare the differences between multiple text files. Format: diff [Parameter] file (--brief confirm that two files are different,-C compares the differences of multiple files in detail)

7. File Directory Management commands

1.Touch: Time to create a blank file or set a file. Format: Touch [options] [file] (-A only modifies "read Time",-M only modifies "modified time",-D simultaneously modifies the first two times)

2.mkdir: Create a blank directory. Format: mkdir [options] Directory

-P indicates that a directory with nested overlay relationships is created recursively.

3.cp: Copy files or directories. Format: CP [option] source file destination file

    • If the destination file is a directory, the source files are copied to the directory

    • If the destination file is also a normal file, you will be asked whether to overwrite

    • If the destination file does not exist, a normal copy operation is performed

4.mv: Cut files or rename files. Format: MV [options] source file [target path | target file name]

5.rm: Delete files or directories. Format: RM [options] File

-F indicates a forced deletion, that is, a message that does not appear to be deleted. The-r parameter is also required if the directory is forcibly deleted.

6.DD: Copies a file or conversion file according to a specified size and number of data blocks. Format: DD [parameter]

7.File: View the type of file. Format: File file name

8. Packaging compression and Search commands

1.tar: Compress or unzip the file. Format: tar [options] [file]

Common packaging Commands: TAR-CZVF compressed package name. tar.gz Directory to package

Common decompression Command: TAR-XZVF compressed package name. tar.gz [-c] [Specify the directory to extract]

-C means to create a compressed file,-X unpack the compressed file,-Z with gzip compression or decompression,-V show the process of compression or decompression,-F target file name (must be placed in the last parameter),-c Specify the extracted directory

2.grep: Performs a keyword search in the text and displays the matching results. Format: grep [options] [file] (-n Displays line number,-V anti-selection information, i.e. all information lines that do not contain keywords)

3.Find: Finds files by specified criteria. Format: Find [Search Path] Find conditional action

-name represents the matching name. /indicates the entire system lookup,-perm matching permissions.

Learn Linux commands for beginners

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.