Linux shell command

Source: Internet
Author: User

Linux shell command

What is a shell?

The Shell is the interface that connects the operating system kernel to the user.

The terminal is the representation of the shell.

the kernel version of Linux consists of three parts: the main version . Minor version . correction number.

The minor version has other meanings: The odd is the test version, the even is the stable version.

The common Linux distributions are Fedora,Ubuntu , and so on.

What is Shell programming?

The Shell scripting language, together with the Linux command statement, forms the shell program. The advantage lies in batch processing, without the user entering manually each time.

Bash is one of the shell program interpreters.

Use commands frequently

Shell -Destined Universal Format: Command option parameters. command option arguments.

Man: The name of the man followed by the command. You can view the use Help for this command. To scroll through the manual page. You can use page up or PAGE down.

command name--help Brief Help

Whatis: The meaning of the query command.

As a result of Whatis chmod:

[email protected]: ~$ whatis chmod

chmod (1)-Change file mode bits

chmod (2)-Change permissions of a file

pwd: Print working directory, printing work folders.

CD: Chang directory, change working folder.

You can use absolute or relative commands ... Represents the parent folder.

ls: List to view the contents of the folder. -L to view specific information.

Clear: Clear the screen.

echo: The specified string is displayed on the display.

Up and down arrows : historical commands.

Tab: command your own active completion. The current input can uniquely locate the command. tab can be filled at once. If there are multiple matches, you can press TAB two times .

wildcard characters have '*': Match random number of random character; '? ': Match a single random character; '[.

]' limits the range of characters.

at: Run tasks on a timed basis. Demo Sample: Displays the system time after the at now + 5 minutes five minutes.

Hard disk and partition

There are three types of Linux hard disk partitions: Primary partition (Primary Partition), extended partition (Extended Partition) , and logical partition (Logical Partition).

A hard disk can have a maximum of 4 primary partitions only.

If you want to have multiple partitions. You need to create an extended partition and then divide the logical partition in the extended partition.

Linux can be mounted on a primary partition or on a logical partition.

Linux uses a combination of letters and numbers to mark hard disk partitions. Hd refers to the IDE hard drive. A represents the first hard disk, the primary partition and the extended partition are digitally identified with the 1~4, and the logical partition is numbered from 5 .

Example one:/dev/hda3 a third primary or extended partition on the first IDE hard disk;

Example two:/dev/hdb6 the 2 logical partitions on the second IDE hard disk .

Mount: Mount the file system.

This command requires root user privileges.

umount: Removes the file system.

File operations

ZIP is compatible under Windows systems.

tar: Backup files and folders as a file for easy access.

Ln –s A soft connection similar to A shortcut under Windows, when the original file is deleted, the linked file is invalidated.

Touch : Create a new file.

mkdir : Create a new folder.

cp : Copy files and folders.

MV : Move files and folders.

RM : Delete files and folders.

View System Status

shutdown: normal shutdown.

reboot: Reboot.

PS: See how the program is running.

-e Show all processes, environment variables
-F Full format
Process state: The state is divided into execute R, hibernate s, Zombie Z.

Top: View the status of the process execution. And real-time updates, including CPU utilization, memory utilization, and so on.

kill: Terminates the process.

Date: change, view dates.

cal: Displays the Calendar or annual calendar (Cal 1992).

Free: Displays memory usage.

Nice: Start a process with some sort of priority.

who: show who's logged on

W: Show who's logged on and what they is doing.


System Folder Brief Introduction

boot file at boot time of the/boot system.

/dev is device. The device currently connected to the system. NULL indicates a device that does not exist. Often used for redirected output. Hide the unwanted output information.

/etc store configuration information for the system.

The new user's name,ID, group, and other information are recorded in the etc/passwd file. Password exists in Etc/shadow .

/home folder where user data is stored.

/mnt Mount other file systems, such as optical drives.

/root Super User home folder.

/tmp temporary file.

/var is variable, variable.

Store log files and server data.

/usr store the application. is the folder that occupies the largest amount of hard disk space.

Common file name extensions:

. conf configuration file

. gz/.gzip gzip Compressed Files

. RPM RPM Package Manager File

. tar backup file

File Read command

Head: Displays several lines from the beginning of the file.

Head-n x File

tail: Displays several lines of the file's countdown.

Tail-n x file is used in conjunction, view line A to line B Head-n B file|tail b-a+1

Cat : View the contents of a file.

More : Split-screen display of text.

Less : With More very similar, but Less agree to look back.

VI Text Editor

VI file name. You can open the file you want to edit. If it does not exist, then take the initiative to create.

After opening, the command mode is the first.

Press A to enter text mode. Press ' I ' key to enter insert mode.

After editing, ": w" Save the File ": Q" Exit VI ": Q. "Discard the changes and exit."

Text Lookup function:</> string forward to find the specified string <?> backward to find the specified string.


Query and location

Locate: Locates files or folders.

grep: used to find files with specific content.

If found. The corresponding column for the lookup target is displayed. Often used with redirects. A findstr similar to CMD.

RPM Package Management

rpm-q "option" "Package or file name" query package.

The main options are files that-p<file> query packages. -F <file> Query <file> which package belongs;-a queries all installed packages.


Rpm-i Installing Packages

Rpm-u Upgrade Package

RPM-E Uninstalling Software

Commands about the network

netstat -nlap
See which processes are consuming which network protocols, port numbers

Job Control

Multiple processes that are logically related are called a job.

In Linux, jobs are controlled using tools such as Cron, at, and batch.


Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.

Linux shell command

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.