Small white Learn Linux commands

Source: Internet
Author: User
Tags clear screen disk usage

Small White is the King Goddess of all-Stack Development Co., Ltd., a financial intern staff, after 3 months of internship, small white is will hurdles hurdles Ah! Finally became a formal employee of the company, and received the king personally sent to Hershey Mail: "Welcome you to join the family, the company is also in line with the overall development of the theme of employees, offers a learning opportunity, please report to the Company's operations department! ”

Small white is pleasantly surprised, with a full-brain question mark came to the operation and Maintenance Department report, department manager of the small leucorrhea to another person's office, "small white", "This is your study of the teacher-Xiao Liu, the company's full stack development engineers and Linux operations engineer, and later he learned." Then the manager introduced Xiao Liu to the little white and went away. "Little white, isn't it?" ", Little white:" Mmm-hmm. Good You will be able to call me Xiao Liu in the process of learning later, you may not know what to learn? "Little White shook his head," All right! Then I'll tell you! Common operation commands for Linux! "Little white face confused," said the nonsense, directly into the theme it! ”

Xiao Liu: First I ask you a few questions, have you heard of Linux? Do you know the difference between it and win?

Little White just shook his head.

Xiao Liu: Linux and Windows are operating systems, Windows operating system has a graphical interface, easy to learn, and Linux is operated by the command line, the operation is more cumbersome than Windows. Good! It says that Linux is not good to operate, then you might think: Why does the company want you to study? Right! Let me tell you something.--linux Security and stability, and open source, we King Goddess Company business so large, the requirements of this is very high, so require every employee to understand the Linux command to deal with the daily work, small white, understand the company's intentions?

Little white Dot nodded.

Xiao Liu: "Then we enter this happy learning journey, first I let you look at the Linux operating system interface:

Xiao Liu: Don't look at this black on a string of letters, in fact, its operation method is roughly the same as windows, but because there is no graphical interface, so before starting operation to know where you are? Little white, how does Windows know where you are??

Xiao Bai thought about it and answered: look directly.

Xiao Liu: Yes! So how does Linux know? There is a called--

  1. Command name: PWD

Command English original: Print working directory

Function Description: Displays the current working directory

Xiao Liu: What does it mean to know your position is/bigdata? What does that mean in the Bigdata directory? That means the root directory, so what if I want to go back to the root directory?

  2. Command name: CD/

Function Description: Go back to the root directory

  Xiao Liu: Look at Ha, witness the moment of miracles to,, see No, the box becomes/, the explanation has returned to the root directory, good! So now I have another idea, how do I know what directories are in the root directory? Then look down:

  3. Command name: LS

Function Description: View the directory or file under the current directory

  Xiao Liu: This result:, have seen it!

 Small white: You just said directory or file, then I know which is the file, which is the directory?

Xiao Liu: That's a good question! First method: With the CD command, you want to know which is not a directory or file on the CD directory name or filename, the file name will be error!

Xiao Bai: Then I want to know that it is not very troublesome to do so!

Xiao Liu: The second approach I'll cover next:

4. Command name: ls-l

Function Description: Lists the file information in the current directory

, The result is:

Xiao Liu: How to judge? Look at the first character of the first column, if it is a file, if D is the directory, understand?

Little white: thoughtfully nodded

Xiao Liu: What would you do if I wanted to go back to the last time?

Small white: cd/Bar

Xiao Liu: Well, let's try it out: Success! What if I don't know the directory name at the top level?

Small white: can be pwd command

Xiao Liu: Good! I'll tell you another way:

  5. Command name: CD.

Function Description: Back to the previous level

Xiao Liu: The result is the same! Wait, we're looking at the ls-l command, there's a list of numbers in the middle of those columns, you know what that means?

Small white: it means size.

Xiao Liu: Yes! Do you know what the unit is?

Little white: I can't see

Xiao Liu: Then i change a magic to let you see:

 6. Command name: LS-LH

Function Description: User-friendly Display file list

Xiao Liu: see no, Unit is what, K more, right? Magical, huh?

Little white: Nod quickly

Xiao Liu: Next i operate, you look at is:

  7. Command name: Vim. Test

Function Description: Create a hidden file

Xiao Liu: Just now I create a file in the current directory, LS View, which does not have the file I just created, which is why?

Small white: Is it the same as the file hiding function in Windows system??

Xiao Liu: Yes! Smart! All later you see the file folder is real size, but there is no file, you have to think of whether there are hidden files, then if you want to view the hidden files, this will use this method:

 8. Command name: ls-a

Function Description: View hidden files

Xiao Liu: Look, I'll summon the guy:

See! Just come out! Similarly, hidden files can also be displayed in a humane manner:

 9. Command name: Ls-lha

Function Description: humanized display hidden file

Little white: Really magical, I was looking at the operation, the process of creating the document can and I carefully talk about it?

Xiao Liu: No problem, just that is to create a hidden file, then I create a show to you look:

  10.vim filename----(edit mode)--esc--shift:wq--enter file is created

, which also shows 1 lines, 12 characters,

Xiao Liu: You see, is to show the file it, good! The question comes again, I think I just wrote the contents of the document, how to do it?

Small white: Vim file name OK?

Xiao Liu: Yes, not only can see also can be edited again! Tell you another way:

  11. Command name: Cat file name

Function Description: View file contents

Xiao Liu: You see, hello World shows up, but this method has a disadvantage, it is viewed as the entire file display, when the file has a certain length, it directly shows the last few lines, you have to start from the beginning to see the upside, there is no other way to let me start from the beginning to see? The answer is:

 12. Command name: More file name

Function Description: Carriage return is a line of view, the space is a page by page

Xiao Liu: You see, the lower left corner and you see how much! Good! Having said so much about creating files, let's look at how to create a directory:

  13. Command name: mkdir directory Name

Function Description: Create a directory

Xiao Liu: Create a good directory, then I have a need, is to put the datas file I created in this directory, how to do it?

Little White shakes his head

14. Command name: MV file name or directory name Directory name

Function Description: Mobile

Xiao Liu: It's a success!

Little white: What happens if the MV filename is the file name?

Xiao Liu: This is a good question, let me tell you the result.

Xiao Liu: Know overwrite what meaning, is cover off, small white! Cd.. Is back to the upper level, that CD.

Small white: Do not move in situ?

  15. Command name: CD.

Function Description: Current directory

Xiao Liu: It's not too early. I'm going to talk about two more commands, a man, a help, and two are all commands to see a helping hand.

16. Command name: Man

Feature Description: See more help

17. Command name: Help

Function Description: View simple Help

Xiao Liu: Where help is to look at some of the Linux command line built-in commands, such as helping CD, two commands can be helpful to understand, and then I have some command information, you take it back to see, come here today!

18. Command name: mkdir-p

Function Description: Create a directory recursively

19. Command name: Tree directory

Function Description: Display the table of contents in tree structure (not written, default current)

20. Command name: Touch file name

Function Description: Create an empty file

21. Command name: Rm-r file or directory

Function Description: Delete file or directory

22. Command name: Top

Function Description: View system performance (Q exit)

23. Command name: grep Specifies the substring source file

Function Description: Searches the file for matching rows of substrings and outputs

24. Command name: IP

Function Description: View network IP Address

25. Command name: df-h

Feature Description: View disk usage for the current system

26. Command name: Kill process Number (PID)

Feature Description: View disk usage for the current system

27. Command name: Find/-name * File name *

Function Description: Fuzzy query by file name

28. Command name: Find/-size +90m |xargs LS-LH

Function Description: Find the eligible files and show the file size

29. Command name: CHGRP user group file or directory

Function Description: Change the owning group of a file or directory

30. Command name: Tar-c directory

Function Description: Generate a. tar package file

31. Command name: Tar-v directory

Function Description: Show details

32. Command name: Tar-f directory

Function Description: Specify the file name after compression

33. Command name: Tar-z directory

Function Description: Packaging and compression

34. Command name: Write user name

Function Description: Send message to another user, Ctrl + D as end

35. Command name: cp-r source file or directory destination directory

Function Description: Copy files or directories

36. Command name: chmod

Function Description: Change file or directory permissions

37. Command name: Head-num file name

Function Description: View the first few lines of a file

38. Command name: Tail-num file name

Function Description: View the following lines of a file

39. Command name: Stat

Function Description: Displays details of the specified file, more detailed than LS

40. Command name: who

Function Description: show online login user

41. Command name:whoami

Function Description: Displays the current operation user

42. Command name:hostname

Function Description: Display host name

43. Command name:uname

Function Description: Display System Information

44. Command name:Ping

Function Description: Test network Connectivity

46. Command name:Clear

Function Description: clear Screen

47. Command name:ifconfig

Function Description: View network Situation

Little White looked at the information, said thank you!

you are welcome to ask questions and questions about my blog content! Thanks

Author: Pat Province Mr.

    

  

  

  

  

 

  

Small white Learn Linux 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.