Common basic commands for Linux

Source: Internet
Author: User

Believe when you see this post, you are no longer that decadent you, you must also run on the path of chasing dreams, so please leave your "dream", let us heart to communicate, OK?

No more nonsense, just say the right thing!

One, view disk partitions

1.fdisk-l Viewing disk partitions

The 2.DF-LH is used to view the disk space consumption of the file system. This includes the size of the file system, how much is used, how much is left, how much it is used, and which directory is mounted.

Second, Linux hard disk partition and mount

1. Manually add the hard drive shutdown-Edit virtual machine settings-Add hard disk-boot 2.fdisk-l to see if the disk is added successfully 3.FDISK/DEV/SDC the SDC disk (SDC is the hard drive name you just added) 4. Format the disk mkfs.ext3/dev/s DC1 formatting to SDC1 5. Mount Partition to/home/zhang_123 directory mount-t ext3-o rw/dev/sdc1/home/zhang_123-t mount file type-o mount mode first Zhang_ 123 This is there, no words to be created first. 6. Permanently mount, enter the/etc/fstab file, and after the last line add/dev/sdc1/home/zhang_123 ext3 defaults 1 2 Restart the network to see if the mount succeeds.third, the Linux file and directory Base command is used. CD: Switch directory pwd: View current path la-al: Show file details and hide file alias ' la ' = ' ls-al ': Change to command aliases mkdir: Create directory mkdir-p 123/456 create multilevel directory rmdir: Delete directory C P: Copy files or directories mv: Move files or rename rm: Delete command, rm-f Force Delete, rm-r recursively delete tail-f file:-F to display the appended information of files in time. Tail-n 3 File: Displays the last 3 lines of the file head-n 3 file: Displays the first 3 lines of the file files diff file1 file 2: Compare two files different cat: View files, create files, merge files Cat 1.txt ; Cat > 2.txt; Cat 1.txt 2.txt > 3.txtmore: Paging View file Contents CAT/ETC/PASSWD | More
Common shortcut keys: Enter the default line down. CTRL+F scroll down one screen.                                         The SPACEBAR scrolls down one screen.  Ctrl+b returns to the previous screen. = Outputs the line number of the current line. V Call VI Editor.!      command to invoke the shell and execute the command. Q quit more.four, Linux user and user group related commands.    first understand the configuration files related to users and user groups. 1,/etc/passwd: is the user-related system configuration file. Includes many items, from left to right as follows:     user name: Cipher ciphertext: Uid:gid: Username full name: User's home directory: Shell type 2,/etc/shadow: Is/etc/passwd shadow file. This includes user and encrypted passwords and other user-related items that/etc/passwd cannot include, which can be read and manipulated only by Root. Common three items are as follows:     user name: Cipher ciphertext: The last time the password was modified 3, Etc/group: Is the user group profile, each user group a record. Includes many items, from left to right the following:     user group name: User group password (but because this file can be viewed by ordinary users, so this item does not put things, X, password under/etc/shadow): GID: User List 4, User's initial and valid groups:    example: Useradd xiaoming Add user    passwd xiaoming set Password    The initial group of Xiaoming is now the Xiaoming group with the same name.           Usermod-g Fans xiaoming   then Xiaoming's initial group changed to fans           Usermod-g fans xiaoming   at this time the initial group or xiaoming, Fans are effective groups.         -g   Change initial group  -G change effective group           Initial group has only one, valid groups can have multiple. The attribution group for the          file is its initial group. (In/etc/group files can be embodied)   v. Related commands for process management1, PS View Process command 2, PS aux view the status of all processes.  (most commonly used) the AUX indicates that all processes, including add-ins, are displayed in a user-oriented format. 3.top dynamic display process status 4.kill kills the specified process kill + process ID number kill-9 forces the kill Killall command to kill the specified name of the process, followed directly by the service name.

Common basic 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.