Common commands and server configurations in Linux
Source: Internet
Author: User
Common commands and server configurations for Linux systems-Linux Enterprise applications-Linux server applications. For more information, see the following.
1. Add User useradd command
Example:
# Useradd? M? G users? G wheel, sales? S/bin/tcsh? C "a user" myname
-M automatically creates the user's home directory and copies the framework directory (/etc/skel) file to the user directory.
-G: set the basic group in which the user is located.
-G adds the user to all comma-separated groups.
-S specifies the shell used.
-C description.
-D: set the main directory for the account.
-R system account. You do not need to create a home directory in/home.
The last one is the user name.
Ii. Specify the password passwd
Example: # passwd User Name
Enter the password.
3. delete user userdel
Example: # userdel Username
# Userdel? R user name
-R: Delete the home Directory (/home /.....)
Iv. File System commands
4.1 fdisk command
(1) fdisk? L: displays all partitions on the hard disk. Partition type (FAT32, Ext3 ).
(2) df? H: shows how the file system is mounted.
(3) fdisk/dev/hdb1: format the second IDE disk.
4.2 mount command mount the File System
(1) mount (no parameters are used) to view the system mounting status.
(2) mount/mnt/cdrom: mount the optical drive. You can use the cd/mnt/cdrom and then ls to view the content on the optical drive.
(3) mount/mnt/floppy: mount a floppy disk. You can use cd/mnt/floppy to check the content on the floppy disk.
In steps 2 and 3, you can use/dev/cdrom and/dev/fd0 to replace the mount point and get the same effect!
(4) mount? T msdos/dev/fd0/mnt/floppy: mount the DOS floppy disk to/mnt/floppy.
(5) mount Windows partitions
# Fdisk-l: List hard disk partitions.
# Mkdir/mnt/win: create a directory for mounting.
# Mount-t vfat/dev/hda1/mnt/win: Suppose Windows is in the first partition of the first IDE hard disk.
Note: can be used? T auto parameter makes the system automatically monitor the file type!
-R is mounted in read-only mode.
-W read/write mounting.
4.3 umount command uninstall the File System
(1) umount/mnt/floppy detach the device (such as/dev/fd0) from the mount point/mnt/floppy. You can also do this by using the following methods: umount/dev/fd0 to make the partition permanently available for Linux, you need to add the following line in the/etc/fstab file:
/Dev/hda1/mnt/win vfat defaults 0 0
V. File-related commands
5.1 File Permission chmod
Example:
Chmod 777 files-> rwxrwxrwx
Chmod 755 files-> rwx r-x
Chmod 644 files-> rw--r-
Chmod 000 files-> -〉---------
Chmod u + x g + w o + r file (give the file the right to be executable by the owner, writable by the same group, and read by others)
$ Chmod? R 777/tmp/test: Change the permissions of all files and directories in the directory (all permissions ).
$ Chmod? R 664/tmp/test: Disable the execution permission.
5.2 File Ownership
Chown user1 file (allocate file to user1)
5.3 mobile file mv
Example: mv abc def in this file abc moved its name to def.
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.