Common commands for Linux

Source: Internet
Author: User

1.PWD command

The pwd command represents ' Print working directory ' (print working directory). When you type PWD, you are asked to display your current location on your Linux system. For example:
[Email protected] apache]# pwd
/tmp/apache
Indicates that you are currently in the/tmp/apache directory

2.Locate Command

Sometimes you know that a file or directory exists, but you don't know where to find it. You can use the Locate command to search for files or directories.
With the Locate command, you will see each directory or file that includes the search criteria. For example, if you want to search for files with the word finger in all names, type:
Locate finger
The locate command uses a database to locate files and directories with the word finger in a file or directory name. This search result may include a file called Finger.txt, a file called Pointerfinger.txt, a directory named Fingerthumbnails, and so on.

3.clear and Cat

The clear command clears the terminal window.
Cat is a shorthand for concatenate (chain), which means merging files. The command can display the contents of a file (often with more), or merge multiple files into one file

4.head command

You can use the Head command to view the beginning of the file. This command is:
Head <filename>
Head is a useful command, but since it is limited to the first few lines of the file, you cannot see how long the file actually is. By default, you can only read the first 10 lines of a file. You can change the number of rows to display by specifying a number option, as shown in the following command:
Head-20 <filename>

5.tail command

The opposite of the head command is the tail command. With the tail command, you can view 10 lines at the end of the file. This helps you see the last ten lines of the log file to read important system messages. You can also use tail to observe the process of the log file being updated. With the-f option, tail automatically displays new messages in the open file to the screen in real time. For example, to instantly observe changes in/var/log/messages, type the following command at the shell prompt as root user:
Tail-f/var/log/messages

6.grep command

The grep command is useful for locating a specified string in a file. For example, if you want to find every place in the Sneakers.txt file that mentions "coffee", you can type:
grep Coffee Sneakers.txt
You will see each line with "coffee" in the file.

7.CP command

The CP (copy) command allows you to copy a file or directory to another directory, just like the Copy command under DOS, which is very powerful. When using the CP command, you only need to specify the source file name and destination file name or destination directory. Format:
CP < SOURCE > < target >

----------------------------------------------------------

Another update!! How about some shrimp!!!

Common commands for Linux

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.