Common commands in linux and Common commands in linux

Source: Internet
Author: User
Tags syslog touch command

Common commands in linux and Common commands in linux

Common commands in linux. We should first learn some very basic commands, but the usage is very high. Otherwise, the subsequent courses will not be available. Without a doubt, these commands must be learned, if it is not found, it is best to back down or save these commands, and you can easily find them when necessary.

Ls command:

Ls directory parameters: Display files and directories (hidden files are not displayed)

Example :?

Ls/root: displays files and directories under the/root directory. Hidden directories are not displayed.
Ls-al: displays the files and directories in the current directory

Ll command:

Ll Directory: Display files and directories (show hidden files)

For example:

Ll/root: displays files and directories under the/root directory, but hidden files are displayed. Files starting with. are hidden files.

The difference between the ls command and the ll command is whether to show hidden files. In most cases, it is equivalent, but not completely equivalent. You can use either of the two commands.

Cd command:

Cd: Directory switch command to switch to the corresponding directory.
Example :?
Cd/opt to enter the/opt directory
Cd .. return to the upper-level directory of the current directory

After learning the preceding commands, We need to briefly introduce the file system structure of linux. Otherwise, you will be confused.

 

In windows, we have a file system, and we usually use C disks and D disks for access. So I would like to ask you if you do not know what a file system is. In fact, the concept of a file system is very simple, A collection of file data, directory structures, and related metadata information. The directory structure on linux is quite different from that on windows. In general, there are the following types:

? ? ? ? /Represents the root directory. in linux, there is no drive letter concept. There is only one general directory. Other directories are subdirectories under the root directory.

Bin? (Binaries) stores binary executable files
Sbin? (Super user binaries) stores binary executable files, which can be accessed only by the root user
Etc (etce) stores system configuration files
? ? ? ? Usr? (Unix shared resources) is used to store shared system resources.
Home: root directory for storing User Files
Root? Superuser directory
Dev (devices) is used to store device files.
Lib? (Library) stores the shared libraries and kernel modules required for running programs in the file system.
Mnt? (Mount) System Administrator Installation Point of the Temporary File System
Boot stores various files used for system boot.
Tmp? (Temporary) used to store various temporary files
Var? (Variable) is used to store files that need to change data during runtime.
In this example, the/home and/etc directories are commonly used.

Pwd command:

For example:

Pwd: displays the current directory

Cp command:

Format:

Cp source directory target directory or cp source file path target file path
Example :?
Cp install. log/opt copy the install. log file to the/opt directory
Cp-r/etc/opt: copy the entire/etc directory to the/opt directory

? Rm command:

Format: rm parameter directory or file
Example :?
Rm/root/install. log: Delete the install. log file, but the system prompts whether to delete the file.
Rm-f/root/install. log. syslog Delete the install. log. syslog file, but the system does not prompt whether to delete the file.

What if I need to delete several files ??

Example :?

Rm-f file1 file2 delete both file 1 and file 2
Rm-rf/opt/etc Delete the etc directory under the/opt directory and recursively delete it.

Mkdir: Command

For example:

Mkdir aaaa creates an empty folder named aaaa under the current directory.
Mkdir abc/efg recursively create an empty directory
Mv command:
Format:
Mv source file or directory target file or directory
For example, mv install. log/opt moves the install. log file to the/opt directory.

Touch command:

For example, touch abc.txt creates an empty file named abc.txt.

Cat command:

For example, run cat install. log to view the content of the install. log file.

More command:

For example, view the text content by page in more install. log.

Tail command:

For example:

Tail-f install. log to view the last part of the file

Df command:

For example, df displays the disk status.

Ifconfig command:

For example, ifconfig displays network card configuration details

Ping command:

Example: ping test connectivity

Reboot Command, restart

Shutdown command, shutdown

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.