Common Linux commands

Source: Internet
Author: User

When we learn knowledge, we often encounter problems, solve these problems, and have a solid grasp of basic knowledge. Linux is becoming more and more popular. Do you know about Linux? Are you an application of Linux? This article describes common Linux commands in detail and plays a role in learning common Linux commands.

1. Shutdown and restart

1) # init 0 restart # init 6 shutdown to change the system running level)

2) # reboot restart # halt command method)

3) # showdown-h + 5 (shutdown in 5 minutes) # showdown-r + 5 (restart in 5 minutes)

Ii. Common directory operation commands

1) display files and directories: ls-a-l

2) copy a file or directory: the target file of the cp source file

3) Move the file or directory: the target file of the mv source file

4) show file content: cat text file

5) display text by PAGE: more text files or less text files

6) display the lines at the beginning or end of the file: head-3 myfile (display the first 3 lines of myfile ). Or tail-5 myfile.

7) count the number of lines, characters, and characters of the specified text file: $ wc-l myfile: count the number of lines of the myfile file)

8) find the specified file in the file system: $ find-name 'my * '(find the file starting with my in the current directory)

9) query the specified string row by row from one or more specified text files:

$ Grep "my *" file1 file2 (find strings starting with my line by line from file1 and file2)

10) display the current working directory: pwd

11) create directory: mkdir mydir1 (create a directory named mydir1 under the current directory)

12) delete Directory: rmdir mydir1 (delete mydir1 directory)

13) delete a file: rm my *. * (delete all files starting with my)

Iii. Common Information Display commands

1) display the equivalent information of the specified file: stat myfile

2) displays online login users: who

3) display the user's identity: whoami

4) display Host Name: hostname

5) display the operating system name: uname

6) display network interface information: ifconfig

7) test network connectivity: ping the IP address

8) display the network status information: netstat

9) display the current user id: id

Iv. Common backup compression commands

1) package the file directory: tar-option File

Option:-t list the contents of the package file-c create a new package-r append document-x release the file

2) compressed to gz file: gzip

3) compressed to Z file: compress

4) compress the file into bz2: bzip

5. Common system management commands

1) mount the file system. Mount-t vfat/dev/sdb1/mnt/udisk (mount the USB flash drive to/mnt/udisk. Note that the corresponding directory must be created in advance ).

2) Change the file or directory permissions: chmod +-= permission File

For example, chmod u + x, g + w, o + r myfile

3) Change User: su

4) display system process: ps

5) Stop the specified process: kill process number

Master these common Linux commands and be familiar with Linux.

  1. Basic Linux operating system knowledge
  2. Introduction to the installation of Fedora Linux
  3. Learning Manual: poll and select in Linux
  4. Advantages of the Linux operating system that attracts us
  5. Linux operating system

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.