Linux Common commands

Source: Internet
Author: User
Tags clear screen readable

text Mode– Linux also inherits the traditional command-line-based text user environment of UNIX systems, allowing users to perform their work in an efficient environment at the command line.  –linux Most of the work is done through console mode.  The console of the –linux system is also known as command-line mode or Linux text mode. – the traditional Linux operating mode is a command-line based text pattern.  Users can take advantage of the command-line environment to complete all system administration tasks with less system resources. – This mode of operation is especially useful for remote management of computers and server environments. Choose X Window or text mode to log in to Linux– If you are using a text interface during Linux installation, or if you have chosen to log in to the Linux system from text mode when you install it under the graphical interface, you will be directed to text mode when you start the computer. – If you choose to log in to the system from the graphical interface during the installation process, after you start the computer, the computer will go directly to the X Window mode. If you choose Login mode after installation, you need to modify the/etc/inittab file– Open the Inittab file in the/etc directory; – find "Id:5:initdefault:" line, –3 for text mode, 5 for X Window mode, – Modify to save Inittab file and restart the system to enter text or X Window mode. Note: Remember not to change to 0 or 6. 0 for shutdown, 6 for reboot, if modified to 0 or 6, you will not be able to use the system properly, Linux boot is not immediately shutdown is immediately restarted. ls-viewing file information– LS is a shorthand for the English word list, which functions as a list of contents and is one of the most commonly used commands for users. – It is similar to the dir command under DOS. The common parameters and meanings of the ls [parameter] directory or file are shown in the following table.

Parameters

Meaning

-A

Displays all subdirectories and files in the specified directory, including hidden files

-L

Displays the details of the file in a long format.

File type: "-" for regular files, "D" for directories, "C" for character device files, "B" for block device files; "s" for pipeline files; "L" for linked files. File access permissions: From left to right, each 3 bits is a group, which in turn represents the access rights of the file owner, the same group of users, and other users. Typically, the file has 3 permissions, "R" means read-only, "w" means writable; "X" means executable; "-" means not set. The first column of the file, such as-rw-r--r--, it is a normal file, the file owner's permissions are rw-, readable writable non-executable, the file belongs to the group's permissions are r--, indicating that the readable non-writable non-executable, the other person's property is r--, indicating that the readable non-writable non-executable. Only the owner or superuser of the file can set the properties of the file. The owner and group of the file: Under Linux, each file belongs to a specific user and group, and the owner and Superuser of the file have the maximum access to the file user. More Commands– If you use the LS command to view its contents, when the information is too long can not be displayed on a screen, there will be a quick scrolling screen, so that users can not see the contents of the file, the more command at this time to display only one page, press the space bar to display the next page, press the Q key to get help. – LS | More cd-Switch working directory– The so-called working directory is the directory where the current operation is located. – Users often need to change their working directory when using Linux.  The CD command helps the user to switch the working directory. – The following can be followed by an absolute path, or with a relative path.  If you omit the directory, the default is to switch to the current user's home directory. – You can also use the "." and ".." As the directory name, where "." Represents the current directory, "..."  Represents the upper-level directory of the current directory, which is the parent directory. –CD Directory Name pwd-Show current Path– Using the PWD command to display the current working directory, the command is simple, just enter the PWD, with no parameters at the back. –pwd mkdir-New Directory– You can use the mkdir command to create a new directory. Note that the name of the new directory cannot be the same as the directory or file already in the current directory, and the directory creator must have write access to the current directory. The command format is as follows: –mkdir [parameter] directory name Cat CommandThe – cat command can be used to view the contents of a file. – Cat [parameter] file name. searches for the specified character content grep-the specified file. The common parameters and meanings of grep [parameter] filenames are as follows. -V Displays all rows that do not contain matching text-n displays matching rows and line numbers find-Find File commandThe –find command is very powerful and is often used to search for eligible files in a specific directory, or to search for files that are owned by a particular user. The format is as follows: –find [path] [parameter]– commonly used parameters and meanings are shown in the following table.

Parameters

Meaning

-name <filename>

Specify the file name of the search, and output the search results

-user <username>

Search for files to which the specified user belongs

rm-Deleting a file or directory– RM [Parameter] File name – Note: Use the RM command with caution because the file cannot be recovered after it is deleted.  To prevent files from being mistakenly deleted, you can use the-I parameter after RM to confirm the files that you want to delete individually. – Common parameters and meanings are shown in the table below.

Parameters

Meaning

-I.

For interactive execution

-F

Forced deletion, ignoring nonexistent files without prompting

-R

Recursively delete content under a directory

cp-Copying FilesThe function of the –CP command is to copy the given file or directory to another file or directory, equivalent to the Copy command under DOS. –CP [parameter] source file or directory target file or directory – Common parameters and meanings are shown in the following table.

Parameters

Meaning

-A

This option is typically used when replicating a directory, preserving links, file attributes, and recursively copying directories

-F

Delete a target file that already exists without prompting

-I.

Interactive replication, which prompts the user to confirm before overwriting the target file

-R

If the given source file is a directory file, the CP will recursively replicate all subdirectories and files in that directory, and the destination file must be a directory name

mv-Moving or renaming files– The user can use the MV command to move a file or directory, or to rename a file or directory. It uses a combination of Ren and move under DOS. The command format is as follows: –MV [parameter] source file or directory destination file or directory – Common parameters and meanings are shown in the following table.

Parameters

Meaning

-I.

Interactively, if the MV operation will result in overwriting of an existing target file, the system will ask whether to override it and ask the user to answer to avoid overwriting the file by mistake

-F

Disable interactive operation and do not prompt if overwrite is available

clear-Clear Screen commandsThe –clear command is used to clear the contents of the screen, and it does not require any parameters. The basic usage format for this command is as follows: –clear ps-Viewing process information  – A process is a program with a certain independent function, which is the basic unit for the dynamic execution of the operating system. – the command can view the details of the process, using the format as follows:–ps  [options]– commonly used parameters and meanings are shown in the following table.

Parameters

Meaning

-A

Show all processes on the terminal, including other users ' processes

-U

Show detailed status of the process

-X

Show process without control terminal

-W

Show widening to show more information

-R

Show only running processes

Top Command– This command is used to dynamically display the running process.  The top command is able to update the display information at a specified time interval after it is run. – You can specify a time interval for displaying information updates by adding-D <interval> when using the top command.  After the top command executes, you can press the key to sort the displayed results: – "M" key: Sort by memory usage.  – "P" key: Sort by CPU occupancy.  – "T" key: Sorts according to the length of time the process is running.  – "U" key: The process can be filtered based on the user name entered later.  – "K" key: The process can be killed according to the PID entered later.   – "Q" key: Exit. – "H" key: Get help. whoami-, who am I to order ?– the command user to view the user name of the current system's current account. – Because system administrators often need to log on to a system with multiple identities, such as typically logging on to a system with a normal user, and then managing the legacy by switching to the root identity with the SU command.  At this point, you can use WhoAmI to view the current user's identity. – the command is used in the following format: –whoami Who command– This command is used to view the current user information for all logged-on systems, using the following format: –who [options]– commonly used parameters and meanings are shown in the following table.

Parameters

Meaning

-M or AM I

Displays only the user name, logon terminal, and logon hours that run the WHO command

-Q or--count

Only shows the user's login account and the number of logged-in users

-U

Displays the user's last action to the current time interval after the logon time

-U or--heading

Show Column headings

w Command  – The command can also view user information logged on to the current system. The W command is more powerful than the WHO command, which not only shows which users are currently logged on to the system, but also shows what they are doing and gives more detailed and scientific statistics. The format of the W command is as follows:–w  [option]  [Username]– if the W command carries a user name, only the information of the specified user is displayed, otherwise the information of all currently logged-in users is displayed. The common parameters and meanings are as shown in the table.

Parameters

Meaning

-H

Do not display headings for each column

-L

Displays the details list, which is a preset value

-S

Use short list, do not display user logon time, JCPU and pcpu time

-U

Ignores the name of the executing program, and the PCPU time of the program

tar-Archive Management  – Data in your computer often needs to be backed up, and tar is the most common backup tool in Linux, which can archive a series of files to a large file, or unpack the files to recover data.    –tar  [parameter]  package file name   File –tar command is special, its parameters can be used before "-", or can not be used. – Common parameters and meanings are shown in the table below.

Parameters

Meaning

-C

Generate an archive file

-V

Detailed procedures for listing archive files

-F

Specify the name of the archive file

-T

List files included in the archive

-X

Unlock the archive file

gzip-file Compression command–tar is used in conjunction with the GZIP command to package and archive files. –gzip [Options] Compressed files – Common parameters and meanings are shown in the table below.

Parameters

Meaning

-D

Extract

man-online Help command– A powerful online Help feature is available in Linux, and the most extensive online help command is man. The –man command is primarily used to display online Help for any given command. Common formats are as follows: –man [options] Command name when you normally use the man command, you can directly query the command Help manual to get the exact usage of the query command without having to carry the option, and the man command sets the following function keys for the convenience of the user to view the Help manual, as shown in the table.

Function keys

work   can

/td>

Spacebar

Show man page next screen

Enter key

One row of the scroll man page

B

< p> rollback one screen

F

Roll forward one screen

Q

Exit man command

H

List all function keys

/word

Search word string

Copy to Google TranslateTranslation Results

Linux Common commands

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.